ducalex / retro-go

Retro emulation for the ODROID-GO and other ESP32 devices
GNU General Public License v2.0
574 stars 130 forks source link

Add support for battery on ADC2 #131

Closed tomvanbraeckel closed 4 months ago

tomvanbraeckel commented 4 months ago

The Fri3D Camp 2024 badge has the battery on ADC2.

Similarly to the joystick support for ADC2, this change too adds a new configuration setting, RG_BATTERY_ADC_UNIT, which allows for specifying which ADC to use for the battery ADC.

tomvanbraeckel commented 4 months ago

Done and done!

I tested this with my joystick on ADC2 on the Fri3D Camp 2022 Badge :-) It works, in that moving the joystick left "drains" the battery. I'm picking up the actual Fri3D Camp 2024 Badges today, woohoow!

Two questions:

1) I was wondering why the battery level isn't drawn in the top level of the launcher, when those full-screen images are displayed. Seems nice to have it there as well, either permanently (like in the lower level of the launcher, after you've selected a tab) or at least while in the menu, as it is for retro-core...?

2) I was wondering whether 1% battery level isn't too low for starting to blink the LED as a warning:

            if (battery.level < 2)
                rg_system_set_led((batteryLedState ^= 1));
            else if (batteryLedState)
                rg_system_set_led((batteryLedState = 0));

To me it seems a bit too tight. By the time the user notices, and finishes their game, it's empty... I would want a warning at 5 percent or less. Or even 10%, because draining the battery completely empty isn't good its for the longevity either... or am I misunderstanding something?

Thank you!

ducalex commented 4 months ago

To me it seems a bit too tight. By the time the user notices, and finishes their game, it's empty... I would want a warning at 5 percent or less. Or even 10%, because draining the battery completely empty isn't good its for the longevity either... or am I misunderstanding something?

This is more of an indicator of "save your game now because the device is about to cut off". I agree it would be nice to notify the user when we hit certain low battery milestones, but not by blinking light because at 10 or even 5% there's potentially several hours of gameplay left and it would be highly distracting. I'm okay if you want to make it an even <= 2% though.

When I finally fix the OSD system we could have an unobtrusive on-screen notification when the battery gets to 5-10%, like on laptops.

I was wondering why the battery level isn't drawn in the top level of the launcher, when those full-screen images are displayed.

Aesthetics reasons. Same reason why the tab indicator is disabled. I could never make either look good. I'm open to revisiting all of this!

or at least while in the menu, as it is for retro-core...?

Also aesthetics and glitching reasons but I believe I have unified a lot between the top status bar and the launcher by now, so I'll have a look if this can be re-enabled.

tomvanbraeckel commented 4 months ago

This is more of an indicator of "save your game now because the device is about to cut off". I agree it would be nice to notify the user when we hit certain low battery milestones, but not by blinking light because at 10 or even 5% there's potentially several hours of gameplay left and it would be highly distracting. I'm okay if you want to make it an even <= 2% though.

Alright, I didn't notice it's so frugal with battery!

Deal on the <= 2%, pushed it!