Fix up PSU_CONTROL checks

This commit is contained in:
Scott Lahteine 2019-10-22 15:43:37 -05:00
parent 62b875f918
commit af214ff121
11 changed files with 21 additions and 17 deletions

View file

@ -219,7 +219,7 @@ void setup_powerhold() {
#if HAS_SUICIDE
OUT_WRITE(SUICIDE_PIN, HIGH);
#endif
#if HAS_POWER_SWITCH
#if ENABLED(PSU_CONTROL)
#if ENABLED(PS_DEFAULT_OFF)
powersupply_on = true; PSU_OFF();
#else
@ -721,7 +721,7 @@ void minkill(const bool steppers_off/*=false*/) {
// Power off all steppers (for M112) or just the E steppers
steppers_off ? disable_all_steppers() : disable_e_steppers();
#if HAS_POWER_SWITCH
#if ENABLED(PSU_CONTROL)
PSU_OFF();
#endif

View file

@ -351,7 +351,7 @@ extern millis_t max_inactive_time, stepper_inactive_time;
extern uint8_t controllerfan_speed;
#endif
#if HAS_POWER_SWITCH
#if ENABLED(PSU_CONTROL)
extern bool powersupply_on;
#define PSU_PIN_ON() do{ OUT_WRITE(PS_ON_PIN, PSU_ACTIVE_HIGH); powersupply_on = true; }while(0)
#define PSU_PIN_OFF() do{ OUT_WRITE(PS_ON_PIN, !PSU_ACTIVE_HIGH); powersupply_on = false; }while(0)

View file

@ -35,7 +35,7 @@
#include "../../Marlin.h"
#endif
#if HAS_POWER_SWITCH
#if ENABLED(PSU_CONTROL)
#if ENABLED(AUTO_POWER_CONTROL)
#include "../../feature/power.h"
@ -81,7 +81,7 @@
#endif
}
#endif // HAS_POWER_SWITCH
#endif // ENABLED(PSU_CONTROL)
/**
* M81: Turn off Power, including Power Supply, if there is one.
@ -105,7 +105,7 @@ void GcodeSuite::M81() {
#if HAS_SUICIDE
suicide();
#elif HAS_POWER_SWITCH
#elif ENABLED(PSU_CONTROL)
PSU_OFF();
#endif

View file

@ -471,7 +471,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
#endif
#endif // BARICUDA
#if HAS_POWER_SWITCH
#if ENABLED(PSU_CONTROL)
case 80: M80(); break; // M80: Turn on Power Supply
#endif
case 81: M81(); break; // M81: Turn off Power, including Power Supply, if possible

View file

@ -548,7 +548,7 @@ private:
static void M78();
#endif
#if HAS_POWER_SWITCH
#if ENABLED(PSU_CONTROL)
static void M80();
#endif

View file

@ -112,7 +112,7 @@ void GcodeSuite::M115() {
// SOFTWARE_POWER (M80, M81)
cap_line(PSTR("SOFTWARE_POWER")
#if HAS_POWER_SWITCH
#if ENABLED(PSU_CONTROL)
, true
#endif
);

View file

@ -120,7 +120,7 @@
#define DOGLCD
#define IS_ULTIPANEL
#define LED_COLORS_REDUCE_GREEN
#if HAS_POWER_SWITCH && EITHER(FYSETC_MINI_12864_2_0, FYSETC_MINI_12864_2_1)
#if ENABLED(PSU_CONTROL) && EITHER(FYSETC_MINI_12864_2_0, FYSETC_MINI_12864_2_1)
#define LED_BACKLIGHT_TIMEOUT 10000
#endif

View file

@ -333,8 +333,6 @@
#endif
#endif
#define HAS_POWER_SWITCH (ENABLED(PSU_CONTROL) && PIN_EXISTS(PS_ON))
/**
* Temp Sensor defines
*/

View file

@ -1591,7 +1591,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
/**
* LED Backlight Timeout
*/
#if defined(LED_BACKLIGHT_TIMEOUT) && !(EITHER(FYSETC_MINI_12864_2_0, FYSETC_MINI_12864_2_1) && HAS_POWER_SWITCH)
#if defined(LED_BACKLIGHT_TIMEOUT) && !(EITHER(FYSETC_MINI_12864_2_0, FYSETC_MINI_12864_2_1) && ENABLED(PSU_CONTROL))
#error "LED_BACKLIGHT_TIMEOUT requires a FYSETC Mini Panel and a Power Switch."
#endif
@ -2467,8 +2467,14 @@ static_assert( _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2)
/**
* Ensure this option is set intentionally
*/
#if ENABLED(PSU_CONTROL) && !defined(PSU_ACTIVE_HIGH)
#error "PSU_CONTROL requires PSU_ACTIVE_HIGH to be defined as 'true' or 'false'."
#if ENABLED(PSU_CONTROL)
#ifndef PSU_ACTIVE_HIGH
#error "PSU_CONTROL requires PSU_ACTIVE_HIGH to be defined as 'true' or 'false'."
#elif !PIN_EXISTS(PS_ON)
#error "PSU_CONTROL requires PS_ON_PIN."
#endif
#elif ENABLED(AUTO_POWER_CONTROL)
#error "AUTO_POWER_CONTROL requires PSU_CONTROL."
#endif
#if HAS_CUTTER

View file

@ -199,7 +199,7 @@ void menu_main() {
//
// Switch power on/off
//
#if HAS_POWER_SWITCH
#if ENABLED(PSU_CONTROL)
if (powersupply_on)
GCODES_ITEM(MSG_SWITCH_PS_OFF, PSTR("M81"));
else

View file

@ -552,7 +552,7 @@
#define BTN_EN2 7
#define BTN_ENC 39
#define SD_DETECT_PIN -1 // Pin 49 for display sd interface, 72 for easy adapter board
#define SD_DETECT_PIN -1 // Pin 49 for display SD interface, 72 for easy adapter board
#define KILL_PIN 31
#elif ENABLED(ELB_FULL_GRAPHIC_CONTROLLER)