~toykeeper/flashlight-firmware/lume1

« back to all changes in this revision

Viewing changes to ToyKeeper/spaghetti-monster/fsm-adc.h

  • Committer: Selene Scriven
  • Date: 2020-08-23 17:43:11 UTC
  • Revision ID: bzr@toykeeper.net-20200823174311-o3hi5ljwroz5a3lt
attempt to fix laggy voltage readings right after waking, on FW3A
(with no sleep ticks, the voltage value never gets reset to the raw value,
 and instead only goes through the lowpass filter)
(this fix is not yet tested...  will test before uploading)
(also carries a risk of messing up thermal values after being asleep,
 so that needs to be tested too)

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#define FSM_ADC_H
22
22
 
23
23
 
 
24
#if defined(USE_LVP) || defined(USE_THERMAL_REGULATION)
 
25
// use raw value instead of lowpassed value for the next N measurements
 
26
// (2 = 1 for voltage + 1 for temperature)
 
27
volatile uint8_t adc_reset = 2;
 
28
#endif
 
29
 
24
30
#ifdef USE_LVP
25
31
// default 5 seconds between low-voltage warning events
26
32
#ifndef VOLTAGE_WARNING_SECONDS
85
91
volatile int16_t temperature;
86
92
uint8_t therm_ceil = DEFAULT_THERM_CEIL;
87
93
int8_t therm_cal_offset = 0;
88
 
volatile uint8_t reset_thermal_history = 1;
89
94
static inline void ADC_temperature_handler();
90
95
#endif  // ifdef USE_THERMAL_REGULATION
91
96