Fix stuck decoding marker on silent slots; correct TX-volume comment#171
Merged
Conversation
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>
There was a problem hiding this comment.
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
mutableIsDecodingis cleared on the silent-slot early return inMainViewModel.afterDecode(), and centralize the marker-off decision viadecodingMarkerAfterPass(...). - Add a focused unit test (
DecodingMarkerTest) to lock the “marker always clears after a pass” invariant. - Update
FT8TransmitSignalconstructor 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.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ 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
🚀 New features to boost your workflow:
|
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.
Addresses the two Copilot review comments on the
dev → mainrelease PR (#165).1. Stuck decoding marker on silent slots (real bug)
MainViewModel.afterDecode()returned early on a zero-decode slot (decoded.size() == 0) without clearingmutableIsDecoding.beforeListen()sets that flagtrueat 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 byDecodingMarkerTest(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 chunkedMODE_STREAMAudioTrackloop re-readGeneralVariables.volumePercentper chunk, and the USB-direct path apply gain live viaUsbAudioNative.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