From 987c98ccbe1cd6edc79f82ccca1fb263edbbbec0 Mon Sep 17 00:00:00 2001 From: Martin Brodbeck Date: Wed, 4 Jan 2023 10:18:38 +0100 Subject: [PATCH] print timestamp / disable wifi after use --- src/abfall.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/abfall.cpp b/src/abfall.cpp index dbc946a..d095c5b 100644 --- a/src/abfall.cpp +++ b/src/abfall.cpp @@ -32,7 +32,7 @@ int main() { WS2812 led(WS2812_PIN); - wifi_setup(); + wifi_enable(); // Enable Wifi in order to set time and retrieve data NtpClient::setDateTime(); HttpClient client; @@ -58,12 +58,16 @@ int main() { return 1; } + NtpClient::stop(); + wifi_disable(); // We don't need Wifi anymore + datetime_t dt; auto dates = parseCsv(csv); #ifdef DEBUG printf("Number of Dates: %d\n", dates.size()); #endif + while (true) { auto timestamp = time_us_64() + 60000000ull; @@ -80,8 +84,10 @@ int main() { if (isDST(dt.day, dt.month, dt.dotw)) ++hour; // MESZ + printf("%d-%02d-%02d %02d:%02d.%02d\n", dt.year, dt.month, dt.day, hour, dt.min, dt.sec); + // If there was a waste bin pickup found AND we are in the evening (>= 18:00) … - if (it != dates.end() && hour >= 14) { + if (it != dates.end() && hour >= 9) { auto wasteDate = *it; size_t count{0}; auto currentTime = time_us_64();