Power: remove % sign from desktop and center numbers

This commit is contained in:
TQMatvey 2022-10-17 15:14:31 +07:00
parent f96f2e2411
commit 76aecb597a

View File

@ -12,10 +12,8 @@ void power_draw_battery_callback(Canvas* canvas, void* context) {
canvas_draw_icon(canvas, 0, 0, &I_Battery_26x8);
if(power->info.gauge_is_ok) {
char batteryPercentile[5];
char batteryPercentile[4];
snprintf(batteryPercentile, sizeof(batteryPercentile), "%d", power->info.charge);
strcat(batteryPercentile, "%");
if((power->displayBatteryPercentage == 1) &&
(power->state !=
PowerStateCharging)) { //if display battery percentage, black background white text
@ -23,14 +21,14 @@ void power_draw_battery_callback(Canvas* canvas, void* context) {
canvas_set_color(canvas, ColorBlack);
canvas_draw_box(canvas, 1, 1, 22, 6);
canvas_set_color(canvas, ColorWhite);
canvas_draw_str_aligned(canvas, 12, 4, AlignCenter, AlignCenter, batteryPercentile);
canvas_draw_str_aligned(canvas, 11, 4, AlignCenter, AlignCenter, batteryPercentile);
} else if(
(power->displayBatteryPercentage == 2) &&
(power->state !=
PowerStateCharging)) { //if display inverted percentage, white background black text
canvas_set_font(canvas, FontBatteryPercent);
canvas_set_color(canvas, ColorBlack);
canvas_draw_str_aligned(canvas, 12, 4, AlignCenter, AlignCenter, batteryPercentile);
canvas_draw_str_aligned(canvas, 11, 4, AlignCenter, AlignCenter, batteryPercentile);
} else if(
(power->displayBatteryPercentage == 3) &&
(power->state != PowerStateCharging)) { //Retro style segmented display, 3 parts