Skip to content

Commit

Permalink
✨ AUTO_POWER_SPINDLE_LASER (MarlinFirmware#25739)
Browse files Browse the repository at this point in the history
  • Loading branch information
filimonic authored and Pragma8123 committed Oct 24, 2023
1 parent 1d34816 commit 2fa8bbd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -423,11 +423,12 @@

//#define AUTO_POWER_CONTROL // Enable automatic control of the PS_ON pin
#if ENABLED(AUTO_POWER_CONTROL)
#define AUTO_POWER_FANS // Turn on PSU if fans need power
#define AUTO_POWER_E_FANS
#define AUTO_POWER_CONTROLLERFAN
#define AUTO_POWER_CHAMBER_FAN
#define AUTO_POWER_COOLER_FAN
#define AUTO_POWER_FANS // Turn on PSU for fans
#define AUTO_POWER_E_FANS // Turn on PSU for E Fans
#define AUTO_POWER_CONTROLLERFAN // Turn on PSU for Controller Fan
#define AUTO_POWER_CHAMBER_FAN // Turn on PSU for Chamber Fan
#define AUTO_POWER_COOLER_FAN // Turn on PSU for Cooler Fan
#define AUTO_POWER_SPINDLE_LASER // Turn on PSU for Spindle/Laser
#define POWER_TIMEOUT 30 // (s) Turn off power if the machine is idle for this duration
//#define POWER_OFF_DELAY 60 // (s) Delay of poweroff after M81 command. Useful to let fans run for extra time.
#endif
Expand Down
8 changes: 8 additions & 0 deletions Marlin/src/feature/power.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ bool Power::psu_on;
#include "controllerfan.h"
#endif

#if ANY(LASER_FEATURE, SPINDLE_FEATURE)
#include "spindle_laser.h"
#endif

millis_t Power::lastPowerOn;
#endif

Expand Down Expand Up @@ -196,6 +200,10 @@ void Power::power_off() {
if (controllerFan.state()) return true;
#endif

#if ANY(LASER_FEATURE, SPINDLE_FEATURE)
if (TERN0(AUTO_POWER_SPINDLE_LASER, cutter.enabled())) return true;
#endif

if (TERN0(AUTO_POWER_CHAMBER_FAN, thermalManager.chamberfan_speed))
return true;

Expand Down
3 changes: 3 additions & 0 deletions Marlin/src/inc/Conditionals_post.h
Original file line number Diff line number Diff line change
Expand Up @@ -2623,6 +2623,9 @@
#if !HAS_AUTO_COOLER_FAN || AUTO_COOLER_IS_E
#undef AUTO_POWER_COOLER_FAN
#endif
#if !HAS_CUTTER
#undef AUTO_POWER_SPINDLE_LASER
#endif

/**
* Controller Fan Settings
Expand Down

0 comments on commit 2fa8bbd

Please sign in to comment.