Repository navigation
Firmware 2.3.0: the limit switches decide the ends; position after a power cut - #27
Draft
daniel-frenkel wants to merge 30 commits into
Draft
daniel-frenkel wants to merge 30 commits into
daniel-frenkel wants to merge 30 commits into
Conversation
…ower cut (before any code) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… stop The cover shows closed only while S5 is pressed and fully open only while S4 is pressed. The position is written to flash at every stop, and a move-in-progress marker before each move (cleared at its stop); nothing is written while moving. A cut-off move, a saved end whose switch isn't pressed, or a close that ends without S5 makes the position unknown: 50 %, a Fault line, the next Close runs until S5 and the next Open until S4, and Set position closes to S5 first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r PC4 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ush while moving) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… stop paths) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ancel) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…dle-only flushes, restart halts first, no moves during an update - A pressed limit switch decides the position at startup even with the marker set; a seek toward a switch already pressed settles at once. - Every stop halts the motor before its position is saved. - ESPHome's periodic flush is off; a 30 s flush runs only while idle, and move_begin and the Speed setting flush only while idle. - on_shutdown halts the motor before capturing the position. - An update sets ota_active: Open, Close, Set position and Auto-Calibrate refuse until it fails or is aborted (a finished one restarts). - The S5 handler logs its trigger count; an unknown-position close logs its start. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…oved) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ch; detector log order Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rompts) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ck after a cut) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t, PC6 detail, dry-run models) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…prompts (Amendment 6) pc_run.py: no case, cut or move unless the open guard is connected and watching; STOP and end the case if it drops mid-move outside a cut; from the call until the unit and the guard are back its lost connection is expected; the guard counts as back once it has read not connected since the call. Pull, plug-in, countdown and alerts go through bench_common.Prompter. pc_sim.py: open-guard models (--sim-guard), the bench hears the prompts, sleep ends exactly on time. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ted result (I6-3a) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…art wait, I6-5 refined, I6-6) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… guard at case start ends only that case (ruling 47) The case-start wait sends nothing and sleeps without the in-move check; a guard exception there is recorded as "guard missing" and the next case waits again. pc_sim.py: drop-at-cut guard model and the no-return fault for the dry-run checks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… predicted) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e the cue) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Draft: merges only after 2.2.0 is tagged from the benched build.
What
Daniel's 2.3.0 decisions: the limit switches are the source of truth for the ends, and the position survives a power cut. Review items (Amendments 1–3 in the predictions file) are included.
The ends. The cover shows 0 % (closed) only while S5 is pressed and 100 % (fully open) only while S4 is pressed, at startup and after every move. Otherwise it stays within 1–99 %.
Saving (option A). Today the position reaches flash only once a minute (ESPHome's default
flash_write_interval), so a power cut or an unplanned restart can bring back an old position.position_commit), always after the motor has been halted: STOP, both switches, stalls, the thermal lockout, calibration and the end of a move.move_begin, fromdrive_open,drive_closeand the proportional set-position move) and cleared at the stop.flash_write_interval: never); a 30 s flush runs only while idle, andmove_beginand the Speed setting flush only while idle. Settings changed while idle reach flash within 30 s; one changed during a move is saved at its stop. ESPHome's shutdown flush stays.Unknown position. It happens in three cases:
While the position is unknown:
seek_margin_mm), with stall detection on;Restarts and updates. The motor stops when the unit restarts or an update begins.
After a stall stop (Amendment 5; Daniel's call, he may strike it): the next Close or Open runs until its limit switch, as when the position is unknown, while the cover keeps showing the counted position. On the bench a stall left the count 2.12 mm off, and the next Close stopped short and faulted. Also, the detector switches log "disabled" only when they really stay off.
Logging for the bench. The S5 handler logs the count at its trigger, and an unknown-position close logs the count it starts from, so the recovery close after a power cut shows where the carriage really stopped.
Also:
firmware/README.md(ends rule, "Position after a power cut", fault rows, entity reference), the README feature lines, and a CHANGELOG 2.3.0 section;tools/bench/pc_run.pyruns PC1–PC6 with the power cut by hand, andpc_sim.pyis its dry run. It uses the bench interlock and prompts frombench_common.py(Amendment 6). No case, cut or move is sent unless the open guard is connected and watching. Outside a cut, the script sends STOP and ends the case if the guard drops mid-move. A case that ends on the interlock sends STOP first. A guard missing at case start ends only that case. Every pull, plug-in, countdown and alert is shown on screen and spoken. Before a cue, nothing shown or spoken contains an action word: the countdown reads "Power cut: 3, 2, 1", and only the cue says "pull … now" (Amendment 7).Checks
Registered before each code change in
tools/regression-gate/predictions/2026-11-position-truth.md(original and Amendments 1–7).esphome configvalid; compile succeeds (flash 71.1 %, 1,305,292 bytes); the bench build resolvesposition_commitis refused by the compilerdrive_open,drive_close,motion_halt,auto_calibrate, the 200 ms completion poll, both limit-switch handlers, the Speed setting, and the Fault lambda. New (3):move_begin,position_commit, the 30 s flush. Dropped: none. Amendment 5 vs the previous head: 8 changed and 1 dropped (the StallGuard switch's off-action, which held only the log line), as re-registered in its note before G2 ran.drive_openspliced in,drive_openis no longer listedmove_begin,position_commit, the Speed setting and the 30 s flush)drive_openfails that fact; a head with an extra flush fails the flush factdrive_closewithout the level check, amotion_haltthat commits first, and a 30 s flush without its idle guard each fail exactly their factseek_nextpersisted and set by a stall stop outside calibration; both seeks apply it; the open learns only without it; S5/S4 clear it; the cover doesn't read it; the detector switches log "disabled" only when they stay offOn record: R1's original flush fact missed on the Amendment 1 head (the 30 s flush was added on purpose; the fact was then re-registered). Two checker faults were rerun and disclosed: the R1 reader for the if/else-wrapped scripts, and an R3 reader that matched a quote-escaped dump instead of the lambda text. Amendment 5: a G2 run on a partial head (before the detector change) is disclosed, and the R5 reader first read the switch triggers one level too shallow (fixed, rerun). Amendment 6: the first dry run never returned, because the simulator's sleep stopped short of its end (fixed in the simulator, rerun, disclosed). A sabotage run then showed that a guard exception in the case-start wait could end the whole run. That was fixed as ruled (STOP first; the case-start wait without the in-move check; a missing guard there ends only that case), and the full set was rerun on one head.
Bench (2.3.0)
Registered in the predictions file; they run with Daniel present.
pc_run.pycounts down, and plugs it back in when it says (both shown on screen and spoken), with the open guard running; USB stays unplugged. Each test is judged on its registered outcome, with where the carriage actually stopped taken from the recovery move's logged counts.🤖 Generated with Claude Code