Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix EEPROM checksum to not be lastchar or lastchar+1 #266

Open
wants to merge 1 commit into
base: edge
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions grbl/eeprom.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ void eeprom_put_char( unsigned int addr, unsigned char new_value )
void memcpy_to_eeprom_with_checksum(unsigned int destination, char *source, unsigned int size) {
unsigned char checksum = 0;
for(; size > 0; size--) {
checksum = (checksum << 1) || (checksum >> 7);
checksum = (checksum << 1) | (checksum >> 7);
checksum += *source;
eeprom_put_char(destination++, *(source++));
}
Expand All @@ -141,7 +141,7 @@ int memcpy_from_eeprom_with_checksum(char *destination, unsigned int source, uns
unsigned char data, checksum = 0;
for(; size > 0; size--) {
data = eeprom_get_char(source++);
checksum = (checksum << 1) || (checksum >> 7);
checksum = (checksum << 1) | (checksum >> 7);
checksum += data;
*(destination++) = data;
}
Expand Down