Browse Source

[2.0.x] Enable / disable PSU automatically (#9503)

Scott Lahteine 6 years ago
parent
commit
b5e92f4f90
No account linked to committer's email address
61 changed files with 664 additions and 4 deletions
  1. 9
    0
      Marlin/Configuration.h
  2. 2
    2
      Marlin/src/Marlin.cpp
  3. 9
    0
      Marlin/src/Marlin.h
  4. 9
    0
      Marlin/src/config/default/Configuration.h
  5. 9
    0
      Marlin/src/config/examples/AlephObjects/TAZ4/Configuration.h
  6. 9
    0
      Marlin/src/config/examples/AliExpress/CL-260/Configuration.h
  7. 9
    0
      Marlin/src/config/examples/Anet/A6/Configuration.h
  8. 9
    0
      Marlin/src/config/examples/Anet/A8/Configuration.h
  9. 9
    0
      Marlin/src/config/examples/Azteeg/X5GT/Configuration.h
  10. 9
    0
      Marlin/src/config/examples/BIBO/TouchX/Configuration.h
  11. 9
    0
      Marlin/src/config/examples/BQ/Hephestos/Configuration.h
  12. 9
    0
      Marlin/src/config/examples/BQ/Hephestos_2/Configuration.h
  13. 9
    0
      Marlin/src/config/examples/BQ/WITBOX/Configuration.h
  14. 9
    0
      Marlin/src/config/examples/Cartesio/Configuration.h
  15. 9
    0
      Marlin/src/config/examples/Creality/CR-10/Configuration.h
  16. 9
    0
      Marlin/src/config/examples/Creality/CR-10S/Configuration.h
  17. 9
    0
      Marlin/src/config/examples/Creality/Ender/Configuration.h
  18. 9
    0
      Marlin/src/config/examples/Felix/Configuration.h
  19. 9
    0
      Marlin/src/config/examples/Felix/DUAL/Configuration.h
  20. 9
    0
      Marlin/src/config/examples/FolgerTech/i3-2020/Configuration.h
  21. 9
    0
      Marlin/src/config/examples/Geeetech/GT2560/Configuration.h
  22. 9
    0
      Marlin/src/config/examples/Geeetech/I3_Pro_X-GT2560/Configuration.h
  23. 9
    0
      Marlin/src/config/examples/Infitary/i3-M508/Configuration.h
  24. 9
    0
      Marlin/src/config/examples/JGAurora/A5/Configuration.h
  25. 9
    0
      Marlin/src/config/examples/MakerParts/Configuration.h
  26. 9
    0
      Marlin/src/config/examples/Malyan/M150/Configuration.h
  27. 9
    0
      Marlin/src/config/examples/Malyan/M200/Configuration.h
  28. 9
    0
      Marlin/src/config/examples/Micromake/C1/basic/Configuration.h
  29. 9
    0
      Marlin/src/config/examples/Micromake/C1/enhanced/Configuration.h
  30. 9
    0
      Marlin/src/config/examples/Mks/Sbase/Configuration.h
  31. 9
    0
      Marlin/src/config/examples/RepRapWorld/Megatronics/Configuration.h
  32. 9
    0
      Marlin/src/config/examples/RigidBot/Configuration.h
  33. 9
    0
      Marlin/src/config/examples/SCARA/Configuration.h
  34. 9
    0
      Marlin/src/config/examples/STM32F10/Configuration.h
  35. 9
    0
      Marlin/src/config/examples/Sanguinololu/Configuration.h
  36. 9
    0
      Marlin/src/config/examples/TheBorg/Configuration.h
  37. 9
    0
      Marlin/src/config/examples/TinyBoy2/Configuration.h
  38. 9
    0
      Marlin/src/config/examples/Tronxy/X1/Configuration.h
  39. 9
    0
      Marlin/src/config/examples/UltiMachine/Archim2/Configuration.h
  40. 9
    0
      Marlin/src/config/examples/Velleman/K8200/Configuration.h
  41. 9
    0
      Marlin/src/config/examples/Velleman/K8400/Configuration.h
  42. 9
    0
      Marlin/src/config/examples/Velleman/K8400/Dual-head/Configuration.h
  43. 9
    0
      Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration.h
  44. 9
    0
      Marlin/src/config/examples/adafruit/ST7565/Configuration.h
  45. 9
    0
      Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration.h
  46. 9
    0
      Marlin/src/config/examples/delta/FLSUN/kossel/Configuration.h
  47. 9
    0
      Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration.h
  48. 9
    0
      Marlin/src/config/examples/delta/generic/Configuration.h
  49. 9
    0
      Marlin/src/config/examples/delta/kossel_mini/Configuration.h
  50. 9
    0
      Marlin/src/config/examples/delta/kossel_pro/Configuration.h
  51. 9
    0
      Marlin/src/config/examples/delta/kossel_xl/Configuration.h
  52. 9
    0
      Marlin/src/config/examples/gCreate/gMax1.5+/Configuration.h
  53. 9
    0
      Marlin/src/config/examples/makibox/Configuration.h
  54. 9
    0
      Marlin/src/config/examples/stm32f103ret6/Configuration.h
  55. 9
    0
      Marlin/src/config/examples/tvrrug/Round2/Configuration.h
  56. 9
    0
      Marlin/src/config/examples/wt150/Configuration.h
  57. 96
    0
      Marlin/src/feature/power.cpp
  58. 42
    0
      Marlin/src/feature/power.h
  59. 6
    2
      Marlin/src/gcode/control/M80_M81.cpp
  60. 8
    0
      Marlin/src/module/temperature.cpp
  61. 15
    0
      Marlin/src/module/temperature.h

+ 9
- 0
Marlin/Configuration.h View File

@@ -245,6 +245,15 @@
245 245
   // Enable this option to leave the PSU off at startup.
246 246
   // Power to steppers and heaters will need to be turned on with M80.
247 247
   //#define PS_DEFAULT_OFF
248
+
249
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
250
+  #if ENABLED(AUTO_POWER_CONTROL)
251
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
252
+    #define AUTO_POWER_E_FANS
253
+    #define AUTO_POWER_CONTROLLERFAN
254
+    #define POWER_TIMEOUT 30
255
+  #endif
256
+
248 257
 #endif
249 258
 
250 259
 // @section temperature

+ 2
- 2
Marlin/src/Marlin.cpp View File

@@ -236,9 +236,9 @@ void setup_powerhold() {
236 236
   #endif
237 237
   #if HAS_POWER_SWITCH
238 238
     #if ENABLED(PS_DEFAULT_OFF)
239
-      OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP);
239
+      PSU_OFF();
240 240
     #else
241
-      OUT_WRITE(PS_ON_PIN, PS_ON_AWAKE);
241
+      PSU_ON();
242 242
     #endif
243 243
   #endif
244 244
 }

+ 9
- 0
Marlin/src/Marlin.h View File

@@ -42,6 +42,15 @@ void idle(
42 42
 
43 43
 void manage_inactivity(bool ignore_stepper_queue = false);
44 44
 
45
+// Auto Power Control
46
+#if ENABLED(AUTO_POWER_CONTROL)
47
+  #define PSU_ON()  powerManager.power_on()
48
+  #define PSU_OFF() powerManager.power_off()
49
+#else
50
+  #define PSU_ON()  OUT_WRITE(PS_ON_PIN, PS_ON_AWAKE)
51
+  #define PSU_OFF() OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP)
52
+#endif
53
+
45 54
 #if HAS_X2_ENABLE
46 55
   #define  enable_X() do{ X_ENABLE_WRITE( X_ENABLE_ON); X2_ENABLE_WRITE( X_ENABLE_ON); }while(0)
47 56
   #define disable_X() do{ X_ENABLE_WRITE(!X_ENABLE_ON); X2_ENABLE_WRITE(!X_ENABLE_ON); axis_known_position[X_AXIS] = false; }while(0)

+ 9
- 0
Marlin/src/config/default/Configuration.h View File

@@ -245,6 +245,15 @@
245 245
   // Enable this option to leave the PSU off at startup.
246 246
   // Power to steppers and heaters will need to be turned on with M80.
247 247
   //#define PS_DEFAULT_OFF
248
+
249
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
250
+  #if ENABLED(AUTO_POWER_CONTROL)
251
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
252
+    #define AUTO_POWER_E_FANS
253
+    #define AUTO_POWER_CONTROLLERFAN
254
+    #define POWER_TIMEOUT 30
255
+  #endif
256
+
248 257
 #endif
249 258
 
250 259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/AlephObjects/TAZ4/Configuration.h View File

@@ -245,6 +245,15 @@
245 245
   // Enable this option to leave the PSU off at startup.
246 246
   // Power to steppers and heaters will need to be turned on with M80.
247 247
   //#define PS_DEFAULT_OFF
248
+
249
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
250
+  #if ENABLED(AUTO_POWER_CONTROL)
251
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
252
+    #define AUTO_POWER_E_FANS
253
+    #define AUTO_POWER_CONTROLLERFAN
254
+    #define POWER_TIMEOUT 30
255
+  #endif
256
+
248 257
 #endif
249 258
 
250 259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/AliExpress/CL-260/Configuration.h View File

@@ -245,6 +245,15 @@
245 245
   // Enable this option to leave the PSU off at startup.
246 246
   // Power to steppers and heaters will need to be turned on with M80.
247 247
   //#define PS_DEFAULT_OFF
248
+
249
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
250
+  #if ENABLED(AUTO_POWER_CONTROL)
251
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
252
+    #define AUTO_POWER_E_FANS
253
+    #define AUTO_POWER_CONTROLLERFAN
254
+    #define POWER_TIMEOUT 30
255
+  #endif
256
+
248 257
 #endif
249 258
 
250 259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Anet/A6/Configuration.h View File

@@ -245,6 +245,15 @@
245 245
   // Enable this option to leave the PSU off at startup.
246 246
   // Power to steppers and heaters will need to be turned on with M80.
247 247
   //#define PS_DEFAULT_OFF
248
+
249
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
250
+  #if ENABLED(AUTO_POWER_CONTROL)
251
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
252
+    #define AUTO_POWER_E_FANS
253
+    #define AUTO_POWER_CONTROLLERFAN
254
+    #define POWER_TIMEOUT 30
255
+  #endif
256
+
248 257
 #endif
249 258
 
250 259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Anet/A8/Configuration.h View File

@@ -246,6 +246,15 @@
246 246
   // Enable this option to leave the PSU off at startup.
247 247
   // Power to steppers and heaters will need to be turned on with M80.
248 248
   //#define PS_DEFAULT_OFF
249
+
250
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
251
+  #if ENABLED(AUTO_POWER_CONTROL)
252
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
253
+    #define AUTO_POWER_E_FANS
254
+    #define AUTO_POWER_CONTROLLERFAN
255
+    #define POWER_TIMEOUT 30
256
+  #endif
257
+
249 258
 #endif
250 259
 
251 260
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Azteeg/X5GT/Configuration.h View File

@@ -245,6 +245,15 @@
245 245
   // Enable this option to leave the PSU off at startup.
246 246
   // Power to steppers and heaters will need to be turned on with M80.
247 247
   //#define PS_DEFAULT_OFF
248
+
249
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
250
+  #if ENABLED(AUTO_POWER_CONTROL)
251
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
252
+    #define AUTO_POWER_E_FANS
253
+    #define AUTO_POWER_CONTROLLERFAN
254
+    #define POWER_TIMEOUT 30
255
+  #endif
256
+
248 257
 #endif
249 258
 
250 259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/BIBO/TouchX/Configuration.h View File

@@ -236,6 +236,15 @@
236 236
   // Enable this option to leave the PSU off at startup.
237 237
   // Power to steppers and heaters will need to be turned on with M80.
238 238
   //#define PS_DEFAULT_OFF
239
+
240
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
241
+  #if ENABLED(AUTO_POWER_CONTROL)
242
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
243
+    #define AUTO_POWER_E_FANS
244
+    #define AUTO_POWER_CONTROLLERFAN
245
+    #define POWER_TIMEOUT 30
246
+  #endif
247
+
239 248
 #endif
240 249
 
241 250
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/BQ/Hephestos/Configuration.h View File

@@ -245,6 +245,15 @@
245 245
   // Enable this option to leave the PSU off at startup.
246 246
   // Power to steppers and heaters will need to be turned on with M80.
247 247
   //#define PS_DEFAULT_OFF
248
+
249
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
250
+  #if ENABLED(AUTO_POWER_CONTROL)
251
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
252
+    #define AUTO_POWER_E_FANS
253
+    #define AUTO_POWER_CONTROLLERFAN
254
+    #define POWER_TIMEOUT 30
255
+  #endif
256
+
248 257
 #endif
249 258
 
250 259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/BQ/Hephestos_2/Configuration.h View File

@@ -244,6 +244,15 @@
244 244
   // Enable this option to leave the PSU off at startup.
245 245
   // Power to steppers and heaters will need to be turned on with M80.
246 246
   //#define PS_DEFAULT_OFF
247
+
248
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
249
+  #if ENABLED(AUTO_POWER_CONTROL)
250
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
251
+    #define AUTO_POWER_E_FANS
252
+    #define AUTO_POWER_CONTROLLERFAN
253
+    #define POWER_TIMEOUT 30
254
+  #endif
255
+
247 256
 #endif
248 257
 
249 258
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/BQ/WITBOX/Configuration.h View File

@@ -245,6 +245,15 @@
245 245
   // Enable this option to leave the PSU off at startup.
246 246
   // Power to steppers and heaters will need to be turned on with M80.
247 247
   //#define PS_DEFAULT_OFF
248
+
249
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
250
+  #if ENABLED(AUTO_POWER_CONTROL)
251
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
252
+    #define AUTO_POWER_E_FANS
253
+    #define AUTO_POWER_CONTROLLERFAN
254
+    #define POWER_TIMEOUT 30
255
+  #endif
256
+
248 257
 #endif
249 258
 
250 259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Cartesio/Configuration.h View File

@@ -246,6 +246,15 @@
246 246
   // Enable this option to leave the PSU off at startup.
247 247
   // Power to steppers and heaters will need to be turned on with M80.
248 248
   //#define PS_DEFAULT_OFF
249
+
250
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
251
+  #if ENABLED(AUTO_POWER_CONTROL)
252
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
253
+    #define AUTO_POWER_E_FANS
254
+    #define AUTO_POWER_CONTROLLERFAN
255
+    #define POWER_TIMEOUT 30
256
+  #endif
257
+
249 258
 #endif
250 259
 
251 260
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Creality/CR-10/Configuration.h View File

@@ -245,6 +245,15 @@
245 245
   // Enable this option to leave the PSU off at startup.
246 246
   // Power to steppers and heaters will need to be turned on with M80.
247 247
   //#define PS_DEFAULT_OFF
248
+
249
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
250
+  #if ENABLED(AUTO_POWER_CONTROL)
251
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
252
+    #define AUTO_POWER_E_FANS
253
+    #define AUTO_POWER_CONTROLLERFAN
254
+    #define POWER_TIMEOUT 30
255
+  #endif
256
+
248 257
 #endif
249 258
 
250 259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Creality/CR-10S/Configuration.h View File

@@ -236,6 +236,15 @@
236 236
   // Enable this option to leave the PSU off at startup.
237 237
   // Power to steppers and heaters will need to be turned on with M80.
238 238
   //#define PS_DEFAULT_OFF
239
+
240
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
241
+  #if ENABLED(AUTO_POWER_CONTROL)
242
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
243
+    #define AUTO_POWER_E_FANS
244
+    #define AUTO_POWER_CONTROLLERFAN
245
+    #define POWER_TIMEOUT 30
246
+  #endif
247
+
239 248
 #endif
240 249
 
241 250
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Creality/Ender/Configuration.h View File

@@ -236,6 +236,15 @@
236 236
   // Enable this option to leave the PSU off at startup.
237 237
   // Power to steppers and heaters will need to be turned on with M80.
238 238
   //#define PS_DEFAULT_OFF
239
+
240
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
241
+  #if ENABLED(AUTO_POWER_CONTROL)
242
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
243
+    #define AUTO_POWER_E_FANS
244
+    #define AUTO_POWER_CONTROLLERFAN
245
+    #define POWER_TIMEOUT 30
246
+  #endif
247
+
239 248
 #endif
240 249
 
241 250
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Felix/Configuration.h View File

@@ -245,6 +245,15 @@
245 245
   // Enable this option to leave the PSU off at startup.
246 246
   // Power to steppers and heaters will need to be turned on with M80.
247 247
   #define PS_DEFAULT_OFF
248
+
249
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
250
+  #if ENABLED(AUTO_POWER_CONTROL)
251
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
252
+    #define AUTO_POWER_E_FANS
253
+    #define AUTO_POWER_CONTROLLERFAN
254
+    #define POWER_TIMEOUT 30
255
+  #endif
256
+
248 257
 #endif
249 258
 
250 259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Felix/DUAL/Configuration.h View File

@@ -245,6 +245,15 @@
245 245
   // Enable this option to leave the PSU off at startup.
246 246
   // Power to steppers and heaters will need to be turned on with M80.
247 247
   #define PS_DEFAULT_OFF
248
+
249
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
250
+  #if ENABLED(AUTO_POWER_CONTROL)
251
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
252
+    #define AUTO_POWER_E_FANS
253
+    #define AUTO_POWER_CONTROLLERFAN
254
+    #define POWER_TIMEOUT 30
255
+  #endif
256
+
248 257
 #endif
249 258
 
250 259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/FolgerTech/i3-2020/Configuration.h View File

@@ -246,6 +246,15 @@
246 246
   // Enable this option to leave the PSU off at startup.
247 247
   // Power to steppers and heaters will need to be turned on with M80.
248 248
   //#define PS_DEFAULT_OFF
249
+
250
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
251
+  #if ENABLED(AUTO_POWER_CONTROL)
252
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
253
+    #define AUTO_POWER_E_FANS
254
+    #define AUTO_POWER_CONTROLLERFAN
255
+    #define POWER_TIMEOUT 30
256
+  #endif
257
+
249 258
 #endif
250 259
 
251 260
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Geeetech/GT2560/Configuration.h View File

@@ -245,6 +245,15 @@
245 245
   // Enable this option to leave the PSU off at startup.
246 246
   // Power to steppers and heaters will need to be turned on with M80.
247 247
   //#define PS_DEFAULT_OFF
248
+
249
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
250
+  #if ENABLED(AUTO_POWER_CONTROL)
251
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
252
+    #define AUTO_POWER_E_FANS
253
+    #define AUTO_POWER_CONTROLLERFAN
254
+    #define POWER_TIMEOUT 30
255
+  #endif
256
+
248 257
 #endif
249 258
 
250 259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Geeetech/I3_Pro_X-GT2560/Configuration.h View File

@@ -245,6 +245,15 @@
245 245
   // Enable this option to leave the PSU off at startup.
246 246
   // Power to steppers and heaters will need to be turned on with M80.
247 247
   //#define PS_DEFAULT_OFF
248
+
249
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
250
+  #if ENABLED(AUTO_POWER_CONTROL)
251
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
252
+    #define AUTO_POWER_E_FANS
253
+    #define AUTO_POWER_CONTROLLERFAN
254
+    #define POWER_TIMEOUT 30
255
+  #endif
256
+
248 257
 #endif
249 258
 
250 259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Infitary/i3-M508/Configuration.h View File

@@ -245,6 +245,15 @@
245 245
   // Enable this option to leave the PSU off at startup.
246 246
   // Power to steppers and heaters will need to be turned on with M80.
247 247
   //#define PS_DEFAULT_OFF
248
+
249
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
250
+  #if ENABLED(AUTO_POWER_CONTROL)
251
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
252
+    #define AUTO_POWER_E_FANS
253
+    #define AUTO_POWER_CONTROLLERFAN
254
+    #define POWER_TIMEOUT 30
255
+  #endif
256
+
248 257
 #endif
249 258
 
250 259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/JGAurora/A5/Configuration.h View File

@@ -250,6 +250,15 @@
250 250
   // Enable this option to leave the PSU off at startup.
251 251
   // Power to steppers and heaters will need to be turned on with M80.
252 252
   //#define PS_DEFAULT_OFF
253
+
254
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
255
+  #if ENABLED(AUTO_POWER_CONTROL)
256
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
257
+    #define AUTO_POWER_E_FANS
258
+    #define AUTO_POWER_CONTROLLERFAN
259
+    #define POWER_TIMEOUT 30
260
+  #endif
261
+
253 262
 #endif
254 263
 
255 264
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/MakerParts/Configuration.h View File

@@ -256,6 +256,15 @@
256 256
   // Enable this option to leave the PSU off at startup.
257 257
   // Power to steppers and heaters will need to be turned on with M80.
258 258
   //#define PS_DEFAULT_OFF
259
+
260
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
261
+  #if ENABLED(AUTO_POWER_CONTROL)
262
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
263
+    #define AUTO_POWER_E_FANS
264
+    #define AUTO_POWER_CONTROLLERFAN
265
+    #define POWER_TIMEOUT 30
266
+  #endif
267
+
259 268
 #endif
260 269
 
261 270
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Malyan/M150/Configuration.h View File

@@ -250,6 +250,15 @@
250 250
   // Enable this option to leave the PSU off at startup.
251 251
   // Power to steppers and heaters will need to be turned on with M80.
252 252
   //#define PS_DEFAULT_OFF
253
+
254
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
255
+  #if ENABLED(AUTO_POWER_CONTROL)
256
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
257
+    #define AUTO_POWER_E_FANS
258
+    #define AUTO_POWER_CONTROLLERFAN
259
+    #define POWER_TIMEOUT 30
260
+  #endif
261
+
253 262
 #endif
254 263
 
255 264
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Malyan/M200/Configuration.h View File

@@ -236,6 +236,15 @@
236 236
   // Enable this option to leave the PSU off at startup.
237 237
   // Power to steppers and heaters will need to be turned on with M80.
238 238
   //#define PS_DEFAULT_OFF
239
+
240
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
241
+  #if ENABLED(AUTO_POWER_CONTROL)
242
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
243
+    #define AUTO_POWER_E_FANS
244
+    #define AUTO_POWER_CONTROLLERFAN
245
+    #define POWER_TIMEOUT 30
246
+  #endif
247
+
239 248
 #endif
240 249
 
241 250
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Micromake/C1/basic/Configuration.h View File

@@ -245,6 +245,15 @@
245 245
   // Enable this option to leave the PSU off at startup.
246 246
   // Power to steppers and heaters will need to be turned on with M80.
247 247
   //#define PS_DEFAULT_OFF
248
+
249
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
250
+  #if ENABLED(AUTO_POWER_CONTROL)
251
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
252
+    #define AUTO_POWER_E_FANS
253
+    #define AUTO_POWER_CONTROLLERFAN
254
+    #define POWER_TIMEOUT 30
255
+  #endif
256
+
248 257
 #endif
249 258
 
250 259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Micromake/C1/enhanced/Configuration.h View File

@@ -245,6 +245,15 @@
245 245
   // Enable this option to leave the PSU off at startup.
246 246
   // Power to steppers and heaters will need to be turned on with M80.
247 247
   //#define PS_DEFAULT_OFF
248
+
249
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
250
+  #if ENABLED(AUTO_POWER_CONTROL)
251
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
252
+    #define AUTO_POWER_E_FANS
253
+    #define AUTO_POWER_CONTROLLERFAN
254
+    #define POWER_TIMEOUT 30
255
+  #endif
256
+
248 257
 #endif
249 258
 
250 259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Mks/Sbase/Configuration.h View File

@@ -245,6 +245,15 @@
245 245
   // Enable this option to leave the PSU off at startup.
246 246
   // Power to steppers and heaters will need to be turned on with M80.
247 247
 #define PS_DEFAULT_OFF
248
+
249
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
250
+  #if ENABLED(AUTO_POWER_CONTROL)
251
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
252
+    #define AUTO_POWER_E_FANS
253
+    #define AUTO_POWER_CONTROLLERFAN
254
+    #define POWER_TIMEOUT 30
255
+  #endif
256
+
248 257
 #endif
249 258
 
250 259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/RepRapWorld/Megatronics/Configuration.h View File

@@ -245,6 +245,15 @@
245 245
   // Enable this option to leave the PSU off at startup.
246 246
   // Power to steppers and heaters will need to be turned on with M80.
247 247
   //#define PS_DEFAULT_OFF
248
+
249
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
250
+  #if ENABLED(AUTO_POWER_CONTROL)
251
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
252
+    #define AUTO_POWER_E_FANS
253
+    #define AUTO_POWER_CONTROLLERFAN
254
+    #define POWER_TIMEOUT 30
255
+  #endif
256
+
248 257
 #endif
249 258
 
250 259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/RigidBot/Configuration.h View File

@@ -248,6 +248,15 @@
248 248
   // Enable this option to leave the PSU off at startup.
249 249
   // Power to steppers and heaters will need to be turned on with M80.
250 250
   //#define PS_DEFAULT_OFF
251
+
252
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
253
+  #if ENABLED(AUTO_POWER_CONTROL)
254
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
255
+    #define AUTO_POWER_E_FANS
256
+    #define AUTO_POWER_CONTROLLERFAN
257
+    #define POWER_TIMEOUT 30
258
+  #endif
259
+
251 260
 #endif
252 261
 
253 262
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/SCARA/Configuration.h View File

@@ -275,6 +275,15 @@
275 275
   // Enable this option to leave the PSU off at startup.
276 276
   // Power to steppers and heaters will need to be turned on with M80.
277 277
   //#define PS_DEFAULT_OFF
278
+
279
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
280
+  #if ENABLED(AUTO_POWER_CONTROL)
281
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
282
+    #define AUTO_POWER_E_FANS
283
+    #define AUTO_POWER_CONTROLLERFAN
284
+    #define POWER_TIMEOUT 30
285
+  #endif
286
+
278 287
 #endif
279 288
 
280 289
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/STM32F10/Configuration.h View File

@@ -245,6 +245,15 @@
245 245
   // Enable this option to leave the PSU off at startup.
246 246
   // Power to steppers and heaters will need to be turned on with M80.
247 247
   //#define PS_DEFAULT_OFF
248
+
249
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
250
+  #if ENABLED(AUTO_POWER_CONTROL)
251
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
252
+    #define AUTO_POWER_E_FANS
253
+    #define AUTO_POWER_CONTROLLERFAN
254
+    #define POWER_TIMEOUT 30
255
+  #endif
256
+
248 257
 #endif
249 258
 
250 259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Sanguinololu/Configuration.h View File

@@ -245,6 +245,15 @@
245 245
   // Enable this option to leave the PSU off at startup.
246 246
   // Power to steppers and heaters will need to be turned on with M80.
247 247
   //#define PS_DEFAULT_OFF
248
+
249
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
250
+  #if ENABLED(AUTO_POWER_CONTROL)
251
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
252
+    #define AUTO_POWER_E_FANS
253
+    #define AUTO_POWER_CONTROLLERFAN
254
+    #define POWER_TIMEOUT 30
255
+  #endif
256
+
248 257
 #endif
249 258
 
250 259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/TheBorg/Configuration.h View File

@@ -245,6 +245,15 @@
245 245
   // Enable this option to leave the PSU off at startup.
246 246
   // Power to steppers and heaters will need to be turned on with M80.
247 247
   //#define PS_DEFAULT_OFF
248
+
249
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
250
+  #if ENABLED(AUTO_POWER_CONTROL)
251
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
252
+    #define AUTO_POWER_E_FANS
253
+    #define AUTO_POWER_CONTROLLERFAN
254
+    #define POWER_TIMEOUT 30
255
+  #endif
256
+
248 257
 #endif
249 258
 
250 259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/TinyBoy2/Configuration.h View File

@@ -267,6 +267,15 @@
267 267
   // Enable this option to leave the PSU off at startup.
268 268
   // Power to steppers and heaters will need to be turned on with M80.
269 269
   //#define PS_DEFAULT_OFF
270
+
271
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
272
+  #if ENABLED(AUTO_POWER_CONTROL)
273
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
274
+    #define AUTO_POWER_E_FANS
275
+    #define AUTO_POWER_CONTROLLERFAN
276
+    #define POWER_TIMEOUT 30
277
+  #endif
278
+
270 279
 #endif
271 280
 
272 281
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Tronxy/X1/Configuration.h View File

@@ -236,6 +236,15 @@
236 236
   // Enable this option to leave the PSU off at startup.
237 237
   // Power to steppers and heaters will need to be turned on with M80.
238 238
   //#define PS_DEFAULT_OFF
239
+
240
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
241
+  #if ENABLED(AUTO_POWER_CONTROL)
242
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
243
+    #define AUTO_POWER_E_FANS
244
+    #define AUTO_POWER_CONTROLLERFAN
245
+    #define POWER_TIMEOUT 30
246
+  #endif
247
+
239 248
 #endif
240 249
 
241 250
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/UltiMachine/Archim2/Configuration.h View File

@@ -236,6 +236,15 @@
236 236
   // Enable this option to leave the PSU off at startup.
237 237
   // Power to steppers and heaters will need to be turned on with M80.
238 238
   //#define PS_DEFAULT_OFF
239
+
240
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
241
+  #if ENABLED(AUTO_POWER_CONTROL)
242
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
243
+    #define AUTO_POWER_E_FANS
244
+    #define AUTO_POWER_CONTROLLERFAN
245
+    #define POWER_TIMEOUT 30
246
+  #endif
247
+
239 248
 #endif
240 249
 
241 250
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Velleman/K8200/Configuration.h View File

@@ -265,6 +265,15 @@
265 265
   // Enable this option to leave the PSU off at startup.
266 266
   // Power to steppers and heaters will need to be turned on with M80.
267 267
   //#define PS_DEFAULT_OFF
268
+
269
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
270
+  #if ENABLED(AUTO_POWER_CONTROL)
271
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
272
+    #define AUTO_POWER_E_FANS
273
+    #define AUTO_POWER_CONTROLLERFAN
274
+    #define POWER_TIMEOUT 30
275
+  #endif
276
+
268 277
 #endif
269 278
 
270 279
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Velleman/K8400/Configuration.h View File

@@ -245,6 +245,15 @@
245 245
   // Enable this option to leave the PSU off at startup.
246 246
   // Power to steppers and heaters will need to be turned on with M80.
247 247
   //#define PS_DEFAULT_OFF
248
+
249
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
250
+  #if ENABLED(AUTO_POWER_CONTROL)
251
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
252
+    #define AUTO_POWER_E_FANS
253
+    #define AUTO_POWER_CONTROLLERFAN
254
+    #define POWER_TIMEOUT 30
255
+  #endif
256
+
248 257
 #endif
249 258
 
250 259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Velleman/K8400/Dual-head/Configuration.h View File

@@ -245,6 +245,15 @@
245 245
   // Enable this option to leave the PSU off at startup.
246 246
   // Power to steppers and heaters will need to be turned on with M80.
247 247
   //#define PS_DEFAULT_OFF
248
+
249
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
250
+  #if ENABLED(AUTO_POWER_CONTROL)
251
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
252
+    #define AUTO_POWER_E_FANS
253
+    #define AUTO_POWER_CONTROLLERFAN
254
+    #define POWER_TIMEOUT 30
255
+  #endif
256
+
248 257
 #endif
249 258
 
250 259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration.h View File

@@ -236,6 +236,15 @@
236 236
   // Enable this option to leave the PSU off at startup.
237 237
   // Power to steppers and heaters will need to be turned on with M80.
238 238
   //#define PS_DEFAULT_OFF
239
+
240
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
241
+  #if ENABLED(AUTO_POWER_CONTROL)
242
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
243
+    #define AUTO_POWER_E_FANS
244
+    #define AUTO_POWER_CONTROLLERFAN
245
+    #define POWER_TIMEOUT 30
246
+  #endif
247
+
239 248
 #endif
240 249
 
241 250
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/adafruit/ST7565/Configuration.h View File

@@ -245,6 +245,15 @@
245 245
   // Enable this option to leave the PSU off at startup.
246 246
   // Power to steppers and heaters will need to be turned on with M80.
247 247
   //#define PS_DEFAULT_OFF
248
+
249
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
250
+  #if ENABLED(AUTO_POWER_CONTROL)
251
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
252
+    #define AUTO_POWER_E_FANS
253
+    #define AUTO_POWER_CONTROLLERFAN
254
+    #define POWER_TIMEOUT 30
255
+  #endif
256
+
248 257
 #endif
249 258
 
250 259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration.h View File

@@ -245,6 +245,15 @@
245 245
   // Enable this option to leave the PSU off at startup.
246 246
   // Power to steppers and heaters will need to be turned on with M80.
247 247
   //#define PS_DEFAULT_OFF
248
+
249
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
250
+  #if ENABLED(AUTO_POWER_CONTROL)
251
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
252
+    #define AUTO_POWER_E_FANS
253
+    #define AUTO_POWER_CONTROLLERFAN
254
+    #define POWER_TIMEOUT 30
255
+  #endif
256
+
248 257
 #endif
249 258
 
250 259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/delta/FLSUN/kossel/Configuration.h View File

@@ -236,6 +236,15 @@
236 236
   // Enable this option to leave the PSU off at startup.
237 237
   // Power to steppers and heaters will need to be turned on with M80.
238 238
   //#define PS_DEFAULT_OFF
239
+
240
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
241
+  #if ENABLED(AUTO_POWER_CONTROL)
242
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
243
+    #define AUTO_POWER_E_FANS
244
+    #define AUTO_POWER_CONTROLLERFAN
245
+    #define POWER_TIMEOUT 30
246
+  #endif
247
+
239 248
 #endif
240 249
 
241 250
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration.h View File

@@ -245,6 +245,15 @@
245 245
   // Enable this option to leave the PSU off at startup.
246 246
   // Power to steppers and heaters will need to be turned on with M80.
247 247
   //#define PS_DEFAULT_OFF
248
+
249
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
250
+  #if ENABLED(AUTO_POWER_CONTROL)
251
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
252
+    #define AUTO_POWER_E_FANS
253
+    #define AUTO_POWER_CONTROLLERFAN
254
+    #define POWER_TIMEOUT 30
255
+  #endif
256
+
248 257
 #endif
249 258
 
250 259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/delta/generic/Configuration.h View File

@@ -245,6 +245,15 @@
245 245
   // Enable this option to leave the PSU off at startup.
246 246
   // Power to steppers and heaters will need to be turned on with M80.
247 247
   //#define PS_DEFAULT_OFF
248
+
249
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
250
+  #if ENABLED(AUTO_POWER_CONTROL)
251
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
252
+    #define AUTO_POWER_E_FANS
253
+    #define AUTO_POWER_CONTROLLERFAN
254
+    #define POWER_TIMEOUT 30
255
+  #endif
256
+
248 257
 #endif
249 258
 
250 259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/delta/kossel_mini/Configuration.h View File

@@ -245,6 +245,15 @@
245 245
   // Enable this option to leave the PSU off at startup.
246 246
   // Power to steppers and heaters will need to be turned on with M80.
247 247
   //#define PS_DEFAULT_OFF
248
+
249
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
250
+  #if ENABLED(AUTO_POWER_CONTROL)
251
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
252
+    #define AUTO_POWER_E_FANS
253
+    #define AUTO_POWER_CONTROLLERFAN
254
+    #define POWER_TIMEOUT 30
255
+  #endif
256
+
248 257
 #endif
249 258
 
250 259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/delta/kossel_pro/Configuration.h View File

@@ -249,6 +249,15 @@
249 249
   // Enable this option to leave the PSU off at startup.
250 250
   // Power to steppers and heaters will need to be turned on with M80.
251 251
   //#define PS_DEFAULT_OFF
252
+
253
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
254
+  #if ENABLED(AUTO_POWER_CONTROL)
255
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
256
+    #define AUTO_POWER_E_FANS
257
+    #define AUTO_POWER_CONTROLLERFAN
258
+    #define POWER_TIMEOUT 30
259
+  #endif
260
+
252 261
 #endif
253 262
 
254 263
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/delta/kossel_xl/Configuration.h View File

@@ -245,6 +245,15 @@
245 245
   // Enable this option to leave the PSU off at startup.
246 246
   // Power to steppers and heaters will need to be turned on with M80.
247 247
   #define PS_DEFAULT_OFF
248
+
249
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
250
+  #if ENABLED(AUTO_POWER_CONTROL)
251
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
252
+    #define AUTO_POWER_E_FANS
253
+    #define AUTO_POWER_CONTROLLERFAN
254
+    #define POWER_TIMEOUT 30
255
+  #endif
256
+
248 257
 #endif
249 258
 
250 259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/gCreate/gMax1.5+/Configuration.h View File

@@ -250,6 +250,15 @@
250 250
   // Enable this option to leave the PSU off at startup.
251 251
   // Power to steppers and heaters will need to be turned on with M80.
252 252
   //#define PS_DEFAULT_OFF
253
+
254
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
255
+  #if ENABLED(AUTO_POWER_CONTROL)
256
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
257
+    #define AUTO_POWER_E_FANS
258
+    #define AUTO_POWER_CONTROLLERFAN
259
+    #define POWER_TIMEOUT 30
260
+  #endif
261
+
253 262
 #endif
254 263
 
255 264
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/makibox/Configuration.h View File

@@ -245,6 +245,15 @@
245 245
   // Enable this option to leave the PSU off at startup.
246 246
   // Power to steppers and heaters will need to be turned on with M80.
247 247
   //#define PS_DEFAULT_OFF
248
+
249
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
250
+  #if ENABLED(AUTO_POWER_CONTROL)
251
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
252
+    #define AUTO_POWER_E_FANS
253
+    #define AUTO_POWER_CONTROLLERFAN
254
+    #define POWER_TIMEOUT 30
255
+  #endif
256
+
248 257
 #endif
249 258
 
250 259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/stm32f103ret6/Configuration.h View File

@@ -217,6 +217,15 @@
217 217
   // Enable this option to leave the PSU off at startup.
218 218
   // Power to steppers and heaters will need to be turned on with M80.
219 219
   //#define PS_DEFAULT_OFF
220
+
221
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
222
+  #if ENABLED(AUTO_POWER_CONTROL)
223
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
224
+    #define AUTO_POWER_E_FANS
225
+    #define AUTO_POWER_CONTROLLERFAN
226
+    #define POWER_TIMEOUT 30
227
+  #endif
228
+
220 229
 #endif
221 230
 
222 231
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/tvrrug/Round2/Configuration.h View File

@@ -245,6 +245,15 @@
245 245
   // Enable this option to leave the PSU off at startup.
246 246
   // Power to steppers and heaters will need to be turned on with M80.
247 247
   //#define PS_DEFAULT_OFF
248
+
249
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
250
+  #if ENABLED(AUTO_POWER_CONTROL)
251
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
252
+    #define AUTO_POWER_E_FANS
253
+    #define AUTO_POWER_CONTROLLERFAN
254
+    #define POWER_TIMEOUT 30
255
+  #endif
256
+
248 257
 #endif
249 258
 
250 259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/wt150/Configuration.h View File

@@ -245,6 +245,15 @@
245 245
   // Enable this option to leave the PSU off at startup.
246 246
   // Power to steppers and heaters will need to be turned on with M80.
247 247
   //#define PS_DEFAULT_OFF
248
+
249
+  //#define AUTO_POWER_CONTROL        // Enable automatic control of the PS_ON pin
250
+  #if ENABLED(AUTO_POWER_CONTROL)
251
+    #define AUTO_POWER_FANS           // Turn on PSU if fans need power
252
+    #define AUTO_POWER_E_FANS
253
+    #define AUTO_POWER_CONTROLLERFAN
254
+    #define POWER_TIMEOUT 30
255
+  #endif
256
+
248 257
 #endif
249 258
 
250 259
 // @section temperature

+ 96
- 0
Marlin/src/feature/power.cpp View File

@@ -0,0 +1,96 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+/**
24
+ * power.cpp - power control
25
+ */
26
+
27
+#include "../inc/MarlinConfig.h"
28
+
29
+#if ENABLED(AUTO_POWER_CONTROL)
30
+
31
+#include "power.h"
32
+#include "temperature.h"
33
+#include "stepper_indirection.h"
34
+
35
+Power powerManager;
36
+
37
+millis_t Power::lastPowerOn;
38
+
39
+bool Power::is_power_needed() {
40
+  #if ENABLED(AUTO_POWER_FANS)
41
+    for (uint8_t i = 0; i < FAN_COUNT; i++) if (fanSpeeds[i] > 0) return true;
42
+  #endif
43
+
44
+  #if ENABLED(AUTO_POWER_E_FANS)
45
+    HOTEND_LOOP() if (thermalManager.autofan_speed[e] > 0) return true;
46
+  #endif
47
+
48
+  #if ENABLED(AUTO_POWER_CONTROLLERFAN) && HAS_CONTROLLERFAN
49
+    if (controllerFanSpeed > 0) return true;
50
+  #endif
51
+
52
+  if (X_ENABLE_READ == X_ENABLE_ON || Y_ENABLE_READ == Y_ENABLE_ON || Z_ENABLE_READ == Z_ENABLE_ON ||
53
+      thermalManager.soft_pwm_bed > 0
54
+      || E0_ENABLE_READ == E_ENABLE_ON // If any of the drivers are enabled...
55
+      #if E_STEPPERS > 1
56
+        || E1_ENABLE_READ == E_ENABLE_ON
57
+        #if HAS_X2_ENABLE
58
+          || X2_ENABLE_READ == X_ENABLE_ON
59
+        #endif
60
+        #if E_STEPPERS > 2
61
+            || E2_ENABLE_READ == E_ENABLE_ON
62
+          #if E_STEPPERS > 3
63
+              || E3_ENABLE_READ == E_ENABLE_ON
64
+          #endif
65
+        #endif
66
+      #endif
67
+  ) return true;
68
+
69
+  HOTEND_LOOP() if (thermalManager.degTargetHotend(e) > 0) return true;
70
+  if (thermalManager.degTargetBed() > 0) return true;
71
+
72
+  return false;
73
+}
74
+
75
+void Power::check() {
76
+  static millis_t nextPowerCheck = 0;
77
+  millis_t ms = millis();
78
+  if (ELAPSED(ms, nextPowerCheck)) {
79
+    nextPowerCheck = ms + 2500UL;
80
+    if (is_power_needed())
81
+      power_on();
82
+    else if (!lastPowerOn || ELAPSED(ms, lastPowerOn + (POWER_TIMEOUT) * 1000UL))
83
+      power_off();
84
+  }
85
+}
86
+
87
+void Power::power_on() {
88
+  lastPowerOn = millis();
89
+  OUT_WRITE(PS_ON_PIN, PS_ON_AWAKE);
90
+}
91
+
92
+void Power::power_off() {
93
+  OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP);
94
+}
95
+
96
+#endif // AUTO_POWER_CONTROL

+ 42
- 0
Marlin/src/feature/power.h View File

@@ -0,0 +1,42 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+/**
24
+ * power.h - power control
25
+ */
26
+
27
+#ifndef POWER_H
28
+#define POWER_H
29
+
30
+class Power {
31
+  public:
32
+    static void check();
33
+    static void power_on();
34
+    static void power_off();
35
+  private:
36
+    static millis_t lastPowerOn;
37
+    static bool is_power_needed();
38
+};
39
+
40
+extern Power powerManager;
41
+
42
+#endif // POWER_H

+ 6
- 2
Marlin/src/gcode/control/M80_M81.cpp View File

@@ -36,6 +36,10 @@
36 36
 
37 37
 #if HAS_POWER_SWITCH
38 38
 
39
+  #if ENABLED(AUTO_POWER_CONTROL)
40
+    #include "../../feature/power.h"
41
+  #endif
42
+
39 43
   // Could be moved to a feature, but this is all the data
40 44
   bool powersupply_on =
41 45
     #if ENABLED(PS_DEFAULT_OFF)
@@ -61,7 +65,7 @@
61 65
       return;
62 66
     }
63 67
 
64
-    OUT_WRITE(PS_ON_PIN, PS_ON_AWAKE); // GND
68
+    PSU_ON();
65 69
 
66 70
     /**
67 71
      * If you have a switch on suicide pin, this is useful
@@ -114,7 +118,7 @@ void GcodeSuite::M81() {
114 118
     stepper.synchronize();
115 119
     suicide();
116 120
   #elif HAS_POWER_SWITCH
117
-    OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP);
121
+    PSU_OFF();
118 122
     powersupply_on = false;
119 123
   #endif
120 124
 

+ 8
- 0
Marlin/src/module/temperature.cpp View File

@@ -63,10 +63,15 @@ Temperature thermalManager;
63 63
 
64 64
 float Temperature::current_temperature[HOTENDS] = { 0.0 },
65 65
       Temperature::current_temperature_bed = 0.0;
66
+
66 67
 int16_t Temperature::current_temperature_raw[HOTENDS] = { 0 },
67 68
         Temperature::target_temperature[HOTENDS] = { 0 },
68 69
         Temperature::current_temperature_bed_raw = 0;
69 70
 
71
+#if ENABLED(AUTO_POWER_E_FANS)
72
+  int16_t Temperature::autofan_speed[HOTENDS] = { 0 };
73
+#endif
74
+
70 75
 #if HAS_HEATER_BED
71 76
   int16_t Temperature::target_temperature_bed = 0;
72 77
 #endif
@@ -529,6 +534,9 @@ int Temperature::getHeaterPower(int heater) {
529 534
       const uint8_t bit = pgm_read_byte(&fanBit[f]);
530 535
       if (pin >= 0 && !TEST(fanDone, bit)) {
531 536
         uint8_t newFanSpeed = TEST(fanState, bit) ? EXTRUDER_AUTO_FAN_SPEED : 0;
537
+        #if ENABLED(AUTO_POWER_E_FANS)
538
+          autofan_speed[f] = newFanSpeed;
539
+        #endif
532 540
         // this idiom allows both digital and PWM fan outputs (see M42 handling).
533 541
         digitalWrite(pin, newFanSpeed);
534 542
         analogWrite(pin, newFanSpeed);

+ 15
- 0
Marlin/src/module/temperature.h View File

@@ -28,11 +28,16 @@
28 28
 #define TEMPERATURE_H
29 29
 
30 30
 #include "thermistor/thermistors.h"
31
+#include "../inc/MarlinConfig.h"
31 32
 
32 33
 #if ENABLED(BABYSTEPPING)
33 34
   extern bool axis_known_position[XYZ];
34 35
 #endif
35 36
 
37
+#if ENABLED(AUTO_POWER_CONTROL)
38
+  #include "power.h"
39
+#endif
40
+
36 41
 #if ENABLED(PID_EXTRUSION_SCALING)
37 42
   #include "stepper.h"
38 43
 #endif
@@ -113,6 +118,10 @@ class Temperature {
113 118
                    target_temperature[HOTENDS],
114 119
                    current_temperature_bed_raw;
115 120
 
121
+    #if ENABLED(AUTO_POWER_E_FANS)
122
+      static int16_t autofan_speed[HOTENDS];
123
+    #endif
124
+
116 125
     #if HAS_HEATER_BED
117 126
       static int16_t target_temperature_bed;
118 127
     #endif
@@ -393,6 +402,9 @@ class Temperature {
393 402
         else if (target_temperature[HOTEND_INDEX] == 0)
394 403
           start_preheat_time(HOTEND_INDEX);
395 404
       #endif
405
+      #if ENABLED(AUTO_POWER_CONTROL)
406
+        powerManager.power_on();
407
+      #endif
396 408
       target_temperature[HOTEND_INDEX] = celsius;
397 409
       #if WATCH_HOTENDS
398 410
         start_watching_heater(HOTEND_INDEX);
@@ -401,6 +413,9 @@ class Temperature {
401 413
 
402 414
     static void setTargetBed(const int16_t celsius) {
403 415
       #if HAS_HEATER_BED
416
+        #if ENABLED(AUTO_POWER_CONTROL)
417
+          powerManager.power_on();
418
+        #endif
404 419
         target_temperature_bed =
405 420
           #ifdef BED_MAXTEMP
406 421
             min(celsius, BED_MAXTEMP)

Loading…
Cancel
Save