This commit is contained in:
r4 2022-11-27 02:06:43 +01:00
parent 618c75b72b
commit dac3a33e9e

View File

@ -5,9 +5,9 @@
void (*full_reset)() = nullptr;
static volatile bool wdt_int_sleep_mode = false;
static volatile bool wdt_in_sleep_mode = false;
ISR (WDT_vect) {
if (wdt_int_sleep_mode)
if (wdt_in_sleep_mode)
wdt_disable();
else
full_reset();
@ -15,7 +15,7 @@ ISR (WDT_vect) {
/* Based on https://github.com/rocketscream/Low-Power. */
void low_power_sleep_minutes(unsigned long t) {
wdt_int_sleep_mode = true;
wdt_in_sleep_mode = true;
ADCSRA &= ~_BV(ADEN); /* Disable ADC. */
for (unsigned long i = 0; 8ul * i < 60ul * t; i++) {
// Power Down for 8s
@ -33,5 +33,5 @@ void low_power_sleep_minutes(unsigned long t) {
} while (0);
}
ADCSRA |= _BV(ADEN); /* Re-enable ADC. */
wdt_int_sleep_mode = false;
wdt_in_sleep_mode = false;
}