Skip to content

Website does not load correctly with ESP32S3 and latest pioarduino #338

@THorst92

Description

@THorst92

Describe the bug
I am not able to get a stable working implementation, where the website is loaded on my PC.
On my phone it is loading sometimes, but slow (Maybe there is something still in the cache).
I can access the files when I change the URL to e.g. http://10.10.10.155/js/zepto.min.js.
If I add ElegantOTA to the server the update site is loading fast and stable.

It was working already, maybe only with the old platformio config (old arduinoespressif32), I am not sure anymore. I had to update to pioarduino and newer arduinoespressif32 due to another lib I want to use.

Has anybody an idea where the failure could be? This would be great.

My dev. environment:
ESP32S3-N16R8
pioarduino

CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32-s3-devkitc-1.html
PLATFORM: Espressif 32 (55.3.36+sha.66d8993) > Espressif ESP32-S3-DevKitC-1-N8 (8 MB QD, No PSRAM)
HARDWARE: ESP32S3 240MHz, 320KB RAM, 16MB Flash
DEBUG: Current (esp-builtin) On-board (esp-builtin) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES: 
 - contrib-piohome @ 3.4.4 
 - framework-arduinoespressif32 @ 3.3.6 
 - framework-arduinoespressif32-libs @ 5.5.0+sha.f56bea3d1f 
 - tool-esp-rom-elfs @ 2024.10.11 
 - tool-esptoolpy @ 5.1.0 
 - toolchain-xtensa-esp-elf @ 14.2.0+20251107

To Reproduce
Here my simple implementation:
platformio.ini

[env:esp32-s3-devkitc-1]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino

board_build.arduino.memory_type = qio_opi
board_build.flash_mode = qio
board_build.f_flash = 80000000L
board_build.f_cpu = 240000000L
board_upload.flash_size = 16MB
board_upload.maximum_size = 16777216
board_build.partitions = default_16MB.csv
board_build.filesystem = littlefs

; --- Debugging & Upload ---
monitor_speed = 115200
monitor_filters = esp32_exception_decoder

build_flags = 
    -DCONFIG_ESP_CONSOLE_USB_SERIAL_JTAG=y
    -DARDUINO_USB_MODE=1
    -DARDUINO_USB_CDC_ON_BOOT=1
    
    ; PSRAM Stabilitäts-Flags
    -DBOARD_HAS_PSRAM
    -mfix-esp32-psram-cache-issue
    -DCONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY
    -DCONFIG_SPIRAM_OCCUPY_NO_CANCELL_PROHIBITED_SEGMENT=1
    -DCONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP_ALL=1

    -DELEGANTOTA_USE_ASYNC_WEBSERVER=1

    
    ; Inkludierung der Filesystem-Pfade
    -I${platformio.packages_dir}/framework-arduinoespressif32/libraries/FS/src
    -I${platformio.packages_dir}/framework-arduinoespressif32/libraries/LittleFS/src

lib_deps = 
    https://github.com/mathieucarbou/AsyncTCP.git
    https://github.com/mathieucarbou/ESPAsyncWebServer.git
    https://github.com/s00500/ESPUI.git#master
    # No change when I use https://github.com/s00500/ESPUI.git
    
    FS
    LittleFS
    
    teemuatlut/TMCStepper@^0.7.3
    olikraus/U8g2@^2.36.15
    waspinator/AccelStepper@^1.64
    paulstoffregen/OneWire@^2.3.8
    milesburton/DallasTemperature@^4.0.5
    ayushsharma82/ElegantOTA@^3.1.7
    sensslen/LibLanc@^3.0.2

lib_ignore = 
    ESP32AsyncTCP ; Verhindert Konflikte mit Mathieucarbou's AsyncTCP

main.cpp

#include <stdio.h>
#include "Globals.h"
#include "WebsiteControl.h"


void setup()
{
  vTaskDelay(pdMS_TO_TICKS(2000));

  Serial.begin(115200);

  WC_ZDataToVC = xQueueCreate(QUEUE_SIZE, sizeof(struct_wctovc));

  delay(500); // Dem PSRAM-Controller Zeit geben

  if (!psramInit()) {
      Serial.printf("PSRAM not ready! Restarting...\n");
      ESP.restart();
  }
  
  Serial.printf("PSRAM erkannt: %d KB\n", ESP.getPsramSize() / 1024);
  Serial.printf("SRAM frei: %d KB\n", ESP.getFreeHeap() / 1024);

  char ssid[] = "SSID";
  char pass[] = "Password";

  WiFi.begin(ssid, pass);
  Serial.printf("Connecting WIFI to SSID: %s\n", ssid);
  long timer = millis();
  while (WiFi.status() != WL_CONNECTED)
  {
      if (millis() - timer > 5000)
      {
          Serial.printf("Failed to connect to WiFi after 5s. Restarting...\n");
          ESP.restart();
      }
      else
      {
          vTaskDelay(pdMS_TO_TICKS(500));
          Serial.printf(".\n");
      }
  }

  Serial.printf("IP: %s\n", WiFi.localIP().toString().c_str());

  vTaskDelay(pdMS_TO_TICKS(500));


  xTaskCreatePinnedToCore(
    taskWebsiteControl,   /* Function to implement the task */
    "WebsiteControl",     /* Name of the task */
    16384,              /* Stack size in words */
    NULL,               /* Task input parameter */
    1,                  /* Priority of the task */
    &task_websiteControl, /* Task handle. */
    0);                 /* Core where the task should run */

  Serial.printf("Starting Main complete\n");
}

void loop()
{
  UBaseType_t XFreeStackWebsite = uxTaskGetStackHighWaterMark(task_websiteControl);

  Serial.printf("WC: %d | ", XFreeStackWebsite);
  Serial.printf("Heap: %d KB ", ESP.getFreeHeap() / 1024);
  Serial.printf("(min. %d KB)\n", ESP.getMinFreeHeap() / 1024);

  vTaskDelay(pdMS_TO_TICKS(5000));
}

WebsiteControl.cpp

#include "WebsiteControl.h"
#include "Globals.h"
#include <string>


struct_wctovc ZDataToVC;

uint16_t ISlFixWide;
uint16_t ISlFixTele;

void callConfigVC(Control *sender, int type);

void taskWebsiteControl(void *parameter){

    Serial.printf("Start setup of Website Control\n");

    String clearLabelStyle = "background-color: unset; width: 100%;";
    static unsigned long lastUpdate = 0;
    Preferences IConf;

    Serial.printf("Wait for WiFi connection\n");
    while (WiFi.status() != WL_CONNECTED)
    {
        vTaskDelay(pdMS_TO_TICKS(500));
    }
    vTaskDelay(pdMS_TO_TICKS(1000));


    Serial.printf("Get config from flash\n");

    IConf.begin("VC", false);

    ZDataToVC.PFixZoomSpdWide = IConf.getInt("PFixZoomSpdWide", FIX_ZOOM_WIDE);
    ZDataToVC.PFixZoomSpdTele = IConf.getInt("PFixZoomSpdTele", FIX_ZOOM_TELE);

    IConf.end();

    Serial.printf("Setup WebUI\n");
    
    ESPUI.addControl(ControlType::Separator, "LANC Control", "", ControlColor::None);

    ISlFixWide = ESPUI.addControl(Slider, "Fix Zoom Speed", "3", Turquoise, Control::noParent, callConfigVC);
	ESPUI.addControl(Min, "", "-8", None, ISlFixWide);
	ESPUI.addControl(Max, "", "-1", None, ISlFixWide);
    ESPUI.setElementStyle(ESPUI.addControl(Label, "", "Wide", None, ISlFixWide), clearLabelStyle);

    ISlFixTele = ESPUI.addControl(Slider, "", "3", Turquoise, ISlFixWide, callConfigVC);
	ESPUI.addControl(Min, "", "1", None, ISlFixTele);
	ESPUI.addControl(Max, "", "8", None, ISlFixTele);
    ESPUI.setElementStyle(ESPUI.addControl(Label, "", "Tele", None, ISlFixWide), clearLabelStyle);

    Serial.printf("Start WebUI\n");

    ESPUI.begin("Camera Gimbal");

    Serial.printf("Update Labels and values\n");

    ESPUI.updateNumber(ISlFixWide, (int)ZDataToVC.PFixZoomSpdWide);
    ESPUI.updateNumber(ISlFixTele, (int)ZDataToVC.PFixZoomSpdTele);

    Serial.printf("Setup of Website Control complete\n");

    for(;;){
        
        if (millis() - lastUpdate >= 1000) {
            lastUpdate = millis();
            // To update labels
        }

        //ElegantOTA.loop();
        vTaskDelay(pdMS_TO_TICKS(1));
    }

}

void callConfigVC(Control *sender, int type){

    Serial.printf("Config change in VC: %d, %s\n", sender->id, sender->value.c_str());

    if(sender->id == ISlFixWide){
        ZDataToVC.PFixZoomSpdWide = sender->value.toInt();
    }
    else if(sender->id == ISlFixTele){
        ZDataToVC.PFixZoomSpdTele = sender->value.toInt();
    }

    xQueueOverwrite(WC_ZDataToVC, &ZDataToVC);

}

Expected behavior
Website can be loaded on all devices.

Screenshots
Screenshot from Browser (Safari 26.2)
Image

Desktop (please complete the following information):

  • OS: macOS26.2
  • Browser safari
  • Version 26.2

Smartphone (please complete the following information):

  • Device: iPhone16
  • OS: iOS26.2.1
  • Browser safari

Additional context
I am planning to implement also other functions therefore I create a separate task for the Website.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions