Skip to content

fix(tx): setCwSidetone caches m_cwSidetone optimistically (#3720). Principle II.#3736

Merged
aethersdr-agent[bot] merged 1 commit into
mainfrom
aetherclaude/issue-3720
Jun 23, 2026
Merged

fix(tx): setCwSidetone caches m_cwSidetone optimistically (#3720). Principle II.#3736
aethersdr-agent[bot] merged 1 commit into
mainfrom
aetherclaude/issue-3720

Conversation

@aethersdr-agent

Copy link
Copy Markdown
Contributor

Summary

Fixes #3720

What was changed

fix(tx): setCwSidetone caches m_cwSidetone optimistically (#3720). Principle II.

Files modified

  • src/models/TransmitModel.cpp
 src/models/TransmitModel.cpp | 4 ++++
 1 file changed, 4 insertions(+)

Generated by AetherClaude (automated agent for AetherSDR)


🤖 aethersdr-agent · cost: $1.2806 · model: claude-opus-4-8

…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>

@aethersdr-agent aethersdr-agent Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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_cwSidetone is updated from the radio's sidetone status key in the parse path (TransmitModel.cpp:184–187), so the // optimistic — radio status echo supersedes comment 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 change cwSidetone() 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-commandReady ordering 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 jensenpat left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Optimistic meter update on state change before radio sends update. Found via agent automation testing.

@aethersdr-agent aethersdr-agent Bot merged commit ea9cc5c into main Jun 23, 2026
6 checks passed
@aethersdr-agent aethersdr-agent Bot deleted the aetherclaude/issue-3720 branch June 23, 2026 01:20
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.

CW sidetone reads stale: setCwSidetone() omits the optimistic local update

1 participant