Konfigurator: Apply settings per-device, Game Settings persistence #2

Merged
Joe merged 2 commits from fixes_after_playtesting into main 2026-04-20 00:20:51 +00:00
Owner

Overview

After playtesting the previous version of the Konfigurator subapp with eight 2020TPCs, we decided to make the following usability improvements:

  1. Settings on the Team Settings page are now applied to devices one at a time, with the operator manually triggering each device, rather than all devices being configured in a single bulk operation. The app was struggling to get though all eight devices cleanly, and in this way, if a single device fails to configure, only that device needs to be (and can be) reconfigured.
  2. Game Settings are now persisted across sessions — values entered by the operator are restored the next time the app is launched.

Per-device manual settings apply

Problem: The "Apply Settings" button sent configuration packets to all discovered devices at once. There was no way to apply settings to a single device independently.

Changes:

  • StateMachineViewModel.kt — Replaced configureDevices() (bulk, all devices) with configureSingleDevice(device: Device), which builds and sends the same four BLE parameter packets but scoped to one device. A new configuringDeviceAddress: StateFlow<String?> tracks which device is currently being configured (null when idle). Guards against concurrent calls — a second tap while one device is in progress is ignored.

  • KonfiguratorActivity.kt — Each DeviceCard now shows an "Apply" button at the bottom of the card whenever that device's desired settings don't yet match its acknowledged (broadcasted) settings. While the device is being configured, the button is replaced by a small spinner and "Applying…" label. All Apply buttons are disabled while any device is being configured.

  • The global "Apply Settings" bottom bar button has been removed. The bottom bar now shows:

    • Scanning for devices… — no devices found yet
    • Configuring… — a device is currently being configured
    • "Make Ready" — all devices have confirmed settings (replaces the old flow where this appeared after bulk apply)
    • "Start Game" — all devices report Ready state
    • A hint text "Tap 'Apply' on each device to configure" — devices present but not all configured yet
  • _pendingApply, _isConfiguring, and _configurationProgress state flows removed as they are no longer needed.


Game Settings persistence

Problem: All Game Settings fields except Game Duration and Time Until Countdown reverted to defaults whenever the operator returned to the Game Settings screen.

Changes:

  • GamePreferenceKeys.kt (shared-services) — Added SharedPreferences keys and defaults for the six previously-unpersisted fields: NUM_ROUNDS, MAX_HEALTH, SPECIAL_WEAPONS_ON_REENTRY, SHOT_CAPACITY, RELOAD_ON_REENTRY, MIN_TIME_BETWEEN_SHOTS_MS.

  • StateMachineViewModel.kt_currentGameConfig initialization now reads all eight GameConfig fields from SharedPreferences. updateGameConfig() now writes all eight fields on save (previously only wrote two).


Files changed

File Module
subapp-konfigurator/.../StateMachineViewModel.kt subapp-konfigurator
subapp-konfigurator/.../KonfiguratorActivity.kt subapp-konfigurator
shared-services/.../GamePreferenceKeys.kt shared-services
### Overview After playtesting the previous version of the Konfigurator subapp with eight 2020TPCs, we decided to make the following usability improvements: 1. Settings on the Team Settings page are now applied to devices one at a time, with the operator manually triggering each device, rather than all devices being configured in a single bulk operation. The app was struggling to get though all eight devices cleanly, and in this way, if a single device fails to configure, only that device needs to be (and can be) reconfigured. 2. Game Settings are now persisted across sessions — values entered by the operator are restored the next time the app is launched. --- ### Per-device manual settings apply **Problem:** The "Apply Settings" button sent configuration packets to all discovered devices at once. There was no way to apply settings to a single device independently. **Changes:** - `StateMachineViewModel.kt` — Replaced `configureDevices()` (bulk, all devices) with `configureSingleDevice(device: Device)`, which builds and sends the same four BLE parameter packets but scoped to one device. A new `configuringDeviceAddress: StateFlow<String?>` tracks which device is currently being configured (`null` when idle). Guards against concurrent calls — a second tap while one device is in progress is ignored. - `KonfiguratorActivity.kt` — Each `DeviceCard` now shows an **"Apply"** button at the bottom of the card whenever that device's desired settings don't yet match its acknowledged (broadcasted) settings. While the device is being configured, the button is replaced by a small spinner and "Applying…" label. All Apply buttons are disabled while any device is being configured. - The global "Apply Settings" bottom bar button has been removed. The bottom bar now shows: - **Scanning for devices…** — no devices found yet - **Configuring…** — a device is currently being configured - **"Make Ready"** — all devices have confirmed settings (replaces the old flow where this appeared after bulk apply) - **"Start Game"** — all devices report Ready state - A hint text *"Tap 'Apply' on each device to configure"* — devices present but not all configured yet - `_pendingApply`, `_isConfiguring`, and `_configurationProgress` state flows removed as they are no longer needed. --- ### Game Settings persistence **Problem:** All Game Settings fields except Game Duration and Time Until Countdown reverted to defaults whenever the operator returned to the Game Settings screen. **Changes:** - `GamePreferenceKeys.kt` (shared-services) — Added SharedPreferences keys and defaults for the six previously-unpersisted fields: `NUM_ROUNDS`, `MAX_HEALTH`, `SPECIAL_WEAPONS_ON_REENTRY`, `SHOT_CAPACITY`, `RELOAD_ON_REENTRY`, `MIN_TIME_BETWEEN_SHOTS_MS`. - `StateMachineViewModel.kt` — `_currentGameConfig` initialization now reads all eight `GameConfig` fields from SharedPreferences. `updateGameConfig()` now writes all eight fields on save (previously only wrote two). --- ### Files changed | File | Module | |------|--------| | `subapp-konfigurator/.../StateMachineViewModel.kt` | subapp-konfigurator | | `subapp-konfigurator/.../KonfiguratorActivity.kt` | subapp-konfigurator | | `shared-services/.../GamePreferenceKeys.kt` | shared-services |
Joe merged commit 30925fe493 into main 2026-04-20 00:20:51 +00:00
Joe deleted branch fixes_after_playtesting 2026-04-20 00:20:51 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Software/Android-KTag-Apps!2
No description provided.