Merge pull request #2021 from kuhnmarek/bugfix/PFW-917_saving_live_z

PFW-917 Adjust Z value persists across update to v3.8
This commit is contained in:
DRracer 2019-07-22 12:47:08 +02:00 committed by GitHub
commit 1a5478f7ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -71,6 +71,12 @@ void eeprom_init()
}
if(is_uninitialized)
{
// When upgrading from version older version (before multiple sheets were implemented in v3.8.0)
// Sheet 1 uses the previous Live adjust Z (@EEPROM_BABYSTEP_Z)
if(i == 0){
int last_babystep = eeprom_read_word((uint16_t *)EEPROM_BABYSTEP_Z);
eeprom_write_word(reinterpret_cast<uint16_t *>(&(EEPROM_Sheets_base->s[i].z_offset)), last_babystep);
}
eeprom_write(&(EEPROM_Sheets_base->s[i].name[0]), static_cast<char>(i + '1'));
eeprom_write(&(EEPROM_Sheets_base->s[i].name[1]), '\0');
}