Merge pull request #9678 from thinkyhead/bf1_myserial_yourserial
[1.1.x] Use serial macros over direct calls
This commit is contained in:
commit
ec045f39aa
@ -274,7 +274,7 @@
|
||||
// action to give the user a more responsive 'Stop'.
|
||||
set_destination_from_current();
|
||||
idle();
|
||||
MYSERIAL0.flush(); // Prevent host M105 buffer overrun.
|
||||
SERIAL_FLUSH(); // Prevent host M105 buffer overrun.
|
||||
}
|
||||
|
||||
wait_for_release();
|
||||
@ -501,7 +501,7 @@
|
||||
SERIAL_EOL();
|
||||
}
|
||||
idle();
|
||||
MYSERIAL0.flush(); // Prevent host M105 buffer overrun.
|
||||
SERIAL_FLUSH(); // Prevent host M105 buffer overrun.
|
||||
}
|
||||
#if ENABLED(ULTRA_LCD)
|
||||
}
|
||||
@ -525,7 +525,7 @@
|
||||
}
|
||||
idle();
|
||||
|
||||
MYSERIAL0.flush(); // Prevent host M105 buffer overrun.
|
||||
SERIAL_FLUSH(); // Prevent host M105 buffer overrun.
|
||||
}
|
||||
#if ENABLED(ULTRA_LCD)
|
||||
lcd_reset_status();
|
||||
@ -811,12 +811,12 @@
|
||||
#endif
|
||||
|
||||
print_line_from_here_to_there(rx, ry, g26_layer_height, xe, ye, g26_layer_height);
|
||||
MYSERIAL0.flush(); // Prevent host M105 buffer overrun.
|
||||
SERIAL_FLUSH(); // Prevent host M105 buffer overrun.
|
||||
}
|
||||
if (look_for_lines_to_connect())
|
||||
goto LEAVE;
|
||||
}
|
||||
MYSERIAL0.flush(); // Prevent host M105 buffer overrun.
|
||||
SERIAL_FLUSH(); // Prevent host M105 buffer overrun.
|
||||
} while (--g26_repeats && location.x_index >= 0 && location.y_index >= 0);
|
||||
|
||||
LEAVE:
|
||||
|
@ -11981,7 +11981,7 @@ void process_next_command() {
|
||||
*/
|
||||
void FlushSerialRequestResend() {
|
||||
//char command_queue[cmd_queue_index_r][100]="Resend:";
|
||||
MYSERIAL0.flush();
|
||||
SERIAL_FLUSH();
|
||||
SERIAL_PROTOCOLPGM(MSG_RESEND);
|
||||
SERIAL_PROTOCOLLN(gcode_LastN + 1);
|
||||
ok_to_send();
|
||||
|
@ -339,38 +339,38 @@ int8_t SdBaseFile::lsPrintNext(uint8_t flags, uint8_t indent) {
|
||||
&& DIR_IS_FILE_OR_SUBDIR(&dir)) break;
|
||||
}
|
||||
// indent for dir level
|
||||
for (uint8_t i = 0; i < indent; i++) MYSERIAL0.write(' ');
|
||||
for (uint8_t i = 0; i < indent; i++) SERIAL_CHAR(' ');
|
||||
|
||||
// print name
|
||||
for (uint8_t i = 0; i < 11; i++) {
|
||||
if (dir.name[i] == ' ')continue;
|
||||
if (i == 8) {
|
||||
MYSERIAL0.write('.');
|
||||
SERIAL_CHAR('.');
|
||||
w++;
|
||||
}
|
||||
MYSERIAL0.write(dir.name[i]);
|
||||
SERIAL_CHAR(dir.name[i]);
|
||||
w++;
|
||||
}
|
||||
if (DIR_IS_SUBDIR(&dir)) {
|
||||
MYSERIAL0.write('/');
|
||||
SERIAL_CHAR('/');
|
||||
w++;
|
||||
}
|
||||
if (flags & (LS_DATE | LS_SIZE)) {
|
||||
while (w++ < 14) MYSERIAL0.write(' ');
|
||||
while (w++ < 14) SERIAL_CHAR(' ');
|
||||
}
|
||||
// print modify date/time if requested
|
||||
if (flags & LS_DATE) {
|
||||
MYSERIAL0.write(' ');
|
||||
SERIAL_CHAR(' ');
|
||||
printFatDate(dir.lastWriteDate);
|
||||
MYSERIAL0.write(' ');
|
||||
SERIAL_CHAR(' ');
|
||||
printFatTime(dir.lastWriteTime);
|
||||
}
|
||||
// print size if requested
|
||||
if (!DIR_IS_SUBDIR(&dir) && (flags & LS_SIZE)) {
|
||||
MYSERIAL0.write(' ');
|
||||
MYSERIAL0.print(dir.fileSize);
|
||||
SERIAL_CHAR(' ');
|
||||
SERIAL_PROTOCOL(dir.fileSize);
|
||||
}
|
||||
MYSERIAL0.println();
|
||||
SERIAL_EOL();
|
||||
return DIR_IS_FILE(&dir) ? 1 : 2;
|
||||
}
|
||||
|
||||
@ -905,8 +905,8 @@ int SdBaseFile::peek() {
|
||||
|
||||
// print uint8_t with width 2
|
||||
static void print2u(uint8_t v) {
|
||||
if (v < 10) MYSERIAL0.write('0');
|
||||
MYSERIAL0.print(v, DEC);
|
||||
if (v < 10) SERIAL_CHAR('0');
|
||||
SERIAL_PRINT(v, DEC);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -927,10 +927,10 @@ static void print2u(uint8_t v) {
|
||||
* \param[in] fatDate The date field from a directory entry.
|
||||
*/
|
||||
void SdBaseFile::printFatDate(uint16_t fatDate) {
|
||||
MYSERIAL0.print(FAT_YEAR(fatDate));
|
||||
MYSERIAL0.write('-');
|
||||
SERIAL_PROTOCOL(FAT_YEAR(fatDate));
|
||||
SERIAL_CHAR('-');
|
||||
print2u(FAT_MONTH(fatDate));
|
||||
MYSERIAL0.write('-');
|
||||
SERIAL_CHAR('-');
|
||||
print2u(FAT_DAY(fatDate));
|
||||
}
|
||||
|
||||
@ -945,9 +945,9 @@ void SdBaseFile::printFatDate(uint16_t fatDate) {
|
||||
*/
|
||||
void SdBaseFile::printFatTime(uint16_t fatTime) {
|
||||
print2u(FAT_HOUR(fatTime));
|
||||
MYSERIAL0.write(':');
|
||||
SERIAL_CHAR(':');
|
||||
print2u(FAT_MINUTE(fatTime));
|
||||
MYSERIAL0.write(':');
|
||||
SERIAL_CHAR(':');
|
||||
print2u(FAT_SECOND(fatTime));
|
||||
}
|
||||
|
||||
@ -959,7 +959,7 @@ void SdBaseFile::printFatTime(uint16_t fatTime) {
|
||||
bool SdBaseFile::printName() {
|
||||
char name[FILENAME_LENGTH];
|
||||
if (!getFilename(name)) return false;
|
||||
MYSERIAL0.print(name);
|
||||
SERIAL_PROTOCOL(name);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ int SdFatUtil::FreeRam() {
|
||||
* \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++) MYSERIAL0.write(c);
|
||||
for (uint8_t c; (c = pgm_read_byte(str)); str++) SERIAL_CHAR(c);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -72,7 +72,7 @@ void SdFatUtil::print_P(PGM_P str) {
|
||||
* \param[in] pr Print object for output.
|
||||
* \param[in] str Pointer to string stored in flash memory.
|
||||
*/
|
||||
void SdFatUtil::println_P(PGM_P str) { print_P(str); MYSERIAL0.println(); }
|
||||
void SdFatUtil::println_P(PGM_P str) { print_P(str); SERIAL_EOL(); }
|
||||
|
||||
/**
|
||||
* %Print a string in flash memory to Serial.
|
||||
|
@ -474,9 +474,9 @@ inline void report_pin_state_extended(int8_t pin, bool ignore, bool extended = f
|
||||
for (uint8_t y = 0; y < 28; y++) { // always print pin name
|
||||
temp_char = pgm_read_byte(name_mem_pointer + y);
|
||||
if (temp_char != 0)
|
||||
MYSERIAL0.write(temp_char);
|
||||
SERIAL_CHAR(temp_char);
|
||||
else {
|
||||
for (uint8_t i = 0; i < 28 - y; i++) MYSERIAL0.write(' ');
|
||||
for (uint8_t i = 0; i < 28 - y; i++) SERIAL_CHAR(' ');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -25,12 +25,12 @@
|
||||
const char errormagic[] PROGMEM = "Error:";
|
||||
const char echomagic[] PROGMEM = "echo:";
|
||||
|
||||
void serial_echopair_P(const char* s_P, const char *v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
|
||||
void serial_echopair_P(const char* s_P, char v) { serialprintPGM(s_P); SERIAL_CHAR(v); }
|
||||
void serial_echopair_P(const char* s_P, int v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
|
||||
void serial_echopair_P(const char* s_P, long v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
|
||||
void serial_echopair_P(const char* s_P, float v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
|
||||
void serial_echopair_P(const char* s_P, double v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
|
||||
void serial_echopair_P(const char* s_P, unsigned long v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
|
||||
void serial_echopair_PGM(const char* s_P, const char *v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
|
||||
void serial_echopair_PGM(const char* s_P, char v) { serialprintPGM(s_P); SERIAL_CHAR(v); }
|
||||
void serial_echopair_PGM(const char* s_P, int v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
|
||||
void serial_echopair_PGM(const char* s_P, long v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
|
||||
void serial_echopair_PGM(const char* s_P, float v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
|
||||
void serial_echopair_PGM(const char* s_P, double v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
|
||||
void serial_echopair_PGM(const char* s_P, unsigned long v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
|
||||
|
||||
void serial_spaces(uint8_t count) { count *= (PROPORTIONAL_FONT_RATIO); while (count--) MYSERIAL0.write(' '); }
|
||||
void serial_spaces(uint8_t count) { count *= (PROPORTIONAL_FONT_RATIO); while (count--) SERIAL_CHAR(' '); }
|
||||
|
@ -48,13 +48,18 @@ extern const char errormagic[] PROGMEM;
|
||||
#define SERIAL_PRINTLN(x,b) MYSERIAL0.println(x,b)
|
||||
#define SERIAL_PRINTF(args...) MYSERIAL0.printf(args)
|
||||
|
||||
#define SERIAL_FLUSH() MYSERIAL0.flush()
|
||||
#if TX_BUFFER_SIZE > 0
|
||||
#define SERIAL_FLUSHTX() MYSERIAL0.flushTX()
|
||||
#endif
|
||||
|
||||
#define SERIAL_PROTOCOLCHAR(x) SERIAL_CHAR(x)
|
||||
#define SERIAL_PROTOCOL(x) MYSERIAL0.print(x)
|
||||
#define SERIAL_PROTOCOL_F(x,y) MYSERIAL0.print(x,y)
|
||||
#define SERIAL_PROTOCOLPGM(x) serialprintPGM(PSTR(x))
|
||||
#define SERIAL_PROTOCOLLN(x) do{ MYSERIAL0.print(x); SERIAL_EOL(); }while(0)
|
||||
#define SERIAL_PROTOCOLLNPGM(x) serialprintPGM(PSTR(x "\n"))
|
||||
#define SERIAL_PROTOCOLPAIR(name, value) serial_echopair_P(PSTR(name),(value))
|
||||
#define SERIAL_PROTOCOLPAIR(name, value) serial_echopair_PGM(PSTR(name),(value))
|
||||
#define SERIAL_PROTOCOLLNPAIR(name, value) do{ SERIAL_PROTOCOLPAIR(name, value); SERIAL_EOL(); }while(0)
|
||||
|
||||
#define SERIAL_ECHO_START() serialprintPGM(echomagic)
|
||||
@ -78,29 +83,29 @@ extern const char errormagic[] PROGMEM;
|
||||
#define SERIAL_ECHOPAIR_F(pre,value) SERIAL_ECHOPAIR(pre, FIXFLOAT(value))
|
||||
#define SERIAL_ECHOLNPAIR_F(pre, value) SERIAL_ECHOLNPAIR(pre, FIXFLOAT(value))
|
||||
|
||||
void serial_echopair_P(const char* s_P, const char *v);
|
||||
void serial_echopair_P(const char* s_P, char v);
|
||||
void serial_echopair_P(const char* s_P, int v);
|
||||
void serial_echopair_P(const char* s_P, long v);
|
||||
void serial_echopair_P(const char* s_P, float v);
|
||||
void serial_echopair_P(const char* s_P, double v);
|
||||
void serial_echopair_P(const char* s_P, unsigned int v);
|
||||
void serial_echopair_P(const char* s_P, unsigned long v);
|
||||
FORCE_INLINE void serial_echopair_P(const char* s_P, uint8_t v) { serial_echopair_P(s_P, (int)v); }
|
||||
FORCE_INLINE void serial_echopair_P(const char* s_P, uint16_t v) { serial_echopair_P(s_P, (int)v); }
|
||||
FORCE_INLINE void serial_echopair_P(const char* s_P, bool v) { serial_echopair_P(s_P, (int)v); }
|
||||
FORCE_INLINE void serial_echopair_P(const char* s_P, void *v) { serial_echopair_P(s_P, (unsigned long)v); }
|
||||
//
|
||||
// Functions for serial printing from PROGMEM. (Saves loads of SRAM.)
|
||||
//
|
||||
FORCE_INLINE void serialprintPGM(const char* str) {
|
||||
while (char ch = pgm_read_byte(str++)) SERIAL_CHAR(ch);
|
||||
}
|
||||
|
||||
void serial_echopair_PGM(const char* s_P, const char *v);
|
||||
void serial_echopair_PGM(const char* s_P, char v);
|
||||
void serial_echopair_PGM(const char* s_P, int v);
|
||||
void serial_echopair_PGM(const char* s_P, long v);
|
||||
void serial_echopair_PGM(const char* s_P, float v);
|
||||
void serial_echopair_PGM(const char* s_P, double v);
|
||||
void serial_echopair_PGM(const char* s_P, unsigned int v);
|
||||
void serial_echopair_PGM(const char* s_P, unsigned long v);
|
||||
FORCE_INLINE void serial_echopair_PGM(const char* s_P, uint8_t v) { serial_echopair_PGM(s_P, (int)v); }
|
||||
FORCE_INLINE void serial_echopair_PGM(const char* s_P, uint16_t v) { serial_echopair_PGM(s_P, (int)v); }
|
||||
FORCE_INLINE void serial_echopair_PGM(const char* s_P, bool v) { serial_echopair_PGM(s_P, (int)v); }
|
||||
FORCE_INLINE void serial_echopair_PGM(const char* s_P, void *v) { serial_echopair_PGM(s_P, (unsigned long)v); }
|
||||
|
||||
void serial_spaces(uint8_t count);
|
||||
#define SERIAL_ECHO_SP(C) serial_spaces(C)
|
||||
#define SERIAL_ERROR_SP(C) serial_spaces(C)
|
||||
#define SERIAL_PROTOCOL_SP(C) serial_spaces(C)
|
||||
|
||||
//
|
||||
// Functions for serial printing from PROGMEM. (Saves loads of SRAM.)
|
||||
//
|
||||
FORCE_INLINE void serialprintPGM(const char* str) {
|
||||
while (char ch = pgm_read_byte(str++)) MYSERIAL0.write(ch);
|
||||
}
|
||||
|
||||
#endif // __SERIAL_H__
|
||||
|
@ -336,8 +336,8 @@ class Stepper {
|
||||
}
|
||||
if (timer < 100) { // (20kHz - this should never happen)
|
||||
timer = 100;
|
||||
MYSERIAL0.print(MSG_STEPPER_TOO_HIGH);
|
||||
MYSERIAL0.println(step_rate);
|
||||
SERIAL_PROTOCOL(MSG_STEPPER_TOO_HIGH);
|
||||
SERIAL_PROTOCOLLN(step_rate);
|
||||
}
|
||||
return timer;
|
||||
}
|
||||
|
@ -199,7 +199,7 @@
|
||||
if (map_type == 1 && i < GRID_MAX_POINTS_X - 1) SERIAL_CHAR(',');
|
||||
|
||||
#if TX_BUFFER_SIZE > 0
|
||||
MYSERIAL0.flushTX();
|
||||
SERIAL_FLUSHTX();
|
||||
#endif
|
||||
safe_delay(15);
|
||||
if (map_type == 0) {
|
||||
|
@ -763,7 +763,7 @@
|
||||
const float measured_z = probe_pt(rawx, rawy, stow_probe, g29_verbose_level); // TODO: Needs error handling
|
||||
z_values[location.x_index][location.y_index] = measured_z;
|
||||
}
|
||||
MYSERIAL0.flush(); // Prevent host M105 buffer overrun.
|
||||
SERIAL_FLUSH(); // Prevent host M105 buffer overrun.
|
||||
|
||||
} while (location.x_index >= 0 && --max_iterations);
|
||||
|
||||
@ -902,7 +902,7 @@
|
||||
SERIAL_PROTOCOL_F(z_values[location.x_index][location.y_index], 6);
|
||||
SERIAL_EOL();
|
||||
}
|
||||
MYSERIAL0.flush(); // Prevent host M105 buffer overrun.
|
||||
SERIAL_FLUSH(); // Prevent host M105 buffer overrun.
|
||||
} while (location.x_index >= 0 && location.y_index >= 0);
|
||||
|
||||
if (do_ubl_mesh_map) display_map(g29_map_type); // show user where we're probing
|
||||
@ -1414,7 +1414,7 @@
|
||||
do_blocking_move_to_z(h_offset + new_z); // Move the nozzle as the point is edited
|
||||
#endif
|
||||
idle();
|
||||
MYSERIAL0.flush(); // Prevent host M105 buffer overrun.
|
||||
SERIAL_FLUSH(); // Prevent host M105 buffer overrun.
|
||||
} while (!is_lcd_clicked());
|
||||
|
||||
if (!lcd_map_control) lcd_return_to_status();
|
||||
|
Loading…
x
Reference in New Issue
Block a user