Merge pull request #61 from daid/Marlin_v1
Updated SERIAL define to MYSERIAL, because Arduino 1.0 defines SERIAL as 0.
This commit is contained in:
commit
3e7fcb813e
|
@ -47,9 +47,9 @@
|
||||||
#include "WString.h"
|
#include "WString.h"
|
||||||
|
|
||||||
#if MOTHERBOARD == 8 // Teensylu
|
#if MOTHERBOARD == 8 // Teensylu
|
||||||
#define SERIAL Serial
|
#define MYSERIAL Serial
|
||||||
#else
|
#else
|
||||||
#define SERIAL MSerial
|
#define MYSERIAL MSerial
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//this is a unfinsihed attemp to removes a lot of warning messages, see:
|
//this is a unfinsihed attemp to removes a lot of warning messages, see:
|
||||||
|
@ -63,10 +63,10 @@
|
||||||
//#define MYPGM(s) (__extension__({static prog_char __c[] = (s); &__c[0];})) //this does not work but hides the warnings
|
//#define MYPGM(s) (__extension__({static prog_char __c[] = (s); &__c[0];})) //this does not work but hides the warnings
|
||||||
|
|
||||||
|
|
||||||
#define SERIAL_PROTOCOL(x) SERIAL.print(x);
|
#define SERIAL_PROTOCOL(x) MYSERIAL.print(x);
|
||||||
#define SERIAL_PROTOCOLPGM(x) serialprintPGM(MYPGM(x));
|
#define SERIAL_PROTOCOLPGM(x) serialprintPGM(MYPGM(x));
|
||||||
#define SERIAL_PROTOCOLLN(x) {SERIAL.print(x);SERIAL.write('\n');}
|
#define SERIAL_PROTOCOLLN(x) {MYSERIAL.print(x);MYSERIAL.write('\n');}
|
||||||
#define SERIAL_PROTOCOLLNPGM(x) {serialprintPGM(MYPGM(x));SERIAL.write('\n');}
|
#define SERIAL_PROTOCOLLNPGM(x) {serialprintPGM(MYPGM(x));MYSERIAL.write('\n');}
|
||||||
|
|
||||||
|
|
||||||
const char errormagic[] PROGMEM ="Error:";
|
const char errormagic[] PROGMEM ="Error:";
|
||||||
|
@ -93,7 +93,7 @@ FORCE_INLINE void serialprintPGM(const char *str)
|
||||||
char ch=pgm_read_byte(str);
|
char ch=pgm_read_byte(str);
|
||||||
while(ch)
|
while(ch)
|
||||||
{
|
{
|
||||||
SERIAL.write(ch);
|
MYSERIAL.write(ch);
|
||||||
ch=pgm_read_byte(++str);
|
ch=pgm_read_byte(++str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -247,7 +247,7 @@ void suicide()
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
setup_powerhold();
|
setup_powerhold();
|
||||||
SERIAL.begin(BAUDRATE);
|
MYSERIAL.begin(BAUDRATE);
|
||||||
SERIAL_PROTOCOLLNPGM("start");
|
SERIAL_PROTOCOLLNPGM("start");
|
||||||
SERIAL_ECHO_START;
|
SERIAL_ECHO_START;
|
||||||
SERIAL_ECHOPGM("Marlin: ");
|
SERIAL_ECHOPGM("Marlin: ");
|
||||||
|
@ -328,8 +328,8 @@ void loop()
|
||||||
|
|
||||||
void get_command()
|
void get_command()
|
||||||
{
|
{
|
||||||
while( SERIAL.available() > 0 && buflen < BUFSIZE) {
|
while( MYSERIAL.available() > 0 && buflen < BUFSIZE) {
|
||||||
serial_char = SERIAL.read();
|
serial_char = MYSERIAL.read();
|
||||||
if(serial_char == '\n' || serial_char == '\r' || serial_char == ':' || serial_count >= (MAX_CMD_SIZE - 1) )
|
if(serial_char == '\n' || serial_char == '\r' || serial_char == ':' || serial_count >= (MAX_CMD_SIZE - 1) )
|
||||||
{
|
{
|
||||||
if(!serial_count) return; //if empty line
|
if(!serial_count) return; //if empty line
|
||||||
|
@ -1219,7 +1219,7 @@ void process_commands()
|
||||||
void FlushSerialRequestResend()
|
void FlushSerialRequestResend()
|
||||||
{
|
{
|
||||||
//char cmdbuffer[bufindr][100]="Resend:";
|
//char cmdbuffer[bufindr][100]="Resend:";
|
||||||
SERIAL.flush();
|
MYSERIAL.flush();
|
||||||
SERIAL_PROTOCOLPGM("Resend:");
|
SERIAL_PROTOCOLPGM("Resend:");
|
||||||
SERIAL_PROTOCOLLN(gcode_LastN + 1);
|
SERIAL_PROTOCOLLN(gcode_LastN + 1);
|
||||||
ClearToSend();
|
ClearToSend();
|
||||||
|
|
|
@ -343,38 +343,38 @@ int8_t SdBaseFile::lsPrintNext( uint8_t flags, uint8_t indent) {
|
||||||
&& DIR_IS_FILE_OR_SUBDIR(&dir)) break;
|
&& DIR_IS_FILE_OR_SUBDIR(&dir)) break;
|
||||||
}
|
}
|
||||||
// indent for dir level
|
// indent for dir level
|
||||||
for (uint8_t i = 0; i < indent; i++) SERIAL.write(' ');
|
for (uint8_t i = 0; i < indent; i++) MYSERIAL.write(' ');
|
||||||
|
|
||||||
// print name
|
// print name
|
||||||
for (uint8_t i = 0; i < 11; i++) {
|
for (uint8_t i = 0; i < 11; i++) {
|
||||||
if (dir.name[i] == ' ')continue;
|
if (dir.name[i] == ' ')continue;
|
||||||
if (i == 8) {
|
if (i == 8) {
|
||||||
SERIAL.write('.');
|
MYSERIAL.write('.');
|
||||||
w++;
|
w++;
|
||||||
}
|
}
|
||||||
SERIAL.write(dir.name[i]);
|
MYSERIAL.write(dir.name[i]);
|
||||||
w++;
|
w++;
|
||||||
}
|
}
|
||||||
if (DIR_IS_SUBDIR(&dir)) {
|
if (DIR_IS_SUBDIR(&dir)) {
|
||||||
SERIAL.write('/');
|
MYSERIAL.write('/');
|
||||||
w++;
|
w++;
|
||||||
}
|
}
|
||||||
if (flags & (LS_DATE | LS_SIZE)) {
|
if (flags & (LS_DATE | LS_SIZE)) {
|
||||||
while (w++ < 14) SERIAL.write(' ');
|
while (w++ < 14) MYSERIAL.write(' ');
|
||||||
}
|
}
|
||||||
// print modify date/time if requested
|
// print modify date/time if requested
|
||||||
if (flags & LS_DATE) {
|
if (flags & LS_DATE) {
|
||||||
SERIAL.write(' ');
|
MYSERIAL.write(' ');
|
||||||
printFatDate( dir.lastWriteDate);
|
printFatDate( dir.lastWriteDate);
|
||||||
SERIAL.write(' ');
|
MYSERIAL.write(' ');
|
||||||
printFatTime( dir.lastWriteTime);
|
printFatTime( dir.lastWriteTime);
|
||||||
}
|
}
|
||||||
// print size if requested
|
// print size if requested
|
||||||
if (!DIR_IS_SUBDIR(&dir) && (flags & LS_SIZE)) {
|
if (!DIR_IS_SUBDIR(&dir) && (flags & LS_SIZE)) {
|
||||||
SERIAL.write(' ');
|
MYSERIAL.write(' ');
|
||||||
SERIAL.print(dir.fileSize);
|
MYSERIAL.print(dir.fileSize);
|
||||||
}
|
}
|
||||||
SERIAL.println();
|
MYSERIAL.println();
|
||||||
return DIR_IS_FILE(&dir) ? 1 : 2;
|
return DIR_IS_FILE(&dir) ? 1 : 2;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
@ -945,26 +945,26 @@ void SdBaseFile::printDirName(const dir_t& dir,
|
||||||
for (uint8_t i = 0; i < 11; i++) {
|
for (uint8_t i = 0; i < 11; i++) {
|
||||||
if (dir.name[i] == ' ')continue;
|
if (dir.name[i] == ' ')continue;
|
||||||
if (i == 8) {
|
if (i == 8) {
|
||||||
SERIAL.write('.');
|
MYSERIAL.write('.');
|
||||||
w++;
|
w++;
|
||||||
}
|
}
|
||||||
SERIAL.write(dir.name[i]);
|
MYSERIAL.write(dir.name[i]);
|
||||||
w++;
|
w++;
|
||||||
}
|
}
|
||||||
if (DIR_IS_SUBDIR(&dir) && printSlash) {
|
if (DIR_IS_SUBDIR(&dir) && printSlash) {
|
||||||
SERIAL.write('/');
|
MYSERIAL.write('/');
|
||||||
w++;
|
w++;
|
||||||
}
|
}
|
||||||
while (w < width) {
|
while (w < width) {
|
||||||
SERIAL.write(' ');
|
MYSERIAL.write(' ');
|
||||||
w++;
|
w++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// print uint8_t with width 2
|
// print uint8_t with width 2
|
||||||
static void print2u( uint8_t v) {
|
static void print2u( uint8_t v) {
|
||||||
if (v < 10) SERIAL.write('0');
|
if (v < 10) MYSERIAL.write('0');
|
||||||
SERIAL.print(v, DEC);
|
MYSERIAL.print(v, DEC);
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
/** %Print a directory date field to Serial.
|
/** %Print a directory date field to Serial.
|
||||||
|
@ -983,10 +983,10 @@ static void print2u( uint8_t v) {
|
||||||
* \param[in] fatDate The date field from a directory entry.
|
* \param[in] fatDate The date field from a directory entry.
|
||||||
*/
|
*/
|
||||||
void SdBaseFile::printFatDate(uint16_t fatDate) {
|
void SdBaseFile::printFatDate(uint16_t fatDate) {
|
||||||
SERIAL.print(FAT_YEAR(fatDate));
|
MYSERIAL.print(FAT_YEAR(fatDate));
|
||||||
SERIAL.write('-');
|
MYSERIAL.write('-');
|
||||||
print2u( FAT_MONTH(fatDate));
|
print2u( FAT_MONTH(fatDate));
|
||||||
SERIAL.write('-');
|
MYSERIAL.write('-');
|
||||||
print2u( FAT_DAY(fatDate));
|
print2u( FAT_DAY(fatDate));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1000,9 +1000,9 @@ void SdBaseFile::printFatDate(uint16_t fatDate) {
|
||||||
*/
|
*/
|
||||||
void SdBaseFile::printFatTime( uint16_t fatTime) {
|
void SdBaseFile::printFatTime( uint16_t fatTime) {
|
||||||
print2u( FAT_HOUR(fatTime));
|
print2u( FAT_HOUR(fatTime));
|
||||||
SERIAL.write(':');
|
MYSERIAL.write(':');
|
||||||
print2u( FAT_MINUTE(fatTime));
|
print2u( FAT_MINUTE(fatTime));
|
||||||
SERIAL.write(':');
|
MYSERIAL.write(':');
|
||||||
print2u( FAT_SECOND(fatTime));
|
print2u( FAT_SECOND(fatTime));
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
@ -1014,7 +1014,7 @@ void SdBaseFile::printFatTime( uint16_t fatTime) {
|
||||||
bool SdBaseFile::printName() {
|
bool SdBaseFile::printName() {
|
||||||
char name[13];
|
char name[13];
|
||||||
if (!getFilename(name)) return false;
|
if (!getFilename(name)) return false;
|
||||||
SERIAL.print(name);
|
MYSERIAL.print(name);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
|
@ -48,7 +48,7 @@ int SdFatUtil::FreeRam() {
|
||||||
* \param[in] str Pointer to string stored in flash memory.
|
* \param[in] str Pointer to string stored in flash memory.
|
||||||
*/
|
*/
|
||||||
void SdFatUtil::print_P( PGM_P str) {
|
void SdFatUtil::print_P( PGM_P str) {
|
||||||
for (uint8_t c; (c = pgm_read_byte(str)); str++) SERIAL.write(c);
|
for (uint8_t c; (c = pgm_read_byte(str)); str++) MYSERIAL.write(c);
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
/** %Print a string in flash memory followed by a CR/LF.
|
/** %Print a string in flash memory followed by a CR/LF.
|
||||||
|
@ -58,7 +58,7 @@ void SdFatUtil::print_P( PGM_P str) {
|
||||||
*/
|
*/
|
||||||
void SdFatUtil::println_P( PGM_P str) {
|
void SdFatUtil::println_P( PGM_P str) {
|
||||||
print_P( str);
|
print_P( str);
|
||||||
SERIAL.println();
|
MYSERIAL.println();
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
/** %Print a string in flash memory to Serial.
|
/** %Print a string in flash memory to Serial.
|
||||||
|
|
|
@ -254,7 +254,7 @@ FORCE_INLINE unsigned short calc_timer(unsigned short step_rate) {
|
||||||
timer = (unsigned short)pgm_read_word_near(table_address);
|
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);
|
timer -= (((unsigned short)pgm_read_word_near(table_address+2) * (unsigned char)(step_rate & 0x0007))>>3);
|
||||||
}
|
}
|
||||||
if(timer < 100) { timer = 100; SERIAL.print("Steprate to high : "); SERIAL.println(step_rate); }//(20kHz this should never happen)
|
if(timer < 100) { timer = 100; MYSERIAL.print("Steprate to high : "); MYSERIAL.println(step_rate); }//(20kHz this should never happen)
|
||||||
return timer;
|
return timer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue