Add MarlinSettings::validate()

This commit is contained in:
Scott Lahteine
2018-01-04 19:51:18 -06:00
parent 878f54c27b
commit 51e0f2bee3
12 changed files with 192 additions and 138 deletions

View File

@@ -93,13 +93,13 @@ bool write_data(int &pos, const uint8_t *value, uint16_t size, uint16_t *crc) {
return true;
}
void read_data(int &pos, uint8_t* value, uint16_t size, uint16_t *crc) {
void read_data(int &pos, uint8_t* value, uint16_t size, uint16_t *crc, const bool writing/*=true*/) {
for (uint16_t i = 0; i < size; i++) {
byte* accessPoint = (byte*)(pageBase + pos + i);
value[i] = *accessPoint;
uint8_t c = *accessPoint;
if (writing) value[i] = c;
crc16(crc, &c, 1);
}
crc16(crc, value, size);
pos += ((size + 1) & ~1);
}