working with DEBUG

This commit is contained in:
Martin Brodbeck 2023-01-03 08:57:39 +01:00
parent 25c11e465e
commit 258a0c051f
7 changed files with 61 additions and 33 deletions

View file

@ -51,25 +51,30 @@ std::vector<WasteDate> parseCsv(const std::string &csv) {
switch (tokenPos) {
case 0:
printf("Gelber Sack: %s\n", token.c_str());
// printf("Gelber Sack: %s\n", token.c_str());
wd.wasteTypes.push_back(Waste::GelberSack);
break;
case 1:
printf("Papiertonne: %s\n", token.c_str());
// printf("Papiertonne: %s\n", token.c_str());
wd.wasteTypes.push_back(Waste::Papiertonne);
break;
case 2:
printf("Biotonne: %s\n", token.c_str());
// printf("Biotonne: %s\n", token.c_str());
wd.wasteTypes.push_back(Waste::Biotonne);
break;
case 3:
printf("Restmüll: %s\n", token.c_str());
// printf("Restmüll: %s\n", token.c_str());
wd.wasteTypes.push_back(Waste::Restmuell);
break;
case 4:
printf("Problemstoffmobil: %s\n", token.c_str());
// printf("Problemstoffmobil: %s\n", token.c_str());
wd.wasteTypes.push_back(Waste::Problemstoffmobil);
break;
default:
#ifdef DEBUG
printf("Unknown waste token detected.\n");
#endif
break;
}
}
@ -78,11 +83,11 @@ std::vector<WasteDate> parseCsv(const std::string &csv) {
}
}
//for(const auto& ymd: dates) {
// std::cout << "Current Year: " << static_cast<int>(ymd.date.year())
// << ", Month: " << static_cast<unsigned>(ymd.date.month())
// << ", Day: " << static_cast<unsigned>(ymd.date.day()) << '\n';
//}
// for(const auto& ymd: dates) {
// std::cout << "Current Year: " << static_cast<int>(ymd.date.year())
// << ", Month: " << static_cast<unsigned>(ymd.date.month())
// << ", Day: " << static_cast<unsigned>(ymd.date.day()) << '\n';
// }
return dates;
}
@ -126,8 +131,9 @@ int wifi_setup_impl(uint32_t country, const string &ssid, const string &pw, bool
cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 0);
} else {
cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 1);
#ifdef DEBUG
printf("IP: %s\n", ip4addr_ntoa(netif_ip_addr4(netif_default)));
#endif
}
return status;
@ -145,7 +151,9 @@ void wifi_setup() {
res = wifi_setup_impl(country, ssid, pw, true);
firstTry = false;
} else {
#ifdef DEBUG
printf("Setting up connection failed. Trying again after 5 sec...\n");
#endif
sleep_ms(5000);
res = wifi_setup_impl(country, ssid, pw, false);
}