Konfigurator: Apply settings per-device, Game Settings persistence #2
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fixes_after_playtesting"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Overview
After playtesting the previous version of the Konfigurator subapp with eight 2020TPCs, we decided to make the following usability improvements:
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— ReplacedconfigureDevices()(bulk, all devices) withconfigureSingleDevice(device: Device), which builds and sends the same four BLE parameter packets but scoped to one device. A newconfiguringDeviceAddress: StateFlow<String?>tracks which device is currently being configured (nullwhen idle). Guards against concurrent calls — a second tap while one device is in progress is ignored.KonfiguratorActivity.kt— EachDeviceCardnow 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:
_pendingApply,_isConfiguring, and_configurationProgressstate 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—_currentGameConfiginitialization now reads all eightGameConfigfields from SharedPreferences.updateGameConfig()now writes all eight fields on save (previously only wrote two).Files changed
subapp-konfigurator/.../StateMachineViewModel.ktsubapp-konfigurator/.../KonfiguratorActivity.ktshared-services/.../GamePreferenceKeys.kt