diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 4aff7fe099..9db8dee5f4 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -37,6 +37,8 @@ // 7 = Ultimaker // 71 = Ultimaker (Older electronics. Pre 1.5.4. This is rare) // 8 = Teensylu +// 81 = Printrboard (AT90USB1286) +// 82 = Brainwave (AT90USB646) // 9 = Gen3+ // 70 = Megatronics // 90 = Alpha OMCA board diff --git a/Marlin/Makefile b/Marlin/Makefile index 28f4120d01..dee6eccbe0 100644 --- a/Marlin/Makefile +++ b/Marlin/Makefile @@ -99,21 +99,21 @@ MCU ?= atmega328p #Gen6 else ifeq ($(HARDWARE_MOTHERBOARD),5) HARDWARE_VARIANT ?= Gen6 -MCU ?= atmega664p +MCU ?= atmega644p else ifeq ($(HARDWARE_MOTHERBOARD),51) HARDWARE_VARIANT ?= Gen6 -MCU ?= atmega664p +MCU ?= atmega644p #Sanguinololu else ifeq ($(HARDWARE_MOTHERBOARD),6) HARDWARE_VARIANT ?= Sanguino -MCU ?= atmega1284p +MCU ?= atmega644p else ifeq ($(HARDWARE_MOTHERBOARD),62) HARDWARE_VARIANT ?= Sanguino -MCU ?= atmega1284p +MCU ?= atmega644p else ifeq ($(HARDWARE_MOTHERBOARD),63) HARDWARE_VARIANT ?= Sanguino -MCU ?= atmega1284p +MCU ?= atmega644p #Ultimaker else ifeq ($(HARDWARE_MOTHERBOARD),7) @@ -127,6 +127,12 @@ MCU ?= atmega1280 else ifeq ($(HARDWARE_MOTHERBOARD),8) HARDWARE_VARIANT ?= Teensyduino MCU ?= at90usb1286 +else ifeq ($(HARDWARE_MOTHERBOARD),81) +HARDWARE_VARIANT ?= Teensyduino +MCU ?= at90usb1286 +else ifeq ($(HARDWARE_MOTHERBOARD),82) +HARDWARE_VARIANT ?= Teensyduino +MCU ?= at90usb646 #Gen3+ else ifeq ($(HARDWARE_MOTHERBOARD),9) diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h index 2af7dc97a9..a6aa43e00a 100644 --- a/Marlin/Marlin.h +++ b/Marlin/Marlin.h @@ -4,8 +4,6 @@ #ifndef MARLIN_H #define MARLIN_H -#define HardwareSerial_h // trick to disable the standard HWserial - #define FORCE_INLINE __attribute__((always_inline)) inline #include @@ -24,6 +22,10 @@ #include "Configuration.h" #include "pins.h" +#ifndef AT90USB +#define HardwareSerial_h // trick to disable the standard HWserial +#endif + #if ARDUINO >= 100 #if defined(__AVR_ATmega644P__) #include "WProgram.h" @@ -45,7 +47,7 @@ #include "WString.h" -#if MOTHERBOARD == 8 // Teensylu +#ifdef AT90USB #define MYSERIAL Serial #else #define MYSERIAL MSerial @@ -179,7 +181,7 @@ void setPwmFrequency(uint8_t pin, int val); extern float homing_feedrate[]; extern bool axis_relative_modes[]; -extern int feedmultiply; +extern int feedmultiply; extern bool feedmultiplychanged; extern int extrudemultiply; // Sets extrude multiply factor (in percent) extern float current_position[NUM_AXIS] ; 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/fastio.h b/Marlin/fastio.h index 6749a28bf9..ed77b50e23 100644 --- a/Marlin/fastio.h +++ b/Marlin/fastio.h @@ -1928,7 +1928,7 @@ pins #endif -#if defined (__AVR_AT90USB1287__) || defined (__AVR_AT90USB1286__) +#if defined (__AVR_AT90USB1287__) || defined (__AVR_AT90USB1286__) || defined (__AVR_AT90USB646__) || defined(__AVR_AT90USB647__) // SPI #define SCK DIO9 #define MISO DIO11 diff --git a/Marlin/pins.h b/Marlin/pins.h index febe2cd1f3..59f86a5ac7 100644 --- a/Marlin/pins.h +++ b/Marlin/pins.h @@ -957,64 +957,140 @@ #endif /**************************************************************************************** -* Teensylu 0.7 pin assingments (ATMEGA90USB) -* Requires the Teensyduino software with Teensy2.0++ selected in arduino IDE! +* Teensylu 0.7 / Printrboard pin assignments (AT90USB1286) +* Requires the Teensyduino software with Teensy++ 2.0 selected in Arduino IDE! + http://www.pjrc.com/teensy/teensyduino.html +* See http://reprap.org/wiki/Printrboard for more info ****************************************************************************************/ -#if MOTHERBOARD == 8 -#define MOTHERBOARD 8 +#if MOTHERBOARD == 8 || MOTHERBOARD == 81 #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. +#endif -#define X_STEP_PIN 0 -#define X_DIR_PIN 1 -#define X_ENABLE_PIN 39 -#define X_MIN_PIN 13 -#define X_MAX_PIN -1 +#define X_STEP_PIN 0 +#define X_DIR_PIN 1 +#define X_ENABLE_PIN 39 +#define X_MIN_PIN 13 +#define X_MAX_PIN -1 -#define Y_STEP_PIN 2 -#define Y_DIR_PIN 3 -#define Y_ENABLE_PIN 38 -#define Y_MIN_PIN 14 -#define Y_MAX_PIN -1 +#define Y_STEP_PIN 2 +#define Y_DIR_PIN 3 +#define Y_ENABLE_PIN 38 +#define Y_MIN_PIN 14 +#define Y_MAX_PIN -1 #define Z_STEP_PIN 4 -#define Z_DIR_PIN 5 -#define Z_ENABLE_PIN 23 -#define Z_MIN_PIN 15 -#define Z_MAX_PIN -1 - -#define E0_STEP_PIN 6 -#define E0_DIR_PIN 7 -#define E0_ENABLE_PIN 19 - +#define Z_DIR_PIN 5 +#define Z_ENABLE_PIN 23 +#define Z_MIN_PIN 15 +#define Z_MAX_PIN -1 +#define E0_STEP_PIN 6 +#define E0_DIR_PIN 7 +#define E0_ENABLE_PIN 19 #define HEATER_0_PIN 21 // Extruder #define HEATER_1_PIN -1 #define HEATER_2_PIN -1 #define HEATER_BED_PIN 20 // Bed -#define FAN_PIN 22 // Fan +#define FAN_PIN 22 // Fan + +#if MOTHERBOARD == 8 + #define TEMP_0_PIN 7 // Extruder / Analog pin numbering + #define TEMP_BED_PIN 6 // Bed / Analog pin numbering +#else + #define TEMP_0_PIN 1 // Extruder / Analog pin numbering + #define TEMP_BED_PIN 0 // Bed / Analog pin numbering +#endif -#define TEMP_0_PIN 7 // Extruder #define TEMP_1_PIN -1 #define TEMP_2_PIN -1 -#define TEMP_BED_PIN 6 // Bed #define SDPOWER -1 #define SDSS 8 #define LED_PIN -1 #define PS_ON_PIN -1 -#define KILL_PIN -1 +#define KILL_PIN -1 #define ALARM_PIN -1 #ifndef SDSUPPORT -// these pins are defined in the SD library if building with SD support - #define SCK_PIN 9 - #define MISO_PIN 11 - #define MOSI_PIN 10 +// these pins are defined in the SD library if building with SD support + #define SCK_PIN 9 + #define MISO_PIN 11 + #define MOSI_PIN 10 #endif + +#endif // MOTHERBOARD == 8 (Teensylu) or 81 (Printrboard) + +/**************************************************************************************** + * Brainwave 1.0 pin assignments (AT90USB646) + * Requires hardware bundle for Arduino: + https://github.com/unrepentantgeek/brainwave-arduino + ****************************************************************************************/ +#if MOTHERBOARD == 82 +#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. #endif +#define X_STEP_PIN 27 +#define X_DIR_PIN 29 +#define X_ENABLE_PIN 28 +#define X_MIN_PIN 7 +#define X_MAX_PIN -1 +#define X_ATT_PIN 26 + +#define Y_STEP_PIN 31 +#define Y_DIR_PIN 33 +#define Y_ENABLE_PIN 32 +#define Y_MIN_PIN 6 +#define Y_MAX_PIN -1 +#define Y_ATT_PIN 30 + +#define Z_STEP_PIN 17 +#define Z_DIR_PIN 19 +#define Z_ENABLE_PIN 18 +#define Z_MIN_PIN 5 +#define Z_MAX_PIN -1 +#define Z_ATT_PIN 16 + +#define E0_STEP_PIN 21 +#define E0_DIR_PIN 23 +#define E0_ENABLE_PIN 22 +#define E0_ATT_PIN 20 + +#define HEATER_0_PIN 4 // Extruder +#define HEATER_1_PIN -1 +#define HEATER_2_PIN -1 +#define HEATER_BED_PIN 38 // Bed +#define FAN_PIN 3 // Fan + +#define TEMP_0_PIN 7 // Extruder / Analog pin numbering +#define TEMP_1_PIN -1 +#define TEMP_2_PIN -1 +#define TEMP_BED_PIN 6 // Bed / Analog pin numbering + +#define SDPOWER -1 +#define SDSS -1 +#define LED_PIN 39 +#define PS_ON_PIN -1 +#define KILL_PIN -1 +#define ALARM_PIN -1 + +#ifndef SDSUPPORT +// these pins are defined in the SD library if building with SD support + #define SCK_PIN 9 + #define MISO_PIN 11 + #define MOSI_PIN 10 +#endif + +#endif // MOTHERBOARD == 82 (Brainwave) + /**************************************************************************************** * Gen3+ pin assignment * diff --git a/Marlin/stepper.cpp b/Marlin/stepper.cpp index 760b3a752a..81b2ab75c6 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) {