From 82fb0460132a6b42491fb578045e573ef68b6a56 Mon Sep 17 00:00:00 2001 From: InsanityAutomation <38436470+InsanityAutomation@users.noreply.github.com> Date: Thu, 24 Oct 2019 15:07:28 -0400 Subject: [PATCH] Allow suicide pin inverting (#15586) --- Marlin/src/Marlin.cpp | 2 +- Marlin/src/Marlin.h | 2 +- Marlin/src/gcode/control/M80_M81.cpp | 2 +- Marlin/src/pins/pins.h | 3 +++ Marlin/src/pins/ramps/pins_RAMPS_CREALITY.h | 26 +++++++++++++++------ 5 files changed, 25 insertions(+), 10 deletions(-) diff --git a/Marlin/src/Marlin.cpp b/Marlin/src/Marlin.cpp index 3ef57766e..62bc10ee0 100644 --- a/Marlin/src/Marlin.cpp +++ b/Marlin/src/Marlin.cpp @@ -217,7 +217,7 @@ void setup_killpin() { void setup_powerhold() { #if HAS_SUICIDE - OUT_WRITE(SUICIDE_PIN, HIGH); + OUT_WRITE(SUICIDE_PIN, !SUICIDE_PIN_INVERTING); #endif #if ENABLED(PSU_CONTROL) #if ENABLED(PS_DEFAULT_OFF) diff --git a/Marlin/src/Marlin.h b/Marlin/src/Marlin.h index b036e8114..9887dbebd 100644 --- a/Marlin/src/Marlin.h +++ b/Marlin/src/Marlin.h @@ -368,7 +368,7 @@ bool pin_is_protected(const pin_t pin); void protected_pin_err(); #if HAS_SUICIDE - inline void suicide() { OUT_WRITE(SUICIDE_PIN, LOW); } + inline void suicide() { OUT_WRITE(SUICIDE_PIN, SUICIDE_PIN_INVERTING); } #endif #if ENABLED(G29_RETRY_AND_RECOVER) diff --git a/Marlin/src/gcode/control/M80_M81.cpp b/Marlin/src/gcode/control/M80_M81.cpp index 9b27b5e4e..28d335e81 100644 --- a/Marlin/src/gcode/control/M80_M81.cpp +++ b/Marlin/src/gcode/control/M80_M81.cpp @@ -68,7 +68,7 @@ * a print without suicide... */ #if HAS_SUICIDE - OUT_WRITE(SUICIDE_PIN, HIGH); + OUT_WRITE(SUICIDE_PIN, !SUICIDE_PIN_INVERTING); #endif #if DISABLED(AUTO_POWER_CONTROL) diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 7f6833080..83b226b86 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -801,6 +801,9 @@ #ifndef SUICIDE_PIN #define SUICIDE_PIN -1 #endif +#ifndef SUICIDE_PIN_INVERTING + #define SUICIDE_PIN_INVERTING false +#endif #ifndef NUM_SERVO_PLUGS #define NUM_SERVO_PLUGS 4 diff --git a/Marlin/src/pins/ramps/pins_RAMPS_CREALITY.h b/Marlin/src/pins/ramps/pins_RAMPS_CREALITY.h index 379d2b471..1328354b7 100644 --- a/Marlin/src/pins/ramps/pins_RAMPS_CREALITY.h +++ b/Marlin/src/pins/ramps/pins_RAMPS_CREALITY.h @@ -36,15 +36,27 @@ #define FIL_RUNOUT_PIN 2 #if NUM_RUNOUT_SENSORS > 1 - #define FIL_RUNOUT2_PIN 15 // Creality CR-X can use dual runout sensors + #define FIL_RUNOUT2_PIN 15 // Creality CR-X can use dual runout sensors #endif -#define SD_DETECT_PIN 49 // Always define onboard SD detect -#define BEEPER_PIN 37 // Always define beeper pin so Play Tone works with ExtUI +#define SD_DETECT_PIN 49 // Always define onboard SD detect + +#define PS_ON_PIN 40 // Used by CR2020 Industrial series + +#if ENABLED(CASE_LIGHT_ENABLE) && !defined(CASE_LIGHT_PIN) + #define CASE_LIGHT_PIN 65 +#endif #include "pins_RAMPS.h" -#define EXP1_PIN 65 // A11 -#define EXP2_PIN 66 // A12 -#define EXP3_PIN 11 // SERVO0_PIN -#define EXP4_PIN 12 // PS_ON_PIN +#ifndef BEEPER_PIN + #define BEEPER_PIN 37 // Always define beeper pin so Play Tone works with ExtUI +#endif + +#define EXP1_PIN 65 // A11 - Used by CR2020 Industrial series for case +#define EXP2_PIN 66 // A12 +#define EXP3_PIN 11 // SERVO0_PIN +#define EXP4_PIN 12 // PS_ON_PIN + +#define SUICIDE_PIN 12 // Used by CR2020 Industrial series +#define SUICIDE_PIN_INVERTING true // Used by CR2020 Industrial series