From d65abac0d5d77679c05d3d43c5766d99a367ac1b Mon Sep 17 00:00:00 2001 From: Henrik Muehe Date: Sun, 3 May 2026 14:19:14 +0200 Subject: [PATCH] Config: idempotent macro file rename W -> A The auxiliary stepper used to be exposed as a W axis. After the gplan integration it is exposed as A. Migrate persisted macro config on every load: w_down.nc -> a_down.nc w_up.nc -> a_up.nc 'W Down' -> 'A Down' 'W Up' -> 'A Up' Idempotent so a stale in-memory copy can never reintroduce the old names. --- src/py/bbctrl/Config.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/py/bbctrl/Config.py b/src/py/bbctrl/Config.py index 53118f2..173c88a 100644 --- a/src/py/bbctrl/Config.py +++ b/src/py/bbctrl/Config.py @@ -216,6 +216,32 @@ class Config(object): defaults = json.load(f) config['selected-tool-settings'] = defaults['selected-tool-settings']; + # Auxiliary axis nomenclature: rename W -> A in macro names and + # filenames. The auxcnc-driven stepper has been integrated into + # gplan as A since the option-b migration; old configs may + # still carry W Down/W Up macro entries pointing at + # w_down.nc/w_up.nc which were renamed on disk to a_down.nc / + # a_up.nc. Migrate idempotently on every load so a stale + # in-memory copy can never reintroduce the old names. + macros = config.get('macros') if isinstance(config, dict) else None + if isinstance(macros, list): + renames = { + 'w_down.nc': 'a_down.nc', + 'w_up.nc': 'a_up.nc', + } + display_renames = { + 'W Down': 'A Down', + 'W Up': 'A Up', + } + for m in macros: + if not isinstance(m, dict): continue + fn = m.get('file_name') + if isinstance(fn, str) and fn in renames: + m['file_name'] = renames[fn] + nm = m.get('name') + if isinstance(nm, str) and nm in display_renames: + m['name'] = display_renames[nm] + config['version'] = self.version.split('b')[0] config['full_version'] = self.version