From ce08d17a11aee6210d5aa2ad1ef53e196b55247c Mon Sep 17 00:00:00 2001 From: Martin Brodbeck Date: Tue, 10 Jan 2023 21:51:36 +0100 Subject: [PATCH] WIP: trying to deep sleep --- src/abfall.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/abfall.cpp b/src/abfall.cpp index ccfdb3f..0f133b9 100644 --- a/src/abfall.cpp +++ b/src/abfall.cpp @@ -9,8 +9,13 @@ #include "hardware/pio.h" #include "hardware/rtc.h" #include "hardware/structs/scb.h" +// #include "hardware/xosc.h" +// #nclude "hardware/rosc.h" +// #include "hardware/clocks.h" +// #include "hardware/pll.h" #include "pico/cyw43_arch.h" +#include "pico/sleep.h" #include "pico/stdlib.h" #include "pico/util/datetime.h" @@ -33,8 +38,6 @@ int main() { #endif printf("Firmware version: %s\n", PROJECT_VERSION); - WS2812 led(WS2812_PIN); - wifi_enable(); // Enable Wifi in order to set time and retrieve data NtpClient::setDateTime(); @@ -75,6 +78,10 @@ int main() { uint scb_orig = scb_hw->scr; uint clock0_orig = clocks_hw->sleep_en0; uint clock1_orig = clocks_hw->sleep_en1; + uart_default_tx_wait_blocking(); + sleep_run_from_xosc(); + + WS2812 led(WS2812_PIN); while (true) { auto timestamp = time_us_64() + 60'000'000ull; @@ -138,6 +145,7 @@ int main() { } led.blinkReady(); + sleep_ms(800); datetime_t dtUntil = dt; add_one_hour(dtUntil); // next hour