aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster/werner
diff options
context:
space:
mode:
authorSelene ToyKeeper2020-03-16 03:57:19 -0600
committerSelene ToyKeeper2020-03-16 03:57:19 -0600
commit15fe735df7edf31ac388c2ffd65020216e1a70aa (patch)
tree8f8b1668ccb555dc4825ccbd9f4ac0487401b5cf /spaghetti-monster/werner
parentadded FETless KR4 build target, calibrated other KR4 therm faster level better (diff)
parentmerged adc-rework branch, which rewrote all ADC code (voltage, temperature, a... (diff)
downloadanduril-15fe735df7edf31ac388c2ffd65020216e1a70aa.tar.gz
anduril-15fe735df7edf31ac388c2ffd65020216e1a70aa.tar.bz2
anduril-15fe735df7edf31ac388c2ffd65020216e1a70aa.zip
merged fsm branch (to get adc-rework branch with new thermal regulation)
Diffstat (limited to 'spaghetti-monster/werner')
-rw-r--r--spaghetti-monster/werner/werner.c12
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
If you find this content useful please consider a small donation via bitcoin: bitcoin:1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2?amount=0.001&message=Donation Scraping git contents via cgit is very resource intensive. The continued hosting of these git repositories is entirely financed by your bitcoin contributions. For donations of a least 1 mBTC you include your IP address in the message of your bitcoin donation. This will remove this message in the future for requests from your IP, which will significantly reduce token usage. In any case, any contributions to bitcoin address 1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2 are very welcome. Thanks in advance for you contribution to a self-sustaining ecosystem.