Skip to content

Fix stuck decoding marker on silent slots; correct TX-volume comment#171

Merged
patrickrb merged 1 commit into
devfrom
fix/decode-flag-tx-volume-comment
Jun 8, 2026
Merged

Fix stuck decoding marker on silent slots; correct TX-volume comment#171
patrickrb merged 1 commit into
devfrom
fix/decode-flag-tx-volume-comment

Conversation

@patrickrb

Copy link
Copy Markdown
Owner

Addresses the two Copilot review comments on the dev → main release PR (#165).

1. Stuck decoding marker on silent slots (real bug)

MainViewModel.afterDecode() returned early on a zero-decode slot (decoded.size() == 0) without clearing mutableIsDecoding. beforeListen() sets that flag true at the start of every cycle, so a genuinely silent slot left the spectrum-display "decoding" marker stuck on until a later non-empty cycle. The two other exit paths (all-own-echo, and the normal path) already cleared it — only this branch didn't.

Fix: all three exit paths now route through a new pure helper decodingMarkerAfterPass(rawDecodeCount, keptCount), so they can't drift apart again. Covered by DecodingMarkerTest (silent slot, all-own-echo, normal slot).

2. Stale TX-volume comment

FT8TransmitSignal's constructor comment claimed volume is "baked into the TX samples per-cycle … takes effect on the next cycle." The live-TX-volume work (#155) made the chunked MODE_STREAM AudioTrack loop re-read GeneralVariables.volumePercent per chunk, and the USB-direct path apply gain live via UsbAudioNative.setTxVolume. The comment was misleading for future debugging; updated to describe the live behavior.

Testing

gradlew.bat testDebugUnitTest --tests com.bg7yoz.ft8cn.DecodingMarkerTest — BUILD SUCCESSFUL, 3/3 pass.

🤖 Generated with Claude Code

Two issues flagged by Copilot on the dev->main release PR (#165):

1. MainViewModel.afterDecode() returned early on a zero-decode slot without
   clearing mutableIsDecoding. beforeListen() sets it true every cycle, so a
   silent slot left the spectrum-display decoding marker stuck on until a later
   non-empty cycle. Route all three afterDecode() exit paths through a new pure
   helper decodingMarkerAfterPass() so they stay in agreement, and cover it with
   DecodingMarkerTest.

2. FT8TransmitSignal's constructor comment claimed TX volume is baked per-cycle
   and only takes effect next cycle. The live-TX-volume change (#155) made the
   MODE_STREAM AudioTrack loop re-read volumePercent per chunk and the USB-direct
   path apply gain live via setTxVolume, so the comment was stale. Updated it to
   describe the live behavior.

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

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

Fixes a UI-state bug where the spectrum “decoding” marker could remain stuck on after a silent decode slot, and updates transmit-volume documentation to reflect the current live (mid-transmission) volume behavior.

Changes:

  • Ensure mutableIsDecoding is cleared on the silent-slot early return in MainViewModel.afterDecode(), and centralize the marker-off decision via decodingMarkerAfterPass(...).
  • Add a focused unit test (DecodingMarkerTest) to lock the “marker always clears after a pass” invariant.
  • Update FT8TransmitSignal constructor comment to describe live TX-volume application for both AudioTrack streaming and USB-direct paths.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
ft8cn/app/src/main/java/com/bg7yoz/ft8cn/MainViewModel.java Clears the decoding marker on the zero-decode early-return path and routes all exit paths through a shared helper.
ft8cn/app/src/test/java/com/bg7yoz/ft8cn/DecodingMarkerTest.java Adds unit coverage asserting the decoding marker is cleared for silent, all-own-echo, and normal slots.
ft8cn/app/src/main/java/com/bg7yoz/ft8cn/ft8transmit/FT8TransmitSignal.java Updates the TX-volume comment to reflect live mid-cycle volume changes.

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

Comment thread ft8cn/app/src/main/java/com/bg7yoz/ft8cn/MainViewModel.java
@patrickrb patrickrb merged commit e736709 into dev Jun 8, 2026
3 checks passed
@patrickrb patrickrb deleted the fix/decode-flag-tx-volume-comment branch June 8, 2026 22:13
@codecov

codecov Bot commented Jun 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 16.66667% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 6.56%. Comparing base (4f2e2e4) to head (ea3973f).
⚠️ Report is 5 commits behind head on dev.

Files with missing lines Patch % Lines
.../src/main/java/com/bg7yoz/ft8cn/MainViewModel.java 16.66% 5 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##               dev    #171   +/-   ##
=======================================
  Coverage     6.56%   6.56%           
- Complexity     695     697    +2     
=======================================
  Files          272     272           
  Lines        31563   31566    +3     
  Branches      4982    4982           
=======================================
+ Hits          2071    2073    +2     
- Misses       29348   29349    +1     
  Partials       144     144           
Files with missing lines Coverage Δ
...om/bg7yoz/ft8cn/ft8transmit/FT8TransmitSignal.java 2.96% <ø> (ø)
.../src/main/java/com/bg7yoz/ft8cn/MainViewModel.java 0.32% <16.66%> (+0.32%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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