moved saving offset to config from State.py to Mach.py

This commit is contained in:
sanjayk03-dev
2024-09-18 22:56:18 +05:30
parent f12e7fbe69
commit e7ab108581
2 changed files with 4 additions and 5 deletions

View File

@@ -363,6 +363,10 @@ class Mach(Comm):
# If homed, change the offset rather than the absolute position # If homed, change the offset rather than the absolute position
self.mdi('G92%s%f' % (axis, position)) self.mdi('G92%s%f' % (axis, position))
#storing the offset to config
self.ctrl.config.set('axes', {'offset_' + axis : state.get(axis + 'p')})
self.log.info('set_position: {} = {} '.format(axis, state.get(axis + 'p')))
elif state.is_axis_enabled(axis): elif state.is_axis_enabled(axis):
if self._get_cycle() != 'idle' and not self._is_paused(): if self._get_cycle() != 'idle' and not self._is_paused():
raise Exception('Cannot set position during ' + raise Exception('Cannot set position during ' +

View File

@@ -243,11 +243,6 @@ class State(object):
if self.timeout is None: if self.timeout is None:
self.timeout = self.ctrl.ioloop.call_later(0.25, self._notify) self.timeout = self.ctrl.ioloop.call_later(0.25, self._notify)
# Storing origin to config
if name in ['offset_x', 'offset_y', 'offset_z'] and self.vars.get('cycle') == 'mdi':
self.ctrl.config.set('axes', {name: value})
self.set('cycle', 'idle')
# Loading origin from config after homing # Loading origin from config after homing
if load_position and self.vars.get('cycle') == 'idle': if load_position and self.vars.get('cycle') == 'idle':
for axis in 'xyz': for axis in 'xyz':