Closed GitHubUserEH closed 1 year ago
Change updateChart; to updateChart(); probably?
Oops... The brackets must have disappeared during code shortening. No, even with the brackets the ESP32 crashes immediately after the reboot. Once the code part of the updateChart() routine is copied into the loop() routine it works perfectly for many hours without any problems.
This is the crash error. It is 100% reproducable.
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:2 load:0x3fff0030,len:1184 load:0x40078000,len:13192 load:0x40080400,len:3028 entry 0x400805e4 Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC : 0x4015000d PS : 0x00060430 A0 : 0x800da3fd A1 : 0x3ffcf2d0
A2 : 0x3ffd1dcf A3 : 0x800dd138 A4 : 0x3ffcf38c A5 : 0x3ffd1dce
A6 : 0x0000656d A7 : 0x614e2074 A8 : 0x3ffd1dc4 A9 : 0x3ffd1dc4
A10 : 0x800dd138 A11 : 0x3ffd2584 A12 : 0x00001004 A13 : 0x00000043
A14 : 0x00000000 A15 : 0x3ffb657c SAR : 0x0000001d EXCCAUSE: 0x0000001c
EXCVADDR: 0x800dd138 LBEG : 0x400891a0 LEND : 0x400891b6 LCOUNT : 0xffffffff
Backtrace: 0x4015000a:0x3ffcf2d0 0x400da3fa:0x3ffcf2f0 0x400da972:0x3ffcf310 0x400db8de:0x3ffcf350 0x400dbee9:0x3ffcf780 0x400dc021:0x3ffcf900 0x40151cee:0x3ffcf920 0x40141bdd:0x3ffcf970 0x40141c01:0x3ffcf9b0 0x4013f921:0x3ffcf9d0 0x4013f999:0x3ffcfa00 0x4014015a:0x3ffcfa20
Hi @GitHubUserEH ,
The X and Y Axis data variables have to be kept in global scope because those are stored as a pointer inside ESP-DASH to keep memory footprint low. This change came as a part of V4 to further optimize the library ( You can read more about it in Migration Guide on docs page ).
Closing this issue.
The ESP32 crashes if not everything is the loop().
This code is working very stable on ESP32 Dev Board:
include
include
include // esphome/AsyncTCP-esphome@^2.0.0
include // ottowinter/ESPAsyncWebServer-esphome@^3.0.0
include // ayushsharma82/ESP-DASH@^4.0.1
const char ssid = "testwifi"; const char password = "testpassword";
AsyncWebServer server(80);
ESPDash dashboard(&server);
Chart chart1(&dashboard, BAR_CHART, "Chart Name");
void setup() { WiFi.begin(ssid, password); server.begin(); }
void loop() {
String XAxis[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; chart1.updateX(XAxis, 7);
int YAxis[] = {random(0, 100), random(0, 100), random(0, 100), random(0, 100), random(0, 100), random(0, 100), random(0, 100)}; chart1.updateY(YAxis, 7);
dashboard.sendUpdates();
delay(2000); }
===============================
This code causes the ESP32 to crash immediately after restart. It makes no difference if dashboard.sendUpdates() is in the loop() or not.
include
include
include // esphome/AsyncTCP-esphome@^2.0.0
include // ottowinter/ESPAsyncWebServer-esphome@^3.0.0
include // ayushsharma82/ESP-DASH@^4.0.1
const char ssid = "testwifi"; const char password = "testpassword";
AsyncWebServer server(80);
ESPDash dashboard(&server);
Chart chart1(&dashboard, BAR_CHART, "Chart Name");
void updateChart() { String XAxis[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; chart1.updateX(XAxis, 7);
int YAxis[] = {random(0, 100), random(0, 100), random(0, 100), random(0, 100), random(0, 100), random(0, 100), random(0, 100)}; chart1.updateY(YAxis, 7);
dashboard.sendUpdates(); }
void setup() { WiFi.begin(ssid, password); server.begin(); }
void loop() {
updateChart;
delay(2000); }