aboutsummaryrefslogtreecommitdiffhomepage
path: root/source
diff options
context:
space:
mode:
authorBen V. Brown <[email protected]>2022-02-05 09:59:45 +1100
committerBen V. Brown <[email protected]>2022-02-05 09:59:45 +1100
commitc38dfb6007b2deb72bed04bb91efefadd70611f5 (patch)
tree7c66789a5817e5137704527c11aae55c12704e99 /source
parent4f2179287e7aa5ad9e1c37fc70ce488715676d63 (diff)
downloadIronOS-c38dfb6007b2deb72bed04bb91efefadd70611f5.tar.gz
IronOS-c38dfb6007b2deb72bed04bb91efefadd70611f5.zip
Dont wrap negative deltas
Diffstat (limited to 'source')
-rw-r--r--source/Core/BSP/Miniware/configuration.h2
-rw-r--r--source/Core/Threads/PIDThread.cpp8
2 files changed, 5 insertions, 5 deletions
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;