Skip to content

Switch section control on automatically when an implement connects - #102

Open
gunicsba wants to merge 2 commits into
developfrom
feature/section-control-on-connect
Open

gunicsba wants to merge 2 commits into
developfrom
feature/section-control-on-connect

Conversation

@gunicsba

@gunicsba gunicsba commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #94.

An implement used to stay in manual mode after connecting until someone pressed AOG's ISOBUS SC button. With this change the TC switches section control on by itself.

  • The TC remembers the section control state it wants. At startup that comes from a new settings.json key, sectionControlOnConnect, which defaults to true.
  • 2 s after a client's object pool is activated, the TC applies that state. It sets its local auto flag, so AOG's section states (PGN 229) are forwarded, and it writes DDI 160 (Section Control State) if the implement declares it.
  • Every activation starts with a fresh ClientState, so this also covers implements that connect after startup, reconnects and pool re-uploads.
  • AOG's SC button works as before: PGN 241 switches every connected client. It now also sets the state used for implements that connect later.
  • The implement keeps the final say. If it declines, or the operator switches it back to manual, its DDI 160 report is followed as before.

AOG only sends PGN 241 when the button is pressed, and the button shows the state from the TC heartbeat. That means AOG doesn't override the default, and its button shows ON once the implement is switched on.

Switching on when AOG opens a field

A second setting, sectionControlOnFieldOpen (default true), does the same thing when AOG opens a field: the TC calls the same code as PGN 241 "enabled", as if the SC button had been pressed.

  • AOG sends the field name (PGN 0xF3) on every field open and close, and again when the TC reconnects. A non-empty name counts as a field opening.
  • Older AOG versions don't send the field name. For those, PGN 229 starting after a 2 s gap counts as a field opening, because AOG only sends PGN 229 while a field is open.
  • Both signals report the same opening, so the TC acts on it at most once per 5 s.
  • Field open and close are logged as [Field] AOG opened field '...' and [Field] AOG closed the field.

Background: in a field log from 2026-10-13, after field changes a spreader in automatic spread full width without receiving setpoints (see #106). This option makes a field change restart automatic section control in the TC without anyone pressing the button.

Notes

  • Track control (DDI 515) is not switched on automatically. It is still only driven by the AOG button.
  • To turn these off, set "sectionControlOnConnect": false or "sectionControlOnFieldOpen": false in settings.json. Both are listed in the readme. There is no VT Config toggle yet.
  • Announce guidance track data (DDI 507-511, 513) to implements #84 also handles PGN 0xF3; whichever lands second should merge the two handlers.

Testing

  • Release build passes on Windows (MSVC).
  • Not yet tested on a real implement. Things to check: the log shows [TC] Applying initial section control state: enabled about 2 s after the pool is activated, the implement reports DDI 160 = 1, and AOG's button shows ON.

🤖 Generated with Claude Code

Until now an implement stayed in manual mode after connecting until the
operator pressed AOG's ISOBUS SC button, which sends PGN 241. The TC now
remembers the section control state it wants and applies it to each
client 2 s after its pool is activated: it sets the local auto flag and
writes DDI 160 when the implement declares it.

The initial state comes from the new settings.json key
"sectionControlOnConnect" (default true). Pressing AOG's button still
switches all clients and also becomes the state for implements that
connect later. The implement can still decline or go back to manual;
its DDI 160 report is followed as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
New sectionControlOnFieldOpen setting (default on): when AOG opens a field,
the TC switches section control on as if AOG's SC button was pressed (the
same update_section_control_enabled(true) that PGN 241 "enabled" triggers).

AOG sends the field name (PGN 0xF3) on every field open and close, and
again when the TC reconnects. Older AOG versions do not, so PGN 229
starting after a 2 s gap (AOG sends it only while a field is open) counts
as a field opening too. Both report the same opening, so it is acted on at
most once per 5 s. Field open and close are logged.

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Late-registering implement is never told to go to Auto if AOG enabled SC earlier

1 participant