diff --git a/ClockMeter.c b/ClockMeter.c index 38f0591fa..9c70b24f6 100644 --- a/ClockMeter.c +++ b/ClockMeter.c @@ -26,7 +26,6 @@ static void ClockMeter_updateValues(Meter* this) { struct tm result; const struct tm* lt = localtime_r(&host->realtime.tv_sec, &result); - this->values[0] = lt->tm_hour * 60 + lt->tm_min; strftime(this->txtBuffer, sizeof(this->txtBuffer), "%H:%M:%S", lt); } @@ -37,8 +36,9 @@ const MeterClass ClockMeter_class = { }, .updateValues = ClockMeter_updateValues, .defaultMode = TEXT_METERMODE, - .maxItems = 1, - .total = 1440, /* 24*60 */ + .supportedModes = (1 << TEXT_METERMODE) | (1 << LED_METERMODE), + .maxItems = 0, + .total = 0.0, .attributes = ClockMeter_attributes, .name = "Clock", .uiName = "Clock", diff --git a/DateMeter.c b/DateMeter.c index 0bdb30a87..02aaabfb1 100644 --- a/DateMeter.c +++ b/DateMeter.c @@ -26,13 +26,6 @@ static void DateMeter_updateValues(Meter* this) { struct tm result; const struct tm* lt = localtime_r(&host->realtime.tv_sec, &result); - this->values[0] = lt->tm_yday; - int year = lt->tm_year + 1900; - if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) { - this->total = 366; - } else { - this->total = 365; - } strftime(this->txtBuffer, sizeof(this->txtBuffer), "%F", lt); } @@ -43,8 +36,9 @@ const MeterClass DateMeter_class = { }, .updateValues = DateMeter_updateValues, .defaultMode = TEXT_METERMODE, - .maxItems = 1, - .total = 365, + .supportedModes = (1 << TEXT_METERMODE) | (1 << LED_METERMODE), + .maxItems = 0, + .total = 0.0, .attributes = DateMeter_attributes, .name = "Date", .uiName = "Date", diff --git a/DateTimeMeter.c b/DateTimeMeter.c index dcd85ea6c..c4ec0def8 100644 --- a/DateTimeMeter.c +++ b/DateTimeMeter.c @@ -26,13 +26,6 @@ static void DateTimeMeter_updateValues(Meter* this) { struct tm result; const struct tm* lt = localtime_r(&host->realtime.tv_sec, &result); - int year = lt->tm_year + 1900; - if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) { - this->total = 366; - } else { - this->total = 365; - } - this->values[0] = lt->tm_yday; strftime(this->txtBuffer, sizeof(this->txtBuffer), "%F %H:%M:%S", lt); } @@ -43,8 +36,9 @@ const MeterClass DateTimeMeter_class = { }, .updateValues = DateTimeMeter_updateValues, .defaultMode = TEXT_METERMODE, - .maxItems = 1, - .total = 365, + .supportedModes = (1 << TEXT_METERMODE) | (1 << LED_METERMODE), + .maxItems = 0, + .total = 0.0, .attributes = DateTimeMeter_attributes, .name = "DateTime", .uiName = "Date and Time", diff --git a/UptimeMeter.c b/UptimeMeter.c index 622deda3e..1f4f1bbb3 100644 --- a/UptimeMeter.c +++ b/UptimeMeter.c @@ -29,10 +29,7 @@ static void UptimeMeter_updateValues(Meter* this) { int minutes = (totalseconds / 60) % 60; int hours = (totalseconds / 3600) % 24; int days = (totalseconds / 86400); - this->values[0] = days; - if (days > this->total) { - this->total = days; - } + char daysbuf[32]; if (days > 100) { xSnprintf(daysbuf, sizeof(daysbuf), "%d days(!), ", days); @@ -53,8 +50,9 @@ const MeterClass UptimeMeter_class = { }, .updateValues = UptimeMeter_updateValues, .defaultMode = TEXT_METERMODE, - .maxItems = 1, - .total = 100.0, + .supportedModes = (1 << TEXT_METERMODE) | (1 << LED_METERMODE), + .maxItems = 0, + .total = 0.0, .attributes = UptimeMeter_attributes, .name = "Uptime", .uiName = "Uptime",