Repository navigation
fix: re-take an unowned lease after a PLC restart (#7) - #8
Merged
Merged
Conversation
…se (#7, red) MiniPlc.PowerCycle clears the command block (LeaseOwner 0, WatchdogFault 0), State Disabled, Homed off, CommandAck 0. GA-I-25 fails on master: the driver keeps beating a PLC whose LeaseOwner stays 0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A tick that reads LeaseOwner = 0 while attached is a PLC restart or a clean release, never another commander. The device now re-attaches in place along the initial attach path: the tick's status block is checked before any write (map version, limit publication, reading range), LeaseOwner = own id, WatchdogFault = 0, a fresh read is checked again, and the engine re-attaches (CommandSeq continues from CommandAck, Enable from the PLC state, a verb in flight fails CommunicationLost naming the dropped lease). One Warning names the register read. The axis then shows whatever the PLC reports (typically Disabled, not homed). A foreign non-zero owner still latches LeaseHeld; a refused re-take latches ProtocolMismatch / OutOfRange; a Transport failure is CommunicationLost. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… is re-taken in place (#7) 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.
Fixes #7.
After a PLC power-cycle the PLC came back with
LeaseOwner = 0. The driver kept beating, the tick latchedLeaseHeld("another commander took the axis"),IsConnectedstayed true, and the connector never re-attached. The device was dead until reconfigured.Fix (protocol § FR-11 "Advisory lease"). A tick that reads
LeaseOwner = 0while attached is a PLC restart or a clean release, never another commander. The device re-takes the lease in place along the initial attach path:LeaseOwner= own id, thenWatchdogFault = 0.CommandSeqcontinues fromCommandAck, Enable follows the PLC state, stale edges are cleared. A verb in flight failsCommunicationLostnaming the dropped lease and writes nothing more.LeaseOwner (C+9 = holding 9) = 0 while attached as 1 — PLC restarted or lease released; lease re-taken. …The axis then shows whatever the PLC reports, typically Disabled and not homed, so the next move is refused
NotHomed. A foreign non-zero owner still latchesLeaseHeld. A refused re-take latchesProtocolMismatchorOutOfRangeand writes nothing. A Transport failure is the existingCommunicationLostpath. The connector is unchanged.Tests
MiniPlc.PowerCycle()→ lease re-taken, watchdog re-armed, IsConnected true, one Warning, no LeaseHeld; MoveAbsolute refused NotHomed; after Home it moves. Red on master (commit 1846a74), green with the fix.Gates
dotnet build src/GenericAxis.sln: 0 warnings, 0 errors.dotnet test src/GenericAxis.sln: Plugin.Tests 62 → 62, Tests 203 → 206, TestApp.Tests 261 → 261, all passed.🤖 Generated with Claude Code