Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

111, 112 Backlight handling improve #113

Merged
merged 4 commits into from
Aug 14, 2024
Merged

111, 112 Backlight handling improve #113

merged 4 commits into from
Aug 14, 2024

Conversation

hijae
Copy link
Contributor

@hijae hijae commented Aug 11, 2024

I made the lowest brightness of the backlight change depending on the device, and also modified the brightness slider to have 8 levels.
#111 Backlight timeout brightness is hardcoded and too high and #112 Backlight menu slider needs tweaking.

The name of the board is referenced here.( https://docs.m5stack.com/en/arduino/m5unified/m5unified_appendix )

#111 Backlight timeout brightness is hardcoded and too high
#112 Backlight menu slider needs tweaking
@gkoh
Copy link
Owner

gkoh commented Aug 12, 2024

This mostly looks very good @hijae. For the devices I have tested (M5StickC, M5StickC-Plus, M5StickC-Plus2) the inactivity brightness as chosen works well, quite dim, but still visible.

I have one comment to be fixed.

lib/M5ez/src/M5ez.cpp Outdated Show resolved Hide resolved
@gkoh
Copy link
Owner

gkoh commented Aug 13, 2024

@hijae That's improved, but differently.

Minimum brightness is now zero on the progress bar, this is good.

However, for M5StickC[Plus], the progress bar still does not reach near maximum, there is a sizeable gap.
You can reproduce this on a M5StickC-Plus2 by changing _MinimumBrightness to 48.

Perhaps it will be a lot cleaner if we define const uint8_t _MaxSteps = 8 and use that as a step counter in the loop.
This will allow us to:

  • be clearer about the roll over check (ie. rather than brightness < 255, we have step < _MaxSteps)
  • allow easy change of steps later (eg. change to 4 or 40)
  • perfectly calculate the progress bar percentage
    • float p = (step/(_MaxSteps - 1)) * 100.0f;
  • use p to calculate the brightness
    • _brightness = (uint8_t)(2.55 * p);

@hijae
Copy link
Contributor Author

hijae commented Aug 13, 2024

I took your advice and fixed it. 1faf893

@gkoh
Copy link
Owner

gkoh commented Aug 14, 2024

I took your advice and fixed it. 1faf893

Well done, works as expected on all devices now.
Thank you very much for your patience!

@gkoh gkoh merged commit 88a993a into gkoh:master Aug 14, 2024
6 checks passed
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.

Backlight menu slider needs tweaking Backlight timeout brightness is hardcoded and too high
2 participants