From a255945f29406890e5c17b652127f75cbe885605 Mon Sep 17 00:00:00 2001
From: Scott Lahteine <sourcetree@thinkyhead.com>
Date: Sat, 27 Aug 2016 19:37:31 -0500
Subject: [PATCH 1/3] Add DEBUG_ALL enum

---
 Marlin/enum.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Marlin/enum.h b/Marlin/enum.h
index a51d208aee..ded1be6ec7 100644
--- a/Marlin/enum.h
+++ b/Marlin/enum.h
@@ -70,7 +70,8 @@ enum DebugFlags {
   DEBUG_ERRORS        = _BV(2), ///< Not implemented
   DEBUG_DRYRUN        = _BV(3), ///< Ignore temperature setting and E movement commands
   DEBUG_COMMUNICATION = _BV(4), ///< Not implemented
-  DEBUG_LEVELING      = _BV(5)  ///< Print detailed output for homing and leveling
+  DEBUG_LEVELING      = _BV(5), ///< Print detailed output for homing and leveling
+  DEBUG_ALL           = 0xFF
 };
 
 enum EndstopEnum {

From e9bfca58700e832d8356146bf9de34d4b9cf243d Mon Sep 17 00:00:00 2001
From: Scott Lahteine <sourcetree@thinkyhead.com>
Date: Sat, 27 Aug 2016 20:06:26 -0500
Subject: [PATCH 2/3] Additional comments for Temperature::isr

---
 Marlin/temperature.cpp | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp
index 353732dfa4..c6122a4c6c 100644
--- a/Marlin/temperature.cpp
+++ b/Marlin/temperature.cpp
@@ -1399,7 +1399,12 @@ void Temperature::set_current_temp_raw() {
 }
 
 /**
- * Timer 0 is shared with millies
+ * Timer 0 is shared with millies so don't change the prescaler.
+ *
+ * This ISR uses the compare method so it runs at the base
+ * frequency (16 MHz / 256 = 62500 Hz), but at the TCNT0 set
+ * in OCR0B above (128 or halfway between OVFs).
+ *
  *  - Manage PWM to all the heaters and fan
  *  - Update the raw temperature values
  *  - Check new temperature values for MIN/MAX errors
@@ -1515,6 +1520,7 @@ void Temperature::isr() {
       #endif
     #endif
 
+    // 488.28 Hz (or 1:976.56, 2:1953.12, 3:3906.25, 4:7812.5, 5:7812.5 6:15625, 6:15625 7:31250)
     pwm_count += _BV(SOFT_PWM_SCALE);
     pwm_count &= 0x7f;
 
@@ -1523,7 +1529,7 @@ void Temperature::isr() {
     /**
      * SLOW PWM HEATERS
      *
-     * for heaters drived by relay
+     * For relay-driven heaters
      */
     #ifndef MIN_STATE_TIME
       #define MIN_STATE_TIME 16 // MIN_STATE_TIME * 65.5 = time in milliseconds

From a485a1905290209beb851876a2d068563384bcd0 Mon Sep 17 00:00:00 2001
From: Scott Lahteine <sourcetree@thinkyhead.com>
Date: Sat, 27 Aug 2016 20:06:51 -0500
Subject: [PATCH 3/3] Added optional planner logging

---
 Marlin/planner.cpp | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/Marlin/planner.cpp b/Marlin/planner.cpp
index 4fd18f5a2b..dd065988fc 100644
--- a/Marlin/planner.cpp
+++ b/Marlin/planner.cpp
@@ -567,6 +567,17 @@ void Planner::check_axes_activity() {
        dy = target[Y_AXIS] - position[Y_AXIS],
        dz = target[Z_AXIS] - position[Z_AXIS];
 
+  /*
+  SERIAL_ECHO_START;
+  SERIAL_ECHOPAIR("Planner X:", x);
+  SERIAL_ECHOPAIR(" (", dx);
+  SERIAL_ECHOPAIR(") Y:", y);
+  SERIAL_ECHOPAIR(" (", dy);
+  SERIAL_ECHOPAIR(") Z:", z);
+  SERIAL_ECHOPAIR(" (", dz);
+  SERIAL_ECHOLNPGM(")");
+  //*/
+
   // DRYRUN ignores all temperature constraints and assures that the extruder is instantly satisfied
   if (DEBUGGING(DRYRUN))
     position[E_AXIS] = target[E_AXIS];