Skip to content

fix: BM8563 clock via direct Wire1 I2C, lift preview above hints - #11

Merged
juicecultus merged 1 commit into
masterfrom
fix/clock-bm8563-direct-i2c
May 23, 2026
Merged

juicecultus merged 1 commit into
masterfrom
fix/clock-bm8563-direct-i2c

Conversation

@juicecultus

Copy link
Copy Markdown
Owner

Two 1.3.0 regressions reported by user testing:

1. Clock toggles dead. Built HalClock on M5.Rtc.isEnabled() which requires M5.begin(), but this port never calls it. Rewritten to talk to BM8563 directly over Wire1 at 0x51 — same I2C bus that GT911 touch already uses (SDA=41, SCL=42, port 1). lgfx initialises the ESP-IDF I2C master on port 1 during HalTouch::begin; binding Wire1 to it afterwards in HalClock::begin is idempotent on arduino-esp32 v3 and doesn't disturb touch.

2. Status-bar preview overlaps button hints in Customise Status Bar. verticalPreviewPadding=50 was smaller than Lyra-family themes' buttonHintsHeight=80, so the preview drew inside the hint row. Bumped to 100 to clear with breathing room.

Two regressions found by user testing of 1.3.0:

1. All three Clock settings (toggle, format, UTC offset) were dead
   on tap. Root cause: HalClock built on M5.Rtc.isEnabled(), which
   only returns true after M5.begin() — but this port never calls
   M5.begin() (lgfx handles the display directly, the touch driver
   handles GT911 directly). So _available was permanently false and
   handleSelection's halClock.isAvailable() gate no-op'd everything.

   Rewrite HalClock to talk to BM8563 directly over Wire1 at 0x51:
   - The BM8563 sits on the same physical I2C bus as the GT911 touch
     controller (SDA=GPIO41, SCL=GPIO42, port 1).
   - HalTouch::begin() initialises the ESP-IDF I2C master on port 1
     via lgfx during gpio.begin(); calling Wire1.begin(41, 42, 400000)
     in HalClock::begin() afterwards re-binds Arduino TwoWire to the
     same driver (idempotent in arduino-esp32 v3.x) so we can issue
     BCD register reads without disturbing touch.
   - All time fields are BCD; mask the VL bit on minutes and the two
     reserved bits on hours. RTC stores 24-hour UTC; display offset
     and 12h formatting are applied in formatTime as before.

2. The status-bar preview at the bottom of Customise Status Bar was
   drawing inside the button-hint band. verticalPreviewPadding was 50
   but Lyra-family themes have buttonHintsHeight=80, so the preview
   sat 30px below the top of the hint row, colliding with the
   « Back / Toggle / Up / Down labels.

   Bump verticalPreviewPadding to 100 so the preview clears the
   tallest hint band with breathing room. Cheap fix; a follow-up
   could compute it from the active theme's metrics, but the
   constant works because both classic and Lyra share this Activity.
@juicecultus
juicecultus merged commit 2ba780e into master May 23, 2026
6 checks passed
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