show toast when reboot is needed, or error restart happened
less WTF, more information
This commit is contained in:
@@ -2859,6 +2859,14 @@ class AudioReactive : public Usermod {
|
||||
JsonObject top = root[FPSTR(_name)];
|
||||
bool configComplete = !top.isNull();
|
||||
|
||||
// remember previous values
|
||||
auto oldEnabled = enabled;
|
||||
auto oldDMType = dmType;
|
||||
auto oldI2SsdPin = i2ssdPin;
|
||||
auto oldI2SwsPin = i2swsPin;
|
||||
auto oldI2SckPin = i2sckPin;
|
||||
auto oldI2SmclkPin = mclkPin;
|
||||
|
||||
configComplete &= getJsonValue(top[FPSTR(_enabled)], enabled);
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3)
|
||||
@@ -2911,6 +2919,17 @@ class AudioReactive : public Usermod {
|
||||
configComplete &= getJsonValue(top["sync"][F("mode")], audioSyncEnabled);
|
||||
configComplete &= getJsonValue(top["sync"][F("check_sequence")], audioSyncSequence);
|
||||
|
||||
// WLEDMM notify user when a reboot is necessary
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
if (initDone) {
|
||||
if ((audioSource != nullptr) && (oldDMType != dmType)) errorFlag = ERR_REBOOT_NEEDED; // changing mic type requires reboot
|
||||
if ( (audioSource != nullptr) && (enabled==true)
|
||||
&& ((oldI2SsdPin != i2ssdPin) || (oldI2SsdPin != i2ssdPin) || (oldI2SckPin != i2sckPin)) ) errorFlag = ERR_REBOOT_NEEDED; // changing mic pins requires reboot
|
||||
if ((audioSource != nullptr) && (oldI2SmclkPin != mclkPin)) errorFlag = ERR_REBOOT_NEEDED; // changing MCLK pin requires reboot
|
||||
if ((oldDMType != dmType) && (oldDMType == 0)) errorFlag = ERR_POWEROFF_NEEDED; // changing from analog mic requires power cycle
|
||||
if ((oldDMType != dmType) && (dmType == 0)) errorFlag = ERR_POWEROFF_NEEDED; // changing to analog mic requires power cycle
|
||||
}
|
||||
#endif
|
||||
return configComplete;
|
||||
}
|
||||
|
||||
|
||||
@@ -357,6 +357,10 @@
|
||||
#define ERR_LOW_WS_MEM 35 // WLEDMM: low memory (ws)
|
||||
#define ERR_LOW_AJAX_MEM 36 // WLEDMM: low memory (oappend)
|
||||
#define ERR_LOW_BUF 37 // WLEDMM: low memory (LED buffer from allocLEDs)
|
||||
#define ERR_SYS_REBOOT 90 // WLEDMM: reboot after error
|
||||
#define ERR_SYS_BROWNOUT 91 // WLEDMM: reboot after brownout alert
|
||||
#define ERR_REBOOT_NEEDED 98 // WLEDMM: reboot needed after changing hardware setting
|
||||
#define ERR_POWEROFF_NEEDED 99 // WLEDMM: power-cycle needed after changing hardware setting
|
||||
|
||||
// Timer mode types
|
||||
#define NL_MODE_SET 0 //After nightlight time elapsed, set to target brightness
|
||||
|
||||
@@ -2011,8 +2011,20 @@ function readState(s,command=false)
|
||||
case 37:
|
||||
errstr = "no memory for LEDs buffer.";
|
||||
break;
|
||||
case 90:
|
||||
errstr = "Unexpected Restart. Check serial monitor.";
|
||||
break;
|
||||
case 91:
|
||||
errstr = "Brownout Restart.";
|
||||
break;
|
||||
case 98:
|
||||
errstr = "Please reboot WLED to activate changed settings.";
|
||||
break;
|
||||
case 99:
|
||||
errstr = "Please switch your device off and back on.";
|
||||
break;
|
||||
}
|
||||
showToast('Error ' + s.error + ": " + errstr, true);
|
||||
showToast(((s.error < 33)?'Error ':'Warning ') + s.error + ": " + errstr, (s.error < 35)||(s.error > 90));
|
||||
}
|
||||
|
||||
selectedPal = i.pal;
|
||||
|
||||
@@ -548,6 +548,9 @@ void WLED::setup()
|
||||
USER_PRINTF("Core#0 %s (%d)", resetCode2Info(core0code).c_str(), core0code);
|
||||
if (core1code > 0) {USER_PRINTF("; Core#1 %s (%d)", resetCode2Info(core1code).c_str(), core1code);}
|
||||
USER_PRINTLN(F("."));
|
||||
if ((core0code > 1) && (core0code <= 20) && (core0code != 3) && (core0code != 12) && (core0code != 14)) errorFlag = ERR_SYS_REBOOT; // abnormal reboot
|
||||
if ((resetReason >= 4) && (resetReason < 10)) errorFlag = ERR_SYS_REBOOT; // abnormal reboot (crash, brownout, watchdog, etc)
|
||||
if ((resetReason == ESP_RST_BROWNOUT) || (core0code == 15)) errorFlag = ERR_SYS_BROWNOUT; // brownout detected
|
||||
// WLEDMM end
|
||||
|
||||
USER_PRINT(F("FLASH: ")); USER_PRINT((ESP.getFlashChipSize()/1024)/1024);
|
||||
|
||||
Reference in New Issue
Block a user