From 10eff684dfa112fbc0a26bee446a5f456f585c4e Mon Sep 17 00:00:00 2001 From: Martin Brodbeck Date: Mon, 2 Jan 2023 15:17:33 +0100 Subject: [PATCH] Make some attempts to get data. --- src/abfall.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/abfall.cpp b/src/abfall.cpp index 2b3d818..a3c189b 100644 --- a/src/abfall.cpp +++ b/src/abfall.cpp @@ -10,9 +10,9 @@ #include "pico/stdlib.h" #include "pico/util/datetime.h" -#include "utils.h" -#include "ntp_client.h" #include "http_client.h" +#include "ntp_client.h" +#include "utils.h" #include "ws2812.h" using std::string; @@ -25,11 +25,18 @@ int main() { WS2812 led(WS2812_PIN); - wifi_setup(); + wifi_setup(); NtpClient::setDateTime(); HttpClient client; - std::string csv = client.retrieveWasteDatesAsCsv(); + std::string csv(""); + for (int i = 1; i <= 10; i++) { + printf("Attempt %d for retrieving data.\n", i); + csv = client.retrieveWasteDatesAsCsv(); + if (csv.length() > 0) { + break; + } + } printf("%s\n", csv.c_str()); char datetime_buf[256];