Add the option to not include the asterisk in checksum calculation.
RepRap host software does it this way.
This commit is contained in:
parent
5409e1da19
commit
abc0edc635
|
|
@ -17,6 +17,8 @@ uint8_t last_field = 0;
|
||||||
|
|
||||||
const char alphabet[] = "GMXYZEFSPN*";
|
const char alphabet[] = "GMXYZEFSPN*";
|
||||||
|
|
||||||
|
#define crc(a, b) (a ^ b)
|
||||||
|
|
||||||
decfloat read_digit __attribute__ ((__section__ (".bss")));
|
decfloat read_digit __attribute__ ((__section__ (".bss")));
|
||||||
|
|
||||||
GCODE_COMMAND next_target __attribute__ ((__section__ (".bss")));
|
GCODE_COMMAND next_target __attribute__ ((__section__ (".bss")));
|
||||||
|
|
@ -103,10 +105,10 @@ void SpecialMoveE(int32_t e, uint32_t f) {
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void scan_char(uint8_t c) {
|
void scan_char(uint8_t c) {
|
||||||
// move this below switch(c) if the asterisk isn't included in the checksum
|
#ifdef ASTERISK_IN_CHECKSUM_INCLUDED
|
||||||
#define crc(a, b) (a ^ b)
|
|
||||||
if (next_target.seen_checksum == 0)
|
if (next_target.seen_checksum == 0)
|
||||||
next_target.checksum_calculated = crc(next_target.checksum_calculated, c);
|
next_target.checksum_calculated = crc(next_target.checksum_calculated, c);
|
||||||
|
#endif
|
||||||
|
|
||||||
// uppercase
|
// uppercase
|
||||||
if (c >= 'a' && c <= 'z')
|
if (c >= 'a' && c <= 'z')
|
||||||
|
|
@ -290,6 +292,11 @@ void scan_char(uint8_t c) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef ASTERISK_IN_CHECKSUM_INCLUDED
|
||||||
|
if (next_target.seen_checksum == 0)
|
||||||
|
next_target.checksum_calculated = crc(next_target.checksum_calculated, c);
|
||||||
|
#endif
|
||||||
|
|
||||||
// end of line
|
// end of line
|
||||||
if ((c == 10) || (c == 13)) {
|
if ((c == 10) || (c == 13)) {
|
||||||
if (debug_flags & DEBUG_ECHO)
|
if (debug_flags & DEBUG_ECHO)
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,10 @@
|
||||||
|
|
||||||
#include "dda.h"
|
#include "dda.h"
|
||||||
|
|
||||||
|
// wether the asterisk (checksum-command) is included for checksum calculation
|
||||||
|
// undefined for RepRap host software
|
||||||
|
//#define ASTERISK_IN_CHECKSUM_INCLUDED
|
||||||
|
|
||||||
// wether to insist on N line numbers
|
// wether to insist on N line numbers
|
||||||
// if not defined, N's are completely ignored
|
// if not defined, N's are completely ignored
|
||||||
//#define REQUIRE_LINENUMBER
|
//#define REQUIRE_LINENUMBER
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue