From 43eec5d7b84f1ac617519723373850733d3adcb1 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Sun, 19 Apr 2020 03:17:24 -0600 Subject: made thermal response larger when error is large, smaller when error is small (helps on KR4, but will probably need to add the response magnitude thing to adjust speed per build target) --- spaghetti-monster/fsm-adc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/spaghetti-monster/fsm-adc.c b/spaghetti-monster/fsm-adc.c index edf1809..760acc4 100644 --- a/spaghetti-monster/fsm-adc.c +++ b/spaghetti-monster/fsm-adc.c @@ -377,11 +377,17 @@ static inline void ADC_temperature_handler() { if (warning_threshold > 0) { warning_threshold -= offset; } else { // error is big enough; send a warning - warning_threshold = THERM_NEXT_WARNING_THRESHOLD - offset; + //warning_threshold = THERM_NEXT_WARNING_THRESHOLD - offset; // how far above the ceiling? //int16_t howmuch = offset * THERM_RESPONSE_MAGNITUDE / 128; - int16_t howmuch = offset; + //int16_t howmuch = offset; + // increase the amount, except for small values + // 1:1, 2:1, 3:3, 4:5, 6:9, 8:13, 10:17, 40:77 + int16_t howmuch = offset + offset - 3; + if (howmuch < 1) howmuch = 1; + warning_threshold = THERM_NEXT_WARNING_THRESHOLD - (uint8_t)howmuch; + // send a warning emit(EV_temperature_high, howmuch); } -- cgit v1.2.3