aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster
diff options
context:
space:
mode:
authorSelene ToyKeeper2020-09-25 05:19:19 -0600
committerSelene ToyKeeper2020-09-25 05:19:19 -0600
commit1c1980a41a146a5994c8c1cfe67e96be4e63c213 (patch)
tree5eb8b280e5aa169ed87add49dc77e568ee75f7d0 /spaghetti-monster
parentdocumentation improvements: (diff)
downloadanduril-1c1980a41a146a5994c8c1cfe67e96be4e63c213.tar.gz
anduril-1c1980a41a146a5994c8c1cfe67e96be4e63c213.tar.bz2
anduril-1c1980a41a146a5994c8c1cfe67e96be4e63c213.zip
reduced ROM 4 bytes by rearranging thermal_config_save() logic a bit
patch is from SammysHP: https://gist.github.com/SammysHP/48347a770995921444a6e91b187cb55b
Diffstat (limited to 'spaghetti-monster')
-rw-r--r--spaghetti-monster/anduril/tempcheck-mode.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/spaghetti-monster/anduril/tempcheck-mode.c b/spaghetti-monster/anduril/tempcheck-mode.c
index 34abeb0..e618480 100644
--- a/spaghetti-monster/anduril/tempcheck-mode.c
+++ b/spaghetti-monster/anduril/tempcheck-mode.c
@@ -44,21 +44,20 @@ uint8_t tempcheck_state(Event event, uint16_t arg) {
}
void thermal_config_save(uint8_t step, uint8_t value) {
- // item 1: calibrate room temperature
- if (step == 1) {
- if (value) {
+ if (value) {
+ // item 1: calibrate room temperature
+ if (step == 1) {
int8_t rawtemp = temperature - therm_cal_offset;
therm_cal_offset = value - rawtemp;
adc_reset = 2; // invalidate all recent temperature data
}
- }
- // item 2: set maximum heat limit
- else {
- if (value) {
+ // item 2: set maximum heat limit
+ else {
therm_ceil = 30 + value - 1;
}
}
+
if (therm_ceil > MAX_THERM_CEIL) therm_ceil = MAX_THERM_CEIL;
}