Browse Source

Finish AUTO_POWER_CONTROL implementation

Followup to #9503
Scott Lahteine 7 years ago
parent
commit
73cd34b121
2 changed files with 20 additions and 0 deletions
  1. 7
    0
      Marlin/src/Marlin.cpp
  2. 13
    0
      Marlin/src/module/planner.cpp

+ 7
- 0
Marlin/src/Marlin.cpp View File

@@ -272,6 +272,9 @@ void quickstop_stepper() {
272 272
 }
273 273
 
274 274
 void enable_all_steppers() {
275
+  #if ENABLED(AUTO_POWER_CONTROL)
276
+    powerManager.power_on();
277
+  #endif
275 278
   enable_X();
276 279
   enable_Y();
277 280
   enable_Z();
@@ -411,6 +414,10 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
411 414
     controllerfan_update(); // Check if fan should be turned on to cool stepper drivers down
412 415
   #endif
413 416
 
417
+  #if ENABLED(AUTO_POWER_CONTROL)
418
+    powerManager.check();
419
+  #endif
420
+
414 421
   #if ENABLED(EXTRUDER_RUNOUT_PREVENT)
415 422
     if (thermalManager.degHotend(active_extruder) > EXTRUDER_RUNOUT_MINTEMP
416 423
       && ELAPSED(ms, gcode.previous_cmd_ms + (EXTRUDER_RUNOUT_SECONDS) * 1000UL)

+ 13
- 0
Marlin/src/module/planner.cpp View File

@@ -84,6 +84,10 @@
84 84
   #include "../feature/mixing.h"
85 85
 #endif
86 86
 
87
+#if ENABLED(AUTO_POWER_CONTROL)
88
+  #include "../feature/power.h"
89
+#endif
90
+
87 91
 Planner planner;
88 92
 
89 93
   // public:
@@ -860,6 +864,11 @@ void Planner::_buffer_steps(const int32_t (&target)[ABCE], float fr_mm_s, const
860 864
 
861 865
   block->active_extruder = extruder;
862 866
 
867
+  #if ENABLED(AUTO_POWER_CONTROL)
868
+    if (block->steps[X_AXIS] || block->steps[Y_AXIS] || block->steps[Z_AXIS])
869
+        powerManager.power_on();
870
+  #endif
871
+
863 872
   //enable active axes
864 873
   #if CORE_IS_XY
865 874
     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
892 901
   // Enable extruder(s)
893 902
   if (esteps) {
894 903
 
904
+    #if ENABLED(AUTO_POWER_CONTROL)
905
+      powerManager.power_on();
906
+    #endif
907
+
895 908
     #if ENABLED(DISABLE_INACTIVE_EXTRUDER) // Enable only the selected extruder
896 909
 
897 910
       #define DISABLE_IDLE_E(N) if (!g_uc_extruder_last_move[N]) disable_E##N();

Loading…
Cancel
Save