Skip to content
Snippets Groups Projects
Commit 0fb0ede2 authored by Jan Grewe's avatar Jan Grewe
Browse files

more cleanup

parent 2a2de99d
Branches
No related tags found
No related merge requests found
......@@ -6,3 +6,4 @@ void powerSetOutput(uint8_t channel, bool enabled);
void powerStatus();
void powerSetup();
void powerSleep();
void powerBootInfo();
\ No newline at end of file
......@@ -7,7 +7,6 @@
#include <CayenneLPP.h>
int state;
RTC_DATA_ATTR int bootCount = 0;
CayenneLPP payload(55);
void createPayload()
......@@ -27,42 +26,11 @@ void printPayload() {
Serial.println("\n#########################\n");
}
static void bootInfo()
{
++bootCount;
Serial.printf("Boot number: %d\n", bootCount);
esp_sleep_wakeup_cause_t wakeup_reason;
wakeup_reason = esp_sleep_get_wakeup_cause();
switch (wakeup_reason)
{
case ESP_SLEEP_WAKEUP_EXT0:
Serial.println("Wakeup caused by external signal using RTC_IO");
break;
case ESP_SLEEP_WAKEUP_EXT1:
Serial.println("Wakeup caused by external signal using RTC_CNTL");
break;
case ESP_SLEEP_WAKEUP_TIMER:
Serial.println("Wakeup caused by timer");
break;
case ESP_SLEEP_WAKEUP_TOUCHPAD:
Serial.println("Wakeup caused by touchpad");
break;
case ESP_SLEEP_WAKEUP_ULP:
Serial.println("Wakeup caused by ULP program");
break;
default:
Serial.printf("Wakeup was not caused by deep sleep: %d\n", wakeup_reason);
break;
}
}
void setup()
{
Serial.begin(115200);
Wire.begin(21, 22);
bootInfo();
powerBootInfo();
powerSetup();
gpsSetup();
loraSetup();
......
#include "config.h"
#include <axp20x.h>
RTC_DATA_ATTR int bootCount = 0;
AXP20X_Class axp;
void powerLed(axp_chgled_mode_t mode)
......@@ -84,3 +86,35 @@ void powerSleep()
Serial.println("\n### END ###");
esp_deep_sleep_start();
}
void powerBootInfo()
{
++bootCount;
Serial.printf("Boot number: %d\n", bootCount);
esp_sleep_wakeup_cause_t wakeup_reason;
wakeup_reason = esp_sleep_get_wakeup_cause();
switch (wakeup_reason)
{
case ESP_SLEEP_WAKEUP_EXT0:
Serial.println("Wakeup caused by external signal using RTC_IO");
break;
case ESP_SLEEP_WAKEUP_EXT1:
Serial.println("Wakeup caused by external signal using RTC_CNTL");
break;
case ESP_SLEEP_WAKEUP_TIMER:
Serial.println("Wakeup caused by timer");
break;
case ESP_SLEEP_WAKEUP_TOUCHPAD:
Serial.println("Wakeup caused by touchpad");
break;
case ESP_SLEEP_WAKEUP_ULP:
Serial.println("Wakeup caused by ULP program");
break;
default:
Serial.printf("Wakeup was not caused by deep sleep: %d\n", wakeup_reason);
break;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment