debug: clean LilyGO setup isolation baseline
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
|
#include <esp_heap_caps.h>
|
||||||
#include <WebServer.h>
|
#include <WebServer.h>
|
||||||
#include <Preferences.h>
|
#include <Preferences.h>
|
||||||
#include <esp_wifi.h>
|
#include <esp_wifi.h>
|
||||||
@@ -4067,8 +4068,63 @@ void handleStatus() {
|
|||||||
server.send(200, "application/json", output);
|
server.send(200, "application/json", output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void heapCheckpoint(const char* label) {
|
||||||
|
Serial.print("HEAP CHECK ");
|
||||||
|
Serial.print(label);
|
||||||
|
Serial.print(" free=");
|
||||||
|
Serial.print(ESP.getFreeHeap());
|
||||||
|
Serial.print(" min=");
|
||||||
|
Serial.println(ESP.getMinFreeHeap());
|
||||||
|
|
||||||
|
if (!heap_caps_check_integrity_all(true)) {
|
||||||
|
Serial.print("HEAP CORRUPTION DETECTED AT: ");
|
||||||
|
Serial.println(label);
|
||||||
|
while (true) delay(1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
delay(2000);
|
||||||
|
|
||||||
|
Serial.println();
|
||||||
|
Serial.println("LilyGO clean isolation: config+relays+sensors+wifi+bare server");
|
||||||
|
|
||||||
|
heapCheckpoint("setup:start");
|
||||||
|
|
||||||
|
loadConfig();
|
||||||
|
heapCheckpoint("after:loadConfig");
|
||||||
|
|
||||||
|
printConfig();
|
||||||
|
|
||||||
|
initRelays();
|
||||||
|
heapCheckpoint("after:initRelays");
|
||||||
|
|
||||||
|
initSensors();
|
||||||
|
heapCheckpoint("after:initSensors");
|
||||||
|
|
||||||
|
loadWifiConfig();
|
||||||
|
heapCheckpoint("after:loadWifiConfig");
|
||||||
|
|
||||||
|
loadApConfig();
|
||||||
|
heapCheckpoint("after:loadApConfig");
|
||||||
|
|
||||||
|
WiFi.persistent(false);
|
||||||
|
WiFi.setSleep(false);
|
||||||
|
WiFi.mode(WIFI_AP);
|
||||||
|
|
||||||
|
startAccessPoint();
|
||||||
|
heapCheckpoint("after:startAccessPoint");
|
||||||
|
|
||||||
|
server.begin();
|
||||||
|
Serial.println("Bare WebServer started");
|
||||||
|
heapCheckpoint("setup:end");
|
||||||
|
}
|
||||||
|
|
||||||
|
void originalProjectSetupDisabled() {
|
||||||
|
Serial.begin(115200);
|
||||||
|
|
||||||
#if DASHBOARD_UART_ENABLED
|
#if DASHBOARD_UART_ENABLED
|
||||||
DashboardSerial.begin(
|
DashboardSerial.begin(
|
||||||
@@ -4183,20 +4239,9 @@ void setup() {
|
|||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
server.handleClient();
|
server.handleClient();
|
||||||
maintainStaWifi();
|
|
||||||
handleDebugSerial();
|
|
||||||
updateBms();
|
|
||||||
updateAlarms();
|
|
||||||
#if DASHBOARD_UART_ENABLED
|
#if DASHBOARD_UART_ENABLED
|
||||||
pollDashboardUart();
|
pollDashboardUart();
|
||||||
#endif
|
#endif
|
||||||
oledLoop();
|
delay(2);
|
||||||
|
|
||||||
static unsigned long lastSensorUpdate = 0;
|
|
||||||
|
|
||||||
if (millis() - lastSensorUpdate > 5000) {
|
|
||||||
updateSensors();
|
|
||||||
lastSensorUpdate = millis();
|
|
||||||
logDebug("Sensor Update");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user