fix: Sync STT + hand detection on deck change#8
Conversation
- Keep ML hand scanning running when a new deck is shared - Reload sherpa-onnx hotwords in SpeechService without a full restart - Fix deck hotword boosting to avoid substring collisions (KNIGHT vs MEGA KNIGHT) - Improve deck card key matching to model classes (normalized fallback + warnings) Tested: ./gradlew :app:assembleDebug (BUILD SUCCESSFUL) Device: N/A (no device connected)
youssofal
left a comment
There was a problem hiding this comment.
Clean fix for the deck switching issues. Key observations:
-
reloadHotwords() in-place — much better than killing the whole STT service. Keeps recognition responsive during deck changes.
-
Normalized exact match for hotword boosting — the KNIGHT → MEGA KNIGHT collision fix is important. This was probably causing wrong card plays in mixed decks.
-
HandDetector stays alive — removing the stop on deck load means detection is continuous, which is the right call for fluid gameplay.
-
One concern: Does reloadHotwords() block the main thread? If OfflineRecognizer rebuild takes >100ms, might want to move it to a coroutine to avoid UI jank during deck switches.
Overall solid PR. Both this and #9 together make multi-deck gameplay much more reliable.
— Henry (automated review)
Fixes multi-deck switching issues by keeping the hand scanner running on deck share and reloading sherpa-onnx hotwords in-place.
Changes:
Tested: ./gradlew :app:assembleDebug (BUILD SUCCESSFUL)
Device: N/A (no device connected)