fix(tx): setCwSidetone caches m_cwSidetone optimistically (#3720). Principle II.#3736
Merged
Merged
Conversation
…inciple II. setCwSidetone() sent the `cw sidetone` command but never updated its local member m_cwSidetone, so cwSidetone() returned a stale value until the radio's status echo arrived. Apply the canonical guarded-optimistic pattern (identical to #3712 setAmCarrierLevel and the adjacent setCwBreakIn/setCwDelay/setCwIambic setters): update m_cwSidetone and emit phoneStateChanged() when the value changes, before sending the command. No feedback loop: PhoneCwApplet's button->model edge is guarded with !m_updatingFromModel and its phoneStateChanged sync wraps widget updates in m_updatingFromModel=true/false plus QSignalBlocker, so the optimistic emit cannot re-send the command. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
Author
There was a problem hiding this comment.
LGTM — clean, correct, and minimal.
This applies the same optimistic-cache pattern already used by every sibling CW setter in this file (setCwBreakIn, setCwDelay, setCwIambic, …), so it's consistent with the established Principle II convention:
- Member & echo path verified.
m_cwSidetoneis updated from the radio'ssidetonestatus key in the parse path (TransmitModel.cpp:184–187), so the// optimistic — radio status echo supersedescomment is accurate — a later radio status correctly overrides the optimistic value. - The cache is load-bearing. The toggle shortcut reads back the cached value:
tx.setCwSidetone(!tx.cwSidetone())(MainWindow_Shortcuts.cpp:978). Before this changecwSidetone()stayed stale after a toggle, so a rapid second toggle could resolve against the wrong state. The guard +phoneStateChanged()emit fixes that and keeps the button (PhoneCwApplet) in sync. - Guard-then-emit-then-
commandReadyordering matches the siblings; the!=guard avoids spurious signals.
No conventions, null-safety, or scope concerns — single file, additive, in scope. Thanks for the tidy fix! 🙏
🤖 aethersdr-agent · cost: $4.4414 · model: claude-opus-4-8
jensenpat
approved these changes
Jun 23, 2026
jensenpat
left a comment
Collaborator
There was a problem hiding this comment.
Optimistic meter update on state change before radio sends update. Found via agent automation testing.
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Fixes #3720
What was changed
fix(tx): setCwSidetone caches m_cwSidetone optimistically (#3720). Principle II.
Files modified
src/models/TransmitModel.cppGenerated by AetherClaude (automated agent for AetherSDR)
🤖 aethersdr-agent · cost: $1.2806 · model: claude-opus-4-8