Compare commits
2 Commits
618c75b72b
...
ea93980795
Author | SHA1 | Date | |
---|---|---|---|
|
ea93980795 | ||
|
dac3a33e9e |
@ -182,7 +182,7 @@ static void command_loop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void cmd() {
|
void cmd() {
|
||||||
printf(F("You are now in command mode. Reset to exit. Type 'help' for a list of commands.\n"));
|
printf(F("You are now in command mode. Type 'help' for a list of commands.\n"));
|
||||||
while (Serial.available()) Serial.read();
|
while (Serial.available()) Serial.read();
|
||||||
while (1) {
|
while (1) {
|
||||||
command_loop();
|
command_loop();
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
|
|
||||||
void (*full_reset)() = nullptr;
|
void (*full_reset)() = nullptr;
|
||||||
|
|
||||||
static volatile bool wdt_int_sleep_mode = false;
|
static volatile bool wdt_in_sleep_mode = false;
|
||||||
ISR (WDT_vect) {
|
ISR (WDT_vect) {
|
||||||
if (wdt_int_sleep_mode)
|
if (wdt_in_sleep_mode)
|
||||||
wdt_disable();
|
wdt_disable();
|
||||||
else
|
else
|
||||||
full_reset();
|
full_reset();
|
||||||
@ -15,7 +15,7 @@ ISR (WDT_vect) {
|
|||||||
|
|
||||||
/* Based on https://github.com/rocketscream/Low-Power. */
|
/* Based on https://github.com/rocketscream/Low-Power. */
|
||||||
void low_power_sleep_minutes(unsigned long t) {
|
void low_power_sleep_minutes(unsigned long t) {
|
||||||
wdt_int_sleep_mode = true;
|
wdt_in_sleep_mode = true;
|
||||||
ADCSRA &= ~_BV(ADEN); /* Disable ADC. */
|
ADCSRA &= ~_BV(ADEN); /* Disable ADC. */
|
||||||
for (unsigned long i = 0; 8ul * i < 60ul * t; i++) {
|
for (unsigned long i = 0; 8ul * i < 60ul * t; i++) {
|
||||||
// Power Down for 8s
|
// Power Down for 8s
|
||||||
@ -33,5 +33,5 @@ void low_power_sleep_minutes(unsigned long t) {
|
|||||||
} while (0);
|
} while (0);
|
||||||
}
|
}
|
||||||
ADCSRA |= _BV(ADEN); /* Re-enable ADC. */
|
ADCSRA |= _BV(ADEN); /* Re-enable ADC. */
|
||||||
wdt_int_sleep_mode = false;
|
wdt_in_sleep_mode = false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user