Skip to content

Extend panadapter startup layout restore window#2792

Merged
ten9876 merged 1 commit into
aethersdr:mainfrom
rfoust:codex/panadapter-restore-timeout
May 17, 2026
Merged

Extend panadapter startup layout restore window#2792
ten9876 merged 1 commit into
aethersdr:mainfrom
rfoust:codex/panadapter-restore-timeout

Conversation

@rfoust

@rfoust rfoust commented May 17, 2026

Copy link
Copy Markdown
Collaborator

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

  • Increase kPanLayoutRestoreWindowMs from 5000 ms to 30000 ms.
  • Stop m_layoutRestoreTimer and clear m_layoutRestoreUntilMs before applying a user-selected panadapter layout.
  • No persistence format changes.
  • No radio-side panadapter state changes.

Test Plan

  • cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo
  • cmake --build build --parallel
  • Manual follow-up: start with a saved docked multi-pan layout and confirm the layout restores after slow radio panadapter status arrival.
  • Manual follow-up: during startup, change panadapter layout and confirm the user-selected layout is not overwritten by delayed startup restore.

Copilot AI review requested due to automatic review settings May 17, 2026 05:32
@rfoust rfoust requested a review from ten9876 as a code owner May 17, 2026 05:32

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 kPanLayoutRestoreWindowMs from 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.

Comment thread src/gui/MainWindow.cpp Outdated
return true;
}
if (m_layoutRestoreTimer) {
m_layoutRestoreTimer->stop();

@aethersdr-agent aethersdr-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. If panCount > 1, call m_panStack->rearrangeLayout(...) (the part you want to suppress).
  2. 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.

@rfoust rfoust force-pushed the codex/panadapter-restore-timeout branch from 5c9d707 to f7fbe58 Compare May 17, 2026 06:05
@rfoust

rfoust commented May 17, 2026

Copy link
Copy Markdown
Collaborator Author

Updated the PR to address the review comment about restoreFloatingState().

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

@ten9876 ten9876 merged commit 370e064 into aethersdr:main May 17, 2026
5 checks passed
@ten9876

ten9876 commented May 17, 2026

Copy link
Copy Markdown
Collaborator

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)

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.

3 participants