Repository navigation
cleanup(data): correct polling KDoc and position-range sentinel - #1332
Merged
9thLevelSoftware merged 1 commit intoOct 23, 2026
Merged
Conversation
The polling-engine KDoc claimed a 1 Hz diagnostic loop and a 10-20 Hz monitor loop. Diagnostic polling waits 500 ms, and the monitor loop has no success delay (~10-20 ms). stopAll also treated Double.MIN_VALUE as the unset maximum, which never matches the -Double.MAX_VALUE sentinel. Co-authored-by: Devil <9thLevelSoftware@users.noreply.github.com>
9thLevelSoftware
marked this pull request as ready for review
October 23, 2026 14:31
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (3 files)
Reviewed by minimax-m3 · Input: 61.9K · Output: 9K · Cached: 523.4K Review guidance: REVIEW.md from base branch |
9thLevelSoftware
deleted the
cursor/polling-engine-kdoc-and-max-sentinel-e989
branch
October 23, 2026 16:40
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.
Summary
MetricPollingEngine's class KDoc now matches the loops in code. The monitor poll has no delay on success and is rate-limited by the BLE round trip (~10-20 ms, same asstartMonitorPolling). The diagnostic poll is 2 Hz / 500 ms (BleConstants.Timing.DIAGNOSTIC_POLL_INTERVAL_MS). Heuristic (4 Hz / 250 ms) and heartbeat (0.5 Hz / 2000 ms) were already correct.stopAlllogs the workout position range throughHandleStateDetector.hasObservedPositionRange(). That comparesmaxPositionSeenwithUNSET_MAX_POSITION_MM(-Double.MAX_VALUE), the sentinel used to initialize and reset the field.Double.MIN_VALUEis the smallest positive double, so it never matched that sentinel.Behavior
The check only decides whether
stopAllemits theWORKOUT ANALYSISinfo log.stopPollingand the connection manager callstopAlland do not read the result. Nothing in the UI or persistence readsminPositionSeen/maxPositionSeen; both are updated together fromFloatcable positions.A finite sample moves both extremes off their sentinels, so a real workout still prints the range. A
Floatposition cannot equal-Double.MAX_VALUEorDouble.MIN_VALUE, so this does not change that log for trainer positions. The corrected guard skips the log when the maximum is still unset.Test
HandleStateDetectorTest.position range stays unobserved until a sample leaves both sentinelscovers the unset sentinels, an all-negative sample, and reset.:shared:testAndroidHostTestforHandleStateDetectorTestandMetricPollingEngineTestpassed.