You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
S400 hydration shift loses decreases and exact zero in ScaleMeasurement #1588
The S400 handler reports a signed hydration shift, but ScaleMeasurement.set() drops every non-positive number. A decrease or unchanged value therefore disappears before saving.
Minimal reproduction with the existing key:
val measurement =ScaleMeasurement()
measurement[MiScaleS400Handler.HYDRATION_SHIFT] =Percent(-4f)
check(measurement[MiScaleS400Handler.HYDRATION_SHIFT] ==Percent(-4f)) // fails: null
Percent(0f) is discarded too; positive values survive.
S400HydrationShift.shiftPct() calculates a signed change and MiScaleS400Handler publishes it. The positive-only checks in android_app/app/src/main/java/com/health/openscale/core/bluetooth/data/ScaleMeasurement.kt cause the loss. This is also present on the current default branch.
I'm working on adding support for the Tanita RD-545 and ran into the same problem with its scores. A possible fix is an allowNonPositive flag on measurement keys, so fields like hydration shift and signed scores can keep zero/negative values while weight still requires a positive value.
Activity