aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster/fsm-adc.h
diff options
context:
space:
mode:
authorSelene ToyKeeper2023-04-16 18:21:29 -0600
committerSelene ToyKeeper2023-04-16 18:21:29 -0600
commitfbcac59563c32f14de4861449c1b267c247b5b78 (patch)
tree3cddc0e447194d7a6432ebf3561a86208037d44e /spaghetti-monster/fsm-adc.h
parentadded ability to use 2 colors in config mode (diff)
downloadanduril-fbcac59563c32f14de4861449c1b267c247b5b78.tar.gz
anduril-fbcac59563c32f14de4861449c1b267c247b5b78.tar.bz2
anduril-fbcac59563c32f14de4861449c1b267c247b5b78.zip
reduced ROM by ~600 bytes by moving all eeprom config values to a "cfg" struct
(this also made some parts of the code cleaner)
Diffstat (limited to '')
-rw-r--r--spaghetti-monster/fsm-adc.h22
1 files changed, 17 insertions, 5 deletions
diff --git a/spaghetti-monster/fsm-adc.h b/spaghetti-monster/fsm-adc.h
index db2bb7b..77f625a 100644
--- a/spaghetti-monster/fsm-adc.h
+++ b/spaghetti-monster/fsm-adc.h
@@ -63,9 +63,14 @@ void adc_deferred(); // do the actual ADC-related calculations
static inline void ADC_voltage_handler();
uint8_t voltage = 0;
#ifdef USE_VOLTAGE_CORRECTION
-// same 0.05V units as fudge factor,
-// but 7 is neutral, and the expected range is from 1 to 13
-uint8_t voltage_correction = 7;
+ #ifdef USE_CFG
+ #define VOLT_CORR cfg.voltage_correction
+ #else
+ // same 0.05V units as fudge factor,
+ // but 7 is neutral, and the expected range is from 1 to 13
+ uint8_t voltage_correction = 7;
+ #define VOLT_CORR voltage_correction
+ #endif
#endif
#ifdef USE_LVP
void low_voltage();
@@ -98,8 +103,15 @@ void battcheck();
#endif
// temperature now, in C (ish)
int16_t temperature;
-uint8_t therm_ceil = DEFAULT_THERM_CEIL;
-int8_t therm_cal_offset = 0;
+#ifdef USE_CFG
+ #define TH_CEIL cfg.therm_ceil
+ #define TH_CAL cfg.therm_cal_offset
+#else
+ #define TH_CEIL therm_ceil
+ #define TH_CAL therm_cal_offset
+ uint8_t therm_ceil = DEFAULT_THERM_CEIL;
+ int8_t therm_cal_offset = 0;
+#endif
static inline void ADC_temperature_handler();
#endif // ifdef USE_THERMAL_REGULATION