Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Positive/negative" graph meter style #1415

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions BatteryMeter.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const MeterClass BatteryMeter_class = {
.defaultMode = TEXT_METERMODE,
.supportedModes = METERMODE_DEFAULT_SUPPORTED,
.maxItems = 1,
.isPercentChart = true,
.total = 100.0,
.attributes = BatteryMeter_attributes,
.name = "Battery",
Expand Down
1 change: 1 addition & 0 deletions CPUMeter.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ const MeterClass CPUMeter_class = {
.defaultMode = BAR_METERMODE,
.supportedModes = METERMODE_DEFAULT_SUPPORTED,
.maxItems = CPU_METER_ITEMCOUNT,
.isPercentChart = true,
.total = 100.0,
.attributes = CPUMeter_attributes,
.name = "CPU",
Expand Down
1 change: 1 addition & 0 deletions DiskIOMeter.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ const MeterClass DiskIOMeter_class = {
.defaultMode = TEXT_METERMODE,
.supportedModes = METERMODE_DEFAULT_SUPPORTED,
.maxItems = 1,
.isPercentChart = true,
.total = 100.0,
.attributes = DiskIOMeter_attributes,
.name = "DiskIO",
Expand Down
1 change: 1 addition & 0 deletions FileDescriptorMeter.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ const MeterClass FileDescriptorMeter_class = {
.defaultMode = TEXT_METERMODE,
.supportedModes = METERMODE_DEFAULT_SUPPORTED,
.maxItems = 2,
.isPercentChart = false,
.total = 65536.0,
.attributes = FileDescriptorMeter_attributes,
.name = "FileDescriptors",
Expand Down
18 changes: 10 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 @@ -111,7 +111,8 @@ const MeterClass LoadAverageMeter_class = {
.defaultMode = TEXT_METERMODE,
.supportedModes = METERMODE_DEFAULT_SUPPORTED,
.maxItems = 3,
.total = 100.0,
.isPercentChart = false,
.total = 1.0,
.attributes = LoadAverageMeter_attributes,
.name = "LoadAverage",
.uiName = "Load average",
Expand All @@ -129,7 +130,8 @@ const MeterClass LoadMeter_class = {
.defaultMode = TEXT_METERMODE,
.supportedModes = METERMODE_DEFAULT_SUPPORTED,
.maxItems = 1,
.total = 100.0,
.isPercentChart = false,
.total = 1.0,
.attributes = LoadMeter_attributes,
.name = "Load",
.uiName = "Load",
Expand Down
1 change: 1 addition & 0 deletions MemoryMeter.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ const MeterClass MemoryMeter_class = {
.defaultMode = BAR_METERMODE,
.supportedModes = METERMODE_DEFAULT_SUPPORTED,
.maxItems = MEMORY_METER_ITEMCOUNT,
.isPercentChart = true,
.total = 100.0,
.attributes = MemoryMeter_attributes,
.name = "Memory",
Expand Down
Loading
Loading