aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSelene ToyKeeper2017-08-24 03:03:55 -0600
committerSelene ToyKeeper2017-08-24 03:03:55 -0600
commit2249f9913058c534fba51fbc6285e49c67bce726 (patch)
treed5f5580ea70ef0125f84527006a186a7e37eaa25
parentSet default brightness to max 7135 level. (diff)
downloadanduril-2249f9913058c534fba51fbc6285e49c67bce726.tar.gz
anduril-2249f9913058c534fba51fbc6285e49c67bce726.tar.bz2
anduril-2249f9913058c534fba51fbc6285e49c67bce726.zip
Don't send underheat warnings when LVP is active. The signals conflict.
Also, avoid immediate thermal step-down after battery change. (init array with correctly-scaled values)
-rw-r--r--spaghetti-monster/fsm-adc.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/spaghetti-monster/fsm-adc.c b/spaghetti-monster/fsm-adc.c
index b3ae4e9..9a6e2e7 100644
--- a/spaghetti-monster/fsm-adc.c
+++ b/spaghetti-monster/fsm-adc.c
@@ -148,7 +148,7 @@ ISR(ADC_vect) {
for(uint8_t i=0; i<NUM_THERMAL_VALUES; i++)
temperature_values[i] = temp;
for(uint8_t i=0; i<NUM_THERMAL_VALUES_HISTORY; i++)
- temperature_history[i] = temp;
+ temperature_history[i] = temp<<2;
temperature = temp;
} else { // update our current temperature estimate
uint8_t i;
@@ -231,13 +231,13 @@ ISR(ADC_vect) {
if (underheat_lowpass < UNDERHEAT_LOWPASS_STRENGTH) {
underheat_lowpass ++;
} else {
- // FIXME: don't warn about underheating when voltage is low
- // (LVP and underheat warnings fight each other)
// how far below the floor?
int16_t howmuch = (THERM_FLOOR - projected_temperature) >> THERM_DIFF_ATTENUATION;
if (howmuch < 1) howmuch = 1;
- // try to send out a warning
- emit(EV_temperature_low, howmuch);
+ // try to send out a warning (unless voltage is low)
+ // (LVP and underheat warnings fight each other)
+ if (voltage > VOLTAGE_LOW)
+ emit(EV_temperature_low, howmuch);
// reset counters
temperature_timer = TEMPERATURE_TIMER_START;
underheat_lowpass = 0;