Extend panadapter startup layout restore window#2792
Conversation
There was a problem hiding this comment.
Pull request overview
Extends the “startup/reconnect panadapter layout restore” grace window so the saved PanadapterLayout can still be applied even if panadapter status arrives slowly, and prevents the automatic restore from overriding an explicit user-selected layout.
Changes:
- Increase
kPanLayoutRestoreWindowMsfrom 5s to 30s. - When the user explicitly selects a panadapter layout during startup, stop the pending startup restore timer and clear the restore window to prevent later automatic overrides.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return true; | ||
| } | ||
| if (m_layoutRestoreTimer) { | ||
| m_layoutRestoreTimer->stop(); |
There was a problem hiding this comment.
Thanks for the fix @rfoust — extending the window to 30 s addresses the slow-radio startup case cleanly, and the diff is appropriately scoped.
One concern, which mirrors Copilot's finding and I think is real:
Cancelling the timer also cancels restoreFloatingState()
The timer callback at src/gui/MainWindow.cpp:2603-2661 does two things:
- If
panCount > 1, callm_panStack->rearrangeLayout(...)(the part you want to suppress). - Unconditionally call
m_panStack->restoreFloatingState()at line 2660 (the part you probably still want).
When the user picks a layout from m_addPanLabel at line 5949, the new m_layoutRestoreTimer->stop() cancels the whole callback, so any saved floating-pan windows that hadn't yet been restored stay docked. With the window now 30 s wide, the chance of a user clicking before floating restore has run is meaningfully higher than under the old 5 s window.
Suggested fix — restore floating state directly at the cancel site, then suppress only the layout-rearrange portion:
if (m_layoutRestoreTimer) {
m_layoutRestoreTimer->stop();
}
m_layoutRestoreUntilMs = 0;
if (m_panStack) {
m_panStack->restoreFloatingState();
}Or pull floating-state restore out of the timer callback entirely and trigger it independently once any pan exists.
Everything else looks good — m_layoutRestoreTimer is null-checked before stop(), and setting m_layoutRestoreUntilMs = 0 correctly prevents the restart path at line 2667 from re-arming the timer on subsequent pan messages.
5c9d707 to
f7fbe58
Compare
|
Updated the PR to address the review comment about The branch is still a single commit. The user-selected layout path now suppresses only the automatic startup layout rearrange, while still allowing the pending startup timer to run and restore saved floating/detached pan windows. Verified locally: cmake --build build --parallel |
|
Claude here — merged. Thanks Robbie! The pairing of the wider window with the user-intent suppress flag is exactly the kind of thoughtful fix this needed; a naked 5s→30s bump would have introduced a regression where layout-button presses got clobbered by late-arriving pan status. Targeted, clean, no overlap with the four commits that landed since your base. Appreciate the work — four contributions today (#2780→#2786 cherry-pick, #2783, #2789, #2792). 73, Jeremy KK7GWY & Claude (AI dev partner) |
Summary
Extend the startup panadapter layout restore window from 5 seconds to 30 seconds, and cancel pending startup restore when the user explicitly changes the panadapter layout.
Why
Panadapter layout restore is debounced while restored panadapter status arrives from the radio during startup/reconnect. The previous 5-second window could expire before all restored panadapter data arrived, causing docked panadapters to remain in the default arrangement instead of the saved
PanadapterLayout.Because 30 seconds is a wider startup window, user-initiated layout changes now stop the pending startup restore so the automatic restore cannot override an explicit user choice.
Changes
kPanLayoutRestoreWindowMsfrom5000ms to30000ms.m_layoutRestoreTimerand clearm_layoutRestoreUntilMsbefore applying a user-selected panadapter layout.Test Plan
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfocmake --build build --parallel