Skip to content

Commit

Permalink
Added hibernate function
Browse files Browse the repository at this point in the history
  • Loading branch information
blackcoffeexbt committed Oct 25, 2022
1 parent 6c5f6a0 commit 83d28ac
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
3 changes: 0 additions & 3 deletions LightningPiggy.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
"folders": [
{
"path": "."
},
{
"path": "../LNPoS/lnPoSTdisplay"
}
],
"settings": {}
Expand Down
16 changes: 14 additions & 2 deletions LightningPiggy.ino
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ void loop()
Serial.println("-----------------");
getWalletDetails();
Serial.println("-----------------");
getLNURLPayments(3);
getLNURLPayments(5);
Serial.println("-----------------");
getLNURLp();
Serial.println("-----------------");

delay(30000);
hibernate(30);
}


Expand Down Expand Up @@ -165,4 +165,16 @@ String getEndpointData(String endpointUrl) {

const String line = client.readString();
return line;
}

void hibernate(int sleepTimeSeconds) {
uint64_t deepSleepTime = (uint64_t)sleepTimeSeconds * (uint64_t)1000 * (uint64_t)1000;
Serial.println("Going to sleep for seconds");
Serial.println(deepSleepTime);
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_OFF);
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_SLOW_MEM, ESP_PD_OPTION_OFF);
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_FAST_MEM, ESP_PD_OPTION_OFF);
esp_sleep_pd_config(ESP_PD_DOMAIN_XTAL, ESP_PD_OPTION_OFF);
esp_sleep_enable_timer_wakeup(deepSleepTime);
esp_deep_sleep_start();
}

0 comments on commit 83d28ac

Please sign in to comment.