loading the origin back after homing

This commit is contained in:
sanjayk03-dev
2024-07-30 17:40:31 +05:30
parent a8e8a07d85
commit 027a2b0c3b

View File

@@ -243,12 +243,19 @@ class State(object):
if self.timeout is None:
self.timeout = self.ctrl.ioloop.call_later(0.25, self._notify)
if name in ['offset_x', 'offset_y', 'offset_z'] and 'cycle' in self.vars.get('cycle') == 'mdi':
# 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
if load_position and self.vars.get('cycle') == 'idle':
self.log.info('set the position value')
for axis in 'xyz':
offset = self.ctrl.config.get('offset_' + axis)
if offset is not None:
origin = offset if self.get('metric') == True else offset / 25.4
self.log.info('axis: {} offset: {} origin: {}'.format(axis, offset, origin))
self.ctrl.mach.set_position(axis,-origin)
def update(self, update):