Skip to content

Locate task settings by attribute id - #1

Open
santiagolgzz wants to merge 2 commits into
colinlove:fix/task-record-layout-mismatchfrom
santiagolgzz:offer/pr54-task-settings
Open

santiagolgzz wants to merge 2 commits into
colinlove:fix/task-record-layout-mismatchfrom
santiagolgzz:offer/pr54-task-settings

Conversation

@santiagolgzz

Copy link
Copy Markdown

Thanks for hutcheb#54. It stops the crash, but on DispersionPlc_22_07_07 and Project_SIL every 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.

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.
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.

1 participant