Add SERIAL_FLUSH and SERIAL_FLUSHTX macros

This commit is contained in:
Scott Lahteine 2018-02-16 17:50:58 -06:00
parent a8a64f19f4
commit 023d21a1cf
5 changed files with 15 additions and 10 deletions

View File

@ -274,7 +274,7 @@
// action to give the user a more responsive 'Stop'. // action to give the user a more responsive 'Stop'.
set_destination_from_current(); set_destination_from_current();
idle(); idle();
MYSERIAL0.flush(); // Prevent host M105 buffer overrun. SERIAL_FLUSH(); // Prevent host M105 buffer overrun.
} }
wait_for_release(); wait_for_release();
@ -501,7 +501,7 @@
SERIAL_EOL(); SERIAL_EOL();
} }
idle(); idle();
MYSERIAL0.flush(); // Prevent host M105 buffer overrun. SERIAL_FLUSH(); // Prevent host M105 buffer overrun.
} }
#if ENABLED(ULTRA_LCD) #if ENABLED(ULTRA_LCD)
} }
@ -525,7 +525,7 @@
} }
idle(); idle();
MYSERIAL0.flush(); // Prevent host M105 buffer overrun. SERIAL_FLUSH(); // Prevent host M105 buffer overrun.
} }
#if ENABLED(ULTRA_LCD) #if ENABLED(ULTRA_LCD)
lcd_reset_status(); lcd_reset_status();
@ -811,12 +811,12 @@
#endif #endif
print_line_from_here_to_there(rx, ry, g26_layer_height, xe, ye, g26_layer_height); 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()) if (look_for_lines_to_connect())
goto LEAVE; 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); } while (--g26_repeats && location.x_index >= 0 && location.y_index >= 0);
LEAVE: LEAVE:

View File

@ -11981,7 +11981,7 @@ void process_next_command() {
*/ */
void FlushSerialRequestResend() { void FlushSerialRequestResend() {
//char command_queue[cmd_queue_index_r][100]="Resend:"; //char command_queue[cmd_queue_index_r][100]="Resend:";
MYSERIAL0.flush(); SERIAL_FLUSH();
SERIAL_PROTOCOLPGM(MSG_RESEND); SERIAL_PROTOCOLPGM(MSG_RESEND);
SERIAL_PROTOCOLLN(gcode_LastN + 1); SERIAL_PROTOCOLLN(gcode_LastN + 1);
ok_to_send(); ok_to_send();

View File

@ -48,6 +48,11 @@ extern const char errormagic[] PROGMEM;
#define SERIAL_PRINTLN(x,b) MYSERIAL0.println(x,b) #define SERIAL_PRINTLN(x,b) MYSERIAL0.println(x,b)
#define SERIAL_PRINTF(args...) MYSERIAL0.printf(args) #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_PROTOCOLCHAR(x) SERIAL_CHAR(x)
#define SERIAL_PROTOCOL(x) MYSERIAL0.print(x) #define SERIAL_PROTOCOL(x) MYSERIAL0.print(x)
#define SERIAL_PROTOCOL_F(x,y) MYSERIAL0.print(x,y) #define SERIAL_PROTOCOL_F(x,y) MYSERIAL0.print(x,y)

View File

@ -199,7 +199,7 @@
if (map_type == 1 && i < GRID_MAX_POINTS_X - 1) SERIAL_CHAR(','); if (map_type == 1 && i < GRID_MAX_POINTS_X - 1) SERIAL_CHAR(',');
#if TX_BUFFER_SIZE > 0 #if TX_BUFFER_SIZE > 0
MYSERIAL0.flushTX(); SERIAL_FLUSHTX();
#endif #endif
safe_delay(15); safe_delay(15);
if (map_type == 0) { if (map_type == 0) {

View File

@ -763,7 +763,7 @@
const float measured_z = probe_pt(rawx, rawy, stow_probe, g29_verbose_level); // TODO: Needs error handling 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; 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); } while (location.x_index >= 0 && --max_iterations);
@ -902,7 +902,7 @@
SERIAL_PROTOCOL_F(z_values[location.x_index][location.y_index], 6); SERIAL_PROTOCOL_F(z_values[location.x_index][location.y_index], 6);
SERIAL_EOL(); 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); } 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 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 do_blocking_move_to_z(h_offset + new_z); // Move the nozzle as the point is edited
#endif #endif
idle(); idle();
MYSERIAL0.flush(); // Prevent host M105 buffer overrun. SERIAL_FLUSH(); // Prevent host M105 buffer overrun.
} while (!is_lcd_clicked()); } while (!is_lcd_clicked());
if (!lcd_map_control) lcd_return_to_status(); if (!lcd_map_control) lcd_return_to_status();