Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 99f14b517b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (getCalibrate() || getCurrentPosition() == UNKNOWN_POSITION) { | ||
| return false; |
There was a problem hiding this comment.
Handle partial targets safely when position is unknown
By forcing isCalibrated() to return false whenever getCurrentPosition()==UNKNOWN_POSITION, restored devices now enter the uncalibrated path in RollerShutter::onTimer; in that path, targets other than fully open/closed (0/100) leave newDirection as STOP but still fall through to startOpening() when currently stopped. This means a valid absolute command like 50% after reboot with unknown position will now always open, which contradicts the existing non-calibrated logic comment and can move in the wrong direction for close-oriented targets.
Useful? React with 👍 / 👎.
Motivation
UNKNOWN_POSITIONcould be treated as calibrated when opening/closing times exist, causing absolute OPEN commands to compute movement against-1and trigger the wrong motor direction.Description
RollerShutterInterface::isCalibrated()to returnfalsewhengetCalibrate()is set orgetCurrentPosition() == UNKNOWN_POSITION, and only consider time-based calibration when a known position exists; the change is insrc/supla/control/roller_shutter_interface.cpp.loadedUnknownPositionIsNotCalibratedtoextras/test/RollerShutterTests/roller_shutter_tests.cppthat restores a state withUNKNOWN_POSITIONand asserts the device remains uncalibrated and an absolute open target starts opening (checksgetCurrentDirection()isUP_DIR).Testing
git diff --checkwhich reported no issues.cmake -S extras/test -B /tmp/supla-device-test-buildbut it failed during FetchContent cloning ofhttps://github.com/nlohmann/json.git(CONNECT tunnel HTTP 403), so the test binary could not be built in this environment.Codex Task