diff --git a/src/Afterburner/Afterburner.cpp b/src/Afterburner/Afterburner.cpp index 872fce0..306c9e4 100644 --- a/src/Afterburner/Afterburner.cpp +++ b/src/Afterburner/Afterburner.cpp @@ -903,7 +903,7 @@ bool validateFrame(const CProtocol& frame, const char* name) void requestOn() { - if(SmartError.checkVolts(FilteredSamples.FastipVolts.getValue(), FilteredSamples.FastGlowAmps.getValue())) { + if(bHasHtrData && SmartError.checkVolts(FilteredSamples.FastipVolts.getValue(), FilteredSamples.FastGlowAmps.getValue())) { heaterOn(); RTC_Store.setCyclicEngaged(true); // for cyclic mode } diff --git a/src/Afterburner/src/OLED/ScreenHeader.cpp b/src/Afterburner/src/OLED/ScreenHeader.cpp index 2d5c602..e6f3f29 100644 --- a/src/Afterburner/src/OLED/ScreenHeader.cpp +++ b/src/Afterburner/src/OLED/ScreenHeader.cpp @@ -136,7 +136,7 @@ CScreenHeader::animate() showTimers(); switch(_batteryCount) { case 3: - if(SmartError.checkVolts(FilteredSamples.FastipVolts.getValue(), FilteredSamples.FastGlowAmps.getValue())) { + if(SmartError.checkVolts(FilteredSamples.FastipVolts.getValue(), FilteredSamples.FastGlowAmps.getValue(), false)) { // check but do not fault showBatteryIcon(getBatteryVoltage(true)); } else { diff --git a/src/Afterburner/src/Protocol/SmartError.cpp b/src/Afterburner/src/Protocol/SmartError.cpp index 723cd20..ca8171a 100644 --- a/src/Afterburner/src/Protocol/SmartError.cpp +++ b/src/Afterburner/src/Protocol/SmartError.cpp @@ -34,9 +34,9 @@ CSmartError::CSmartError() void CSmartError::reset() { - m_prevRunState = 0; - m_Error = 0; - m_bInhibit = false; + _prevRunState = 0; + _Error = 0; + _bInhibit = false; } // we use inhibit when we manually command the heater off during preheat @@ -44,7 +44,7 @@ CSmartError::reset() void CSmartError::inhibit() { - m_bInhibit = true; + _bInhibit = true; // m_Error = 0; } @@ -71,33 +71,33 @@ CSmartError::monitor(uint8_t newRunState) { // check if moving away from heater Idle state (S0) // especially useful if an OEM controller exists - if((m_prevRunState == 0) && newRunState) { + if((_prevRunState == 0) && newRunState) { // reset the smart error - m_Error = 0; - m_bInhibit = false; + _Error = 0; + _bInhibit = false; } - if(!m_bInhibit) { - if(m_prevRunState == 2) { // preheat state (S2) + if(!_bInhibit) { + if(_prevRunState == 2) { // preheat state (S2) if(newRunState == 4) { // transitioned from preheat to ignited // - all good! - m_Error = 0; + _Error = 0; } else if(newRunState > 5) { // transitioned from preheat to post glow // - second ignition attempt failed, heater is shutting down - m_Error = 11; // +1 over displayed error code + _Error = 11; // +1 over displayed error code } else if(newRunState == 3) { // transitioned from preheat to retry // - first ignition attempt failed, heater will retry - m_Error = 12; // +1 over displayed error code + _Error = 12; // +1 over displayed error code } } } - if(m_prevRunState != newRunState) { + if(_prevRunState != newRunState) { // check for transition to startup // - force cancellation of an on request if we generated it if(newRunState >= 2) { @@ -110,11 +110,11 @@ CSmartError::monitor(uint8_t newRunState) } } - m_prevRunState = newRunState; + _prevRunState = newRunState; } bool -CSmartError::checkVolts(float ipVolts, float glowI) +CSmartError::checkVolts(float ipVolts, float glowI, bool throwfault) { // check for low voltage // values here are x10 integers @@ -122,20 +122,23 @@ CSmartError::checkVolts(float ipVolts, float glowI) float cableComp = glowI * 0.1; // allow 1V drop for 10A current (bit naive but better than no compensation) float Thresh = NVstore.getHeaterTuning().getLVC() - cableComp; // NVstore if(ipVolts < Thresh) { - m_Error = 2; // +1 over displayed error code - requestOff(); + if(throwfault) { + _Error = 2; // +1 over displayed error code + requestOff(); + } return false; } } return true; } + // return our smart error, if it exists, as the registered code uint8_t CSmartError::getError() { - if(m_Error) { - return m_Error; + if(_Error) { + return _Error; } return 0; } \ No newline at end of file diff --git a/src/Afterburner/src/Protocol/SmartError.h b/src/Afterburner/src/Protocol/SmartError.h index 0c91d09..6beab7c 100644 --- a/src/Afterburner/src/Protocol/SmartError.h +++ b/src/Afterburner/src/Protocol/SmartError.h @@ -22,16 +22,16 @@ #include "Protocol.h" class CSmartError { - uint8_t m_prevRunState; - uint8_t m_Error; - bool m_bInhibit; + uint8_t _prevRunState; + uint8_t _Error; + bool _bInhibit; public: CSmartError(); void reset(); void inhibit(); void monitor(const CProtocol& heaterFrame); void monitor(uint8_t runstate); - bool checkVolts(float volts, float plugI); + bool checkVolts(float volts, float plugI, bool throwfault=true); uint8_t getError(); }; diff --git a/src/Afterburner/src/Utility/NVStorage.h b/src/Afterburner/src/Utility/NVStorage.h index f68bdcc..85c1678 100644 --- a/src/Afterburner/src/Utility/NVStorage.h +++ b/src/Afterburner/src/Utility/NVStorage.h @@ -55,9 +55,9 @@ struct sHeaterTuning : public CESP32_NVStorage { retval &= INBOUNDS(glowDrive, 1, 6); retval &= INBOUNDS(pumpCal, 0.001, 1.0); if(sysVoltage == 120) - retval &= INBOUNDS(lowVolts, 100, 125); + retval &= INBOUNDS(lowVolts, 100, 125) || (lowVolts == 0); else - retval &= INBOUNDS(lowVolts, 200, 250); + retval &= INBOUNDS(lowVolts, 200, 250 || (lowVolts == 0)); retval &= INBOUNDS(tempOfs, -10, +10); return retval; }; diff --git a/src/Afterburner/src/WiFi/BTCWebServer.cpp b/src/Afterburner/src/WiFi/BTCWebServer.cpp index 18768f7..f33eda5 100644 --- a/src/Afterburner/src/WiFi/BTCWebServer.cpp +++ b/src/Afterburner/src/WiFi/BTCWebServer.cpp @@ -351,7 +351,11 @@ function completeHandler(event) { _('loaded_n_total').innerHTML = 'Uploaded ' + sendSize + ' bytes of ' + sendSize; var file = _('file1').files[0]; if(file.name.endsWith('.bin')) { - setTimeout( function() { location.assign('/'); }, 5000); + _('status').innerHTML='Rebooting NOW'; + setTimeout(function () { _('status').innerHTML='Rebooted'; }, 2000); + setTimeout(function () { _('status').innerHTML='Initialising...'; }, 4000); + setTimeout(function () { _('status').innerHTML='Loading /Index.html...'; }, 6000); + setTimeout(function () { location.assign('/'); }, 6500); } else { setTimeout( function() { location.assign('/update'); }, 500); @@ -943,7 +947,11 @@ body {