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