InfiniTime
InfiniTime copied to clipboard
colored battery icon "juice"
Battery status icon "juice" colored depending on the reported battery percentage. This is a first attempt to introduce a few colored elements into the UI, in accordance with some of the reactions to #1265
>=60 GREEN
>40 && <60 ORANGE
<=40 RED

@FintasticMan thanks for the suggestion!
Also fixed the formatting issue preventing the workflows from succeding.
doesn't build in InfiniSim
/home/runner/work/InfiniTime/InfiniTime/src/displayapp/screens/BatteryIcon.cpp: In member function ‘void Pinetime::Applications::Screens::BatteryIcon::SetBatteryPercentage(uint8_t)’:
/home/runner/work/InfiniTime/InfiniTime/src/displayapp/screens/BatteryIcon.cpp:31:87: error: ‘LV_COLOR_LIGHT_GREEN’ was not declared in this scope; did you mean ‘LV_COLOR_GREEN’?
31 | lv_obj_set_style_local_bg_color(batteryJuice, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_LIGHT_GREEN);
| ^~~~~~~~~~~~~~~~~~~~
| LV_COLOR_GREEN
and not as firmware
[ 41%] Building CXX object src/CMakeFiles/pinetime-app.dir/displayapp/screens/BleIcon.cpp.o
/__w/InfiniTime/InfiniTime/src/displayapp/screens/BatteryIcon.cpp: In member function 'void Pinetime::Applications::Screens::BatteryIcon::SetBatteryPercentage(uint8_t)':
/__w/InfiniTime/InfiniTime/src/displayapp/screens/BatteryIcon.cpp:31:87: error: 'LV_COLOR_LIGHT_GREEN' was not declared in this scope; did you mean 'LV_COLOR_GREEN'?
31 | lv_obj_set_style_local_bg_color(batteryJuice, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_LIGHT_GREEN);
| ^~~~~~~~~~~~~~~~~~~~
| LV_COLOR_GREEN
gmake[2]: *** [src/CMakeFiles/pinetime-app.dir/build.make:202: src/CMakeFiles/pinetime-app.dir/displayapp/screens/BatteryIcon.cpp.o] Error 1
Oh, oops. I read the lvgl documentation wrong. It should be either LV_COLOR_LIME or LV_COLOR_GREEN, depending on what looks better. I think lime would probably be best.
@NeroBurner @FintasticMan I have fixed it.
FYI: you can start/stop a GIF screen recording using I (shift+i)
from https://github.com/InfiniTimeOrg/InfiniSim#run-simulator
I... start/stop Gif scren capture
please provide screen captures on how it looks on the other watchfaces. I suspect it will look out of place in the PineTimeStyle watchface
@NeroBurner for some reason the built in GIF recorder wouldn't capture the red color of the icon. Cycling the Vbat in the simulator looks like this:

Also note the wonky HRM symbol. Can someone reproduce that behavior of InfiniSim?
indeed! something is wrong with my gif-writing-code! :see_no_evil:

it doesn't happen (or if it happens it is not as visible) on the develop branch

as this issue isn't related to this PR could you please open an issue over at InfiniSim
as this issue isn't related to this PR could you please open an issue over at InfiniSim
Sure thing, I just wanted to confirm that this isn't caused by my setup.
The battery icon is now colorized when below 15% https://github.com/InfiniTimeOrg/InfiniTime/pull/1503. Colorizing the entire range is not planned.