From fbcac59563c32f14de4861449c1b267c247b5b78 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Sun, 16 Apr 2023 18:21:29 -0600 Subject: reduced ROM by ~600 bytes by moving all eeprom config values to a "cfg" struct (this also made some parts of the code cleaner) --- spaghetti-monster/fsm-adc.h | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'spaghetti-monster/fsm-adc.h') 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 -- cgit v1.2.3