Z Offset now stored into EEPROM immediately.

master
Marcio Teixeira 7 years ago
parent 1334567bb4
commit 0661e2d641

@ -37,7 +37,7 @@
#error Must specify model and toolhead. Please see "Configuration_LulzBot.h" for directions.
#endif
#define LULZBOT_FW_VERSION ".19"
#define LULZBOT_FW_VERSION ".20"
// Select options based on printer model
@ -749,4 +749,44 @@
#define LULZBOT_AFTER_Z_HOME_ACTION
#endif
/* Historically, the Lulzbot firmware would save the Z-Offset into the EEPROM
* each time it is changed. The latest Marlin made this more difficult since they
* added a CRC to the EEPROM. We work around this by bracketing the EEPROM_READ
* and EEPROM_WRITE routines such that the CRC ignores the Z-Offset value. That
* code also captures the eeprom_index so we can write only that value later.
*/
/* The following goes in "configuration_store.cpp", before and after
* "EEPROM_WRITE(zprobe_zoffset)" and "EEPROM_READ(zprobe_zoffset)"
*/
#define LULZBOT_EEPROM_BEFORE_ZOFFSET \
const uint16_t eeprom_saved_crc = working_crc; \
eeprom_zoffset_index = eeprom_index;
#define LULZBOT_EEPROM_AFTER_ZOFFSET \
working_crc = eeprom_saved_crc;
/* The following goes in "configuration_store.h" */
#define LULZBOT_SAVE_ZOFFSET_TO_EEPROM_DECL \
static int eeprom_zoffset_index; \
static void store_zoffset();
/* The following goes in "configuration_store.cpp" */
#define LULZBOT_SAVE_ZOFFSET_TO_EEPROM_IMPL \
int MarlinSettings::eeprom_zoffset_index = -1; \
void MarlinSettings::store_zoffset() { \
if(eeprom_zoffset_index > 0) { \
uint16_t working_crc; \
int eeprom_index = eeprom_zoffset_index; \
EEPROM_WRITE(zprobe_zoffset); \
SERIAL_ECHO_START(); \
SERIAL_ECHOPAIR("Updating zoffset in EEPROM: ", zprobe_zoffset); \
SERIAL_ECHOPAIR("; EEPROM Index: ", eeprom_zoffset_index); \
SERIAL_ECHOLNPGM(""); \
} \
}
/* The following goes in "ultralcd.cpp" in "lcd_babystep_zoffset" */
#define LULZBOT_SAVE_ZOFFSET_TO_EEPROM settings.store_zoffset();
#endif /* CONDITIONALS_LULZBOT */

@ -300,6 +300,8 @@ void MarlinSettings::postprocess() {
} while (--size);
}
LULZBOT_SAVE_ZOFFSET_TO_EEPROM_IMPL
/**
* M500 - Store Configuration
*/
@ -393,7 +395,9 @@ void MarlinSettings::postprocess() {
#if !HAS_BED_PROBE
const float zprobe_zoffset = 0;
#endif
LULZBOT_EEPROM_BEFORE_ZOFFSET
EEPROM_WRITE(zprobe_zoffset);
LULZBOT_EEPROM_AFTER_ZOFFSET
//
// Planar Bed Leveling matrix
@ -789,7 +793,9 @@ void MarlinSettings::postprocess() {
#if !HAS_BED_PROBE
float zprobe_zoffset;
#endif
LULZBOT_EEPROM_BEFORE_ZOFFSET
EEPROM_READ(zprobe_zoffset);
LULZBOT_EEPROM_AFTER_ZOFFSET
//
// Planar Bed Leveling matrix

@ -58,6 +58,8 @@ class MarlinSettings {
static void report(bool forReplay=false) { UNUSED(forReplay); }
#endif
LULZBOT_SAVE_ZOFFSET_TO_EEPROM_DECL
private:
static void postprocess();

@ -1008,7 +1008,7 @@ void kill_screen(const char* lcd_msg) {
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
void lcd_babystep_zoffset() {
if (lcd_clicked) { defer_return_to_status = false; return lcd_goto_previous_menu(); }
if (lcd_clicked) { defer_return_to_status = false; LULZBOT_SAVE_ZOFFSET_TO_EEPROM; return lcd_goto_previous_menu(); }
defer_return_to_status = true;
ENCODER_DIRECTION_NORMAL();
if (encoderPosition) {

Loading…
Cancel
Save