Skip to content

colored battery icon "juice"#1276

Closed
ghost wants to merge 4 commits intomainfrom
unknown repository
Closed

colored battery icon "juice"#1276
ghost wants to merge 4 commits intomainfrom
unknown repository

Conversation

@ghost
Copy link

@ghost ghost commented Aug 11, 2022

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

6pnwi3

Co-authored-by: FintasticMan <52415484+FintasticMan@users.noreply.github.com>
@ghost
Copy link
Author

ghost commented Aug 14, 2022

@FintasticMan thanks for the suggestion!

Also fixed the formatting issue preventing the workflows from succeding.

@NeroBurner
Copy link
Contributor

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

@FintasticMan
Copy link
Member

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.

@ghost
Copy link
Author

ghost commented Aug 15, 2022

@NeroBurner @FintasticMan I have fixed it.

@NeroBurner
Copy link
Contributor

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

@ghost
Copy link
Author

ghost commented Aug 15, 2022

@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:
InfiniSim_2022-08-15_150534

Also note the wonky HRM symbol. Can someone reproduce that behavior of InfiniSim?

@NeroBurner
Copy link
Contributor

indeed! something is wrong with my gif-writing-code! 🙈

colored bat breaking gif

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

develop gif ok

@NeroBurner
Copy link
Contributor

as this issue isn't related to this PR could you please open an issue over at InfiniSim

@ghost
Copy link
Author

ghost commented Aug 15, 2022

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.

@Riksu9000
Copy link
Contributor

The battery icon is now colorized when below 15% #1503. Colorizing the entire range is not planned.

@Riksu9000 Riksu9000 closed this Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants