From 73cd34b121023feb9cff4faec505138013a6b232 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 19 Feb 2018 16:12:04 -0600 Subject: [PATCH] Finish AUTO_POWER_CONTROL implementation Followup to #9503 --- Marlin/src/Marlin.cpp | 7 +++++++ Marlin/src/module/planner.cpp | 13 +++++++++++++ 2 files changed, 20 insertions(+) diff --git a/Marlin/src/Marlin.cpp b/Marlin/src/Marlin.cpp index 671fd00702..ddfb0232d9 100644 --- a/Marlin/src/Marlin.cpp +++ b/Marlin/src/Marlin.cpp @@ -272,6 +272,9 @@ void quickstop_stepper() { } void enable_all_steppers() { + #if ENABLED(AUTO_POWER_CONTROL) + powerManager.power_on(); + #endif enable_X(); enable_Y(); enable_Z(); @@ -411,6 +414,10 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) { controllerfan_update(); // Check if fan should be turned on to cool stepper drivers down #endif + #if ENABLED(AUTO_POWER_CONTROL) + powerManager.check(); + #endif + #if ENABLED(EXTRUDER_RUNOUT_PREVENT) if (thermalManager.degHotend(active_extruder) > EXTRUDER_RUNOUT_MINTEMP && ELAPSED(ms, gcode.previous_cmd_ms + (EXTRUDER_RUNOUT_SECONDS) * 1000UL) diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index 8d01afad7e..e06b0f43f5 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -84,6 +84,10 @@ #include "../feature/mixing.h" #endif +#if ENABLED(AUTO_POWER_CONTROL) + #include "../feature/power.h" +#endif + Planner planner; // public: @@ -860,6 +864,11 @@ void Planner::_buffer_steps(const int32_t (&target)[ABCE], float fr_mm_s, const block->active_extruder = extruder; + #if ENABLED(AUTO_POWER_CONTROL) + if (block->steps[X_AXIS] || block->steps[Y_AXIS] || block->steps[Z_AXIS]) + powerManager.power_on(); + #endif + //enable active axes #if CORE_IS_XY if (block->steps[A_AXIS] || block->steps[B_AXIS]) { @@ -892,6 +901,10 @@ void Planner::_buffer_steps(const int32_t (&target)[ABCE], float fr_mm_s, const // Enable extruder(s) if (esteps) { + #if ENABLED(AUTO_POWER_CONTROL) + powerManager.power_on(); + #endif + #if ENABLED(DISABLE_INACTIVE_EXTRUDER) // Enable only the selected extruder #define DISABLE_IDLE_E(N) if (!g_uc_extruder_last_move[N]) disable_E##N();