|
@@ -251,15 +251,7 @@ void flush_and_request_resend() {
|
251
|
251
|
ok_to_send();
|
252
|
252
|
}
|
253
|
253
|
|
254
|
|
-void gcode_line_error(PGM_P err, uint8_t port) {
|
255
|
|
- SERIAL_ERROR_START_P(port);
|
256
|
|
- serialprintPGM_P(port, err);
|
257
|
|
- SERIAL_ECHOLN_P(port, gcode_LastN);
|
258
|
|
- flush_and_request_resend();
|
259
|
|
- serial_count[port] = 0;
|
260
|
|
-}
|
261
|
|
-
|
262
|
|
-static bool serial_data_available() {
|
|
254
|
+inline bool serial_data_available() {
|
263
|
255
|
return false
|
264
|
256
|
|| MYSERIAL0.available()
|
265
|
257
|
#if NUM_SERIAL > 1
|
|
@@ -268,7 +260,7 @@ static bool serial_data_available() {
|
268
|
260
|
;
|
269
|
261
|
}
|
270
|
262
|
|
271
|
|
-static int read_serial(const uint8_t index) {
|
|
263
|
+inline int read_serial(const uint8_t index) {
|
272
|
264
|
switch (index) {
|
273
|
265
|
case 0: return MYSERIAL0.read();
|
274
|
266
|
#if NUM_SERIAL > 1
|
|
@@ -278,6 +270,15 @@ static int read_serial(const uint8_t index) {
|
278
|
270
|
}
|
279
|
271
|
}
|
280
|
272
|
|
|
273
|
+void gcode_line_error(PGM_P err, uint8_t port) {
|
|
274
|
+ SERIAL_ERROR_START_P(port);
|
|
275
|
+ serialprintPGM_P(port, err);
|
|
276
|
+ SERIAL_ECHOLN_P(port, gcode_LastN);
|
|
277
|
+ while (read_serial(port) != -1); // clear out the RX buffer
|
|
278
|
+ flush_and_request_resend();
|
|
279
|
+ serial_count[port] = 0;
|
|
280
|
+}
|
|
281
|
+
|
281
|
282
|
#if ENABLED(FAST_FILE_TRANSFER)
|
282
|
283
|
|
283
|
284
|
#if ENABLED(SDSUPPORT)
|
|
@@ -286,7 +287,7 @@ static int read_serial(const uint8_t index) {
|
286
|
287
|
#define CARD_ECHOLN_P(V) SERIAL_ECHOLN_P(card.transfer_port, V)
|
287
|
288
|
#endif
|
288
|
289
|
|
289
|
|
- static bool serial_data_available(const uint8_t index) {
|
|
290
|
+ inline bool serial_data_available(const uint8_t index) {
|
290
|
291
|
switch (index) {
|
291
|
292
|
case 0: return MYSERIAL0.available();
|
292
|
293
|
#if NUM_SERIAL > 1
|