Managing offsets and baby stepping
We need a way to track work system offsets.
$# facilitates this by returning a list of the X/Y/Z offsets for each coordinate work system:
Send: $#
Recv: [G54:-484.000,-393.000,-46.300]
Recv: [G55:0.000,0.000,0.000]
Recv: [G56:0.000,0.000,0.000]
Recv: [G57:0.000,0.000,0.000]
Recv: [G58:0.000,0.000,0.000]
Recv: [G59:0.000,0.000,0.000]
Recv: [G28:0.000,0.000,0.000]
Recv: [G30:0.000,0.000,0.000]
Recv: [G92:0.000,0.000,0.000]
Recv: [TLO:0.000]
Recv: ok
Here's what I envision for it as dictionary list:
{
"G54": {
"x": -484,
"y": -393,
"z": -46.3
},
"G55": {
"x": 0,
"y": 0,
"z": 0
}
}
and then an internal mechanism within BGS to allow for changing the X/Y/Z offsets dynamically, much like how Marlin provides for baby stepping.
@paukstelis starting to build this up
I've tested part of this thus far.... getting the offsets is working well via the tracked_commands method and I've also ensured whenever I change them using G10 that I update their values with those changes.
this leaves us with the actual baby stepping method I threw into _bgs to support this:
def babystep_offset(_plugin, program, axis, increment):
pgm = int(program.replace("G", "")) - 53
newvalue = _plugin.offsets[program][axis] + increment
_plugin._printer.commands("G10 L2 P{} {}{}".format(pgm, axis, newvalue))
# update our offsets
_plugin.offsets[program][axis] = newvalue
calling it like so from the plugin:
_bgs.babystep_offset(self, self.grblCoordinateSystem, "z", .01 # increments z offset + .01 for active system
_bgs.babystep_offset(self, self.grblCoordinateSystem, "z", -.01 # increments z offset - .01 for active system
so with the plumbing done, now to figure out how to integrate this into the UI. I'm half tempted to create another sidebar widget like the framing / bounding box one, but specific to (baby) stepping the offsets.