Enable and disable power supply automatically

This commit is contained in:
Christopher Reimer 2017-02-20 22:07:23 +01:00 committed by Scott Lahteine
parent 80946a17ee
commit 254417e8b0
8 changed files with 215 additions and 5 deletions

View file

@ -31,6 +31,10 @@
#include "MarlinConfig.h"
#if ENABLED(AUTO_POWER_CONTROL)
#include "power.h"
#endif
#if ENABLED(PID_EXTRUSION_SCALING)
#include "stepper.h"
#endif
@ -121,6 +125,10 @@ class Temperature {
target_temperature[HOTENDS],
current_temperature_bed_raw;
#if ENABLED(AUTO_POWER_E_FANS)
static int16_t autofan_speed[HOTENDS];
#endif
#if HAS_HEATER_BED
static int16_t target_temperature_bed;
#endif
@ -401,6 +409,9 @@ class Temperature {
else if (target_temperature[HOTEND_INDEX] == 0)
start_preheat_time(HOTEND_INDEX);
#endif
#if ENABLED(AUTO_POWER_CONTROL)
powerManager.power_on();
#endif
target_temperature[HOTEND_INDEX] = celsius;
#if WATCH_HOTENDS
start_watching_heater(HOTEND_INDEX);
@ -409,6 +420,9 @@ class Temperature {
static void setTargetBed(const int16_t celsius) {
#if HAS_HEATER_BED
#if ENABLED(AUTO_POWER_CONTROL)
powerManager.power_on();
#endif
target_temperature_bed =
#ifdef BED_MAXTEMP
min(celsius, BED_MAXTEMP)