diff options
| -rw-r--r-- | spaghetti-monster/anduril/tempcheck-mode.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/spaghetti-monster/anduril/tempcheck-mode.c b/spaghetti-monster/anduril/tempcheck-mode.c index 34abeb0..e618480 100644 --- a/spaghetti-monster/anduril/tempcheck-mode.c +++ b/spaghetti-monster/anduril/tempcheck-mode.c @@ -44,21 +44,20 @@ uint8_t tempcheck_state(Event event, uint16_t arg) { } void thermal_config_save(uint8_t step, uint8_t value) { - // item 1: calibrate room temperature - if (step == 1) { - if (value) { + if (value) { + // item 1: calibrate room temperature + if (step == 1) { int8_t rawtemp = temperature - therm_cal_offset; therm_cal_offset = value - rawtemp; adc_reset = 2; // invalidate all recent temperature data } - } - // item 2: set maximum heat limit - else { - if (value) { + // item 2: set maximum heat limit + else { therm_ceil = 30 + value - 1; } } + if (therm_ceil > MAX_THERM_CEIL) therm_ceil = MAX_THERM_CEIL; } |
