diff --git a/source/Core/BSP/Miniware/configuration.h b/source/Core/BSP/Miniware/configuration.h index 69ff81af..72f6f816 100644 --- a/source/Core/BSP/Miniware/configuration.h +++ b/source/Core/BSP/Miniware/configuration.h @@ -95,7 +95,7 @@ #define DETAILED_IDLE 0 // 0: Disable 1: Enable - Default 0 #define THERMAL_RUNAWAY_TIME_SEC 20 -#define THERMAL_RUNAWAY_TEMP_C 20 +#define THERMAL_RUNAWAY_TEMP_C 10 #define CUT_OUT_SETTING 0 // default to no cut-off voltage #define RECOM_VOL_CELL 33 // Minimum voltage per cell (Recommended 3.3V (33)) diff --git a/source/Core/Threads/PIDThread.cpp b/source/Core/Threads/PIDThread.cpp index b87a488e..5173af3e 100644 --- a/source/Core/Threads/PIDThread.cpp +++ b/source/Core/Threads/PIDThread.cpp @@ -148,12 +148,12 @@ void detectThermalRunaway(const int16_t currentTipTempInC, const int tError) { // Check for thermal runaway, where it has been x seconds with negligible (y) temp rise // While trying to actively heat + + // If we are more than 20C below the setpoint if ((tError > THERMAL_RUNAWAY_TEMP_C)) { - // Temp error is high + + // If we have heated up by more than 20C since last sample point, snapshot time and tip temp int16_t delta = (int16_t)currentTipTempInC - (int16_t)tipTempCRunawayTemp; - if (delta < 0) { - delta = -delta; - } if (delta > THERMAL_RUNAWAY_TEMP_C) { // We have heated up more than the threshold, reset the timer tipTempCRunawayTemp = currentTipTempInC;