Nightstand Clock: fix unreachable nightlight, 12h midnight, and notification-record lifetime (closes #243) - #244
Merged
Merged
Conversation
… use-after-close (closes #243) - Round the inherited system brightness and clamp it to 0-100 so the -5/+5 stepping always lands exactly on 0 (the LED nightlight) and 100. Several system brightness levels (e.g. 70%, 90%) truncated off the multiple-of-5 grid, so Down skipped 0 and the nightlight could never be switched on, and brightness could leave the valid range. - Show midnight as 12:xx AM instead of 00:xx AM in 12-hour locales. - Close RECORD_NOTIFICATION after the exit-time settings restore instead of before it, so notif is no longer dereferenced after its record is closed. Bump fap_version 1.0 -> 1.1 and add CHANGELOG.md. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…oc fails The timer == NULL startup path returned 255 after freeing only the mutex, event queue and plugin_state, leaking the already-opened RECORD_NOTIFICATION handle and the allocated view_port, and leaving the backlight forced on with display_off_delay_ms = 0. Restore the notification settings and release both resources on that path, mirroring the normal teardown. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Repository owner
locked as resolved and limited conversation to collaborators
Jul 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #243.
Three user-facing bugs in the Nightstand Clock app (
non_catalog_apps/FlipperNightStand_clock), plus a startup resource leak found during review.1. LED nightlight unreachable at some brightness levels
The internal brightness counter was seeded with a truncating
SavedBrightness * 100, andhandle_up/handle_downstepped by +/-5 with no clamp. The system LCD brightness uses 0.05 steps, six of which truncate off the multiple-of-5 grid (35/45/65/70/90/95% -> 34/44/64/69/89/94), so Down walked...,9,4,-1and never hit 0 - the nightlight (brightness == 0) could never be switched on, and brightness left the 0-100 range.Fix:
roundfon init + clamp to[0,100]in both handlers. This also removes a latent progress-bar assert-crash in debug builds.2. 12-hour clock shows midnight as
00Hour 0 printed as
00:xx AMinstead of12:xx AM. Fixed withhour12 = hour % 12; if(hour12 == 0) hour12 = 12;(noon/PM unchanged).3.
notifused afterfuri_record_closeOn exit the settings-restore ran after the notification record had already been closed. Moved the close to after the restore block.
4. Startup timer-alloc failure leaked the notification record + view_port
The
timer == NULLearly-return freed only the mutex/queue/state, leaking the openRECORD_NOTIFICATIONhandle and the allocatedview_portand leaving the backlight forced on. It now restores the notification settings and releases both, mirroring the normal teardown.fap_version1.0 -> 1.1, addedCHANGELOG.md. This app is third-party (@nymda & @Willy-JL); the fixes may want mirroring upstream.Reviewed with the pr-review-toolkit code-reviewer and code-simplifier agents and clang-formatted with the project style.
🤖 Generated with Claude Code