langerhans / OdinTools

Collection of utilities for the AYN Odin 2
MIT License
108 stars 8 forks source link

Add SettingsRepo, refactoring & setting for battery limit #28

Closed miguelguzmanr closed 1 month ago

miguelguzmanr commented 4 months ago

Things to note:

miguelguzmanr commented 2 months ago

I suggest we put these changes on hold while we review other pull requests @langerhans

miguelguzmanr commented 2 months ago

Introduces configurable charging separation. Requires thorough testing, as this may introduce additional battery drain due to having to monitor the battery level.

image

miguelguzmanr commented 2 months ago

This approach only works if the app is running in the background. I think this might need to be implemented as a foreground service or a background task.

langerhans commented 2 months ago

Even with the fix from #23 this does not work in background? Could we just watch battery state with Intent.ACTION_BATTERY_CHANGED?

miguelguzmanr commented 2 months ago

Introduces a service to monitor the battery level. Just trying out a different approach. Sadly, the service forcefully ends when the app is terminated in any way.

Requires #23 to work in the background.

image

Fixed incorrectly reading restrictCharge setting as a system setting instead of as a text file. Discovered that charging separation briefly turns off when the screen is turned off. Not sure about the culprit. Added a trigger for screen off event to combat this behavior. Should work properly now.

Added an option to dump a log file for debug builds. Might be useful for troubleshooting issues.

image

miguelguzmanr commented 2 months ago

@langerhans please let me know your thoughts!

miguelguzmanr commented 1 month ago

@langerhans please let me know if this approach works better!

langerhans commented 1 month ago

Yup looks good to me, LGTM