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

Add Battery Status Display to Session View 🔋🪫 #3310

Draft
wants to merge 56 commits into
base: community
Choose a base branch
from

Conversation

m0nkmaster
Copy link

@m0nkmaster m0nkmaster commented Jan 23, 2025

Introduces battery status OLED monitoring and USB power detection.

Key Changes

  • Added displayBatteryStatus to render battery level and charging indicators on the OLED display.
  • Updates battery status when voltage changes significantly.
  • Constants for battery voltage thresholds: BATTERY_MV_MAX and BATTERY_MV_MIN - TBD.
  • Added check_usb_power_status in a new usb_check module to detect USB power state (naive voltage level)
  • Display USB charging icon when connected.
  • Refactored battery logic in inputRoutine to integrate with SessionView.
  • Added battery percentage and millivolt icon in SessionView::renderViewDisplay.
  • Enhanced modularity with better separation of hardware interaction (e.g., USB checks) from UI rendering.

Testing

  • Verify OLED display updates for battery levels and USB connection.
  • Confirm functionality across different battery voltage ranges and USB states

Caveats

  • Voltage can be very 'fluid' despite running through a LPF
  • Direct detection of a charging source does not appear to be possible at this level of the software stack

Follows this discussion:
#2991

…tialBatteryChange method for updates, and improved battery display rendering in session view.
LPF changes
…clarity, improved comments, and ensured consistent formatting in the battery icon rendering logic.

// Update battery display if voltage has changed significantly
// TODO: Do we need this, can it be self-contained in session_view?
sessionView.displayPotentialBatteryChange(newBatteryMV);
Copy link
Collaborator

@seangoodvibes seangoodvibes Jan 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably don't need it here as I see you already have it in session view :: graphics routine

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.

2 participants