From a266dca2048e41b560ba03abffb5a1f0dc40a100 Mon Sep 17 00:00:00 2001 From: sanjayk03-dev Date: Fri, 5 Jul 2024 12:26:47 +0530 Subject: [PATCH] updated mach.py --- src/py/bbctrl/Mach.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/py/bbctrl/Mach.py b/src/py/bbctrl/Mach.py index a522a00..1eead51 100644 --- a/src/py/bbctrl/Mach.py +++ b/src/py/bbctrl/Mach.py @@ -371,12 +371,9 @@ class Mach(Comm): # Set the absolute position both locally and via the AVR 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) } } + json_data = config.values.copy() + axes = json_data.setdefault('axes', {}) + axes[axis] = { 'abs' : target, 'off' : state.get('offset_' + axis)} config.save(json_data) state.set(axis + 'p', target) super().queue_command(Cmd.set_axis(axis, target))