From 6cba11f08765de0cf57709d740845c70afc6bcc8 Mon Sep 17 00:00:00 2001 From: Johann Rocholl Date: Sun, 9 Dec 2012 01:32:09 -0800 Subject: [PATCH] Stop redefining MOTHERBOARD and #define AT90USB instead. Also put #ifndef AT90USB around the HardwareSerial_h trick, so now Printrboard / Brainwave support compiles on Arduino 1.0.2 as well. --- Marlin/Marlin.h | 4 +++- Marlin/MarlinSerial.cpp | 5 ++--- Marlin/MarlinSerial.h | 4 ++-- Marlin/pins.h | 6 ++---- Marlin/stepper.cpp | 6 +++--- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h index 2af7dc97a9..cae67ad5ea 100644 --- a/Marlin/Marlin.h +++ b/Marlin/Marlin.h @@ -4,7 +4,9 @@ #ifndef MARLIN_H #define MARLIN_H +#ifndef AT90USB #define HardwareSerial_h // trick to disable the standard HWserial +#endif #define FORCE_INLINE __attribute__((always_inline)) inline @@ -45,7 +47,7 @@ #include "WString.h" -#if MOTHERBOARD == 8 // Teensylu +#ifdef AT90USB #define MYSERIAL Serial #else #define MYSERIAL MSerial diff --git a/Marlin/MarlinSerial.cpp b/Marlin/MarlinSerial.cpp index 0d2aceb3f2..1358f38590 100644 --- a/Marlin/MarlinSerial.cpp +++ b/Marlin/MarlinSerial.cpp @@ -23,7 +23,7 @@ #include "Marlin.h" #include "MarlinSerial.h" -#if MOTHERBOARD != 8 // !teensylu +#ifndef AT90USB // this next line disables the entire HardwareSerial.cpp, // this is so I can support Attiny series and any other chip without a uart #if defined(UBRRH) || defined(UBRR0H) || defined(UBRR1H) || defined(UBRR2H) || defined(UBRR3H) @@ -319,5 +319,4 @@ void MarlinSerial::printFloat(double number, uint8_t digits) MarlinSerial MSerial; #endif // whole file -#endif //teensylu - +#endif // !AT90USB diff --git a/Marlin/MarlinSerial.h b/Marlin/MarlinSerial.h index a48ffbe509..9514730fa0 100644 --- a/Marlin/MarlinSerial.h +++ b/Marlin/MarlinSerial.h @@ -65,7 +65,7 @@ #define BYTE 0 -#if MOTHERBOARD != 8 // ! teensylu +#ifndef AT90USB // Define constants and variables for buffering incoming serial data. We're // using a ring buffer (I think), in which rx_buffer_head is the index of the // location to which to write the next incoming character and rx_buffer_tail @@ -179,6 +179,6 @@ class MarlinSerial //: public Stream }; extern MarlinSerial MSerial; -#endif // ! teensylu +#endif // !AT90USB #endif diff --git a/Marlin/pins.h b/Marlin/pins.h index ec708d87a3..53da259097 100644 --- a/Marlin/pins.h +++ b/Marlin/pins.h @@ -963,9 +963,8 @@ * See http://reprap.org/wiki/Printrboard for more info ****************************************************************************************/ #if MOTHERBOARD == 8 || MOTHERBOARD == 81 -#undef MOTHERBOARD -#define MOTHERBOARD 8 // Disable MarlinSerial etc. #define KNOWN_BOARD 1 +#define AT90USB 1286 // Disable MarlinSerial etc. #ifndef __AVR_AT90USB1286__ #error Oops! Make sure you have 'Teensy++ 2.0' selected from the 'Tools -> Boards' menu. @@ -1026,9 +1025,8 @@ https://github.com/unrepentantgeek/brainwave-arduino ****************************************************************************************/ #if MOTHERBOARD == 82 -#undef MOTHERBOARD -#define MOTHERBOARD 8 // Disable MarlinSerial etc. #define KNOWN_BOARD 1 +#define AT90USB 646 // Disable MarlinSerial etc. #ifndef __AVR_AT90USB646__ #error Oops! Make sure you have 'Brainwave' selected from the 'Tools -> Boards' menu. diff --git a/Marlin/stepper.cpp b/Marlin/stepper.cpp index d9c0a45c5d..81f26f6be0 100644 --- a/Marlin/stepper.cpp +++ b/Marlin/stepper.cpp @@ -478,10 +478,10 @@ ISR(TIMER1_COMPA_vect) for(int8_t i=0; i < step_loops; i++) { // Take multiple steps per interrupt (For high speed moves) - #if MOTHERBOARD != 8 // !teensylu + #ifndef AT90USB MSerial.checkRx(); // Check for serial chars. - #endif - + #endif + #ifdef ADVANCE counter_e += current_block->steps_e; if (counter_e > 0) {