MCPcopy Create free account
hub / github.com/BruceDevices/firmware / drawBatteryStatus

Function drawBatteryStatus

src/core/display.cpp:957–979  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

955}
956
957void drawBatteryStatus(uint8_t bat) {
958 if (bat == 0) return;
959
960 bool charging = isCharging();
961
962 uint16_t color = bruceConfig.priColor;
963 uint16_t barcolor = bruceConfig.priColor;
964 if (bat < 16) barcolor = color = TFT_RED;
965
966 tft.drawRoundRect(tftWidth - 42, 7, 34, 17, 2, color);
967 tft.setTextSize(FP);
968 tft.fillRect(tftWidth - 85, 7, 42, 18, bruceConfig.bgColor);
969 if (charging) {
970 tft.setTextColor(bruceConfig.priColor, bruceConfig.bgColor);
971 tft.drawRightString("CHG", tftWidth - 44, 12, 1);
972 } else {
973 tft.setTextColor(bruceConfig.priColor, bruceConfig.bgColor);
974 tft.drawRightString((bat == 100 ? "" : " ") + String(bat) + "%", tftWidth - 44, 12, 1);
975 }
976 tft.fillRoundRect(tftWidth - 40, 9, 30 * bat / 100, 13, 2, barcolor);
977 tft.drawLine(tftWidth - 30, 9, tftWidth - 30, 9 + 13, bruceConfig.bgColor);
978 tft.drawLine(tftWidth - 20, 9, tftWidth - 20, 9 + 13, bruceConfig.bgColor);
979}
980
981void drawWireguardStatus(int x, int y) {
982 tft.fillRect(x, y, 16, 16, bruceConfig.bgColor);

Callers 1

drawStatusBarFunction · 0.85

Calls 8

isChargingFunction · 0.70
drawRoundRectMethod · 0.45
setTextSizeMethod · 0.45
fillRectMethod · 0.45
setTextColorMethod · 0.45
drawRightStringMethod · 0.45
fillRoundRectMethod · 0.45
drawLineMethod · 0.45

Tested by

no test coverage detected