Skip to content
Open
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
10 changes: 8 additions & 2 deletions examples/companion_radio/ui-new/UITask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,15 @@ class HomeScreen : public UIScreen {
// battery "cap"
display.fillRect(iconX + iconWidth, iconY + (iconHeight / 4), 3, iconHeight / 2);

// fill the battery based on the percentage
// fill the battery based on the percentage as a small bar
int fillWidth = (batteryPercentage * (iconWidth - 4)) / 100;
display.fillRect(iconX + 2, iconY + 2, fillWidth, iconHeight - 4);
display.fillRect(iconX + 2, iconY + 8, fillWidth, iconHeight - 8);

// write the voltage
char voltStr[10];
snprintf(voltStr, sizeof(voltStr), "%.1fV", batteryMilliVolts / 1000.0f);
display.drawTextCentered(iconX + (iconWidth / 2), iconY, voltStr);

}

CayenneLPP sensors_lpp;
Expand Down