Implement sending typical steps to the watch#192
Open
aveao wants to merge 5 commits into
Open
Conversation
This was referenced May 16, 2026
Adds file-private constants (bin count, bin width, history window, minimum-history threshold, unknown sentinel) and the weekday→key map that the upcoming typical-step writer will use. No behavior change yet.
Adds the helper signature and empty-input fast path. Subsequent commits will fill in the binning algorithm test-by-test.
Implements buildWeekdayTypicalsFromData: single-pass binning of HealthDataEntity rows into 7×96 (weekday × 15-min slot) aggregates, with per-slot day-count tracking so a slot that was uncovered on some matching days isn't underweighted. Weekdays below the 2-day minimum-history threshold are omitted; per-slot gaps emit the 0xFFFF sentinel the watch firmware sum-skips. Tests cover empty input, below-threshold skip, sentinel emission, and the per-slot-vs-per-day averaging distinction.
Wires computeAllWeekdayTypicalSteps into updateHealthStatsInDatabase so monday_steps..sunday_steps rows land in BlobDatabase.HealthStats alongside the existing *_movementData / *_sleepData rows. The @GenerateRoomEntity infrastructure on HealthStat pushes them to the watch on next sync. This fixes the missing percentage in the end-of-day activity summary notification on PebbleOS watches (firmware activity_insights.c prv_calc_percent_tier returns OnAverage when the typical sums to 0, and the corresponding copy variants have no "%d%%" placeholder).
Surfaces the seven <weekday>_steps typical totals computed by computeAllWeekdayTypicalSteps in the Health Debug Stats dialog so the values pushed to the watch can be sanity-checked from the phone. Each row sums the 96 15-min bins of that weekday's payload (matching the firmware's prv_cur_step_avg sum semantics), or shows "--" for weekdays below the 2-day minimum-history threshold. New decodeTypicalStepTotal helper in HealthStatsSync encapsulates the wire-format knowledge; HealthDebugStats gains a weekdayTypicalSteps field; Health.getHealthDebugStats and FakeLibPebble.getHealthDebugStats populate it; the iOS healthDebugStatsToJson includes it.
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.
See #78
should fix step insights at the end of the day not showing typical values, plus the typical number under health app.
doesn't have the typical sleep one yet, that's at #194