wakeup reason

This commit is contained in:
Lubos Petrovic
2020-12-28 20:21:55 +01:00
parent 9f7f94d262
commit 1fd2bb0089

View File

@@ -157,10 +157,23 @@ void Board320_240::goToSleep() {
Iterate thru commands and determine if car is charging or ignition is on Iterate thru commands and determine if car is charging or ignition is on
*/ */
void Board320_240::afterSleep() { void Board320_240::afterSleep() {
syslog->println("Waking up from sleep mode!"); syslog->println("Waking up from sleep mode!");
bool firstRun = true; // Wakeup reason
esp_sleep_wakeup_cause_t wakeup_reason;
wakeup_reason = esp_sleep_get_wakeup_cause();
switch (wakeup_reason) {
case ESP_SLEEP_WAKEUP_EXT0 : syslog->println("Wakeup caused by external signal using RTC_IO"); break;
case ESP_SLEEP_WAKEUP_EXT1 : syslog->println("Wakeup caused by external signal using RTC_CNTL"); break;
case ESP_SLEEP_WAKEUP_TIMER : syslog->println("Wakeup caused by timer"); break;
case ESP_SLEEP_WAKEUP_TOUCHPAD : syslog->println("Wakeup caused by touchpad"); break;
case ESP_SLEEP_WAKEUP_ULP : syslog->println("Wakeup caused by ULP program"); break;
default: syslog->printf("Wakeup was not caused by deep sleep: %d\n", wakeup_reason); break;
}
//
bool firstRun = true;
while (liveData->commandQueueIndex - 1 > liveData->commandQueueLoopFrom || firstRun) { while (liveData->commandQueueIndex - 1 > liveData->commandQueueLoopFrom || firstRun) {
if (liveData->commandQueueIndex - 1 == liveData->commandQueueLoopFrom) { if (liveData->commandQueueIndex - 1 == liveData->commandQueueLoopFrom) {
firstRun = false; firstRun = false;