Skip to content

Emit L5X for readable objects instead of aborting on edge cases - #62

Merged
hutcheb merged 1 commit into
hutcheb:mainfrom
frederico-tech6868:fix/l5x-readable-object-export
Nov 3, 2026
Merged

hutcheb merged 1 commit into
hutcheb:mainfrom
frederico-tech6868:fix/l5x-readable-object-export

Conversation

@frederico-tech6868

Copy link
Copy Markdown

The ACD->L5X export aborted on real projects and, when it did run, dropped all ladder logic for some firmware layouts. Three targeted fixes make it emit valid L5X for everything readable and report what it cannot:

  • Classify a tag Produced/Consumed only when its 0x6B link is a full 4-byte object reference; a short stub now stays Base instead of raising in _legacy_linked_data and aborting the whole controller export.
  • Make the controller-scoped tag loop resilient: a tag that cannot be faithfully reconstructed is recorded in controller._skipped_tags and skipped, so the rest of the project still exports (nothing is guessed).
  • Fall back to RLL for a routine that reads back TypeLess but carries "Rung NT" ladder regions, so its rungs are serialised instead of dropped.

Verified against a known project: well-formed L5X with 100% exact rung-text match vs the Studio 5000 export; the existing test suite passes unchanged.

The ACD->L5X export aborted on real projects and, when it did run, dropped
all ladder logic for some firmware layouts. Three targeted fixes make it
emit valid L5X for everything readable and report what it cannot:

- Classify a tag Produced/Consumed only when its 0x6B link is a full 4-byte
  object reference; a short stub now stays Base instead of raising in
  _legacy_linked_data and aborting the whole controller export.
- Make the controller-scoped tag loop resilient: a tag that cannot be
  faithfully reconstructed is recorded in controller._skipped_tags and
  skipped, so the rest of the project still exports (nothing is guessed).
- Fall back to RLL for a routine that reads back TypeLess but carries
  "Rung NT" ladder regions, so its rungs are serialised instead of dropped.

Verified against a known project: well-formed L5X with 100% exact rung-text
match vs the Studio 5000 export; the existing test suite passes unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants