diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2018-01-08 20:50:31 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2018-01-10 19:30:51 -0500 |
commit | 02b141ac43317cb5bd9f926c450dbed3b8fcb733 (patch) | |
tree | 50aac876f6a653fbd89042793d0dd90e6e2d7a44 /klippy/chipmisc.py | |
parent | 47e458210ec27f04616242266aeb64c8c56cd351 (diff) | |
download | kutter-02b141ac43317cb5bd9f926c450dbed3b8fcb733.tar.gz kutter-02b141ac43317cb5bd9f926c450dbed3b8fcb733.tar.xz kutter-02b141ac43317cb5bd9f926c450dbed3b8fcb733.zip |
chipmisc: Fix replicape enable line setup
The enable lines are not one per stepper - instead there are 5
distinct enable settings. Handle them properly.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/chipmisc.py')
-rw-r--r-- | klippy/chipmisc.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/klippy/chipmisc.py b/klippy/chipmisc.py index 82ec70d4..cbbb4d75 100644 --- a/klippy/chipmisc.py +++ b/klippy/chipmisc.py @@ -338,13 +338,14 @@ class Replicape: "power_fan2": (pca9685_pwm, 9), "power_fan3": (pca9685_pwm, 10) } # Setup stepper config self.stepper_dacs = {} - shift_registers = [1] * 5 + shift_registers = [1, 0, 0, 1, 1] for port, name in enumerate('xyzeh'): prefix = 'stepper_%s_' % (name,) sc = config.getchoice( prefix + 'microstep_mode', ReplicapeStepConfig, 'disable') if sc is None: continue + sc |= shift_registers[port] if config.getboolean(prefix + 'chopper_off_time_high', False): sc |= 1<<3 if config.getboolean(prefix + 'chopper_hysteresis_high', False): @@ -358,6 +359,14 @@ class Replicape: self.stepper_dacs[channel] = cur / REPLICAPE_MAX_CURRENT self.pins[prefix + 'enable'] = (ReplicapeDACEnable, channel) self.enabled_channels = {ch: False for cl, ch in self.pins.values()} + if [i for i in [0, 1, 2] if 11+i in self.stepper_dacs]: + # Enable xyz steppers + shift_registers[0] &= ~1 + if [i for i in [3, 4] if 11+i in self.stepper_dacs]: + # Enable eh steppers + shift_registers[3] &= ~1 + if config.getboolean('standstill_power_down', False): + shift_registers[4] &= ~1 shift_registers.reverse() self.host_mcu.add_config_cmd("send_spi bus=%d dev=%d msg=%s" % ( REPLICAPE_SHIFT_REGISTER_BUS, REPLICAPE_SHIFT_REGISTER_DEVICE, |