Fix clock colon blink regularity and AM/PM redraw heap churn #335
No reviewers
Labels
No labels
bug
conflicts
documentation
DO NOT MERGE
duplicate
enhancement
good first issue
hardware
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
greg/info-orbs!335
Loading…
Reference in a new issue
No description provided.
Delete branch "Bullpuph123/fix/clock-colon-ampm"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Split from #330 (part 2 of 3), rebased onto dev as requested.
Summary
displayAmPm()was called every second, and each call reloads TTF fonts (DSEG7↔DSEG14) plus per-loop String allocations — over days of uptime this fragments the heap and eventually corrupts glyph rendering (stray "PM" artifacts observed after long uptime). It's now redrawn only when the value changes or on force, with the old value cleared first.displayDigit()validates the display index;displaySeconds()only draws on the status orb and validates the seconds range — defense against a corrupted index painting tick marks on the wrong panel.CLOCK_UPDATE_DELAY/CLOCK_DRAW_DELAYdefaults changed fromOneSecondtoOneHundredMillisecondsso the 500ms colon blinker actually gets a chance to run; all per-second work is still internally gated on second changes, so this doesn't add redraw load.Test plan
pio run -e infoorbs-v0_3🤖 Generated with Claude Code
Pull request overview
This PR improves long-uptime stability and visual consistency of the firmware
ClockWidget, focusing on a drift-free colon blink for the NORMAL clock type and reducing heap churn by avoiding per-second AM/PM redraws.Changes:
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
@ -97,0 +131,4 @@}}if (m_secondSingle != m_lastSecondSingle || force) {In the NORMAL-clock colon blink logic, a forced redraw (
force == true) can still run the catch-up path (elapsed >= m_colonBlinkInterval) and togglem_colonVisiblebased on time elapsed sincesetup(). This can make the colon immediately start in the “off” state right after a screen clear / widget switch, which is unintuitive for a forced redraw.I would like to see the constant renamed then I will approve this
@ -89,8 +89,13 @@ public:String getName() override;I don't love the variable name SCREEN_STATUS because "status" is not really what is being displayed
@ -89,8 +89,13 @@ public:String getName() override;Good point — renamed to SCREEN_MIDDLE in
2b44a84, matching the existing BUTTON_MIDDLE naming convention.@ -97,0 +131,4 @@}}if (m_secondSingle != m_lastSecondSingle || force) {Fixed in
2b44a84: forced redraws now restart the blink phase with the colon visible (m_colonVisible = true, m_colonBlinkPrev = now) instead of running the catch-up path, so the colon can no longer reappear in the "off" state after a screen clear or widget switch.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.