From b8807128893a0ccb2b4633e27a91024dad36ed4f Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 16 Jul 2020 21:02:52 -0500 Subject: [PATCH] Fix material_preset reference issue --- Marlin/src/lcd/ultralcd.cpp | 55 +++++++++++----------- Marlin/src/pins/stm32f1/pins_CREALITY_V4.h | 6 +-- 2 files changed, 30 insertions(+), 31 deletions(-) diff --git a/Marlin/src/lcd/ultralcd.cpp b/Marlin/src/lcd/ultralcd.cpp index 1848a56d2..d9a18ba4e 100644 --- a/Marlin/src/lcd/ultralcd.cpp +++ b/Marlin/src/lcd/ultralcd.cpp @@ -20,7 +20,7 @@ * */ -#include "../inc/MarlinConfigPre.h" +#include "../inc/MarlinConfig.h" #ifdef LED_BACKLIGHT_TIMEOUT #include "../feature/leds/leds.h" @@ -86,6 +86,32 @@ MarlinUI ui; } #endif +#if PREHEAT_COUNT + preheat_t MarlinUI::material_preset[PREHEAT_COUNT]; // Initialized by settings.load() + PGM_P MarlinUI::get_preheat_label(const uint8_t m) { + #ifdef PREHEAT_1_LABEL + static PGMSTR(preheat_0_label, PREHEAT_1_LABEL); + #endif + #ifdef PREHEAT_2_LABEL + static PGMSTR(preheat_1_label, PREHEAT_2_LABEL); + #endif + #ifdef PREHEAT_3_LABEL + static PGMSTR(preheat_2_label, PREHEAT_3_LABEL); + #endif + #ifdef PREHEAT_4_LABEL + static PGMSTR(preheat_3_label, PREHEAT_4_LABEL); + #endif + #ifdef PREHEAT_5_LABEL + static PGMSTR(preheat_4_label, PREHEAT_5_LABEL); + #endif + + #define _PLBL(N) preheat_##N##_label, + static PGM_P const preheat_labels[PREHEAT_COUNT] PROGMEM = { REPEAT(PREHEAT_COUNT, _PLBL) }; + + return (PGM_P)pgm_read_ptr(&preheat_labels[m]); + } +#endif + #if HAS_SPI_LCD #if HAS_GRAPHICAL_LCD @@ -149,33 +175,6 @@ millis_t MarlinUI::next_button_update_ms; // = 0 volatile int8_t encoderDiff; // Updated in update_buttons, added to encoderPosition every LCD update #endif -#if PREHEAT_COUNT - preheat_t MarlinUI::material_preset[PREHEAT_COUNT]; // Initialized by settings.load() - - PGM_P MarlinUI::get_preheat_label(const uint8_t m) { - #ifdef PREHEAT_1_LABEL - static PGMSTR(preheat_0_label, PREHEAT_1_LABEL); - #endif - #ifdef PREHEAT_2_LABEL - static PGMSTR(preheat_1_label, PREHEAT_2_LABEL); - #endif - #ifdef PREHEAT_3_LABEL - static PGMSTR(preheat_2_label, PREHEAT_3_LABEL); - #endif - #ifdef PREHEAT_4_LABEL - static PGMSTR(preheat_3_label, PREHEAT_4_LABEL); - #endif - #ifdef PREHEAT_5_LABEL - static PGMSTR(preheat_4_label, PREHEAT_5_LABEL); - #endif - - #define _PLBL(N) preheat_##N##_label, - static PGM_P const preheat_labels[PREHEAT_COUNT] PROGMEM = { REPEAT(PREHEAT_COUNT, _PLBL) }; - - return (PGM_P)pgm_read_ptr(&preheat_labels[m]); - } -#endif - #if ENABLED(SDSUPPORT) #include "../sd/cardreader.h" diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h index 2a7a21250..6153ddbe6 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h @@ -43,15 +43,15 @@ //#define FLASH_EEPROM_EMULATION // I2C - //#define IIC_BL24CXX_EEPROM // EEPROM on I2C-0 + #define IIC_BL24CXX_EEPROM // EEPROM on I2C-0 used only for display settings #if ENABLED(IIC_BL24CXX_EEPROM) #define IIC_EEPROM_SDA PA11 #define IIC_EEPROM_SCL PA12 #define MARLIN_EEPROM_SIZE 0x4000 // 16Kb (24c16) - #else - #define SDCARD_EEPROM_EMULATION // SD EEPROM was in the original build, so... #endif + #define SDCARD_EEPROM_EMULATION // SD EEPROM until all EEPROM is BL24CXX + // SPI //#define SPI_EEPROM // EEPROM on SPI-0 //#define SPI_CHAN_EEPROM1 ?