storing mach position to config
This commit is contained in:
@@ -358,6 +358,7 @@ class Mach(Comm):
|
|||||||
def set_position(self, axis, position):
|
def set_position(self, axis, position):
|
||||||
axis = axis.lower()
|
axis = axis.lower()
|
||||||
state = self.ctrl.state
|
state = self.ctrl.state
|
||||||
|
config = self.ctrl.config
|
||||||
|
|
||||||
if state.is_axis_homed(axis):
|
if state.is_axis_homed(axis):
|
||||||
# If homed, change the offset rather than the absolute position
|
# If homed, change the offset rather than the absolute position
|
||||||
@@ -370,6 +371,13 @@ class Mach(Comm):
|
|||||||
|
|
||||||
# Set the absolute position both locally and via the AVR
|
# Set the absolute position both locally and via the AVR
|
||||||
target = position + state.get('offset_' + axis)
|
target = position + state.get('offset_' + axis)
|
||||||
|
json_data = config.copy()
|
||||||
|
axes = json_data.get('axes')
|
||||||
|
if axes:
|
||||||
|
json_data['axes'][axis] = { "abs": target, "off": state.get('offset_' + axis) }
|
||||||
|
else:
|
||||||
|
json_data['axes'] = { axis: { "abs": target, "off": state.get('offset_' + axis) } }
|
||||||
|
config.save(json_data)
|
||||||
state.set(axis + 'p', target)
|
state.set(axis + 'p', target)
|
||||||
super().queue_command(Cmd.set_axis(axis, target))
|
super().queue_command(Cmd.set_axis(axis, target))
|
||||||
|
|
||||||
|
|||||||
@@ -653,6 +653,39 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"axes": {
|
||||||
|
"x": {
|
||||||
|
"abs": {
|
||||||
|
"type": "string",
|
||||||
|
"default": "0"
|
||||||
|
},
|
||||||
|
"off": {
|
||||||
|
"type": "string",
|
||||||
|
"default": "0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"y": {
|
||||||
|
"abs": {
|
||||||
|
"type": "string",
|
||||||
|
"default": "0"
|
||||||
|
},
|
||||||
|
"off": {
|
||||||
|
"type": "string",
|
||||||
|
"default": "0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"z": {
|
||||||
|
"abs": {
|
||||||
|
"type": "string",
|
||||||
|
"default": "0"
|
||||||
|
},
|
||||||
|
"off": {
|
||||||
|
"type": "string",
|
||||||
|
"default": "0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
"admin": {
|
"admin": {
|
||||||
"auto-check-upgrade": {
|
"auto-check-upgrade": {
|
||||||
"type": "bool",
|
"type": "bool",
|
||||||
|
|||||||
Reference in New Issue
Block a user