♻️ Consolidate PSU_CONTROL (#22304)

This commit is contained in:
Katelyn Schiesser
2021-07-11 22:13:58 -07:00
committed by GitHub
parent 37cf94b888
commit c8ee056cc6
10 changed files with 212 additions and 177 deletions

View File

@@ -81,25 +81,6 @@ extern bool wait_for_heatup;
void wait_for_user_response(millis_t ms=0, const bool no_sleep=false);
#endif
#if ENABLED(PSU_CONTROL)
extern bool powersupply_on;
#define PSU_PIN_ON() do{ OUT_WRITE(PS_ON_PIN, PSU_ACTIVE_STATE); powersupply_on = true; }while(0)
#define PSU_PIN_OFF() do{ OUT_WRITE(PS_ON_PIN, !PSU_ACTIVE_STATE); powersupply_on = false; }while(0)
#if ENABLED(AUTO_POWER_CONTROL)
#define PSU_ON() powerManager.power_on()
#define PSU_OFF() powerManager.power_off()
#define PSU_OFF_SOON() powerManager.power_off_soon()
#else
#define PSU_ON() PSU_PIN_ON()
#if ENABLED(PS_OFF_SOUND)
#define PSU_OFF() do{ BUZZ(1000, 659); PSU_PIN_OFF(); }while(0)
#else
#define PSU_OFF() PSU_PIN_OFF()
#endif
#define PSU_OFF_SOON PSU_OFF
#endif
#endif
bool pin_is_protected(const pin_t pin);
#if HAS_SUICIDE