Store bathroom night brightness as a whole percentage #72
Loading…
Reference in a new issue
No description provided.
Delete branch "bathroom-night-brightness"
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?
Follow-up to #71 (merged before this landed). The bathroom night brightness setting is now a whole percentage (1-100, default 30) rather than a raw 0.1 % level, which is a friendlier unit for a setting a person dials in directly.
SemanticClass::Level(0x2C) is renamed toPercentage(1 %, 0-100) with a matching row added to spec section 6;BathroomPolicyis untouched and still takes a 0.1 % level, so the conversion (value() * 10) happens at the one point the setting meets the dimmer, inonFrame.Tested with
pio test -e native(448 cases, all passing, including the shared test vectors) andpio run -e node_lighting.Checked out and verified against
origin/main(the local worktree'smainwas stale, but the real diff matches the PR description exactly — a single commit, four files).value() * 10:SettingEndpoint::value()isuint16_tclamped to [1,100], the multiply promotes tointwith no overflow, and the max result (1000) is exactlycan::units::levelMax. Plain integer arithmetic, no float, nolevelFromPercent— correct, and the right call since the task never needed the float rounding that helper is for.SemanticClass::Level,bathroomNightLevel,epBathroomNightLevel,"bathNightLevel", or the old test name anywhere in the tree.test_bathroom_policy.cppcorrectly left untouched — confirmedBathroomPolicy::onOccupancytakes a raw 0.1%nightLeveland never touchesSemanticClassor the setting; its literals (1000, 300 etc.) are unaffected by the percent/level rename.main.cpp, on a line this PR doesn't touch).pio test -e native(448/448) and CI (Build and test / buildone5a1ac2) both green.Nothing to change — approving would be the right call here but self-approval is blocked by Forgejo.