Browse Source

Updated SERIAL define to MYSERIAL, because Arduino 1.0 defines SERIAL as 0.

daid 13 years ago
parent
commit
2a77c84c8f
5 changed files with 35 additions and 35 deletions
  1. 6
    6
      Marlin/Marlin.h
  2. 4
    4
      Marlin/Marlin.pde
  3. 22
    22
      Marlin/SdBaseFile.cpp
  4. 2
    2
      Marlin/SdFatUtil.cpp
  5. 1
    1
      Marlin/stepper.cpp

+ 6
- 6
Marlin/Marlin.h View File

47
 #include "WString.h"
47
 #include "WString.h"
48
 
48
 
49
 #if MOTHERBOARD == 8  // Teensylu
49
 #if MOTHERBOARD == 8  // Teensylu
50
-  #define SERIAL Serial
50
+  #define MYSERIAL Serial
51
 #else
51
 #else
52
-  #define SERIAL MSerial
52
+  #define MYSERIAL MSerial
53
 #endif
53
 #endif
54
 
54
 
55
 //this is a unfinsihed attemp to removes a lot of warning messages, see:
55
 //this is a unfinsihed attemp to removes a lot of warning messages, see:
63
 //#define MYPGM(s)  (__extension__({static prog_char __c[]  = (s); &__c[0];})) //this does not work but hides the warnings
63
 //#define MYPGM(s)  (__extension__({static prog_char __c[]  = (s); &__c[0];})) //this does not work but hides the warnings
64
 
64
 
65
 
65
 
66
-#define SERIAL_PROTOCOL(x) SERIAL.print(x);
66
+#define SERIAL_PROTOCOL(x) MYSERIAL.print(x);
67
 #define SERIAL_PROTOCOLPGM(x) serialprintPGM(MYPGM(x));
67
 #define SERIAL_PROTOCOLPGM(x) serialprintPGM(MYPGM(x));
68
-#define SERIAL_PROTOCOLLN(x) {SERIAL.print(x);SERIAL.write('\n');}
69
-#define SERIAL_PROTOCOLLNPGM(x) {serialprintPGM(MYPGM(x));SERIAL.write('\n');}
68
+#define SERIAL_PROTOCOLLN(x) {MYSERIAL.print(x);MYSERIAL.write('\n');}
69
+#define SERIAL_PROTOCOLLNPGM(x) {serialprintPGM(MYPGM(x));MYSERIAL.write('\n');}
70
 
70
 
71
 
71
 
72
 const char errormagic[] PROGMEM ="Error:";
72
 const char errormagic[] PROGMEM ="Error:";
93
   char ch=pgm_read_byte(str);
93
   char ch=pgm_read_byte(str);
94
   while(ch)
94
   while(ch)
95
   {
95
   {
96
-    SERIAL.write(ch);
96
+    MYSERIAL.write(ch);
97
     ch=pgm_read_byte(++str);
97
     ch=pgm_read_byte(++str);
98
   }
98
   }
99
 }
99
 }

+ 4
- 4
Marlin/Marlin.pde View File

247
 void setup()
247
 void setup()
248
 { 
248
 { 
249
   setup_powerhold();
249
   setup_powerhold();
250
-  SERIAL.begin(BAUDRATE);
250
+  MYSERIAL.begin(BAUDRATE);
251
   SERIAL_PROTOCOLLNPGM("start");
251
   SERIAL_PROTOCOLLNPGM("start");
252
   SERIAL_ECHO_START;
252
   SERIAL_ECHO_START;
253
   SERIAL_ECHOPGM("Marlin: ");
253
   SERIAL_ECHOPGM("Marlin: ");
328
 
328
 
329
 void get_command() 
329
 void get_command() 
330
 { 
330
 { 
331
-  while( SERIAL.available() > 0  && buflen < BUFSIZE) {
332
-    serial_char = SERIAL.read();
331
+  while( MYSERIAL.available() > 0  && buflen < BUFSIZE) {
332
+    serial_char = MYSERIAL.read();
333
     if(serial_char == '\n' || serial_char == '\r' || serial_char == ':' || serial_count >= (MAX_CMD_SIZE - 1) ) 
333
     if(serial_char == '\n' || serial_char == '\r' || serial_char == ':' || serial_count >= (MAX_CMD_SIZE - 1) ) 
334
     {
334
     {
335
       if(!serial_count) return; //if empty line
335
       if(!serial_count) return; //if empty line
1219
 void FlushSerialRequestResend()
1219
 void FlushSerialRequestResend()
1220
 {
1220
 {
1221
   //char cmdbuffer[bufindr][100]="Resend:";
1221
   //char cmdbuffer[bufindr][100]="Resend:";
1222
-  SERIAL.flush();
1222
+  MYSERIAL.flush();
1223
   SERIAL_PROTOCOLPGM("Resend:");
1223
   SERIAL_PROTOCOLPGM("Resend:");
1224
   SERIAL_PROTOCOLLN(gcode_LastN + 1);
1224
   SERIAL_PROTOCOLLN(gcode_LastN + 1);
1225
   ClearToSend();
1225
   ClearToSend();

+ 22
- 22
Marlin/SdBaseFile.cpp View File

343
       && DIR_IS_FILE_OR_SUBDIR(&dir)) break;
343
       && DIR_IS_FILE_OR_SUBDIR(&dir)) break;
344
   }
344
   }
345
   // indent for dir level
345
   // indent for dir level
346
-  for (uint8_t i = 0; i < indent; i++) SERIAL.write(' ');
346
+  for (uint8_t i = 0; i < indent; i++) MYSERIAL.write(' ');
347
 
347
 
348
   // print name
348
   // print name
349
   for (uint8_t i = 0; i < 11; i++) {
349
   for (uint8_t i = 0; i < 11; i++) {
350
     if (dir.name[i] == ' ')continue;
350
     if (dir.name[i] == ' ')continue;
351
     if (i == 8) {
351
     if (i == 8) {
352
-      SERIAL.write('.');
352
+      MYSERIAL.write('.');
353
       w++;
353
       w++;
354
     }
354
     }
355
-    SERIAL.write(dir.name[i]);
355
+    MYSERIAL.write(dir.name[i]);
356
     w++;
356
     w++;
357
   }
357
   }
358
   if (DIR_IS_SUBDIR(&dir)) {
358
   if (DIR_IS_SUBDIR(&dir)) {
359
-    SERIAL.write('/');
359
+    MYSERIAL.write('/');
360
     w++;
360
     w++;
361
   }
361
   }
362
   if (flags & (LS_DATE | LS_SIZE)) {
362
   if (flags & (LS_DATE | LS_SIZE)) {
363
-    while (w++ < 14) SERIAL.write(' ');
363
+    while (w++ < 14) MYSERIAL.write(' ');
364
   }
364
   }
365
   // print modify date/time if requested
365
   // print modify date/time if requested
366
   if (flags & LS_DATE) {
366
   if (flags & LS_DATE) {
367
-    SERIAL.write(' ');
367
+    MYSERIAL.write(' ');
368
     printFatDate( dir.lastWriteDate);
368
     printFatDate( dir.lastWriteDate);
369
-    SERIAL.write(' ');
369
+    MYSERIAL.write(' ');
370
     printFatTime( dir.lastWriteTime);
370
     printFatTime( dir.lastWriteTime);
371
   }
371
   }
372
   // print size if requested
372
   // print size if requested
373
   if (!DIR_IS_SUBDIR(&dir) && (flags & LS_SIZE)) {
373
   if (!DIR_IS_SUBDIR(&dir) && (flags & LS_SIZE)) {
374
-    SERIAL.write(' ');
375
-    SERIAL.print(dir.fileSize);
374
+    MYSERIAL.write(' ');
375
+    MYSERIAL.print(dir.fileSize);
376
   }
376
   }
377
-  SERIAL.println();
377
+  MYSERIAL.println();
378
   return DIR_IS_FILE(&dir) ? 1 : 2;
378
   return DIR_IS_FILE(&dir) ? 1 : 2;
379
 }
379
 }
380
 //------------------------------------------------------------------------------
380
 //------------------------------------------------------------------------------
945
   for (uint8_t i = 0; i < 11; i++) {
945
   for (uint8_t i = 0; i < 11; i++) {
946
     if (dir.name[i] == ' ')continue;
946
     if (dir.name[i] == ' ')continue;
947
     if (i == 8) {
947
     if (i == 8) {
948
-      SERIAL.write('.');
948
+      MYSERIAL.write('.');
949
       w++;
949
       w++;
950
     }
950
     }
951
-    SERIAL.write(dir.name[i]);
951
+    MYSERIAL.write(dir.name[i]);
952
     w++;
952
     w++;
953
   }
953
   }
954
   if (DIR_IS_SUBDIR(&dir) && printSlash) {
954
   if (DIR_IS_SUBDIR(&dir) && printSlash) {
955
-    SERIAL.write('/');
955
+    MYSERIAL.write('/');
956
     w++;
956
     w++;
957
   }
957
   }
958
   while (w < width) {
958
   while (w < width) {
959
-    SERIAL.write(' ');
959
+    MYSERIAL.write(' ');
960
     w++;
960
     w++;
961
   }
961
   }
962
 }
962
 }
963
 //------------------------------------------------------------------------------
963
 //------------------------------------------------------------------------------
964
 // print uint8_t with width 2
964
 // print uint8_t with width 2
965
 static void print2u( uint8_t v) {
965
 static void print2u( uint8_t v) {
966
-  if (v < 10) SERIAL.write('0');
967
-  SERIAL.print(v, DEC);
966
+  if (v < 10) MYSERIAL.write('0');
967
+  MYSERIAL.print(v, DEC);
968
 }
968
 }
969
 //------------------------------------------------------------------------------
969
 //------------------------------------------------------------------------------
970
 /** %Print a directory date field to Serial.
970
 /** %Print a directory date field to Serial.
983
  * \param[in] fatDate The date field from a directory entry.
983
  * \param[in] fatDate The date field from a directory entry.
984
  */
984
  */
985
 void SdBaseFile::printFatDate(uint16_t fatDate) {
985
 void SdBaseFile::printFatDate(uint16_t fatDate) {
986
-  SERIAL.print(FAT_YEAR(fatDate));
987
-  SERIAL.write('-');
986
+  MYSERIAL.print(FAT_YEAR(fatDate));
987
+  MYSERIAL.write('-');
988
   print2u( FAT_MONTH(fatDate));
988
   print2u( FAT_MONTH(fatDate));
989
-  SERIAL.write('-');
989
+  MYSERIAL.write('-');
990
   print2u( FAT_DAY(fatDate));
990
   print2u( FAT_DAY(fatDate));
991
 }
991
 }
992
 
992
 
1000
  */
1000
  */
1001
 void SdBaseFile::printFatTime( uint16_t fatTime) {
1001
 void SdBaseFile::printFatTime( uint16_t fatTime) {
1002
   print2u( FAT_HOUR(fatTime));
1002
   print2u( FAT_HOUR(fatTime));
1003
-  SERIAL.write(':');
1003
+  MYSERIAL.write(':');
1004
   print2u( FAT_MINUTE(fatTime));
1004
   print2u( FAT_MINUTE(fatTime));
1005
-  SERIAL.write(':');
1005
+  MYSERIAL.write(':');
1006
   print2u( FAT_SECOND(fatTime));
1006
   print2u( FAT_SECOND(fatTime));
1007
 }
1007
 }
1008
 //------------------------------------------------------------------------------
1008
 //------------------------------------------------------------------------------
1014
 bool SdBaseFile::printName() {
1014
 bool SdBaseFile::printName() {
1015
   char name[13];
1015
   char name[13];
1016
   if (!getFilename(name)) return false;
1016
   if (!getFilename(name)) return false;
1017
-  SERIAL.print(name);
1017
+  MYSERIAL.print(name);
1018
   return true;
1018
   return true;
1019
 }
1019
 }
1020
 //------------------------------------------------------------------------------
1020
 //------------------------------------------------------------------------------

+ 2
- 2
Marlin/SdFatUtil.cpp View File

48
  * \param[in] str Pointer to string stored in flash memory.
48
  * \param[in] str Pointer to string stored in flash memory.
49
  */
49
  */
50
 void SdFatUtil::print_P( PGM_P str) {
50
 void SdFatUtil::print_P( PGM_P str) {
51
-  for (uint8_t c; (c = pgm_read_byte(str)); str++) SERIAL.write(c);
51
+  for (uint8_t c; (c = pgm_read_byte(str)); str++) MYSERIAL.write(c);
52
 }
52
 }
53
 //------------------------------------------------------------------------------
53
 //------------------------------------------------------------------------------
54
 /** %Print a string in flash memory followed by a CR/LF.
54
 /** %Print a string in flash memory followed by a CR/LF.
58
  */
58
  */
59
 void SdFatUtil::println_P( PGM_P str) {
59
 void SdFatUtil::println_P( PGM_P str) {
60
   print_P( str);
60
   print_P( str);
61
-  SERIAL.println();
61
+  MYSERIAL.println();
62
 }
62
 }
63
 //------------------------------------------------------------------------------
63
 //------------------------------------------------------------------------------
64
 /** %Print a string in flash memory to Serial.
64
 /** %Print a string in flash memory to Serial.

+ 1
- 1
Marlin/stepper.cpp View File

254
     timer = (unsigned short)pgm_read_word_near(table_address);
254
     timer = (unsigned short)pgm_read_word_near(table_address);
255
     timer -= (((unsigned short)pgm_read_word_near(table_address+2) * (unsigned char)(step_rate & 0x0007))>>3);
255
     timer -= (((unsigned short)pgm_read_word_near(table_address+2) * (unsigned char)(step_rate & 0x0007))>>3);
256
   }
256
   }
257
-  if(timer < 100) { timer = 100; SERIAL.print("Steprate to high : "); SERIAL.println(step_rate); }//(20kHz this should never happen)
257
+  if(timer < 100) { timer = 100; MYSERIAL.print("Steprate to high : "); MYSERIAL.println(step_rate); }//(20kHz this should never happen)
258
   return timer;
258
   return timer;
259
 }
259
 }
260
 
260
 

Loading…
Cancel
Save