Skip to content

tooldb: notify db_program of G10 tool offsets - #4422

Open
alex-pres wants to merge 2 commits into
LinuxCNC:masterfrom
alex-pres:pr-fix-tooldb-offset-notification
Open

tooldb: notify db_program of G10 tool offsets#4422
alex-pres wants to merge 2 commits into
LinuxCNC:masterfrom
alex-pres:pr-fix-tooldb-offset-notification

Conversation

@alex-pres

Copy link
Copy Markdown
Contributor

In db mode no tool table file is written, so offsets set with G10 L1/L10/L11 were lost at restart without the TOOL_OFFSET notification.

may be there was good reason to comment these lines, but now it seems to work ok. I added a test for it.

In db mode no tool table file is written, so offsets set with G10
L1/L10/L11 were lost at restart without the TOOL_OFFSET notification.
Comment thread tests/tooldb/db-g10-offset/.gitignore Outdated
Comment thread tests/tooldb/db-g10-offset/base.inc Outdated
It already provides the estop and toolchange loopbacks, so the local copy
is not needed; drop the .gitignore entries covered by tests/.gitignore.
@alex-pres

Copy link
Copy Markdown
Contributor Author

Done

@grandixximo grandixximo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified against the tree, this looks right to me.

Some history on the commented-out block: it was active code in the old ioControl.cc and was commented out (with the stale io_db_mode name) by 764655e "moving all IO handling from iocontrol to task" during the taskio migration. So there was no deliberate reason to disable it, it was a casualty of that move. And the bug is real: in db mode with a nonrandom toolchanger tooldata_save() returns early without writing anything (tooldata_common.cc), so offsets set with G10 were lost at restart without this notification.

The pno logic matches the pre-move code, db_mode is in scope, and the 'p' notification is synchronous (send_and_verify), so the wait_complete() ordering in the test is sound. The test covers restart persistence, the loaded-tool case, and survival of untouched tools. Nice work.

One non-blocking nit inline.

@@ -0,0 +1,6 @@
Verify that tool offsets set with G10 L1/L10/L11 are persisted when an

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit (non-blocking): the README and PR body say L1/L10/L11, but the test only exercises L1. Same code path, but L10/L11 cases would be cheap to add.

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.

3 participants