debug: clean LilyGO setup isolation baseline
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include <WiFi.h>
|
||||
#include <esp_heap_caps.h>
|
||||
#include <WebServer.h>
|
||||
#include <Preferences.h>
|
||||
#include <esp_wifi.h>
|
||||
@@ -4067,8 +4068,63 @@ void handleStatus() {
|
||||
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() {
|
||||
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
|
||||
DashboardSerial.begin(
|
||||
@@ -4183,20 +4239,9 @@ void setup() {
|
||||
|
||||
void loop() {
|
||||
server.handleClient();
|
||||
maintainStaWifi();
|
||||
handleDebugSerial();
|
||||
updateBms();
|
||||
updateAlarms();
|
||||
#if DASHBOARD_UART_ENABLED
|
||||
pollDashboardUart();
|
||||
#endif
|
||||
oledLoop();
|
||||
|
||||
static unsigned long lastSensorUpdate = 0;
|
||||
|
||||
if (millis() - lastSensorUpdate > 5000) {
|
||||
updateSensors();
|
||||
lastSensorUpdate = millis();
|
||||
logDebug("Sensor Update");
|
||||
}
|
||||
delay(2);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user