diff options
| author | Selene ToyKeeper | 2020-03-16 21:58:42 -0600 |
|---|---|---|
| committer | Selene ToyKeeper | 2020-03-16 21:58:42 -0600 |
| commit | ed3fcdb8f3363c4ccc87119c985d765bb3457515 (patch) | |
| tree | 1712d6ecdfd9370573524149817adf893346f0ce /spaghetti-monster/werner | |
| parent | merged from fsm, mostly to get thermal regulation updates (diff) | |
| parent | removed more references to THERM_HARD_TURBO_DROP (diff) | |
| download | anduril-ed3fcdb8f3363c4ccc87119c985d765bb3457515.tar.gz anduril-ed3fcdb8f3363c4ccc87119c985d765bb3457515.tar.bz2 anduril-ed3fcdb8f3363c4ccc87119c985d765bb3457515.zip | |
merged fsm branch, mostly to get new ADC code (thermal regulation and voltage monitoring)
Diffstat (limited to 'spaghetti-monster/werner')
| -rw-r--r-- | spaghetti-monster/werner/werner.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/spaghetti-monster/werner/werner.c b/spaghetti-monster/werner/werner.c index 7c47cd7..4159fc6 100644 --- a/spaghetti-monster/werner/werner.c +++ b/spaghetti-monster/werner/werner.c @@ -467,14 +467,15 @@ void thermal_config_save() { // calibrate room temperature val = config_state_values[0]; if (val) { - int8_t rawtemp = (temperature >> 1) - therm_cal_offset; + int8_t rawtemp = temperature - therm_cal_offset; therm_cal_offset = val - rawtemp; + reset_thermal_history = 1; // invalidate all recent temperature data } val = config_state_values[1]; if (val) { // set maximum heat limit - therm_ceil = 30 + val; + therm_ceil = 30 + val - 1; } if (therm_ceil > MAX_THERM_CEIL) therm_ceil = MAX_THERM_CEIL; } @@ -589,7 +590,7 @@ uint8_t nearest_level(int16_t target) { for(uint8_t i=0; i<ramp_discrete_steps; i++) { this_level = ramp_discrete_floor + (i * (uint16_t)ramp_range / (ramp_discrete_steps-1)); - int8_t diff = target - this_level; + int16_t diff = target - this_level; if (diff < 0) diff = -diff; if (diff <= (ramp_discrete_step_size>>1)) return this_level; @@ -684,9 +685,6 @@ void loop() { StatePtr state = current_state; - #ifdef USE_DYNAMIC_UNDERCLOCKING - auto_clock_speed(); - #endif if (0) {} #ifdef USE_BATTCHECK @@ -697,7 +695,7 @@ void loop() { #ifdef USE_THERMAL_REGULATION // TODO: blink out therm_ceil during thermal_config_state else if (state == tempcheck_state) { - blink_num(temperature>>1); + blink_num(temperature); nice_delay_ms(1000); } #endif |
