Browse Source

Merge pull request #61 from daid/Marlin_v1

Updated SERIAL define to MYSERIAL, because Arduino 1.0 defines SERIAL as 0.
ErikZalm 12 years ago
parent
commit
3e7fcb813e
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,9 +47,9 @@
47 47
 #include "WString.h"
48 48
 
49 49
 #if MOTHERBOARD == 8  // Teensylu
50
-  #define SERIAL Serial
50
+  #define MYSERIAL Serial
51 51
 #else
52
-  #define SERIAL MSerial
52
+  #define MYSERIAL MSerial
53 53
 #endif
54 54
 
55 55
 //this is a unfinsihed attemp to removes a lot of warning messages, see:
@@ -63,10 +63,10 @@
63 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 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 72
 const char errormagic[] PROGMEM ="Error:";
@@ -93,7 +93,7 @@ FORCE_INLINE void serialprintPGM(const char *str)
93 93
   char ch=pgm_read_byte(str);
94 94
   while(ch)
95 95
   {
96
-    SERIAL.write(ch);
96
+    MYSERIAL.write(ch);
97 97
     ch=pgm_read_byte(++str);
98 98
   }
99 99
 }

+ 4
- 4
Marlin/Marlin.pde View File

@@ -247,7 +247,7 @@ void suicide()
247 247
 void setup()
248 248
 { 
249 249
   setup_powerhold();
250
-  SERIAL.begin(BAUDRATE);
250
+  MYSERIAL.begin(BAUDRATE);
251 251
   SERIAL_PROTOCOLLNPGM("start");
252 252
   SERIAL_ECHO_START;
253 253
   SERIAL_ECHOPGM("Marlin: ");
@@ -328,8 +328,8 @@ void loop()
328 328
 
329 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 333
     if(serial_char == '\n' || serial_char == '\r' || serial_char == ':' || serial_count >= (MAX_CMD_SIZE - 1) ) 
334 334
     {
335 335
       if(!serial_count) return; //if empty line
@@ -1219,7 +1219,7 @@ void process_commands()
1219 1219
 void FlushSerialRequestResend()
1220 1220
 {
1221 1221
   //char cmdbuffer[bufindr][100]="Resend:";
1222
-  SERIAL.flush();
1222
+  MYSERIAL.flush();
1223 1223
   SERIAL_PROTOCOLPGM("Resend:");
1224 1224
   SERIAL_PROTOCOLLN(gcode_LastN + 1);
1225 1225
   ClearToSend();

+ 22
- 22
Marlin/SdBaseFile.cpp View File

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

+ 2
- 2
Marlin/SdFatUtil.cpp View File

@@ -48,7 +48,7 @@ int SdFatUtil::FreeRam() {
48 48
  * \param[in] str Pointer to string stored in flash memory.
49 49
  */
50 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 54
 /** %Print a string in flash memory followed by a CR/LF.
@@ -58,7 +58,7 @@ void SdFatUtil::print_P( PGM_P str) {
58 58
  */
59 59
 void SdFatUtil::println_P( PGM_P str) {
60 60
   print_P( str);
61
-  SERIAL.println();
61
+  MYSERIAL.println();
62 62
 }
63 63
 //------------------------------------------------------------------------------
64 64
 /** %Print a string in flash memory to Serial.

+ 1
- 1
Marlin/stepper.cpp View File

@@ -254,7 +254,7 @@ FORCE_INLINE unsigned short calc_timer(unsigned short step_rate) {
254 254
     timer = (unsigned short)pgm_read_word_near(table_address);
255 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 258
   return timer;
259 259
 }
260 260
 

Loading…
Cancel
Save