Skip to content

Commit

Permalink
Adjust LoadAverageMeter "total" assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
Explorer09 committed May 2, 2024
1 parent bdb7e0d commit 9a94056
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions LoadAverageMeter.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ static void LoadAverageMeter_updateValues(Meter* this) {
this->curItems = 1;

// change bar color and total based on value
if (this->total < this->host->activeCPUs) {
this->total = this->host->activeCPUs;
}
if (this->values[0] < 1.0) {
this->curAttributes = OK_attributes;
this->total = 1.0;
} else if (this->values[0] < this->host->activeCPUs) {
this->curAttributes = Medium_attributes;
this->total = this->host->activeCPUs;
} else {
this->curAttributes = High_attributes;
this->total = 2 * this->host->activeCPUs;
}

xSnprintf(this->txtBuffer, sizeof(this->txtBuffer), "%.2f/%.2f/%.2f", this->values[0], this->values[1], this->values[2]);
Expand All @@ -78,15 +78,15 @@ static void LoadMeter_updateValues(Meter* this) {
Platform_getLoadAverage(&this->values[0], &five, &fifteen);

// change bar color and total based on value
if (this->total < this->host->activeCPUs) {
this->total = this->host->activeCPUs;
}
if (this->values[0] < 1.0) {
this->curAttributes = OK_attributes;
this->total = 1.0;
} else if (this->values[0] < this->host->activeCPUs) {
this->curAttributes = Medium_attributes;
this->total = this->host->activeCPUs;
} else {
this->curAttributes = High_attributes;
this->total = 2 * this->host->activeCPUs;
}

xSnprintf(this->txtBuffer, sizeof(this->txtBuffer), "%.2f", this->values[0]);
Expand All @@ -112,7 +112,7 @@ const MeterClass LoadAverageMeter_class = {
.supportedModes = METERMODE_DEFAULT_SUPPORTED,
.maxItems = 3,
.isPercentChart = false,
.total = 100.0,
.total = 1.0,
.attributes = LoadAverageMeter_attributes,
.name = "LoadAverage",
.uiName = "Load average",
Expand All @@ -131,7 +131,7 @@ const MeterClass LoadMeter_class = {
.supportedModes = METERMODE_DEFAULT_SUPPORTED,
.maxItems = 1,
.isPercentChart = false,
.total = 100.0,
.total = 1.0,
.attributes = LoadMeter_attributes,
.name = "Load",
.uiName = "Load",
Expand Down

0 comments on commit 9a94056

Please sign in to comment.