aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster
diff options
context:
space:
mode:
authorSelene ToyKeeper2023-10-03 16:24:09 -0600
committerSelene ToyKeeper2023-10-03 16:24:09 -0600
commit78f2a7dd69cd21922fc43508b317c5a81f8ea7cb (patch)
treee9fd5c305ef9823e9b9f12f172d34137e0139da6 /spaghetti-monster
parentfixed builds for ff-e01, ff-pl47* (diff)
downloadanduril-78f2a7dd69cd21922fc43508b317c5a81f8ea7cb.tar.gz
anduril-78f2a7dd69cd21922fc43508b317c5a81f8ea7cb.tar.bz2
anduril-78f2a7dd69cd21922fc43508b317c5a81f8ea7cb.zip
raised default temperature limit to 50C on attiny1616 and newer MCUs,
slightly simplified gradual_tick()
Diffstat (limited to 'spaghetti-monster')
-rw-r--r--spaghetti-monster/anduril/config-default.h6
-rw-r--r--spaghetti-monster/fsm-ramping.c5
2 files changed, 8 insertions, 3 deletions
diff --git a/spaghetti-monster/anduril/config-default.h b/spaghetti-monster/anduril/config-default.h
index b66a645..bc301e0 100644
--- a/spaghetti-monster/anduril/config-default.h
+++ b/spaghetti-monster/anduril/config-default.h
@@ -20,7 +20,13 @@
// overheat protection
#define USE_THERMAL_REGULATION
+#if (ATTINY==85) || (ATTINY==1634)
+// sloppy temperature sensor needs bigger error margin
#define DEFAULT_THERM_CEIL 45 // try not to get hotter than this (in C)
+#else
+// more accurate temperature sensor can regulate higher safely
+#define DEFAULT_THERM_CEIL 50 // try not to get hotter than this (in C)
+#endif
// Comment out to disable automatic calibration on factory reset
// - If so, be sure to set THERM_CAL_OFFSET to the correct calibration offset
// - Calibration can still be overridden in temperature check mode
diff --git a/spaghetti-monster/fsm-ramping.c b/spaghetti-monster/fsm-ramping.c
index 89f540b..adc8acb 100644
--- a/spaghetti-monster/fsm-ramping.c
+++ b/spaghetti-monster/fsm-ramping.c
@@ -241,15 +241,14 @@ void gradual_tick() {
uint8_t gt = gradual_target;
if (gt < actual_level) gt = actual_level - 1;
else if (gt > actual_level) gt = actual_level + 1;
- gt --;
// call the relevant hardware-specific function
GradualTickFuncPtr gradual_tick_func = channels[channel_mode].gradual_tick;
- bool done = gradual_tick_func(gt);
+ bool done = gradual_tick_func(gt - 1);
if (done) {
uint8_t orig = gradual_target;
- set_level(gt + 1);
+ set_level(gt);
gradual_target = orig;
}
}