Skip to content

arm11: Add battery and system time display on the bottom screen - #269

Open
RhanCandia wants to merge 4 commits into
profi200:masterfrom
RhanCandia:feature/bottom-screen-stats
Open

RhanCandia wants to merge 4 commits into
profi200:masterfrom
RhanCandia:feature/bottom-screen-stats

Conversation

@RhanCandia

Copy link
Copy Markdown

arm11: Add battery and system time display on the bottom screen

Summary

This PR adds the ability to display the current system time and battery percentage on the bottom screen during GBA gameplay.

Features

  • Independent Toggle: Use the hotkey Y + TOUCH to toggle the bottom screen backlight and statistics display on or off at any time.
  • Power Efficient:
    • The bottom screen is off by default to preserve battery life and maintain the original project behavior.
    • Statistics are refreshed approximately every 10 seconds (600 frames) to minimize I2C traffic to the MCU.
    • Processing (I2C reads and console printing) is entirely suspended when the bottom screen is toggled off.
  • Clean UI:
    • Uses in-place console updates (\r, \x1b[A) to ensure the stats stay pinned to the same lines without scrolling.
    • Includes a concise on-screen hint (Y + Touch: Toggle bottom screen) the first time the display is activated to ensure the feature is discoverable.
  • Documented: Added the new hotkey to the Controls section of the README.md.

Rationale

While open_agb_firm provides an excellent native GBA experience, users currently have no way to check the time or battery level without rebooting the console. This implementation provides that essential information while strictly prioritizing power efficiency and maintaining a clean, unobtrusive interface.

How to Test

  1. Launch open_agb_firm and select any GBA ROM.
  2. The bottom screen will remain off by default.
  3. Hold Y and touch the bottom screen to reveal the stats and the toggle hint.
  4. Verify the stats refresh every 10 seconds.
  5. Toggle the display off again with Y + TOUCH.

Previously, the bottom screen would go black and turn off the backlight
after launching a game. This change keeps the bottom screen active and
displays real-time statistics (current system time and battery level).

To prevent performance impact and excessive I2C traffic to the MCU,
stats are refreshed approximately every 10 seconds (600 frames).
The display uses in-place console updates to maintain a clean output
without scrolling.
This enhancement allows users to independently toggle the bottom screen
on and off by holding the Y button and touching the screen.

When the backlight is toggled off, the stats update processing (I2C
reads and console printing) is also suspended to maximize power
savings.
…creen

This update adds a toggleable statistics display to the bottom screen
during GBA gameplay. Key features include:

- Bottom screen remains OFF by default to conserve power.
- New hotkey 'Y + TOUCH' to toggle the bottom screen backlight and stats.
- Displays current system time and battery percentage.
- Efficient 10-second refresh rate (600 frames) to minimize MCU traffic.
- Processing is fully suspended when the display is toggled off.
- In-place console updates to prevent screen scrolling.
- Documentation updated in README.md.
@RhanCandia

Copy link
Copy Markdown
Author

Improved Toggle Responsiveness

The bottom screen statistics (battery and system time) now refresh immediately upon being toggled on with Y + TOUCH.

Previously, the display would show the last cached values for up to 10 seconds before updating. By aligning the frame counter to the next update interval during the toggle event, we now force an instant refresh without increasing the background CPU overhead or adding complexity to the 10-second update cycle.

Changes:

  • Globalized the Frame Counter: Moved the frameCount to a file-level static variable (g_statsFrameCount) to allow external manipulation.
  • Forced Update Logic: Updated the Y + TOUCH toggle handler to align the counter with the next update interval when the screen is turned on.
  • Zero-Latency Display: The statistics now update within the same frame as the backlight activation, providing an instant and accurate system status.

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.

1 participant