powersave #2

Merged
martin merged 7 commits from powersave into main 2023-01-11 11:29:06 +01:00
Showing only changes of commit ce08d17a11 - Show all commits

View file

@ -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