Skip to content

Add track control level negotiation (DDI 505/506) and track control state (DDI 515) - #85

Open
gunicsba wants to merge 3 commits into
feature/guidance-track-announcementfrom
feature/track-control-levels
Open

gunicsba wants to merge 3 commits into
feature/guidance-track-announcementfrom
feature/track-control-levels

Conversation

@gunicsba

Copy link
Copy Markdown
Contributor

Summary

Last of four PRs split out of #73. Stacked on #84 (base is feature/guidance-track-announcement; GitHub retargets it as the PRs below it merge).

Negotiates a track control level with the implement and switches its track control on and off together with AgOpenGPS's Auto command:

  1. The implement reports the levels it supports as a bitmask in DDI 505.
  2. The TC writes DDI 506 back as an enum (0 = none, 1 = Level 1, ...). Only Level 1 is implemented, so it asks for Level 1 whenever the implement supports it, even if it also advertises Level 2 or 3.
  3. The implement's DDI 506 echo (1) completes the negotiation.

DDI 515 (TrackControlState) is written only to clients that completed the negotiation, each time AOG's section-control mode (PGN 0xF1) arrives. Everything from #83/#84 is deliberately not gated on this.

Also: announces functionality 27 (Task Controller TRACK server) in PGN 64654, and shows the track state and the implement's supported levels on the VT status page.

Differences from the tramline branch

This is a port, not a copy. I dropped things that were dead or redundant there:

  • The DDOP "capability detection" scan in activate_object_pool — ClientState is freshly constructed on every activation, so the negotiation state already starts zeroed, and the flags it set were never read (or duplicated has_element_number_for_ddi).
  • The stored actualTramlineControlState and trackControlEnabled flags — written, never read.
  • The ActualTramlineCondensedWorkState* handling. Nothing uses it while only Level 1 exists, and it is where the DDI-range bug from the Implement TECU capabilities announcement and tramline support for specific seeders #73 review lived. It can come back with Level 3.
  • Identifiers follow the ISO "Track" naming (TrackControlLevel, send_guidance_track_data, ...).

Left out on purpose, worth a follow-up: the diagnostic repetition-rate callback that #73 registered on the TC's PGN-request protocol (depends on #82's helper), and #73's fallback that derives an implement's working width from live-reported values (an unrelated feature).

Things to check on hardware

  • The subscription/negotiation ordering is unchanged from the tramline branch, but this code path isn't covered by a unit test (it needs a live TaskControllerServer).
  • DDI 515 is only written when a PGN 0xF1 arrives. If AOG sends that only on change and an implement finishes negotiating afterwards, it won't get the current state until the next toggle. Same behaviour as Implement TECU capabilities announcement and tramline support for specific seeders #73; I didn't change it.
  • The VT status page now has two extra lines (Track state, Track levels) in the same text object.

Test plan

  • Release build, AOG_TC_VALIDATE_IOP=ON build, ctest 6/6; clang-format clean locally.
  • Trial-merged against Add Tractor Facilities (PGN 65033) for the TECU #82: clean.
  • Real-bus negotiation with a track-capable implement (505 -> 506 -> echo -> 515) — not run.

🤖 Generated with Claude Code

@gunicsba
gunicsba added this pull request to stack #86 September 19, 2026 22:08
@gunicsba gunicsba added this to the Tramlines milestone Sep 19, 2026
@gunicsba gunicsba added the enhancement New feature or request label Sep 19, 2026
@gunicsba
gunicsba force-pushed the feature/track-control-levels branch from cbde51f to ce392c5 Compare September 19, 2026 22:58
…tate (DDI 515)

Negotiates a track control level with implements and switches their track
control on and off together with AgOpenGPS's Auto command:

1. The implement reports the levels it supports as a bitmask in DDI 505.
2. The TC writes DDI 506 (an enum, unlike 505) back. Only Level 1 is
   implemented, so it asks for Level 1 whenever the implement supports it,
   even if it also advertises Level 2 or 3.
3. The implement's DDI 506 echo completes the negotiation.

DDI 515 (TrackControlState) is written only to clients that completed the
negotiation, each time AOG's section control mode arrives. The guidance data
from the previous PR is not gated on any of this.

The DDIs are mapped with find_owning_element_number() from the guidance data
mapping, plus an OnChange subscription because the implement reports them.

Also announces functionality 27 (Task Controller TRACK server) in PGN 64654
and shows the track state and the implement's supported levels on the VT
status page.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@gunicsba
gunicsba force-pushed the feature/track-control-levels branch from ce392c5 to 679b293 Compare September 19, 2026 23:04
gunicsba and others added 2 commits September 27, 2026 16:04
…levels

Resolve conflict in request_measurement_commands(): keep the track
control DDI subscriptions and switch their output to log() to match the
async logging from #79.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…levels

Picks up the test_guidance_track link fix.

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant