Implement CRC16, develop mesh allocation table

- Add crc16 utility function
 - Implement CRC16 for config store, remove old checksum, increment layout version
 - Move UBL mesh store/load to MarlinSettings; increment UBL_VERSION
 - Begin to lay out MAT structure, prototype functions, etc.
 - Rename ubl.state.eeprom_storage_slot to .storage_slot
 - Misc. optimization
 - Cleanup/standardize/improve some messages

This is a work in progress!
This commit is contained in:
Brian
2017-05-06 21:00:56 -04:00
committed by Scott Lahteine
parent 00d358d92d
commit 7852369987
8 changed files with 299 additions and 194 deletions

View File

@ -34,6 +34,19 @@ void safe_delay(millis_t ms) {
thermalManager.manage_heater(); // This keeps us safe if too many small safe_delay() calls are made
}
#if ENABLED(EEPROM_SETTINGS)
void crc16(uint16_t *crc, const void * const data, uint16_t cnt) {
uint8_t *ptr = (uint8_t*)data;
while (cnt-- > 0) {
*crc = (uint16_t)(*crc ^ (uint16_t)(((uint16_t)*ptr++) << 8));
for (uint8_t x = 0; x < 8; x++)
*crc = (uint16_t)((*crc & 0x8000) ? ((uint16_t)(*crc << 1) ^ 0x1021) : (*crc << 1));
}
}
#endif // EEPROM_SETTINGS
#if ENABLED(ULTRA_LCD)
char conv[8] = { 0 };