You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Simulator sound & display dimming, window manager dialogs, UI improvements and more - #775
No actionable comments were generated in the recent review.
Walkthrough
This change adds shared window-manager dialogs and migrates applications to callback-based dialog results. It adds SDL audio and backlight support, brightness persistence and controls, and new System Info views. It adds offline App Hub configuration and ESP reboot support. Other changes update tile layout, development-server socket handling, focused-field theme padding, and ESP SD-card transaction code.
Path filters excluded changed files. This rating applies only to the assessed changes.
This PR adds shared dialogs, simulator audio and brightness controls, and System Info changes. Several dialog-result paths in the Files and MeshChat apps can still apply an earlier result to a later action, and a few smaller correctness and persistence gaps remain. These should be reviewed and resolved or explicitly accepted before merge.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title names several themes: simulator sound and display dimming, window manager dialogs, and UI improvements. The changeset supports this. It adds SDL audio and backlight drivers, display dimming,…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names several themes: simulator sound and display dimming, window manager dialogs, and UI improvements. The changeset supports this. It adds SDL audio and backlight drivers, display dimming, a window-manager dialog API, and many UI changes. The title is broad and lists multiple areas instead of one main change, so it is partially related. It does not describe anything absent from the changeset.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Files skipped from review as they are similar to previous changes: 1
Documentation/ideas.md
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 8
Note
Due to the large number of review comments, Critical, Major severity comments were prioritized as inline comments.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
⚠️ Outside diff range comments (1)
Minor · Preserve brightness changes made through the system menu. · Display.cpp:263
Tactility/Source/app/display/Display.cpp:263 Minor · Data Integrity & Integration · Heavy lift
Preserve brightness changes made through the system menu.
Open Display settings with duty=200 and change orientation. Then set brightness to 50% in the system menu and let its save complete. Closing Display settings saves the retained duty=200 over the newer duty=128. The file mutex cannot prevent this stale-snapshot overwrite. (raw.githubusercontent.com)
Coordinate brightness persistence between both controls. Save unrelated fields without replaying the retained brightness value. Preserve the latest brightness change when either control changed it.
86-86: Minor · Maintainability & Code Quality · Quick win
Move the dialog manager’s container state out of static storage.
manager() keeps a static DialogManager with two long-lived std::vector members. Keep only a pointer in static storage. Allocate the manager with tt::newObject<DialogManager>(), check the result, and use tt::std::vector for active and finishedThreads.
As per coding guidelines: “Don't use file-scope or function-local static variables for state of more than ~64 bytes, or that hold buffers or containers.” The guidelines also state: “Containers that live long use the tt::std replacements from TactilityKernel.”
Source: Coding guidelines
226-226: Minor · Functional Correctness · Quick win
Do not display a choice without a result handler.
If ButtonData allocation fails, the code leaves the button or list item visible without a press handler. A user can press the only OK button on an alert and get no result. Make both builders report allocation failure and unwind the partial dialog, or store the event payload without a separate fallible allocation for each choice. Keep normal choice indices unchanged.
Also applies to: 336-336
Tactility/Source/app/addgps/AddGps.cpp: 1
238-238: Minor · Functional Correctness · Quick win
Keep the selection kind with its completed result.
If the user requests Model after choosing a UART but before result consumption, appMain handles the new request first. This assignment changes selectKind to Model. The earlier UART index then updates modelIndex, not uartName.
Store the originating kind with the callback result. Do not replace an unconsumed result when another selection starts. The result-binding model in the View.cpp comment covers this ordering.
964-964: Minor · Functional Correctness · Quick win
Apply the palette result to its originating color row.
After the callback signals colorResultBit, focus is already back in the app. If the user presses another color row before result consumption, onColorButtonPressed() replaces selectColorIndex. This line then applies the earlier palette choice to the new row.
Keep the originating row index with the completed result. Read that snapshot here. The result-binding model in the View.cpp comment covers this ordering.
Tactility/Source/app/files/View.cpp: 1
340-340: Minor · Stability & Availability · Quick win
Drain dialog callbacks when a buried window is removed.
window_manager_remove() cancels and drains the removed app's dialogs only when the removed window is topmost. A buried window returns early. Its dialog can already be closed, with its result callback still pending on the dialog thread. The app then destroys its View after window_manager_remove() returns, so that callback can run on freed memory. Call dialog_cancel_for_app() and dialog_wait_for_app() in the buried branch too, before the return. The topmost path stays as it is.
Suggested fix
if (!was_topmost) {
// A buried window was removed; the topmost window's widgets are unaffected.
+ // Its dialog can still have a pending result callback, so drain it before returning.+ dialog_cancel_for_app(removed_app_instance_id);+ dialog_wait_for_app(removed_app_instance_id);
mutex_unlock(&s.lifecycle_mutex);
return;
}
51-51: Minor · Stability & Availability · Quick win
Make the confirmation handoff atomic.
The dialog task writes forgetConfirmed, but the app task reads and resets it after every wake, including unrelated Wi-Fi events. That read can occur before the callback signals requestBit. The event signal therefore does not synchronize every access to this plain bool.
Use std::atomic<bool> and consume the flag with exchange(false). This also avoids a separate read/reset operation. Keep the button-0 check so cancellation cannot remove credentials.
Tactility/Source/app/meshchat/MeshApp.cpp: 1
516-516: Minor · Functional Correctness · Quick win
Set the selection kind only after the dialog accepts the request.
startSelection stores the kind before dialog::selection checks whether another dialog is shown. When menuBit and addBit are handled in the same pass, startMenu opens the Mesh menu first. startAddContactMenu then changes selectKind to AddContact, and the dialog layer refuses the request with ERROR_RESOURCE_BUSY. The Mesh menu stays visible. Selecting its first item, “Set path” in Contacts with path support, then reaches onAddContactSelected(&ctx, 0) and starts “Add by key”.
A refused request must not change the kind of an outstanding selection result. Store the kind only after the dialog accepts the request.
106-106: Minor · Functional Correctness · Quick win
Make the minimum backlight level fully black.
The driver reports a minimum of 0. When callers set that value while the display is on, this expression produces 40, so the frame remains visible. This violates the supplied BacklightApi contract that the minimum turns the backlight fully off.
Map brightness 0 to black. Keep the readability floor for positive brightness values.
Devices/simulator/Source/drivers/sdl_audio.cpp: 1
72-72: Minor · Functional Correctness · Quick win
Drain queued audio before closing the SDL device.
close() discards audio that is still queued. write() returns once the queue falls to its threshold, so up to that amount can remain queued. SDL_CloseAudioDevice stops the output thread, waits a fixed two device buffers, and frees the queue. Any queued audio beyond those buffers is lost. A stream that closes right after its final write cuts off the end of the sound.
Before calling SDL_CloseAudioDevice, close() must let queued audio play. Wait on SDL_GetQueuedAudioSize() with a time bound, so a stalled device cannot block close indefinitely. The bound is a design choice for the author.
Tactility/Source/settings/DisplaySettings.cpp: 1
258-258: Minor · Functional Correctness · Quick win
Keep 0% on when the backlight minimum is nonzero.
Line 258 clamps the computed brightness to 1. That value is the off level when backlight_get_min_brightness() returns 1. The pwm backlight driver reports its configured brightness_range.min this way. A pwm configuration with a minimum of 1 therefore turns the backlight off at 0%, which contradicts the comment at line 257. Clamp to the first level above the minimum instead:
Suggested fix
- return brightness < 1 ? 1 : brightness;+ return brightness <= min ? min + 1 : brightness;
For a minimum of 0, the result stays 1, so the current behavior does not change.
Tactility/Source/app/systeminfo/SystemInfo.cpp: 5
610-610: Minor · Functional Correctness · Quick win
Use a task identifier for row expansion and focus.
If two live tasks have the same display name, pressing either row expands both rows. The focus lookup also selects the first matching name instead of following the selected task. Carry TaskStatus_t::xTaskNumber through TaskInfo and the row map, and use it for expansion and focus. Keep the display name for rendering and sorting. (github.com)
373-374: Minor · Functional Correctness · Quick win
Report task snapshot allocation failure instead of showing zero tasks.
On a device under memory pressure, a failed malloc returns an empty vector. The refresh then shows zero tasks in every chip and removes the rows. The previous implementation displayed an allocation error for the same failure. Return a distinct failure result so the caller can display an error without presenting it as valid task data. Let the next successful refresh clear the error and update the counts. (raw.githubusercontent.com)
533-533: Minor · Maintainability & Code Quality · Quick win
Use external-RAM-preferred containers for retained System Info state.
volumes and expandedTask remain in the app context between refreshes. Clearing volumes on window teardown does not release the vector's backing allocation. Use the Tactility containers for this retained state, including the stored volume paths and names. The temporary task snapshot does not need the same change.
As per coding guidelines, “Containers that live long use the tt::std replacements from TactilityKernel”; those containers prefer external RAM.
Also applies to: 549-549
Source: Coding guidelines
582-584: Minor · Functional Correctness · Quick win
Storage cards can finish building with no capacity figures and no unavailable state.
collectStorageVolume discards the capacity sample it reads, and updateStorage skips updateUsageCard when its second query fails. If the first query succeeds and the second fails, the card is built with no detail text. createUsageCard also sets no detail text, and updateStorage runs only once on show. The card stays blank until the window is rebuilt.
Each storage card must show capacity figures or an explicit unavailable state when the initial build completes. Either keep the sample read during collection and apply it when the card is built, or set the unavailable state when the update query fails. Use one of these behaviors consistently.
662-663: Minor · Functional Correctness · Quick win
Render the Ready and Waiting legend shapes with the shared icon font.
The legend uses the small text font for both the shape and the word. The bundled text font and its built-in fallback do not map U+E836 (Ready) or U+EBFF (Waiting). Those two legend entries therefore show no shape on narrow displays. The Running and Paused shapes resolve through the text font. Split each legend item into a shape label and a word label. Give the shape label lvgl_get_shared_icon_default_font(), as the chips already do. Keep the word label on lvgl_get_text_font(FONT_SIZE_SMALL).
Use the external-memory string for retained dialog text.
Context::text keeps the input allocation between dialogs until the app closes. Use tt::std::string and adjust the empty-string assignments to the same type. This keeps the new retained input storage on the repository's external-memory allocation path.
As per coding guidelines, “Containers that live long use the tt::std replacements.”
Context::text retains its allocation across dialog results until the settings app closes. Use the external-memory string type for this new state. The handlers can continue passing c_str() to the mesh APIs.
As per coding guidelines, “Containers that live long use the tt::std replacements.”
Use the external-memory string for the saved address result.
addressText retains the input allocation until another result replaces it or the app closes. Use tt::std::string for this long-lived state. app_hub_repository_add() can still consume its c_str() value.
As per coding guidelines, “Containers that live long use the tt::std replacements.”
Use the project allocation helpers for driver state.
Allocate SdlAudioInternal with tt::newObject<SdlAudioInternal>(). Release it with tt::deleteObject() in stop(). Keep the null check and SDL cleanup. This keeps the new driver's allocation policy consistent with the project.
As per coding guidelines, “In C++ use tt::newObject<T>() and tt::deleteObject() (<tactility/Memory.hpp>). Check for nullptr.”
Source: Coding guidelines
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 8d32153b-01ad-48a8-a1ca-2ba50a0a8f3b
Commits
Reviewing files that changed from the base of the PR and between 8220768 and 49090fa.
Files ignored due to path filters: 1
Data/system/fonts/MaterialSymbolsRounded.ttf is excluded by !**/*.ttf
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 6
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
⚠️ Outside diff range comments (2)
Major · Do not assign paste ownership while another dialog owns the result slot. · View.cpp:1431
Tactility/Source/app/files/View.cpp:1431 Major · Data Integrity & Integration · Heavy lift
Do not assign paste ownership while another dialog owns the result slot.
processPasteQueue() assigns dialogOwner = DialogOwner::Paste at View.cpp:1431 without checking the current owner. A rename can take the slot while the paste loop runs. If the user confirms that rename and its result is consumed after the overwrite prompt opens, onDialogResult() treats result 0 as the overwrite answer. The ActionPaste branch then revalidates the destination and removes it at View.cpp:1334-1340. No overwrite confirmation was given. A rename cancel does not trigger this removal.
Overwrite prompts must not start while dialogOwner != DialogOwner::None. This is the same condition onPasteRequested() applies at line 1393. Each pending result must reach the action that opened its dialog. The required deferral policy for a conflicting item that arrives while another dialog is active is a design choice. The fix should choose it explicitly, for example by pausing the queue and resuming it after the owner clears.
Minor · Capture the install path before releasing dialog ownership. · View.cpp:1202
Tactility/Source/app/files/View.cpp:1202 Minor · Data Integrity & Integration · Quick win
Capture the install path before releasing dialog ownership.
onDialogResult releases dialogOwner at line 1202, then reads installAppPath at line 1205. A new install prompt can start in that gap. viewFile then replaces installAppPath with another file, and the install for the earlier confirmation installs that file instead. Copy the path while ownership still blocks other prompts, and install the copy.
552-552: Minor · Stability & Availability · Poor tradeoff
Make a second removal of the same window wait for the pending callback drain.
When two threads call window_manager_remove() for one WindowId, the second call can return before the first call's result callback finishes. The first call erases the record and releases lifecycle_mutex before it waits in dialog_wait_for_app(). The second call finds no record and returns at the missing-record branch without waiting. If that caller then releases the app's callback context, a running result callback can read freed data. dialog.h requires removal to wait for the callback before the app releases that context.
The inspected app call sites remove each window from one thread only. No inspected caller creates this overlap, so this is a contract hazard rather than an observed production failure. Choose one correction:
Document that each window has exactly one remover.
Track pending removals per window, including the app instance ID. A later call for the same window waits for that pending drain. Do not hold lifecycle_mutex during the wait.
Use external-preferring storage for the new persistent strings.
dialogText and renameTargetPath live for the lifetime of View. Use tt::std::string for these fields, with conversions at standard-string boundaries. This keeps persistent dialog storage on the repository’s external-preferring allocation path.
As per coding guidelines, “Containers that live long use the tt::std replacements”.
Use external-RAM containers for the storage snapshot.
storage retains its allocation for the app lifetime. volumes then copies its elements, including the standard strings in StorageVolume. Use tt::std::vector and the corresponding external-RAM strings for this retained storage state. Update the callback cast on Line 455 to match.
As per coding guidelines, “Containers that live long use the tt::std replacements from TactilityKernel.”
Source: Coding guidelines
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 1ff80e98-585f-42ca-ab52-a7927af12444
Commits
Reviewing files that changed from the base of the PR and between 49090fa and 9514a1e.
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
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
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.
Summary by CodeRabbit