Browse Source

Update powersupply_on in power_on/off (#10015)

Fix #10004
pull/1/head
Scott Lahteine 7 years ago
committed by GitHub
parent
commit
3c2bfa5e53
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 22
      Marlin/src/Marlin.h
  2. 4
      Marlin/src/feature/power.cpp
  3. 3
      Marlin/src/gcode/control/M80_M81.cpp
  4. 4
      Marlin/src/lcd/ultralcd.cpp
  5. 2
      Marlin/src/module/planner.cpp

22
Marlin/src/Marlin.h

@ -42,15 +42,6 @@ void idle(
void manage_inactivity(bool ignore_stepper_queue = false); void manage_inactivity(bool ignore_stepper_queue = false);
// Auto Power Control
#if ENABLED(AUTO_POWER_CONTROL)
#define PSU_ON() powerManager.power_on()
#define PSU_OFF() powerManager.power_off()
#else
#define PSU_ON() OUT_WRITE(PS_ON_PIN, PS_ON_AWAKE)
#define PSU_OFF() OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP)
#endif
#if HAS_X2_ENABLE #if HAS_X2_ENABLE
#define enable_X() do{ X_ENABLE_WRITE( X_ENABLE_ON); X2_ENABLE_WRITE( X_ENABLE_ON); }while(0) #define enable_X() do{ X_ENABLE_WRITE( X_ENABLE_ON); X2_ENABLE_WRITE( X_ENABLE_ON); }while(0)
#define disable_X() do{ X_ENABLE_WRITE(!X_ENABLE_ON); X2_ENABLE_WRITE(!X_ENABLE_ON); axis_known_position[X_AXIS] = false; }while(0) #define disable_X() do{ X_ENABLE_WRITE(!X_ENABLE_ON); X2_ENABLE_WRITE(!X_ENABLE_ON); axis_known_position[X_AXIS] = false; }while(0)
@ -220,6 +211,19 @@ extern millis_t max_inactive_time, stepper_inactive_time;
extern int lpq_len; extern int lpq_len;
#endif #endif
#if HAS_POWER_SWITCH
extern bool powersupply_on;
#define PSU_PIN_ON() do{ OUT_WRITE(PS_ON_PIN, PS_ON_AWAKE); powersupply_on = true; }while(0)
#define PSU_PIN_OFF() do{ OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP); powersupply_on = false; }while(0)
#if ENABLED(AUTO_POWER_CONTROL)
#define PSU_ON() powerManager.power_on()
#define PSU_OFF() powerManager.power_off()
#else
#define PSU_ON() PSU_PIN_ON()
#define PSU_OFF() PSU_PIN_OFF()
#endif
#endif
bool pin_is_protected(const pin_t pin); bool pin_is_protected(const pin_t pin);
#if HAS_SUICIDE #if HAS_SUICIDE

4
Marlin/src/feature/power.cpp

@ -87,11 +87,11 @@ void Power::check() {
void Power::power_on() { void Power::power_on() {
lastPowerOn = millis(); lastPowerOn = millis();
OUT_WRITE(PS_ON_PIN, PS_ON_AWAKE); PSU_PIN_ON();
} }
void Power::power_off() { void Power::power_off() {
OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP); PSU_PIN_OFF();
} }
#endif // AUTO_POWER_CONTROL #endif // AUTO_POWER_CONTROL

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

@ -86,8 +86,6 @@
tmc2208_init(); tmc2208_init();
#endif #endif
powersupply_on = true;
#if ENABLED(ULTIPANEL) #if ENABLED(ULTIPANEL)
LCD_MESSAGEPGM(WELCOME_MSG); LCD_MESSAGEPGM(WELCOME_MSG);
#endif #endif
@ -119,7 +117,6 @@ void GcodeSuite::M81() {
suicide(); suicide();
#elif HAS_POWER_SWITCH #elif HAS_POWER_SWITCH
PSU_OFF(); PSU_OFF();
powersupply_on = false;
#endif #endif
#if ENABLED(ULTIPANEL) #if ENABLED(ULTIPANEL)

4
Marlin/src/lcd/ultralcd.cpp

@ -175,10 +175,6 @@ uint16_t max_display_update_time = 0;
#define TALL_FONT_CORRECTION 0 #define TALL_FONT_CORRECTION 0
#endif #endif
#if HAS_POWER_SWITCH
extern bool powersupply_on;
#endif
bool no_reentry = false; bool no_reentry = false;
constexpr int8_t menu_bottom = LCD_HEIGHT - (TALL_FONT_CORRECTION); constexpr int8_t menu_bottom = LCD_HEIGHT - (TALL_FONT_CORRECTION);

2
Marlin/src/module/planner.cpp

@ -894,7 +894,7 @@ void Planner::_buffer_steps(const int32_t (&target)[XYZE]
#if ENABLED(AUTO_POWER_CONTROL) #if ENABLED(AUTO_POWER_CONTROL)
if (block->steps[X_AXIS] || block->steps[Y_AXIS] || block->steps[Z_AXIS]) if (block->steps[X_AXIS] || block->steps[Y_AXIS] || block->steps[Z_AXIS])
powerManager.power_on(); powerManager.power_on();
#endif #endif
//enable active axes //enable active axes

Loading…
Cancel
Save