Repository navigation
Conversation
DeviceElementObject::get_child_object_ids() returns a DataSpan<const std::uint16_t>, and AgIsoStack's DataSpan scales end() and operator[] by sizeof(T) on top of the pointer arithmetic. Iterating it reads twice as many IDs as the element has children; the second half comes from past the end of the list. Whatever is in that memory can match an object ID. All four TC loops that map DDIs to elements iterated it. On a Mueller sprayer (11 sections), DDI 160 Section Control State was subscribed on elements 2, 17 and 18 although only element 2 lists it, and the TC wrote "automatic" to element 18. The sprayer stayed in manual on element 2 and ignored every setpoint. Whether it happens depends on heap contents, so the same implement mapped correctly with another build. Copy the child IDs through get_number_child_objects()/get_child_object_id(i), which AgIsoStack's own code uses, in one helper used at all four sites. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
|
@gunicsba Let's fix the issue in agisostack itself instead :) |
Contributor
Author
|
@GwnDaan You want to fix it or should I ask Claude to do so? |
gunicsba
marked this pull request as draft
October 14, 2026 07:50
Contributor
Author
|
@GwnDaan Fix proposed upstream in Open-Agriculture/AgIsoStack-plus-plus#783: |
Contributor
Author
|
Closing in favour of the upstream fix, Open-Agriculture/AgIsoStack-plus-plus#783. #110 tracks bumping AgIsoStack once it's merged. |
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.
Summary
DeviceElementObject::get_child_object_ids()returns aDataSpan<const std::uint16_t>. AgIsoStack'sDataSpanmultiplies bysizeof(T)inend()andoperator[], on top of the pointer arithmetic that already scales bysizeof(T):For
std::uint16_t, iterating it reads twice as many IDs as the element has children. The second half comes from past the end of the list, so whatever is in that memory can match an object ID. Checked with AgIsoStack's own deserializer: an element with 22 children yields 44 values, the last 22 of them junk.All four TC loops that map DDIs to elements iterate this span (
find_owning_element_number, the section parent lookup, and both measurement-subscription loops).Field symptom
Local bench test with a Müller sprayer (11 sections, DDOP has DDI 160 only under element 2):
Elements 17 and 18 are plain sections that don't list the DDI 160 object. The TC wrote "automatic" to element 18, the sprayer stayed in manual on element 2, and it ignored every setpoint. Whether it happens depends on heap contents: the same sprayer mapped correctly with another build.
Change
One helper,
get_child_object_ids(DeviceElementObject &), copies the IDs throughget_number_child_objects()/get_child_object_id(i). AgIsoStack's own code uses those (DDOP helpers, TC client, ISOXML export). All four loops now use the helper.Notes
DataSpanbug itself should be fixed upstream in AgIsoStack. This PR doesn't depend on that fix and stays correct after it.Testing
Section Control State = Auto/onon element 2 and follows setpoints.🤖 Generated with Claude Code