Browse Source

Fix up PSU_CONTROL checks

pull/1/head
Scott Lahteine 5 years ago
parent
commit
af214ff121
  1. 4
      Marlin/src/Marlin.cpp
  2. 2
      Marlin/src/Marlin.h
  3. 6
      Marlin/src/gcode/control/M80_M81.cpp
  4. 2
      Marlin/src/gcode/gcode.cpp
  5. 2
      Marlin/src/gcode/gcode.h
  6. 2
      Marlin/src/gcode/host/M115.cpp
  7. 2
      Marlin/src/inc/Conditionals_LCD.h
  8. 2
      Marlin/src/inc/Conditionals_post.h
  9. 12
      Marlin/src/inc/SanityCheck.h
  10. 2
      Marlin/src/lcd/menu/menu_main.cpp
  11. 2
      Marlin/src/pins/ramps/pins_RAMPS.h

4
Marlin/src/Marlin.cpp

@ -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

2
Marlin/src/Marlin.h

@ -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)

6
Marlin/src/gcode/control/M80_M81.cpp

@ -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

2
Marlin/src/gcode/gcode.cpp

@ -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

2
Marlin/src/gcode/gcode.h

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

2
Marlin/src/gcode/host/M115.cpp

@ -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
);

2
Marlin/src/inc/Conditionals_LCD.h

@ -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

2
Marlin/src/inc/Conditionals_post.h

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

12
Marlin/src/inc/SanityCheck.h

@ -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

2
Marlin/src/lcd/menu/menu_main.cpp

@ -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

2
Marlin/src/pins/ramps/pins_RAMPS.h

@ -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)

Loading…
Cancel
Save