瀏覽代碼

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

Scott Lahteine 7 年之前
父節點
當前提交
b5e92f4f90
沒有連結到貢獻者的電子郵件帳戶。
共有 61 個檔案被更改,包括 664 行新增4 行删除
  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 查看文件

245
   // Enable this option to leave the PSU off at startup.
245
   // Enable this option to leave the PSU off at startup.
246
   // Power to steppers and heaters will need to be turned on with M80.
246
   // Power to steppers and heaters will need to be turned on with M80.
247
   //#define PS_DEFAULT_OFF
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
 #endif
257
 #endif
249
 
258
 
250
 // @section temperature
259
 // @section temperature

+ 2
- 2
Marlin/src/Marlin.cpp 查看文件

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

+ 9
- 0
Marlin/src/Marlin.h 查看文件

42
 
42
 
43
 void manage_inactivity(bool ignore_stepper_queue = false);
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
 #if HAS_X2_ENABLE
54
 #if HAS_X2_ENABLE
46
   #define  enable_X() do{ X_ENABLE_WRITE( X_ENABLE_ON); X2_ENABLE_WRITE( X_ENABLE_ON); }while(0)
55
   #define  enable_X() do{ X_ENABLE_WRITE( X_ENABLE_ON); X2_ENABLE_WRITE( X_ENABLE_ON); }while(0)
47
   #define disable_X() do{ X_ENABLE_WRITE(!X_ENABLE_ON); X2_ENABLE_WRITE(!X_ENABLE_ON); axis_known_position[X_AXIS] = false; }while(0)
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 查看文件

245
   // Enable this option to leave the PSU off at startup.
245
   // Enable this option to leave the PSU off at startup.
246
   // Power to steppers and heaters will need to be turned on with M80.
246
   // Power to steppers and heaters will need to be turned on with M80.
247
   //#define PS_DEFAULT_OFF
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
 #endif
257
 #endif
249
 
258
 
250
 // @section temperature
259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/AlephObjects/TAZ4/Configuration.h 查看文件

245
   // Enable this option to leave the PSU off at startup.
245
   // Enable this option to leave the PSU off at startup.
246
   // Power to steppers and heaters will need to be turned on with M80.
246
   // Power to steppers and heaters will need to be turned on with M80.
247
   //#define PS_DEFAULT_OFF
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
 #endif
257
 #endif
249
 
258
 
250
 // @section temperature
259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/AliExpress/CL-260/Configuration.h 查看文件

245
   // Enable this option to leave the PSU off at startup.
245
   // Enable this option to leave the PSU off at startup.
246
   // Power to steppers and heaters will need to be turned on with M80.
246
   // Power to steppers and heaters will need to be turned on with M80.
247
   //#define PS_DEFAULT_OFF
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
 #endif
257
 #endif
249
 
258
 
250
 // @section temperature
259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Anet/A6/Configuration.h 查看文件

245
   // Enable this option to leave the PSU off at startup.
245
   // Enable this option to leave the PSU off at startup.
246
   // Power to steppers and heaters will need to be turned on with M80.
246
   // Power to steppers and heaters will need to be turned on with M80.
247
   //#define PS_DEFAULT_OFF
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
 #endif
257
 #endif
249
 
258
 
250
 // @section temperature
259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Anet/A8/Configuration.h 查看文件

246
   // Enable this option to leave the PSU off at startup.
246
   // Enable this option to leave the PSU off at startup.
247
   // Power to steppers and heaters will need to be turned on with M80.
247
   // Power to steppers and heaters will need to be turned on with M80.
248
   //#define PS_DEFAULT_OFF
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
 #endif
258
 #endif
250
 
259
 
251
 // @section temperature
260
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Azteeg/X5GT/Configuration.h 查看文件

245
   // Enable this option to leave the PSU off at startup.
245
   // Enable this option to leave the PSU off at startup.
246
   // Power to steppers and heaters will need to be turned on with M80.
246
   // Power to steppers and heaters will need to be turned on with M80.
247
   //#define PS_DEFAULT_OFF
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
 #endif
257
 #endif
249
 
258
 
250
 // @section temperature
259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/BIBO/TouchX/Configuration.h 查看文件

236
   // Enable this option to leave the PSU off at startup.
236
   // Enable this option to leave the PSU off at startup.
237
   // Power to steppers and heaters will need to be turned on with M80.
237
   // Power to steppers and heaters will need to be turned on with M80.
238
   //#define PS_DEFAULT_OFF
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
 #endif
248
 #endif
240
 
249
 
241
 // @section temperature
250
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/BQ/Hephestos/Configuration.h 查看文件

245
   // Enable this option to leave the PSU off at startup.
245
   // Enable this option to leave the PSU off at startup.
246
   // Power to steppers and heaters will need to be turned on with M80.
246
   // Power to steppers and heaters will need to be turned on with M80.
247
   //#define PS_DEFAULT_OFF
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
 #endif
257
 #endif
249
 
258
 
250
 // @section temperature
259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/BQ/Hephestos_2/Configuration.h 查看文件

244
   // Enable this option to leave the PSU off at startup.
244
   // Enable this option to leave the PSU off at startup.
245
   // Power to steppers and heaters will need to be turned on with M80.
245
   // Power to steppers and heaters will need to be turned on with M80.
246
   //#define PS_DEFAULT_OFF
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
 #endif
256
 #endif
248
 
257
 
249
 // @section temperature
258
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/BQ/WITBOX/Configuration.h 查看文件

245
   // Enable this option to leave the PSU off at startup.
245
   // Enable this option to leave the PSU off at startup.
246
   // Power to steppers and heaters will need to be turned on with M80.
246
   // Power to steppers and heaters will need to be turned on with M80.
247
   //#define PS_DEFAULT_OFF
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
 #endif
257
 #endif
249
 
258
 
250
 // @section temperature
259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Cartesio/Configuration.h 查看文件

246
   // Enable this option to leave the PSU off at startup.
246
   // Enable this option to leave the PSU off at startup.
247
   // Power to steppers and heaters will need to be turned on with M80.
247
   // Power to steppers and heaters will need to be turned on with M80.
248
   //#define PS_DEFAULT_OFF
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
 #endif
258
 #endif
250
 
259
 
251
 // @section temperature
260
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Creality/CR-10/Configuration.h 查看文件

245
   // Enable this option to leave the PSU off at startup.
245
   // Enable this option to leave the PSU off at startup.
246
   // Power to steppers and heaters will need to be turned on with M80.
246
   // Power to steppers and heaters will need to be turned on with M80.
247
   //#define PS_DEFAULT_OFF
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
 #endif
257
 #endif
249
 
258
 
250
 // @section temperature
259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Creality/CR-10S/Configuration.h 查看文件

236
   // Enable this option to leave the PSU off at startup.
236
   // Enable this option to leave the PSU off at startup.
237
   // Power to steppers and heaters will need to be turned on with M80.
237
   // Power to steppers and heaters will need to be turned on with M80.
238
   //#define PS_DEFAULT_OFF
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
 #endif
248
 #endif
240
 
249
 
241
 // @section temperature
250
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Creality/Ender/Configuration.h 查看文件

236
   // Enable this option to leave the PSU off at startup.
236
   // Enable this option to leave the PSU off at startup.
237
   // Power to steppers and heaters will need to be turned on with M80.
237
   // Power to steppers and heaters will need to be turned on with M80.
238
   //#define PS_DEFAULT_OFF
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
 #endif
248
 #endif
240
 
249
 
241
 // @section temperature
250
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Felix/Configuration.h 查看文件

245
   // Enable this option to leave the PSU off at startup.
245
   // Enable this option to leave the PSU off at startup.
246
   // Power to steppers and heaters will need to be turned on with M80.
246
   // Power to steppers and heaters will need to be turned on with M80.
247
   #define PS_DEFAULT_OFF
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
 #endif
257
 #endif
249
 
258
 
250
 // @section temperature
259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Felix/DUAL/Configuration.h 查看文件

245
   // Enable this option to leave the PSU off at startup.
245
   // Enable this option to leave the PSU off at startup.
246
   // Power to steppers and heaters will need to be turned on with M80.
246
   // Power to steppers and heaters will need to be turned on with M80.
247
   #define PS_DEFAULT_OFF
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
 #endif
257
 #endif
249
 
258
 
250
 // @section temperature
259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/FolgerTech/i3-2020/Configuration.h 查看文件

246
   // Enable this option to leave the PSU off at startup.
246
   // Enable this option to leave the PSU off at startup.
247
   // Power to steppers and heaters will need to be turned on with M80.
247
   // Power to steppers and heaters will need to be turned on with M80.
248
   //#define PS_DEFAULT_OFF
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
 #endif
258
 #endif
250
 
259
 
251
 // @section temperature
260
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Geeetech/GT2560/Configuration.h 查看文件

245
   // Enable this option to leave the PSU off at startup.
245
   // Enable this option to leave the PSU off at startup.
246
   // Power to steppers and heaters will need to be turned on with M80.
246
   // Power to steppers and heaters will need to be turned on with M80.
247
   //#define PS_DEFAULT_OFF
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
 #endif
257
 #endif
249
 
258
 
250
 // @section temperature
259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Geeetech/I3_Pro_X-GT2560/Configuration.h 查看文件

245
   // Enable this option to leave the PSU off at startup.
245
   // Enable this option to leave the PSU off at startup.
246
   // Power to steppers and heaters will need to be turned on with M80.
246
   // Power to steppers and heaters will need to be turned on with M80.
247
   //#define PS_DEFAULT_OFF
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
 #endif
257
 #endif
249
 
258
 
250
 // @section temperature
259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Infitary/i3-M508/Configuration.h 查看文件

245
   // Enable this option to leave the PSU off at startup.
245
   // Enable this option to leave the PSU off at startup.
246
   // Power to steppers and heaters will need to be turned on with M80.
246
   // Power to steppers and heaters will need to be turned on with M80.
247
   //#define PS_DEFAULT_OFF
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
 #endif
257
 #endif
249
 
258
 
250
 // @section temperature
259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/JGAurora/A5/Configuration.h 查看文件

250
   // Enable this option to leave the PSU off at startup.
250
   // Enable this option to leave the PSU off at startup.
251
   // Power to steppers and heaters will need to be turned on with M80.
251
   // Power to steppers and heaters will need to be turned on with M80.
252
   //#define PS_DEFAULT_OFF
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
 #endif
262
 #endif
254
 
263
 
255
 // @section temperature
264
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/MakerParts/Configuration.h 查看文件

256
   // Enable this option to leave the PSU off at startup.
256
   // Enable this option to leave the PSU off at startup.
257
   // Power to steppers and heaters will need to be turned on with M80.
257
   // Power to steppers and heaters will need to be turned on with M80.
258
   //#define PS_DEFAULT_OFF
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
 #endif
268
 #endif
260
 
269
 
261
 // @section temperature
270
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Malyan/M150/Configuration.h 查看文件

250
   // Enable this option to leave the PSU off at startup.
250
   // Enable this option to leave the PSU off at startup.
251
   // Power to steppers and heaters will need to be turned on with M80.
251
   // Power to steppers and heaters will need to be turned on with M80.
252
   //#define PS_DEFAULT_OFF
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
 #endif
262
 #endif
254
 
263
 
255
 // @section temperature
264
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Malyan/M200/Configuration.h 查看文件

236
   // Enable this option to leave the PSU off at startup.
236
   // Enable this option to leave the PSU off at startup.
237
   // Power to steppers and heaters will need to be turned on with M80.
237
   // Power to steppers and heaters will need to be turned on with M80.
238
   //#define PS_DEFAULT_OFF
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
 #endif
248
 #endif
240
 
249
 
241
 // @section temperature
250
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Micromake/C1/basic/Configuration.h 查看文件

245
   // Enable this option to leave the PSU off at startup.
245
   // Enable this option to leave the PSU off at startup.
246
   // Power to steppers and heaters will need to be turned on with M80.
246
   // Power to steppers and heaters will need to be turned on with M80.
247
   //#define PS_DEFAULT_OFF
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
 #endif
257
 #endif
249
 
258
 
250
 // @section temperature
259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Micromake/C1/enhanced/Configuration.h 查看文件

245
   // Enable this option to leave the PSU off at startup.
245
   // Enable this option to leave the PSU off at startup.
246
   // Power to steppers and heaters will need to be turned on with M80.
246
   // Power to steppers and heaters will need to be turned on with M80.
247
   //#define PS_DEFAULT_OFF
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
 #endif
257
 #endif
249
 
258
 
250
 // @section temperature
259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Mks/Sbase/Configuration.h 查看文件

245
   // Enable this option to leave the PSU off at startup.
245
   // Enable this option to leave the PSU off at startup.
246
   // Power to steppers and heaters will need to be turned on with M80.
246
   // Power to steppers and heaters will need to be turned on with M80.
247
 #define PS_DEFAULT_OFF
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
 #endif
257
 #endif
249
 
258
 
250
 // @section temperature
259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/RepRapWorld/Megatronics/Configuration.h 查看文件

245
   // Enable this option to leave the PSU off at startup.
245
   // Enable this option to leave the PSU off at startup.
246
   // Power to steppers and heaters will need to be turned on with M80.
246
   // Power to steppers and heaters will need to be turned on with M80.
247
   //#define PS_DEFAULT_OFF
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
 #endif
257
 #endif
249
 
258
 
250
 // @section temperature
259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/RigidBot/Configuration.h 查看文件

248
   // Enable this option to leave the PSU off at startup.
248
   // Enable this option to leave the PSU off at startup.
249
   // Power to steppers and heaters will need to be turned on with M80.
249
   // Power to steppers and heaters will need to be turned on with M80.
250
   //#define PS_DEFAULT_OFF
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
 #endif
260
 #endif
252
 
261
 
253
 // @section temperature
262
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/SCARA/Configuration.h 查看文件

275
   // Enable this option to leave the PSU off at startup.
275
   // Enable this option to leave the PSU off at startup.
276
   // Power to steppers and heaters will need to be turned on with M80.
276
   // Power to steppers and heaters will need to be turned on with M80.
277
   //#define PS_DEFAULT_OFF
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
 #endif
287
 #endif
279
 
288
 
280
 // @section temperature
289
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/STM32F10/Configuration.h 查看文件

245
   // Enable this option to leave the PSU off at startup.
245
   // Enable this option to leave the PSU off at startup.
246
   // Power to steppers and heaters will need to be turned on with M80.
246
   // Power to steppers and heaters will need to be turned on with M80.
247
   //#define PS_DEFAULT_OFF
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
 #endif
257
 #endif
249
 
258
 
250
 // @section temperature
259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Sanguinololu/Configuration.h 查看文件

245
   // Enable this option to leave the PSU off at startup.
245
   // Enable this option to leave the PSU off at startup.
246
   // Power to steppers and heaters will need to be turned on with M80.
246
   // Power to steppers and heaters will need to be turned on with M80.
247
   //#define PS_DEFAULT_OFF
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
 #endif
257
 #endif
249
 
258
 
250
 // @section temperature
259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/TheBorg/Configuration.h 查看文件

245
   // Enable this option to leave the PSU off at startup.
245
   // Enable this option to leave the PSU off at startup.
246
   // Power to steppers and heaters will need to be turned on with M80.
246
   // Power to steppers and heaters will need to be turned on with M80.
247
   //#define PS_DEFAULT_OFF
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
 #endif
257
 #endif
249
 
258
 
250
 // @section temperature
259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/TinyBoy2/Configuration.h 查看文件

267
   // Enable this option to leave the PSU off at startup.
267
   // Enable this option to leave the PSU off at startup.
268
   // Power to steppers and heaters will need to be turned on with M80.
268
   // Power to steppers and heaters will need to be turned on with M80.
269
   //#define PS_DEFAULT_OFF
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
 #endif
279
 #endif
271
 
280
 
272
 // @section temperature
281
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Tronxy/X1/Configuration.h 查看文件

236
   // Enable this option to leave the PSU off at startup.
236
   // Enable this option to leave the PSU off at startup.
237
   // Power to steppers and heaters will need to be turned on with M80.
237
   // Power to steppers and heaters will need to be turned on with M80.
238
   //#define PS_DEFAULT_OFF
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
 #endif
248
 #endif
240
 
249
 
241
 // @section temperature
250
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/UltiMachine/Archim2/Configuration.h 查看文件

236
   // Enable this option to leave the PSU off at startup.
236
   // Enable this option to leave the PSU off at startup.
237
   // Power to steppers and heaters will need to be turned on with M80.
237
   // Power to steppers and heaters will need to be turned on with M80.
238
   //#define PS_DEFAULT_OFF
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
 #endif
248
 #endif
240
 
249
 
241
 // @section temperature
250
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Velleman/K8200/Configuration.h 查看文件

265
   // Enable this option to leave the PSU off at startup.
265
   // Enable this option to leave the PSU off at startup.
266
   // Power to steppers and heaters will need to be turned on with M80.
266
   // Power to steppers and heaters will need to be turned on with M80.
267
   //#define PS_DEFAULT_OFF
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
 #endif
277
 #endif
269
 
278
 
270
 // @section temperature
279
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Velleman/K8400/Configuration.h 查看文件

245
   // Enable this option to leave the PSU off at startup.
245
   // Enable this option to leave the PSU off at startup.
246
   // Power to steppers and heaters will need to be turned on with M80.
246
   // Power to steppers and heaters will need to be turned on with M80.
247
   //#define PS_DEFAULT_OFF
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
 #endif
257
 #endif
249
 
258
 
250
 // @section temperature
259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Velleman/K8400/Dual-head/Configuration.h 查看文件

245
   // Enable this option to leave the PSU off at startup.
245
   // Enable this option to leave the PSU off at startup.
246
   // Power to steppers and heaters will need to be turned on with M80.
246
   // Power to steppers and heaters will need to be turned on with M80.
247
   //#define PS_DEFAULT_OFF
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
 #endif
257
 #endif
249
 
258
 
250
 // @section temperature
259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration.h 查看文件

236
   // Enable this option to leave the PSU off at startup.
236
   // Enable this option to leave the PSU off at startup.
237
   // Power to steppers and heaters will need to be turned on with M80.
237
   // Power to steppers and heaters will need to be turned on with M80.
238
   //#define PS_DEFAULT_OFF
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
 #endif
248
 #endif
240
 
249
 
241
 // @section temperature
250
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/adafruit/ST7565/Configuration.h 查看文件

245
   // Enable this option to leave the PSU off at startup.
245
   // Enable this option to leave the PSU off at startup.
246
   // Power to steppers and heaters will need to be turned on with M80.
246
   // Power to steppers and heaters will need to be turned on with M80.
247
   //#define PS_DEFAULT_OFF
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
 #endif
257
 #endif
249
 
258
 
250
 // @section temperature
259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration.h 查看文件

245
   // Enable this option to leave the PSU off at startup.
245
   // Enable this option to leave the PSU off at startup.
246
   // Power to steppers and heaters will need to be turned on with M80.
246
   // Power to steppers and heaters will need to be turned on with M80.
247
   //#define PS_DEFAULT_OFF
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
 #endif
257
 #endif
249
 
258
 
250
 // @section temperature
259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/delta/FLSUN/kossel/Configuration.h 查看文件

236
   // Enable this option to leave the PSU off at startup.
236
   // Enable this option to leave the PSU off at startup.
237
   // Power to steppers and heaters will need to be turned on with M80.
237
   // Power to steppers and heaters will need to be turned on with M80.
238
   //#define PS_DEFAULT_OFF
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
 #endif
248
 #endif
240
 
249
 
241
 // @section temperature
250
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration.h 查看文件

245
   // Enable this option to leave the PSU off at startup.
245
   // Enable this option to leave the PSU off at startup.
246
   // Power to steppers and heaters will need to be turned on with M80.
246
   // Power to steppers and heaters will need to be turned on with M80.
247
   //#define PS_DEFAULT_OFF
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
 #endif
257
 #endif
249
 
258
 
250
 // @section temperature
259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/delta/generic/Configuration.h 查看文件

245
   // Enable this option to leave the PSU off at startup.
245
   // Enable this option to leave the PSU off at startup.
246
   // Power to steppers and heaters will need to be turned on with M80.
246
   // Power to steppers and heaters will need to be turned on with M80.
247
   //#define PS_DEFAULT_OFF
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
 #endif
257
 #endif
249
 
258
 
250
 // @section temperature
259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/delta/kossel_mini/Configuration.h 查看文件

245
   // Enable this option to leave the PSU off at startup.
245
   // Enable this option to leave the PSU off at startup.
246
   // Power to steppers and heaters will need to be turned on with M80.
246
   // Power to steppers and heaters will need to be turned on with M80.
247
   //#define PS_DEFAULT_OFF
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
 #endif
257
 #endif
249
 
258
 
250
 // @section temperature
259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/delta/kossel_pro/Configuration.h 查看文件

249
   // Enable this option to leave the PSU off at startup.
249
   // Enable this option to leave the PSU off at startup.
250
   // Power to steppers and heaters will need to be turned on with M80.
250
   // Power to steppers and heaters will need to be turned on with M80.
251
   //#define PS_DEFAULT_OFF
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
 #endif
261
 #endif
253
 
262
 
254
 // @section temperature
263
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/delta/kossel_xl/Configuration.h 查看文件

245
   // Enable this option to leave the PSU off at startup.
245
   // Enable this option to leave the PSU off at startup.
246
   // Power to steppers and heaters will need to be turned on with M80.
246
   // Power to steppers and heaters will need to be turned on with M80.
247
   #define PS_DEFAULT_OFF
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
 #endif
257
 #endif
249
 
258
 
250
 // @section temperature
259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/gCreate/gMax1.5+/Configuration.h 查看文件

250
   // Enable this option to leave the PSU off at startup.
250
   // Enable this option to leave the PSU off at startup.
251
   // Power to steppers and heaters will need to be turned on with M80.
251
   // Power to steppers and heaters will need to be turned on with M80.
252
   //#define PS_DEFAULT_OFF
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
 #endif
262
 #endif
254
 
263
 
255
 // @section temperature
264
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/makibox/Configuration.h 查看文件

245
   // Enable this option to leave the PSU off at startup.
245
   // Enable this option to leave the PSU off at startup.
246
   // Power to steppers and heaters will need to be turned on with M80.
246
   // Power to steppers and heaters will need to be turned on with M80.
247
   //#define PS_DEFAULT_OFF
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
 #endif
257
 #endif
249
 
258
 
250
 // @section temperature
259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/stm32f103ret6/Configuration.h 查看文件

217
   // Enable this option to leave the PSU off at startup.
217
   // Enable this option to leave the PSU off at startup.
218
   // Power to steppers and heaters will need to be turned on with M80.
218
   // Power to steppers and heaters will need to be turned on with M80.
219
   //#define PS_DEFAULT_OFF
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
 #endif
229
 #endif
221
 
230
 
222
 // @section temperature
231
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/tvrrug/Round2/Configuration.h 查看文件

245
   // Enable this option to leave the PSU off at startup.
245
   // Enable this option to leave the PSU off at startup.
246
   // Power to steppers and heaters will need to be turned on with M80.
246
   // Power to steppers and heaters will need to be turned on with M80.
247
   //#define PS_DEFAULT_OFF
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
 #endif
257
 #endif
249
 
258
 
250
 // @section temperature
259
 // @section temperature

+ 9
- 0
Marlin/src/config/examples/wt150/Configuration.h 查看文件

245
   // Enable this option to leave the PSU off at startup.
245
   // Enable this option to leave the PSU off at startup.
246
   // Power to steppers and heaters will need to be turned on with M80.
246
   // Power to steppers and heaters will need to be turned on with M80.
247
   //#define PS_DEFAULT_OFF
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
 #endif
257
 #endif
249
 
258
 
250
 // @section temperature
259
 // @section temperature

+ 96
- 0
Marlin/src/feature/power.cpp 查看文件

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 查看文件

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 查看文件

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

+ 8
- 0
Marlin/src/module/temperature.cpp 查看文件

63
 
63
 
64
 float Temperature::current_temperature[HOTENDS] = { 0.0 },
64
 float Temperature::current_temperature[HOTENDS] = { 0.0 },
65
       Temperature::current_temperature_bed = 0.0;
65
       Temperature::current_temperature_bed = 0.0;
66
+
66
 int16_t Temperature::current_temperature_raw[HOTENDS] = { 0 },
67
 int16_t Temperature::current_temperature_raw[HOTENDS] = { 0 },
67
         Temperature::target_temperature[HOTENDS] = { 0 },
68
         Temperature::target_temperature[HOTENDS] = { 0 },
68
         Temperature::current_temperature_bed_raw = 0;
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
 #if HAS_HEATER_BED
75
 #if HAS_HEATER_BED
71
   int16_t Temperature::target_temperature_bed = 0;
76
   int16_t Temperature::target_temperature_bed = 0;
72
 #endif
77
 #endif
529
       const uint8_t bit = pgm_read_byte(&fanBit[f]);
534
       const uint8_t bit = pgm_read_byte(&fanBit[f]);
530
       if (pin >= 0 && !TEST(fanDone, bit)) {
535
       if (pin >= 0 && !TEST(fanDone, bit)) {
531
         uint8_t newFanSpeed = TEST(fanState, bit) ? EXTRUDER_AUTO_FAN_SPEED : 0;
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
         // this idiom allows both digital and PWM fan outputs (see M42 handling).
540
         // this idiom allows both digital and PWM fan outputs (see M42 handling).
533
         digitalWrite(pin, newFanSpeed);
541
         digitalWrite(pin, newFanSpeed);
534
         analogWrite(pin, newFanSpeed);
542
         analogWrite(pin, newFanSpeed);

+ 15
- 0
Marlin/src/module/temperature.h 查看文件

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

Loading…
取消
儲存