print timestamp / disable wifi after use

This commit is contained in:
Martin Brodbeck 2023-01-04 10:18:38 +01:00
parent 36575884f3
commit 987c98ccbe

View file

@ -32,7 +32,7 @@ int main() {
WS2812 led(WS2812_PIN); WS2812 led(WS2812_PIN);
wifi_setup(); wifi_enable(); // Enable Wifi in order to set time and retrieve data
NtpClient::setDateTime(); NtpClient::setDateTime();
HttpClient client; HttpClient client;
@ -58,12 +58,16 @@ int main() {
return 1; return 1;
} }
NtpClient::stop();
wifi_disable(); // We don't need Wifi anymore
datetime_t dt; datetime_t dt;
auto dates = parseCsv(csv); auto dates = parseCsv(csv);
#ifdef DEBUG #ifdef DEBUG
printf("Number of Dates: %d\n", dates.size()); printf("Number of Dates: %d\n", dates.size());
#endif #endif
while (true) { while (true) {
auto timestamp = time_us_64() + 60000000ull; auto timestamp = time_us_64() + 60000000ull;
@ -80,8 +84,10 @@ int main() {
if (isDST(dt.day, dt.month, dt.dotw)) if (isDST(dt.day, dt.month, dt.dotw))
++hour; // MESZ ++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 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; auto wasteDate = *it;
size_t count{0}; size_t count{0};
auto currentTime = time_us_64(); auto currentTime = time_us_64();