From 4311dd13ae6fc08d7ef94057560b466a89fbdc11 Mon Sep 17 00:00:00 2001
From: Scott Lahteine <github@thinkyhead.com>
Date: Sat, 10 Feb 2018 15:28:01 -0600
Subject: [PATCH 1/2] Test POWER_SUPPLY and AUTO_POWER_CONTROL

---
 .travis.yml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/.travis.yml b/.travis.yml
index 6fb5d200c1..7d73787e3e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -62,9 +62,10 @@ script:
   - opt_set TEMP_SENSOR_0 -2
   - opt_set TEMP_SENSOR_1 1
   - opt_set TEMP_SENSOR_BED 1
+  - opt_set POWER_SUPPLY 1
   - opt_enable PIDTEMPBED FIX_MOUNTED_PROBE Z_SAFE_HOMING ARC_P_CIRCLES CNC_WORKSPACE_PLANES CNC_COORDINATE_SYSTEMS
   - opt_enable REPRAP_DISCOUNT_SMART_CONTROLLER SDSUPPORT EEPROM_SETTINGS
-  - opt_enable BLINKM PCA9632 RGB_LED NEOPIXEL_LED
+  - opt_enable BLINKM PCA9632 RGB_LED NEOPIXEL_LED AUTO_POWER_CONTROL
   - opt_enable AUTO_BED_LEVELING_LINEAR Z_MIN_PROBE_REPEATABILITY_TEST DEBUG_LEVELING_FEATURE SKEW_CORRECTION SKEW_CORRECTION_FOR_Z SKEW_CORRECTION_GCODE
   - opt_enable_adv FWRETRACT MAX7219_DEBUG LED_CONTROL_MENU CASE_LIGHT_ENABLE CASE_LIGHT_USE_NEOPIXEL
   - opt_set ABL_GRID_POINTS_X 16

From 7280fa1e31c4c027a9711aab6eda599af2b803ac Mon Sep 17 00:00:00 2001
From: Scott Lahteine <github@thinkyhead.com>
Date: Sat, 10 Feb 2018 15:41:18 -0600
Subject: [PATCH 2/2] Patch Power class

---
 Marlin/src/feature/power.cpp    | 7 ++++---
 Marlin/src/feature/power.h      | 2 ++
 Marlin/src/module/temperature.h | 2 +-
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/Marlin/src/feature/power.cpp b/Marlin/src/feature/power.cpp
index d713cb3ddf..c72d7100e4 100644
--- a/Marlin/src/feature/power.cpp
+++ b/Marlin/src/feature/power.cpp
@@ -29,8 +29,9 @@
 #if ENABLED(AUTO_POWER_CONTROL)
 
 #include "power.h"
-#include "temperature.h"
-#include "stepper_indirection.h"
+#include "../module/temperature.h"
+#include "../module/stepper_indirection.h"
+#include "../Marlin.h"
 
 Power powerManager;
 
@@ -50,7 +51,7 @@ bool Power::is_power_needed() {
   #endif
 
   if (X_ENABLE_READ == X_ENABLE_ON || Y_ENABLE_READ == Y_ENABLE_ON || Z_ENABLE_READ == Z_ENABLE_ON ||
-      thermalManager.soft_pwm_bed > 0
+      thermalManager.soft_pwm_amount_bed > 0
       || E0_ENABLE_READ == E_ENABLE_ON // If any of the drivers are enabled...
       #if E_STEPPERS > 1
         || E1_ENABLE_READ == E_ENABLE_ON
diff --git a/Marlin/src/feature/power.h b/Marlin/src/feature/power.h
index c61c64e6f7..225e4dc6f3 100644
--- a/Marlin/src/feature/power.h
+++ b/Marlin/src/feature/power.h
@@ -27,6 +27,8 @@
 #ifndef POWER_H
 #define POWER_H
 
+#include "../core/types.h"
+
 class Power {
   public:
     static void check();
diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h
index 49019ebfe0..4210803011 100644
--- a/Marlin/src/module/temperature.h
+++ b/Marlin/src/module/temperature.h
@@ -35,7 +35,7 @@
 #endif
 
 #if ENABLED(AUTO_POWER_CONTROL)
-  #include "power.h"
+  #include "../feature/power.h"
 #endif
 
 #if ENABLED(PID_EXTRUSION_SCALING)