From b6f091f0ed85ab461f4aafb6510e4b4101b7488a Mon Sep 17 00:00:00 2001 From: sanjayk03-dev Date: Tue, 30 Jul 2024 17:57:57 +0530 Subject: [PATCH] loading origin only if offset is 0 --- src/py/bbctrl/State.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/py/bbctrl/State.py b/src/py/bbctrl/State.py index 476a1aa..72d1c76 100644 --- a/src/py/bbctrl/State.py +++ b/src/py/bbctrl/State.py @@ -242,7 +242,7 @@ class State(object): # Trigger listener notify if self.timeout is None: 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}) @@ -252,7 +252,7 @@ class State(object): if load_position and self.vars.get('cycle') == 'idle': for axis in 'xyz': offset = self.ctrl.config.get('offset_' + axis) - if offset is not None: + if offset is not None and self.get('offset_'+ axis) == 0: 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)