From 03e80ce4a8eac8855050f967ce8b675732cd5741 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20K=C3=BChn?= Date: Thu, 18 Jul 2019 16:50:44 +0200 Subject: [PATCH] PFW-917 Adjust Z value persists across update to v3.8 --- Firmware/eeprom.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Firmware/eeprom.cpp b/Firmware/eeprom.cpp index 1be708d0..f2d89716 100644 --- a/Firmware/eeprom.cpp +++ b/Firmware/eeprom.cpp @@ -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(&(EEPROM_Sheets_base->s[i].z_offset)), last_babystep); + } eeprom_write(&(EEPROM_Sheets_base->s[i].name[0]), static_cast(i + '1')); eeprom_write(&(EEPROM_Sheets_base->s[i].name[1]), '\0'); }