code cleanup

This commit is contained in:
Martin Brodbeck 2023-01-03 13:21:28 +01:00
parent b0f8855f22
commit 16bc6d50cc

View file

@ -58,8 +58,6 @@ int main() {
return 1; return 1;
} }
char datetime_buf[256];
char *datetime_str = &datetime_buf[0];
datetime_t dt; datetime_t dt;
auto dates = parseCsv(csv); auto dates = parseCsv(csv);
@ -71,9 +69,6 @@ int main() {
rtc_get_datetime(&dt); rtc_get_datetime(&dt);
// datetime_to_str(datetime_str, sizeof(datetime_buf), &dt);
// printf("DateTime: %s\n", datetime_str);
chrono::year_month_day tomorrowYMD(chrono::year{dt.year}, chrono::year_month_day tomorrowYMD(chrono::year{dt.year},
chrono::month{static_cast<unsigned>(dt.month)}, chrono::month{static_cast<unsigned>(dt.month)},
chrono::day{static_cast<unsigned>(dt.day + 1)}); chrono::day{static_cast<unsigned>(dt.day + 1)});
@ -81,8 +76,7 @@ int main() {
return date.date == tomorrowYMD; return date.date == tomorrowYMD;
}); });
if (it != dates.end()) { if (it != dates.end() && dt.hour >= 18) {
printf("\n+++ FOUND +++\n");
auto wasteDate = *it; auto wasteDate = *it;
size_t count{0}; size_t count{0};
auto currentTime = time_us_64(); auto currentTime = time_us_64();
@ -108,13 +102,10 @@ int main() {
} }
auto timeLeft = timestamp - currentTime; auto timeLeft = timestamp - currentTime;
// std::cout << "Info: " << timeLeft << std::endl;
if (timeLeft > 3000000) { if (timeLeft > 3000000) {
sleep_us(3000000); sleep_us(3000000);
} else { } else {
// std::cout << "Switching LED off." << std::endl;
// led.switchColor(Color::OFF);
sleep_us(timeLeft); sleep_us(timeLeft);
} }