From 3c1a4aac2bbe6f77b2e779520f848685c1c57cc1 Mon Sep 17 00:00:00 2001
From: Bernhard <bkubicek@x201.(none)>
Date: Thu, 22 Dec 2011 12:38:50 +0100
Subject: [PATCH] header file simplification

---
 Marlin/EEPROMwrite.h      | 1 -
 Marlin/Marlin.h           | 8 +++++++-
 Marlin/Marlin.pde         | 7 ++++---
 Marlin/cardreader.pde     | 3 +--
 Marlin/motion_control.cpp | 1 -
 Marlin/planner.cpp        | 7 +------
 Marlin/planner.h          | 3 +--
 Marlin/stepper.cpp        | 4 +---
 Marlin/temperature.cpp    | 5 +----
 Marlin/temperature.h      | 1 -
 Marlin/ultralcd.h         | 5 ++---
 Marlin/ultralcd.pde       | 4 +---
 Marlin/watchdog.h         | 2 +-
 13 files changed, 20 insertions(+), 31 deletions(-)

diff --git a/Marlin/EEPROMwrite.h b/Marlin/EEPROMwrite.h
index 8680a5fdc8..5714dacfe3 100644
--- a/Marlin/EEPROMwrite.h
+++ b/Marlin/EEPROMwrite.h
@@ -5,7 +5,6 @@
 #include "planner.h"
 #include "temperature.h"
 
-#include <EEPROM.h>
 
 template <class T> int EEPROM_writeAnything(int &ee, const T& value)
 {
diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h
index f8ded924e1..0773f11c1b 100644
--- a/Marlin/Marlin.h
+++ b/Marlin/Marlin.h
@@ -6,15 +6,21 @@
 #define  HardwareSerial_h // trick to disable the standard HWserial
 #include <stdio.h>
 #include <math.h>
+#include <util/delay.h>
+#include <avr/pgmspace.h>
+
+
 #if ARDUINO >= 100
   #include "Arduino.h"
 #else
    #include "WProgram.h"
 #endif
+#include <EEPROM.h>
+
 
 #include "fastio.h"
-#include <avr/pgmspace.h>
 #include "Configuration.h"
+#include "pins.h"
 #include "MarlinSerial.h"
 
 #define  FORCE_INLINE __attribute__((always_inline)) inline
diff --git a/Marlin/Marlin.pde b/Marlin/Marlin.pde
index c20ac49b62..bf9a1bc489 100644
--- a/Marlin/Marlin.pde
+++ b/Marlin/Marlin.pde
@@ -25,7 +25,8 @@
     http://reprap.org/pipermail/reprap-dev/2011-May/003323.html
  */
 
-#include <math.h>
+
+#include "Marlin.h"
 #include <EEPROM.h>
 #include <stdio.h>
 
@@ -33,7 +34,7 @@
 #include "fastio.h"
 #include "Configuration.h"
 #include "pins.h"
-#include "Marlin.h"
+
 #include "ultralcd.h"
 #include "planner.h"
 #include "stepper.h"
@@ -41,7 +42,7 @@
 #include "motion_control.h"
 #include "cardreader.h"
 #include "watchdog.h"
-#include <util/delay.h>
+
 
 
 
diff --git a/Marlin/cardreader.pde b/Marlin/cardreader.pde
index a5044f8d33..89f4b2f93f 100644
--- a/Marlin/cardreader.pde
+++ b/Marlin/cardreader.pde
@@ -1,8 +1,7 @@
 #include "cardreader.h"
-//#include <unistd.h>
 #ifdef SDSUPPORT
 
-#include "Configuration.h"
+#include "Marlin.h"
 
 CardReader::CardReader()
 {
diff --git a/Marlin/motion_control.cpp b/Marlin/motion_control.cpp
index 8ecc1a0445..ab403e9812 100644
--- a/Marlin/motion_control.cpp
+++ b/Marlin/motion_control.cpp
@@ -19,7 +19,6 @@
   along with Grbl.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#include "Configuration.h"
 #include "Marlin.h"
 #include "stepper.h"
 #include "planner.h"
diff --git a/Marlin/planner.cpp b/Marlin/planner.cpp
index 1d66dad03f..f3007af531 100644
--- a/Marlin/planner.cpp
+++ b/Marlin/planner.cpp
@@ -52,14 +52,9 @@
 */
                                                                                                             
 
-//#include <inttypes.h>
-//#include <math.h>       
-//#include <stdlib.h>
 
-#include "Configuration.h"
-#include "pins.h"
+
 #include "Marlin.h"
-#include "fastio.h"
 #include "planner.h"
 #include "stepper.h"
 #include "temperature.h"
diff --git a/Marlin/planner.h b/Marlin/planner.h
index 82f53413ef..02e299fa8c 100644
--- a/Marlin/planner.h
+++ b/Marlin/planner.h
@@ -23,8 +23,7 @@
 
 #ifndef planner_h
 #define planner_h
-#include <math.h>
-#include "Configuration.h"
+
 #include "Marlin.h"
 
 // This struct is used when buffering the setup for each linear movement "nominal" values are as specified in 
diff --git a/Marlin/stepper.cpp b/Marlin/stepper.cpp
index cffa25f2ac..6985da00b4 100644
--- a/Marlin/stepper.cpp
+++ b/Marlin/stepper.cpp
@@ -23,11 +23,9 @@
 
 
 #include "stepper.h"
-#include "Configuration.h"
-#include "pins.h"
+
 #include "Marlin.h"
 #include "planner.h"
-#include "fastio.h"
 #include "temperature.h"
 #include "ultralcd.h"
 
diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp
index e6c352fdff..371c6e589b 100644
--- a/Marlin/temperature.cpp
+++ b/Marlin/temperature.cpp
@@ -27,11 +27,8 @@
     http://reprap.org/pipermail/reprap-dev/2011-May/003323.html
 
  */
-#include <avr/pgmspace.h>
 
-#include "fastio.h"
-#include "Configuration.h"
-#include "pins.h"
+
 #include "Marlin.h"
 #include "ultralcd.h"
 #include "temperature.h"
diff --git a/Marlin/temperature.h b/Marlin/temperature.h
index 8e1deac8fe..80e68f78b4 100644
--- a/Marlin/temperature.h
+++ b/Marlin/temperature.h
@@ -22,7 +22,6 @@
 #define temperature_h 
 
 #include "Marlin.h"
-#include "fastio.h"
 #include "planner.h"
 #ifdef PID_ADD_EXTRUSION_RATE
   #include "stepper.h"
diff --git a/Marlin/ultralcd.h b/Marlin/ultralcd.h
index 93fa4895d7..716ddb90c5 100644
--- a/Marlin/ultralcd.h
+++ b/Marlin/ultralcd.h
@@ -1,9 +1,8 @@
 #ifndef __ULTRALCDH
 #define __ULTRALCDH
-#include "Configuration.h"
 #include "Marlin.h"
 #ifdef ULTRA_LCD
-
+  #include <LiquidCrystal.h>
   void lcd_status();
   void lcd_init();
   void lcd_status(const char* message);
@@ -15,7 +14,7 @@
   #define STATUSTIMEOUT 15000
 
 
-  #include <LiquidCrystal.h>
+  
   extern LiquidCrystal lcd;
 
 
diff --git a/Marlin/ultralcd.pde b/Marlin/ultralcd.pde
index 35c0c4091a..5be09ac4a6 100644
--- a/Marlin/ultralcd.pde
+++ b/Marlin/ultralcd.pde
@@ -1,6 +1,6 @@
 #include "ultralcd.h"
 #ifdef ULTRA_LCD
-
+#include <LiquidCrystal.h>
 //===========================================================================
 //=============================imported variables============================
 //===========================================================================
@@ -27,7 +27,6 @@ static char messagetext[LCD_WIDTH]="";
 //return for string conversion routines
 static char conv[8];
 
-#include <LiquidCrystal.h>
 LiquidCrystal lcd(LCD_PINS_RS, LCD_PINS_ENABLE, LCD_PINS_D4, LCD_PINS_D5,LCD_PINS_D6,LCD_PINS_D7);  //RS,Enable,D4,D5,D6,D7 
 
 static unsigned long previous_millis_lcd=0;
@@ -42,7 +41,6 @@ static long previous_millis_buttons=0;
  
 static MainMenu menu;
 
-#include <avr/pgmspace.h>
 
 void lcdProgMemprint(const char *str)
 {
diff --git a/Marlin/watchdog.h b/Marlin/watchdog.h
index 1d41488271..ff6af60afd 100644
--- a/Marlin/watchdog.h
+++ b/Marlin/watchdog.h
@@ -1,6 +1,6 @@
 #ifndef __WATCHDOGH
 #define __WATCHDOGH
-#include "Configuration.h"
+#include "Marlin.h"
 #ifdef USE_WATCHDOG
 
   // intialise watch dog with a 1 sec interrupt time