Merge pull request #179 from DarkZeros/Arduino_2.0.3+_fix

Tentative fixes for 2.0.3+
pull/189/head
SQFMI 2022-10-07 22:17:27 -04:00 committed by GitHub
commit 53acbe6929
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions

View File

@ -53,10 +53,16 @@ void Watchy::displayBusyCallback(const void *) {
void Watchy::deepSleep() { void Watchy::deepSleep() {
display.hibernate(); display.hibernate();
if (displayFullInit) // For some reason, seems to be enabled on first boot
esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_TIMER);
displayFullInit = false; // Notify not to init it again displayFullInit = false; // Notify not to init it again
RTC.clearAlarm(); // resets the alarm flag in the RTC RTC.clearAlarm(); // resets the alarm flag in the RTC
// Set pins 0-39 to input to avoid power leaking out
for (int i = 0; i < 40; i++) { // Set GPIOs 0-39 to input to avoid power leaking out
const uint64_t ignore = 0b11110001000000110000100111000010; // Ignore some GPIOs due to resets
for (int i = 0; i < GPIO_NUM_MAX; i++) {
if ((ignore >> i) & 0b1)
continue;
pinMode(i, INPUT); pinMode(i, INPUT);
} }
esp_sleep_enable_ext0_wakeup((gpio_num_t)RTC_INT_PIN, esp_sleep_enable_ext0_wakeup((gpio_num_t)RTC_INT_PIN,