Skip to content

FancyClock: add optional Glass2 Grove OLED support#50

Open
Swissola wants to merge 3 commits into
echo-lalia:mainfrom
Swissola:feat/fancyclock-glass2
Open

FancyClock: add optional Glass2 Grove OLED support#50
Swissola wants to merge 3 commits into
echo-lalia:mainfrom
Swissola:feat/fancyclock-glass2

Conversation

@Swissola

Copy link
Copy Markdown

Summary

  • Adds complementary display output to an M5Stack Glass2 Unit (SSD1309 OLED) connected via Grove port (GPIO1=SCL, GPIO2=SDA) on Cardputer ADV
  • Glass2 is fully optional — detected at startup via I2C scan; app is identical without it
  • Shows info the main bouncing display doesn't have room for:
    • View 0 (datetime): 24hr time with seconds, day name, full date
    • View 1 (battery): percentage + estimated voltage (~3.15–4.2V range)
  • Any keypress while the backlight is already on cycles between views
  • First press from idle wakes the backlight only, without cycling — so you see what's currently shown before changing it

Behaviour

Backlight off → any key → backlight on, Glass2 stays on current view
Backlight on  → any key → Glass2 cycles to next view + backlight reset

Hardware

  • M5Stack Glass2 Unit (U070) — Grove HY2.0-4P to Cardputer ADV Grove port
  • No additional libraries required — ssd1306 is available in MicroPython firmware

🤖 Generated with Claude Code

Swissola and others added 3 commits May 24, 2026 15:31
If an SSD1309 OLED is connected via Grove (GPIO1/GPIO2), it shows
complementary info to the main bouncing clock display:

  View 0 (datetime): 24hr HH:MM:SS, day name, full date
  View 1 (battery):  percentage, estimated voltage (~3.15–4.2V)

Any keypress while the backlight is already on cycles between views.
First press from idle wakes the backlight without cycling (expected
behaviour — user confirms what they see before changing it).

Glass2 is fully optional; app behaves identically without it.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Calling _g2_show once per loop iteration rather than only on the
100-frame tick — otherwise displayed seconds would be frozen for ~6s
at a time. Battery view still only recalculates pct on the slow tick.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Update OLED once per second (on second change) rather than every
  60ms frame — reduces I2C traffic ~60x and OLED power draw
- Power off OLED when backlight dims to idle (burn-in prevention)
- Power on and force immediate redraw when any key wakes the display

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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