Skip to content

Fix TX frequency reset when band changes via frequency edit - #1113

Merged
ea4k merged 1 commit into
masterfrom
claude/tx-frequency-revert-bug-cdof92
Aug 17, 2026
Merged

Fix TX frequency reset when band changes via frequency edit#1113
ea4k merged 1 commit into
masterfrom
claude/tx-frequency-revert-bug-cdof92

Conversation

@ea4k

@ea4k ea4k commented Aug 17, 2026

Copy link
Copy Markdown
Owner

Summary

This PR fixes a bug where the TX frequency would be incorrectly reset when the user edits the TX frequency and the band automatically changes as a side effect.

Key Changes

  • Added freqDrivenBandChange flag to track when slotBandChanged() is being called as a side effect of a frequency edit in slotFreqTXChanged()
  • Modified the condition in slotBandChanged() to skip TX frequency reset when the band change was triggered by a frequency edit, preventing the use of stale frequency values
  • Fixed syntax errors in mainwindowsattab.cpp where extra parameters were being passed to isThisFreqInBand() calls

Implementation Details

The core issue was a race condition: when slotFreqTXChanged() calls setBand() to update the band based on the new frequency, this can synchronously re-enter slotBandChanged(). At that point, the TX frequency spinbox still contains the old value, so slotBandChanged() would incorrectly use it to decide whether to reset the TX frequency.

The fix uses the freqDrivenBandChange flag to signal that the band change is frequency-driven, allowing slotBandChanged() to skip its frequency validation logic and let the correct frequency value be applied by the subsequent setTXFreq() call in slotFreqTXChanged().

https://claude.ai/code/session_01KnQDWAUkEBcsfH2ahuU6kC

Typing a TX frequency that belongs to a different band than the one
currently selected (e.g. entering 435 MHz while on 2M) could make the
just-typed value silently snap back to the old RX frequency.

MainWindow::slotFreqTXChanged() switches the band via
mainQSOEntryWidget->setBand() before writing the new frequency to the
TX spin box. That band switch re-enters MainWindow::slotBandChanged()
synchronously (directly, and again through the satellite tab's band
combos), which decides whether to reset the TX frequency to the new
band's default by reading the TX spin box's *current* value - still
the pre-edit frequency at that point, since the real value hasn't been
written yet. That stale read intermittently causes it to conclude the
new value is out of band and reset it, discarding what the user typed.

Guard the reentrant call with a flag so slotBandChanged() skips that
reset whenever the band switch is itself driven by a frequency edit;
the correct frequency is already being applied right after by the
caller. Manually changing the band combo box directly is unaffected
and still resets the frequency to the band's default as before.

Also fixes a comma-operator typo in
MainWindowSatTab::slotSatBandTXComboBoxChanged() (`if (expr, MHz)`)
that made two related band/satellite checks always evaluate true,
found while tracing the same reentrant frequency-sync path.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KnQDWAUkEBcsfH2ahuU6kC
@ea4k
ea4k merged commit 9772263 into master Aug 17, 2026
6 of 10 checks passed
@ea4k
ea4k deleted the claude/tx-frequency-revert-bug-cdof92 branch August 17, 2026 17:45
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.

2 participants