From 17a534e42b91b54673164305faeabb8f8c089f75 Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Mon, 25 Mar 2019 23:28:25 +0100 Subject: [PATCH] "disable_z()" for Delta PSU II --- Firmware/Marlin_main.cpp | 4 +++- Firmware/io_atmega2560.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 303d4693..d119fbe4 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1316,7 +1316,7 @@ void setup() } #endif //TMC2130 -#if defined(Z_AXIS_ALWAYS_ON) +#if defined(Z_AXIS_ALWAYS_ON) && !defined(PSU_Delta) enable_z(); #endif farm_mode = eeprom_read_byte((uint8_t*)EEPROM_FARM_MODE); @@ -9608,6 +9608,8 @@ void disable_force_z() { uint16_t z_microsteps=0; +if(PIN_INQ(Z_ENABLE_PIN)!=Z_ENABLE_ON) + return; // motor already disabled (may be ;-p ) #ifdef TMC2130 z_microsteps=tmc2130_rd_MSCNT(Z_TMC2130_CS); #endif //TMC2130 diff --git a/Firmware/io_atmega2560.h b/Firmware/io_atmega2560.h index e8c756ff..e353eb05 100644 --- a/Firmware/io_atmega2560.h +++ b/Firmware/io_atmega2560.h @@ -368,6 +368,7 @@ #define PIN_SET(pin) PORT(pin) |= __MSK(pin) #define PIN_VAL(pin, val) if (val) PIN_SET(pin); else PIN_CLR(pin); #define PIN_GET(pin) (PIN(pin) & __MSK(pin)) +#define PIN_INQ(pin) (PORT(pin) & __MSK(pin)) #endif //_IO_ATMEGA2560