Make some attempts to get data.

This commit is contained in:
Martin Brodbeck 2023-01-02 15:17:33 +01:00
parent 8911dcbe35
commit 10eff684df

View file

@ -10,9 +10,9 @@
#include "pico/stdlib.h" #include "pico/stdlib.h"
#include "pico/util/datetime.h" #include "pico/util/datetime.h"
#include "utils.h"
#include "ntp_client.h"
#include "http_client.h" #include "http_client.h"
#include "ntp_client.h"
#include "utils.h"
#include "ws2812.h" #include "ws2812.h"
using std::string; using std::string;
@ -29,7 +29,14 @@ int main() {
NtpClient::setDateTime(); NtpClient::setDateTime();
HttpClient client; 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()); printf("%s\n", csv.c_str());
char datetime_buf[256]; char datetime_buf[256];