1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-12-18 00:07:50 +00:00

Update powersupply_on in power_on/off (#10015)

Fix #10004
This commit is contained in:
Scott Lahteine 2018-03-08 18:56:47 -06:00 committed by GitHub
parent 42608b1925
commit 3c2bfa5e53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 19 deletions

View File

@ -42,15 +42,6 @@ void idle(
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
#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)
@ -220,6 +211,19 @@ extern millis_t max_inactive_time, stepper_inactive_time;
extern int lpq_len;
#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);
#if HAS_SUICIDE

View File

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

View File

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

View File

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

View File

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