Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Patch to reenable EEPROM settings in Prusa Mini Buddy Firmware
From 8523a8fb5e0d749afbd27bcaeed0f43a6a56d7fd Mon Sep 17 00:00:00 2001
From: "github@matthewlloyd.net" <github@matthewlloyd.net>
Date: Tue, 1 Jun 2021 16:41:09 -0400
Subject: [PATCH] Reenable EEPROM settings in Marlin
---
CMakeLists.txt | 1 +
include/marlin/Configuration_A3ides_2209_MINI.h | 2 +-
src/common/Marlin_eeprom.cpp | 2 ++
src/common/marlin_server.cpp | 3 +++
4 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 525c6a1c..4b00c9f0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -498,6 +498,7 @@ target_sources(
src/common/diag.cpp
src/common/eeprom.cpp
src/common/eeprom_loadsave.c
+ src/common/Marlin_eeprom.cpp
src/common/MarlinPin.cpp
src/common/marlin_vars.c
src/common/media.cpp
diff --git a/include/marlin/Configuration_A3ides_2209_MINI.h b/include/marlin/Configuration_A3ides_2209_MINI.h
index 0ca3cbc5..4c8e3b23 100644
--- a/include/marlin/Configuration_A3ides_2209_MINI.h
+++ b/include/marlin/Configuration_A3ides_2209_MINI.h
@@ -1324,7 +1324,7 @@
// M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).
// M502 - reverts to the default "factory settings". You still need to store them in EEPROM afterwards if you want to.
//
-//#define EEPROM_SETTINGS // Enable for M500 and M501 commands
+#define EEPROM_SETTINGS // Enable for M500 and M501 commands
//#define DISABLE_M503 // Saves ~2700 bytes of PROGMEM. Disable for release!
//#define EEPROM_CHITCHAT // Give feedback on EEPROM commands. Disable to save PROGMEM.
diff --git a/src/common/Marlin_eeprom.cpp b/src/common/Marlin_eeprom.cpp
index 2c0cef3a..2dd34823 100644
--- a/src/common/Marlin_eeprom.cpp
+++ b/src/common/Marlin_eeprom.cpp
@@ -4,6 +4,7 @@
#include "stm32f4xx_hal.h"
#include "st25dv64k.h"
#include "dbg.h"
+#include "wdt.h"
// this source implements four functions defined in Marlin/src/HAL/HAL_STM32F4/HAL.h:
// eeprom_write_byte, eeprom_update_block, eeprom_read_byte, eeprom_read_block
@@ -23,6 +24,7 @@ uint8_t eeprom_read_byte(uint8_t *pos) {
uint8_t data;
data = st25dv64k_user_read(adr);
DBG("EErd %04x %02x", adr, data);
+ wdt_iwdg_refresh();
return data;
}
diff --git a/src/common/marlin_server.cpp b/src/common/marlin_server.cpp
index 0cbb40fe..33fdc6d4 100644
--- a/src/common/marlin_server.cpp
+++ b/src/common/marlin_server.cpp
@@ -392,6 +392,9 @@ void marlin_server_settings_save(void) {
void marlin_server_settings_load(void) {
(void)settings.reset();
+ // Load Marlin EEPROM settings first, then apply overrides from the Prusa
+ // EEPROM settings.
+ (void)settings.load();
#if HAS_BED_PROBE
probe_offset.z = variant8_get_flt(eeprom_get_var(EEVAR_ZOFFSET));
#endif
--
2.25.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment