Update auto-sleep timeout options and handle watchdog timer in web server loop

This commit is contained in:
altsysrq
2026-01-03 22:34:30 -06:00
parent 9ab27f848c
commit d3d0f684aa
4 changed files with 24 additions and 13 deletions

View File

@@ -4,6 +4,7 @@
#include <ESPmDNS.h>
#include <GfxRenderer.h>
#include <WiFi.h>
#include <esp_task_wdt.h>
#include <qrcode.h>
#include <cstddef>
@@ -308,9 +309,14 @@ void CrossPointWebServerActivity::loop() {
// Call handleClient multiple times to process pending requests faster
// This is critical for upload performance - HTTP file uploads send data
// in chunks and each handleClient() call processes incoming data
constexpr int HANDLE_CLIENT_ITERATIONS = 10;
// Reduced from 10 to 3 to prevent watchdog timer issues
constexpr int HANDLE_CLIENT_ITERATIONS = 3;
for (int i = 0; i < HANDLE_CLIENT_ITERATIONS && webServer->isRunning(); i++) {
webServer->handleClient();
// Feed the watchdog timer between iterations to prevent resets
esp_task_wdt_reset();
// Yield to other tasks to prevent starvation
yield();
}
lastHandleClientTime = millis();
}

View File

@@ -38,7 +38,7 @@ const SettingInfo settingsList[settingsCount] = {
{"Auto Sleep Timeout",
SettingType::ENUM,
&CrossPointSettings::autoSleepMinutes,
{"5 min", "10 min", "15 min", "20 min", "30 min", "60 min", "Never"}},
{"2 min", "5 min", "10 min", "15 min", "20 min", "30 min", "60 min", "Never"}},
{"Bluetooth", SettingType::TOGGLE, &CrossPointSettings::bluetoothEnabled, {}},
{"Check for updates", SettingType::ACTION, nullptr, {}},
};