Repository navigation
Locate task settings by attribute id - #1
Open
santiagolgzz wants to merge 2 commits into
Open
santiagolgzz wants to merge 2 commits into
santiagolgzz wants to merge 2 commits into
Conversation
Task settings live in Rx attribute 0x01 and were read at absolute record offsets that assume it comes first. Other attributes can precede it (shifting it by 48 bytes), which left rate/priority/watchdog wrong and the scheduled-program count implausible. Read them relative to attribute 0x01's value, found by walking the attributes. When 0x01 is the record's last attribute it can lack its final four bytes (they lie past the stored length); the settings sit before them, so that value is used as far as it goes. Records the walk cannot read keep the fixed offsets. Attribute 0x01 is read without the generated Rx parser, which drops a record's last attribute.
A task's program list ends where its rate begins, so a legacy task holds at most 128 programs. Replace the test that expected an error for 129 with one that checks 128 are all read, and that 129 keeps the task and its settings, logs a warning and reads no programs, even when every slot and the rate look like real program ids.
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.
Thanks for hutcheb#54. It stops the crash, but on
DispersionPlc_22_07_07andProject_SILevery task then comes out with zero rate, priority and watchdog and no programs, which Studio would happily import as real settings.Your offsets turned out to be right; it's the block they're measured from that moves in newer files. This finds that block wherever it sits, so both files get their real settings back. Nothing else changed on the 20 projects I tested, and your fallback still catches anything unreadable.
I also swapped the old "too many programs" test, which still expected an error, for one that checks a bad count can't turn neighbouring data into phantom programs.