ExternalAxis: virtual A axis through gplan, mirrored on the ESP
ExternalAxis exposes the auxcnc-driven ESP stepper as motor 4 (a
synthetic, host-only motor that gplan sees but the AVR doesn't). The
result is a virtual A axis that is fully integrated with the planner:
G1 A25 F1500 schedules a coordinated S-curve and the ESP runs the
exact same 7-segment trajectory the AVR would have run if A were a
real motor.
- ExternalAxis.py: synthetic-motor state, S-curve LINE block forward
to the ESP, soft-limit enforcement, option-(b) homing (user A=0
at the home limit).
- State: walk motors 0..4 in find_motor; clear both homed and h on
reset; expose synthetic motor vars.
- axis-vars.js: motor-4 guard so the JS computed axis bindings don't
throw when motor 4 has no entry in config.motors; resolve motor_id
for the synthetic axis by scanning state['4an'].
- Ctrl: instantiate ExternalAxis after AuxAxis, share the axis_letter
setting, wire AuxAxis state observer.
- Web: route /api/aux/{home,jog,move} through ExternalAxis when it
is enabled so the DRO and synthetic-motor flags stay in sync.
This commit is contained in:
@@ -75,6 +75,19 @@ class Ctrl(object):
|
||||
self.hooks = bbctrl.Hooks(self)
|
||||
with Trace.span('ctrl.aux'):
|
||||
self.aux = bbctrl.AuxAxis(self)
|
||||
with Trace.span('ctrl.ext_axis'):
|
||||
# ExternalAxis exposes the auxcnc ESP stepper as a
|
||||
# virtual A axis that gplan handles natively. Created
|
||||
# unconditionally so State sees the synthetic motor
|
||||
# vars even when aux is disabled (kept inert in that
|
||||
# case via ext_axis.enabled).
|
||||
axis_letter = self.aux._cfg.get('axis_letter', 'a')
|
||||
self.ext_axis = bbctrl.ExternalAxis(
|
||||
self, self.aux, axis_letter=axis_letter)
|
||||
# Hook AuxAxis post-publish callback so homed flag
|
||||
# mirrors into State after homing.
|
||||
self.aux.set_state_observer(
|
||||
self.ext_axis.refresh_homed)
|
||||
|
||||
with Trace.span('ctrl.mach.connect'):
|
||||
self.mach.connect()
|
||||
@@ -132,6 +145,8 @@ class Ctrl(object):
|
||||
|
||||
|
||||
def close(self):
|
||||
try: self.ext_axis.close()
|
||||
except Exception: pass
|
||||
try: self.aux.close()
|
||||
except Exception: pass
|
||||
self.log.get('Ctrl').info('Closing %s' % self.id)
|
||||
|
||||
Reference in New Issue
Block a user