Skip to content

Decode: optionally clear decodes + reset TX target on band/mode change#351

Merged
patrickrb merged 2 commits into
devfrom
feat/clear-on-mode-band-change
Jun 26, 2026
Merged

Decode: optionally clear decodes + reset TX target on band/mode change#351
patrickrb merged 2 commits into
devfrom
feat/clear-on-mode-band-change

Conversation

@patrickrb

Copy link
Copy Markdown
Owner

Problem

Tester request: "how about add new option for auto clear decode scene & tx target when change mode / band :)"

Today, changing band or mode leaves the decode list showing stale spots from the old band/mode and keeps the previous TX target.

Change

New clearOnBandModeChange setting (default ON), persisted as "clearOnBandModeChange", with a toggle in Transmission settings under the existing TX/RX split row.

When enabled, clearDecodesAndTarget() wipes the decode list and resets the TX target to CQ from the three change paths:

  • setOperatingMode — mode change (FT8 ⇄ FT4 ⇄ …),
  • selectBandIndex — operator picks a band in the frequency picker,
  • onFreqChanged — rig reports a band change (e.g. dial turned).

The band paths gate on shouldClearOnBandChange(enabled, oldIndex, newIndex), a pure predicate that clears only when the band index actually changed — so a no-op band re-select or a small in-band dial report doesn't wipe the list. The TX target is only reset when not mid-transmit.

Tests

  • New ClearOnBandChangeTest covering the predicate (enabled+changed clears; same band doesn't; disabled never).
  • testDebugUnitTest green; built and installed on the Pixel 8, launches cleanly.

Part of a series addressing tester feedback on the Android UI (item 4 of 4 in this batch).

Changing band or mode left the decode list showing stale spots from the
old band/mode and kept the previous TX target. A tester asked for an
option to auto-clear the decode scene and TX target on such a change.

Add a clearOnBandModeChange setting (default ON, persisted as
"clearOnBandModeChange", with a toggle in Transmission settings). When
on, clearDecodesAndTarget() wipes the decode list and resets the TX
target to CQ from the three change paths:
  - setOperatingMode (mode change),
  - selectBandIndex (operator picks a band),
  - onFreqChanged (rig reports a band change).

The band paths gate on shouldClearOnBandChange(), a pure predicate that
clears only when the band index actually changed (so a no-op re-select
or a small in-band dial report doesn't wipe the list). Unit-tested.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 11.45%. Comparing base (6bc083c) to head (ec062da).
⚠️ Report is 29 commits behind head on dev.

Files with missing lines Patch % Lines
...o/ks3ckc/ft8af/ui/settings/TransmissionSettings.kt 0.00% 11 Missing ⚠️
...ks3ckc/ft8af/ui/components/FrequencyPickerSheet.kt 0.00% 5 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##                dev     #351      +/-   ##
============================================
- Coverage     11.70%   11.45%   -0.26%     
- Complexity      113      120       +7     
============================================
  Files            85       89       +4     
  Lines         11691    12580     +889     
  Branches       2110     2249     +139     
============================================
+ Hits           1369     1441      +72     
- Misses        10191    11008     +817     
  Partials        131      131              
Files with missing lines Coverage Δ
...ks3ckc/ft8af/ui/components/FrequencyPickerSheet.kt 0.00% <0.00%> (ø)
...o/ks3ckc/ft8af/ui/settings/TransmissionSettings.kt 0.00% <0.00%> (ø)

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Adds a new setting to optionally clear stale decodes and reset the TX target when the operator changes band or operating mode, aiming to prevent the UI and TX target from reflecting the previous band/mode after a change.

Changes:

  • Introduces clearOnBandModeChange (default ON), persisted as clearOnBandModeChange, and exposes it as a toggle in Transmission settings.
  • Clears decodes + resets TX target on mode changes and on band changes coming from either user selection or rig-reported frequency changes (with an attempted “no-op band change” gate).
  • Adds a unit test suite for the band-change gating predicate.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
ft8af/app/src/test/java/com/k1af/ft8af/ClearOnBandChangeTest.java Adds unit tests for the band-change clearing predicate.
ft8af/app/src/main/res/values/strings_compose.xml Adds user-facing strings for the new Transmission setting toggle.
ft8af/app/src/main/kotlin/radio/ks3ckc/ft8af/ui/settings/TransmissionSettings.kt Adds UI toggle + persistence for clearOnBandModeChange.
ft8af/app/src/main/kotlin/radio/ks3ckc/ft8af/ui/components/FrequencyPickerSheet.kt Clears decodes/target on user-selected band changes when enabled.
ft8af/app/src/main/java/com/k1af/ft8af/MainViewModel.java Implements clearing behavior and band-change predicate; wires clearing into rig freq change + mode change paths.
ft8af/app/src/main/java/com/k1af/ft8af/GeneralVariables.java Adds new global boolean clearOnBandModeChange defaulting to true.
ft8af/app/src/main/java/com/k1af/ft8af/database/DatabaseOpr.java Loads the persisted clearOnBandModeChange config value into GeneralVariables.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ft8af/app/src/main/java/com/k1af/ft8af/MainViewModel.java Outdated
Comment thread ft8af/app/src/test/java/com/k1af/ft8af/ClearOnBandChangeTest.java
shouldClearOnBandChange compared band-list indices, but
OperationBand.getIndexByFreq() appends a new entry for any previously-unseen
frequency, so a small in-band dial move changes the index without changing
the band — and wrongly cleared decodes/TX target. Compare the meter
(wavelength) band instead, which only changes on a real band hop.

- shouldClearOnBandChange(enabled, oldWaveLength, newWaveLength)
- Update both callers (rig onFreqChanged, band-picker selectBandIndex) to
  derive wavelengths via BaseRigOperation.getMeterFromFreq.
- Rewrite ClearOnBandChangeTest for wavelength semantics: different
  wavelength clears; same wavelength (incl. different in-band freq) does not;
  disabled never clears; null wavelengths compare equal.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@patrickrb patrickrb merged commit ea614c7 into dev Jun 26, 2026
16 checks passed
@patrickrb patrickrb deleted the feat/clear-on-mode-band-change branch June 26, 2026 19:00
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