Repository navigation
Studio: a battery layer never updated on a wireless device - #93
Merged
infinityInfinite merged 1 commit intoNov 21, 2026
Merged
infinityInfinite merged 1 commit into
infinityInfinite merged 1 commit into
Conversation
…runs A battery layer on a wireless device kept showing the level it had when its stream started: on a DeathStalker V2 Pro (Wireless) the bar stood below 40 % for hours while the keyboard reported 100 %. The level is read once every 1800 ticks, and it was read on tick 1 of them. A wireless device whose stream has started is only served on every third tick, and that check comes first. 1800 is a multiple of 3, so tick 1 is never one of those and the read did not run again. - The battery's turn is tick 3 of the 1800 (BATTERY_TICK), a tick wireless devices get. Wired devices are read as often as before, two ticks later. - A const assertion keeps the turn on such a tick if the numbers change. - A test runs Studio::tick on the simulated wireless mouse: a started stream with 75 % noted, the battery full since. The level is still 75 % after ticks 1801 and 1802 and 100 % after 1803. With the old schedule it stays 75 %.
Owner
|
Merged, thanks. Your test fails on the old schedule ( |
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.
Found a bug in RGB Studio's battery layer: on my wireless keyboard the bar never moved. Text below and fix is by Fable 5.2 reviewed by GPT-6.2 Astra.
Problem
A battery layer on a wireless device keeps showing the level it had when its stream started. On my DeathStalker V2 Pro (Wireless) the bar on the top row stood below 40 % (orange, up to F6) for hours while
secbird infosaidBattery 100%.Cause
Studio::tickreads the battery on tick 1 of everyBATTERY_EVERY(1800). A wireless device whose stream has started is skipped on every tick that isn't a multiple ofWIRELESS_EVERY(3), and that check comes first:1800 is a multiple of 3, so a tick with
tick % 1800 == 1is never a multiple of 3. While the stream runs and a level is noted, the read doesn't happen again. The level only changes when a stream starts without one: at tray start, or when the device comes back after being gone.Fix
BATTERY_TICK = WIRELESS_EVERY), a tick wireless devices get. Wired devices are read as often as before, two ticks later.constassertion keeps the turn on such a tick if the numbers change.Studio::tickon the simulated wireless mouse: a started stream with 75 % noted, the battery full since. The level must still be 75 % after ticks 1801 and 1802, and 100 % after 1803. With the old schedule in the loop it fails withleft: (1803, Some(75)),right: (1803, Some(100)).Tested
x86_64-pc-windows-gnu(rustc 1.100.0, mingw-w64). Onlysecbird-tray.exewas replaced.cargo clippy --release --target x86_64-pc-windows-gnu --all-targets -- -D warningsis clean. Unit tests: 6 (tray) pass on Windows, 128 (core) and 1 (CLI) pass on Linux.