Browse Source

don't fall asleep on alarm

main
Hendrik Langer 7 years ago
parent
commit
24dbb4dfa6
  1. 10
      src/main.cpp

10
src/main.cpp

@ -337,9 +337,15 @@ void loop()
localtime_r(&now, &timeinfo);
double seconds = difftime(now, mktime(&alarmTime));
bool stayAwake = false;
if (alarmArmed && seconds >= -2*5*60) stayAwake = true;
if (!mp3.playing && millis() - lastButtonPress >= 60*1000 && !stayAwake) suspend();
Serial.printf("alarm in %f seconds (%d)\n", seconds, alarmArmed);
if (seconds >= 0 && alarmArmed) {
alarmArmed = false;
lastButtonPress = millis();
led.wakeUpLight(0);
Serial.println("WAKEUP TIME!!!!!");
mp3.setVolume(2);
@ -350,10 +356,6 @@ void loop()
led.wakeUpLight(255*(seconds+300)/300);
}
bool stayAwake = false;
if (alarmArmed && seconds >= -2*5*60) stayAwake = true;
if (!mp3.playing && millis() - lastButtonPress >= 60*1000 && !stayAwake) suspend();
int voltage = rom_phy_get_vdd33();
Serial.printf("voltage: %d\n", voltage);

Loading…
Cancel
Save