//LCD and SD support
//#define ULTRA_LCD //general lcd support, also 16x2
-//#define SDSUPPORT // Enable SD Card Support in Hardware Console
+#define SDSUPPORT // Enable SD Card Support in Hardware Console
//#define ULTIPANEL
#ifdef ULTIPANEL
#include "WString.h"
-
+#if MOTHERBOARD == 8 // Teensylu
+ #define SERIAL Serial
+#else
+ #define SERIAL MSerial
+#endif
//this is a unfinsihed attemp to removes a lot of warning messages, see:
// http://www.avrfreaks.net/index.php?name=PNphpBB2&file=printview&t=57011
//#define MYPGM(s) (__extension__({static prog_char __c[] = (s); &__c[0];})) //this does not work but hides the warnings
-#define SERIAL_PROTOCOL(x) MSerial.print(x);
+#define SERIAL_PROTOCOL(x) SERIAL.print(x);
#define SERIAL_PROTOCOLPGM(x) serialprintPGM(MYPGM(x));
-#define SERIAL_PROTOCOLLN(x) {MSerial.print(x);MSerial.write('\n');}
-#define SERIAL_PROTOCOLLNPGM(x) {serialprintPGM(MYPGM(x));MSerial.write('\n');}
+#define SERIAL_PROTOCOLLN(x) {SERIAL.print(x);SERIAL.write('\n');}
+#define SERIAL_PROTOCOLLNPGM(x) {serialprintPGM(MYPGM(x));SERIAL.write('\n');}
const prog_char errormagic[] PROGMEM ="Error:";
char ch=pgm_read_byte(str);
while(ch)
{
- MSerial.write(ch);
+ SERIAL.write(ch);
ch=pgm_read_byte(++str);
}
}
void setup()
{
setup_powerhold();
- MSerial.begin(BAUDRATE);
+ SERIAL.begin(BAUDRATE);
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM(VERSION_STRING);
SERIAL_PROTOCOLLNPGM("start");
void get_command()
{
- while( MSerial.available() > 0 && buflen < BUFSIZE) {
- serial_char = MSerial.read();
+ while( SERIAL.available() > 0 && buflen < BUFSIZE) {
+ serial_char = SERIAL.read();
if(serial_char == '\n' || serial_char == '\r' || serial_char == ':' || serial_count >= (MAX_CMD_SIZE - 1) )
{
if(!serial_count) return; //if empty line
void FlushSerialRequestResend()
{
//char cmdbuffer[bufindr][100]="Resend:";
- MSerial.flush();
+ SERIAL.flush();
SERIAL_PROTOCOLPGM("Resend:");
SERIAL_PROTOCOLLN(gcode_LastN + 1);
ClearToSend();
#include "Marlin.h"
#include "MarlinSerial.h"
+#if MOTHERBOARD != 8 // !teensylu
// 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)
-
-
-
-
-
#if defined(UBRRH) || defined(UBRR0H)
ring_buffer rx_buffer = { { 0 }, 0, 0 };
#endif
-
FORCE_INLINE void store_char(unsigned char c)
{
int i = (unsigned int)(rx_buffer.head + 1) % RX_BUFFER_SIZE;
remainder -= toPrint;
}
}
-
// Preinstantiate Objects //////////////////////////////////////////////////////
-MarlinSerial MSerial;
+MarlinSerial MSerial;
#endif // whole file
+#endif //teensylu
#define BYTE 0
-
+#if MOTHERBOARD != 8 // ! teensylu
// 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
void println(void);
};
-#if defined(UBRRH) || defined(UBRR0H)
- extern MarlinSerial MSerial;
-#endif
+extern MarlinSerial MSerial;
+#endif // ! teensylu
#endif
* <http://www.gnu.org/licenses/>.
*/
-#define SERIAL MSerial
-
#include "Marlin.h"
#ifdef SDSUPPORT
&& DIR_IS_FILE_OR_SUBDIR(&dir)) break;
}
// indent for dir level
- for (uint8_t i = 0; i < indent; i++) MSerial.write(' ');
+ for (uint8_t i = 0; i < indent; i++) SERIAL.write(' ');
// print name
for (uint8_t i = 0; i < 11; i++) {
if (dir.name[i] == ' ')continue;
if (i == 8) {
- MSerial.write('.');
+ SERIAL.write('.');
w++;
}
- MSerial.write(dir.name[i]);
+ SERIAL.write(dir.name[i]);
w++;
}
if (DIR_IS_SUBDIR(&dir)) {
- MSerial.write('/');
+ SERIAL.write('/');
w++;
}
if (flags & (LS_DATE | LS_SIZE)) {
- while (w++ < 14) MSerial.write(' ');
+ while (w++ < 14) SERIAL.write(' ');
}
// print modify date/time if requested
if (flags & LS_DATE) {
- MSerial.write(' ');
+ SERIAL.write(' ');
printFatDate( dir.lastWriteDate);
- MSerial.write(' ');
+ SERIAL.write(' ');
printFatTime( dir.lastWriteTime);
}
// print size if requested
if (!DIR_IS_SUBDIR(&dir) && (flags & LS_SIZE)) {
- MSerial.write(' ');
- MSerial.print(dir.fileSize);
+ SERIAL.write(' ');
+ SERIAL.print(dir.fileSize);
}
- MSerial.println();
+ SERIAL.println();
return DIR_IS_FILE(&dir) ? 1 : 2;
}
//------------------------------------------------------------------------------
for (uint8_t i = 0; i < 11; i++) {
if (dir.name[i] == ' ')continue;
if (i == 8) {
- MSerial.write('.');
+ SERIAL.write('.');
w++;
}
- MSerial.write(dir.name[i]);
+ SERIAL.write(dir.name[i]);
w++;
}
if (DIR_IS_SUBDIR(&dir) && printSlash) {
- MSerial.write('/');
+ SERIAL.write('/');
w++;
}
while (w < width) {
- MSerial.write(' ');
+ SERIAL.write(' ');
w++;
}
}
//------------------------------------------------------------------------------
// print uint8_t with width 2
static void print2u( uint8_t v) {
- if (v < 10) MSerial.write('0');
- MSerial.print(v, DEC);
+ if (v < 10) SERIAL.write('0');
+ SERIAL.print(v, DEC);
}
//------------------------------------------------------------------------------
/** %Print a directory date field to Serial.
* \param[in] fatDate The date field from a directory entry.
*/
void SdBaseFile::printFatDate(uint16_t fatDate) {
- MSerial.print(FAT_YEAR(fatDate));
- MSerial.write('-');
+ SERIAL.print(FAT_YEAR(fatDate));
+ SERIAL.write('-');
print2u( FAT_MONTH(fatDate));
- MSerial.write('-');
+ SERIAL.write('-');
print2u( FAT_DAY(fatDate));
}
*/
void SdBaseFile::printFatTime( uint16_t fatTime) {
print2u( FAT_HOUR(fatTime));
- MSerial.write(':');
+ SERIAL.write(':');
print2u( FAT_MINUTE(fatTime));
- MSerial.write(':');
+ SERIAL.write(':');
print2u( FAT_SECOND(fatTime));
}
//------------------------------------------------------------------------------
bool SdBaseFile::printName() {
char name[13];
if (!getFilename(name)) return false;
- MSerial.print(name);
+ SERIAL.print(name);
return true;
}
//------------------------------------------------------------------------------
#endif // ALLOW_DEPRECATED_FUNCTIONS
-#endif
\ No newline at end of file
+#endif
* \param[in] str Pointer to string stored in flash memory.
*/
void SdFatUtil::print_P( PGM_P str) {
- for (uint8_t c; (c = pgm_read_byte(str)); str++) MSerial.write(c);
+ for (uint8_t c; (c = pgm_read_byte(str)); str++) SERIAL.write(c);
}
//------------------------------------------------------------------------------
/** %Print a string in flash memory followed by a CR/LF.
*/
void SdFatUtil::println_P( PGM_P str) {
print_P( str);
- MSerial.println();
+ SERIAL.println();
}
//------------------------------------------------------------------------------
/** %Print a string in flash memory to Serial.
#endif
-#if defined (__AVR_AT90USB1287__)
+#if defined (__AVR_AT90USB1287__) || defined (__AVR_AT90USB1286__)
// SPI
#define SCK DIO9
#define MISO DIO11
timer = (unsigned short)pgm_read_word_near(table_address);
timer -= (((unsigned short)pgm_read_word_near(table_address+2) * (unsigned char)(step_rate & 0x0007))>>3);
}
- if(timer < 100) { timer = 100; MSerial.print("Steprate to high : "); MSerial.println(step_rate); }//(20kHz this should never happen)
+ if(timer < 100) { timer = 100; SERIAL.print("Steprate to high : "); SERIAL.println(step_rate); }//(20kHz this should never happen)
return timer;
}
for(int8_t i=0; i < step_loops; i++) { // Take multiple steps per interrupt (For high speed moves)
- MSerial.checkRx(); // Check for serial chars.
+ #if MOTHERBOARD != 8 // !teensylu
+ MSerial.checkRx(); // Check for serial chars.
+ #endif
#ifdef ADVANCE
counter_e += current_block->steps_e;