Make resend requests RepRap host compatible, too.

This commit is contained in:
Markus Hitter 2010-07-03 02:03:51 +02:00
parent aa590c4502
commit 0bd0848dd5
2 changed files with 24 additions and 4 deletions

View File

@ -329,15 +329,17 @@ void scan_char(uint8_t c) {
next_target.N_expected = next_target.N + 1;
}
else {
serial_writestr_P(PSTR("RESEND: BAD CHECKSUM: EXPECTED "));
serial_writestr_P(PSTR("Expected checksum "));
serwrite_uint8(next_target.checksum_calculated);
serial_writestr_P(PSTR("\n"));
request_resend();
}
}
else {
serial_writestr_P(PSTR("RESEND: BAD LINE NUMBER: EXPECTED "));
serial_writestr_P(PSTR("Expected line number "));
serwrite_uint32(next_target.N_expected);
serial_writestr_P(PSTR("\n"));
request_resend();
}
// reset variables
@ -722,3 +724,18 @@ void process_gcode_command(GCODE_COMMAND *gcmd) {
}
}
}
/****************************************************************************
* *
* Request a resend of the current line - used from various places. *
* *
* Relies on the global variable next_target.N being valid. *
* *
****************************************************************************/
void request_resend() {
serial_writestr_P(PSTR("Resend:"));
serwrite_uint8(next_target.N);
serial_writestr_P(PSTR("\n"));
}

View File

@ -7,10 +7,10 @@
// wether to insist on N line numbers
// if not defined, N's are completely ignored
//#define REQUIRE_LINENUMBER
//#define REQUIRE_LINENUMBER
// wether to insist on a checksum
//#define REQUIRE_CHECKSUM
//#define REQUIRE_CHECKSUM
// this is a very crude decimal-based floating point structure. a real floating point would at least have signed exponent
typedef struct {
@ -70,4 +70,7 @@ void scan_char(uint8_t c);
// when we have a whole line, feed it to this
void process_gcode_command(GCODE_COMMAND *gcmd);
// uses the global variable next_target.N
void request_resend();
#endif /* _GCODE_H */