Skip to content

Commit

Permalink
Enable non-percent graph for Uptime meter
Browse files Browse the repository at this point in the history
Also change one behavior, that in Bar or Graph mode, Uptime meter will
now draw fractions of days. (Not a useful tweak though. :) )

Signed-off-by: Kang-Che Sung <[email protected]>
  • Loading branch information
Explorer09 committed Aug 3, 2021
1 parent 3638990 commit ff77948
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions UptimeMeter.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,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;
}
this->values[0] = (double)totalseconds / 86400.0;
char daysbuf[32];
if (days > 100) {
xSnprintf(daysbuf, sizeof(daysbuf), "%d days(!), ", days);
Expand All @@ -52,7 +49,7 @@ const MeterClass UptimeMeter_class = {
.updateValues = UptimeMeter_updateValues,
.defaultMode = TEXT_METERMODE,
.maxItems = 1,
.total = 100.0,
.total = -1.0,
.attributes = UptimeMeter_attributes,
.name = "Uptime",
.uiName = "Uptime",
Expand Down

0 comments on commit ff77948

Please sign in to comment.