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);
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();