diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 5afaad56..57ef18d8 100755 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -79,9 +79,9 @@ extern FILE _uartout; #define SERIAL_PROTOCOL_F(x,y) (MYSERIAL.print(x,y)) #define SERIAL_PROTOCOLPGM(x) (serialprintPGM(PSTR(x))) #define SERIAL_PROTOCOLRPGM(x) (serialprintPGM((x))) -#define SERIAL_PROTOCOLLN(x) (MYSERIAL.println(x)/*,MYSERIAL.write('\n')*/) -#define SERIAL_PROTOCOLLNPGM(x) (serialprintPGM(PSTR(x)),MYSERIAL.println()/*write('\n')*/) -#define SERIAL_PROTOCOLLNRPGM(x) (serialprintPGM((x)),MYSERIAL.println()/*write('\n')*/) +#define SERIAL_PROTOCOLLN(x) (MYSERIAL.println(x)) +#define SERIAL_PROTOCOLLNPGM(x) (serialprintlnPGM(PSTR(x))) +#define SERIAL_PROTOCOLLNRPGM(x) (serialprintlnPGM((x))) extern const char errormagic[] PROGMEM; @@ -115,6 +115,9 @@ void serial_echopair_P(const char *s_P, unsigned long v); // I'd rather skip a few CPU ticks than 5.5KB (!!) of FLASH void serialprintPGM(const char *str); +//The "ln" variant of the function above. +void serialprintlnPGM(const char *str); + bool is_buffer_empty(); void process_commands(); void ramming(); diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index c7480c4c..17aa5481 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -467,22 +467,16 @@ void serial_echopair_P(const char *s_P, double v) void serial_echopair_P(const char *s_P, unsigned long v) { serialprintPGM(s_P); SERIAL_ECHO(v); } -/*FORCE_INLINE*/ void serialprintPGM(const char *str) -{ -#if 0 - char ch=pgm_read_byte(str); - while(ch) - { - MYSERIAL.write(ch); - ch=pgm_read_byte(++str); - } -#else - // hmm, same size as the above version, the compiler did a good job optimizing the above - while( uint8_t ch = pgm_read_byte(str) ){ - MYSERIAL.write((char)ch); - ++str; - } -#endif +void serialprintPGM(const char *str) { + while(uint8_t ch = pgm_read_byte(str)) { + MYSERIAL.write((char)ch); + ++str; + } +} + +void serialprintlnPGM(const char *str) { + serialprintPGM(str); + MYSERIAL.println(); } #ifdef SDSUPPORT