♻️ Adjust LCD init, contrast default, settings load
This commit is contained in:
parent
de0bc19230
commit
99f3b8b4a8
|
@ -113,7 +113,7 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o
|
||||||
#define _IS_RX1_1 IS_RX1
|
#define _IS_RX1_1 IS_RX1
|
||||||
#if IS_TX1(TMC_SW_SCK)
|
#if IS_TX1(TMC_SW_SCK)
|
||||||
#error "Serial port pins (1) conflict with other pins!"
|
#error "Serial port pins (1) conflict with other pins!"
|
||||||
#elif HAS_WIRED_LCD
|
#elif HAS_ROTARY_ENCODER
|
||||||
#if IS_TX1(BTN_EN2) || IS_RX1(BTN_EN1)
|
#if IS_TX1(BTN_EN2) || IS_RX1(BTN_EN1)
|
||||||
#error "Serial port pins (1) conflict with Encoder Buttons!"
|
#error "Serial port pins (1) conflict with Encoder Buttons!"
|
||||||
#elif ANY_TX(1, SD_SCK_PIN, LCD_PINS_D4, DOGLCD_SCK, LCD_RESET_PIN, LCD_PINS_RS, SHIFT_CLK_PIN) \
|
#elif ANY_TX(1, SD_SCK_PIN, LCD_PINS_D4, DOGLCD_SCK, LCD_RESET_PIN, LCD_PINS_RS, SHIFT_CLK_PIN) \
|
||||||
|
|
|
@ -1294,16 +1294,7 @@ void setup() {
|
||||||
// UI must be initialized before EEPROM
|
// UI must be initialized before EEPROM
|
||||||
// (because EEPROM code calls the UI).
|
// (because EEPROM code calls the UI).
|
||||||
|
|
||||||
#if HAS_DWIN_E3V2_BASIC
|
|
||||||
SETUP_RUN(DWIN_Startup());
|
|
||||||
#else
|
|
||||||
SETUP_RUN(ui.init());
|
SETUP_RUN(ui.init());
|
||||||
#if BOTH(HAS_WIRED_LCD, SHOW_BOOTSCREEN)
|
|
||||||
SETUP_RUN(ui.show_bootscreen());
|
|
||||||
const millis_t bootscreen_ms = millis();
|
|
||||||
#endif
|
|
||||||
SETUP_RUN(ui.reset_status()); // Load welcome message early. (Retained if no errors exist.)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if PIN_EXISTS(SAFE_POWER)
|
#if PIN_EXISTS(SAFE_POWER)
|
||||||
#if HAS_DRIVER_SAFE_POWER_PROTECT
|
#if HAS_DRIVER_SAFE_POWER_PROTECT
|
||||||
|
@ -1314,10 +1305,6 @@ void setup() {
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(PROBE_TARE)
|
|
||||||
SETUP_RUN(probe.tare_init());
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if BOTH(SDSUPPORT, SDCARD_EEPROM_EMULATION)
|
#if BOTH(SDSUPPORT, SDCARD_EEPROM_EMULATION)
|
||||||
SETUP_RUN(card.mount()); // Mount media with settings before first_load
|
SETUP_RUN(card.mount()); // Mount media with settings before first_load
|
||||||
#endif
|
#endif
|
||||||
|
@ -1325,6 +1312,15 @@ void setup() {
|
||||||
SETUP_RUN(settings.first_load()); // Load data from EEPROM if available (or use defaults)
|
SETUP_RUN(settings.first_load()); // Load data from EEPROM if available (or use defaults)
|
||||||
// This also updates variables in the planner, elsewhere
|
// This also updates variables in the planner, elsewhere
|
||||||
|
|
||||||
|
#if BOTH(HAS_WIRED_LCD, SHOW_BOOTSCREEN)
|
||||||
|
SETUP_RUN(ui.show_bootscreen());
|
||||||
|
const millis_t bootscreen_ms = millis();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if ENABLED(PROBE_TARE)
|
||||||
|
SETUP_RUN(probe.tare_init());
|
||||||
|
#endif
|
||||||
|
|
||||||
#if HAS_ETHERNET
|
#if HAS_ETHERNET
|
||||||
SETUP_RUN(ethernet.init());
|
SETUP_RUN(ethernet.init());
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
* M250: Read and optionally set the LCD contrast
|
* M250: Read and optionally set the LCD contrast
|
||||||
*/
|
*/
|
||||||
void GcodeSuite::M250() {
|
void GcodeSuite::M250() {
|
||||||
if (parser.seenval('C'))
|
if (LCD_CONTRAST_MIN < LCD_CONTRAST_MAX && parser.seenval('C'))
|
||||||
ui.set_contrast(parser.value_byte());
|
ui.set_contrast(parser.value_byte());
|
||||||
else
|
else
|
||||||
M250_report();
|
M250_report();
|
||||||
|
|
|
@ -237,7 +237,7 @@
|
||||||
#define LCD_HEIGHT 10 // Character lines
|
#define LCD_HEIGHT 10 // Character lines
|
||||||
#define LCD_CONTRAST_MIN 127
|
#define LCD_CONTRAST_MIN 127
|
||||||
#define LCD_CONTRAST_MAX 255
|
#define LCD_CONTRAST_MAX 255
|
||||||
#define DEFAULT_LCD_CONTRAST 250
|
#define LCD_CONTRAST_DEFAULT 250
|
||||||
#define CONVERT_TO_EXT_ASCII // Use extended 128-255 symbols from ASCII table.
|
#define CONVERT_TO_EXT_ASCII // Use extended 128-255 symbols from ASCII table.
|
||||||
// At this time present conversion only for cyrillic - bg, ru and uk languages.
|
// At this time present conversion only for cyrillic - bg, ru and uk languages.
|
||||||
// First 7 ASCII symbols in panel font must be replaced with Marlin's special symbols.
|
// First 7 ASCII symbols in panel font must be replaced with Marlin's special symbols.
|
||||||
|
|
|
@ -376,7 +376,6 @@
|
||||||
#elif EITHER(MKS_MINI_12864_V3, BTT_MINI_12864_V1)
|
#elif EITHER(MKS_MINI_12864_V3, BTT_MINI_12864_V1)
|
||||||
#define _LCD_CONTRAST_MIN 255
|
#define _LCD_CONTRAST_MIN 255
|
||||||
#define _LCD_CONTRAST_INIT 255
|
#define _LCD_CONTRAST_INIT 255
|
||||||
#define _LCD_CONTRAST_MAX 255
|
|
||||||
#elif ENABLED(FYSETC_MINI_12864)
|
#elif ENABLED(FYSETC_MINI_12864)
|
||||||
#define _LCD_CONTRAST_INIT 220
|
#define _LCD_CONTRAST_INIT 220
|
||||||
#elif ENABLED(ULTI_CONTROLLER)
|
#elif ENABLED(ULTI_CONTROLLER)
|
||||||
|
@ -389,18 +388,12 @@
|
||||||
#elif ENABLED(ZONESTAR_12864OLED)
|
#elif ENABLED(ZONESTAR_12864OLED)
|
||||||
#define _LCD_CONTRAST_MIN 64
|
#define _LCD_CONTRAST_MIN 64
|
||||||
#define _LCD_CONTRAST_INIT 128
|
#define _LCD_CONTRAST_INIT 128
|
||||||
#define _LCD_CONTRAST_MAX 255
|
|
||||||
#elif IS_TFTGLCD_PANEL
|
#elif IS_TFTGLCD_PANEL
|
||||||
#define _LCD_CONTRAST_MIN 0
|
|
||||||
#define _LCD_CONTRAST_INIT 250
|
#define _LCD_CONTRAST_INIT 250
|
||||||
#define _LCD_CONTRAST_MAX 255
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _LCD_CONTRAST_INIT
|
#ifdef _LCD_CONTRAST_INIT
|
||||||
#define HAS_LCD_CONTRAST 1
|
#define HAS_LCD_CONTRAST 1
|
||||||
#endif
|
|
||||||
|
|
||||||
#if HAS_LCD_CONTRAST
|
|
||||||
#ifndef LCD_CONTRAST_MIN
|
#ifndef LCD_CONTRAST_MIN
|
||||||
#ifdef _LCD_CONTRAST_MIN
|
#ifdef _LCD_CONTRAST_MIN
|
||||||
#define LCD_CONTRAST_MIN _LCD_CONTRAST_MIN
|
#define LCD_CONTRAST_MIN _LCD_CONTRAST_MIN
|
||||||
|
@ -420,8 +413,8 @@
|
||||||
#define LCD_CONTRAST_MAX 63 // ST7567 6-bits contrast
|
#define LCD_CONTRAST_MAX 63 // ST7567 6-bits contrast
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#ifndef DEFAULT_LCD_CONTRAST
|
#ifndef LCD_CONTRAST_DEFAULT
|
||||||
#define DEFAULT_LCD_CONTRAST LCD_CONTRAST_INIT
|
#define LCD_CONTRAST_DEFAULT LCD_CONTRAST_INIT
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -559,3 +559,7 @@
|
||||||
#if CANNOT_EMBED_CONFIGURATION
|
#if CANNOT_EMBED_CONFIGURATION
|
||||||
#warning "Disabled CONFIGURATION_EMBEDDING because the target usually has less flash storage. Define FORCE_CONFIG_EMBED to override."
|
#warning "Disabled CONFIGURATION_EMBEDDING because the target usually has less flash storage. Define FORCE_CONFIG_EMBED to override."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if HAS_LCD_CONTRAST && LCD_CONTRAST_MIN >= LCD_CONTRAST_MAX
|
||||||
|
#warning "Contrast cannot be changed when LCD_CONTRAST_MIN >= LCD_CONTRAST_MAX."
|
||||||
|
#endif
|
||||||
|
|
|
@ -1834,6 +1834,9 @@ void make_name_without_ext(char *dst, char *src, size_t maxlen=MENU_CHAR_LIMIT)
|
||||||
|
|
||||||
void HMI_SDCardInit() { card.cdroot(); }
|
void HMI_SDCardInit() { card.cdroot(); }
|
||||||
|
|
||||||
|
// Initialize or re-initialize the LCD
|
||||||
|
void MarlinUI::init_lcd() { DWIN_Startup(); }
|
||||||
|
|
||||||
void MarlinUI::refresh() { /* Nothing to see here */ }
|
void MarlinUI::refresh() { /* Nothing to see here */ }
|
||||||
|
|
||||||
#if HAS_LCD_BRIGHTNESS
|
#if HAS_LCD_BRIGHTNESS
|
||||||
|
|
|
@ -888,6 +888,9 @@ void make_name_without_ext(char *dst, char *src, size_t maxlen=MENU_CHAR_LIMIT)
|
||||||
|
|
||||||
void HMI_SDCardInit() { card.cdroot(); }
|
void HMI_SDCardInit() { card.cdroot(); }
|
||||||
|
|
||||||
|
// Initialize or re-initialize the LCD
|
||||||
|
void MarlinUI::init_lcd() { DWIN_Startup(); }
|
||||||
|
|
||||||
void MarlinUI::refresh() { /* Nothing to see here */ }
|
void MarlinUI::refresh() { /* Nothing to see here */ }
|
||||||
|
|
||||||
#if HAS_LCD_BRIGHTNESS
|
#if HAS_LCD_BRIGHTNESS
|
||||||
|
|
|
@ -4980,7 +4980,7 @@ void CrealityDWINClass::Reset_Settings() {
|
||||||
Redraw_Screen();
|
Redraw_Screen();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MarlinUI::init() {
|
void MarlinUI::init_lcd() {
|
||||||
delay(800);
|
delay(800);
|
||||||
SERIAL_ECHOPGM("\nDWIN handshake ");
|
SERIAL_ECHOPGM("\nDWIN handshake ");
|
||||||
if (DWIN_Handshake()) SERIAL_ECHOLNPGM("ok."); else SERIAL_ECHOLNPGM("error.");
|
if (DWIN_Handshake()) SERIAL_ECHOLNPGM("ok."); else SERIAL_ECHOLNPGM("error.");
|
||||||
|
|
|
@ -79,9 +79,7 @@ void MarlinUI::set_font(const uint8_t font_nr) {
|
||||||
bool MarlinUI::detected() { return true; }
|
bool MarlinUI::detected() { return true; }
|
||||||
|
|
||||||
// Initialize or re-initialize the LCD
|
// Initialize or re-initialize the LCD
|
||||||
void MarlinUI::init_lcd() {
|
void MarlinUI::init_lcd() { DWIN_Startup(); }
|
||||||
DWIN_Startup();
|
|
||||||
}
|
|
||||||
|
|
||||||
// This LCD should clear where it will draw anew
|
// This LCD should clear where it will draw anew
|
||||||
void MarlinUI::clear_lcd() {
|
void MarlinUI::clear_lcd() {
|
||||||
|
|
|
@ -1144,7 +1144,7 @@ namespace ExtUI {
|
||||||
|
|
||||||
// At the moment we hook into MarlinUI methods, but this could be cleaned up in the future
|
// At the moment we hook into MarlinUI methods, but this could be cleaned up in the future
|
||||||
|
|
||||||
void MarlinUI::init() { ExtUI::onStartup(); }
|
void MarlinUI::init_lcd() { ExtUI::onStartup(); }
|
||||||
|
|
||||||
void MarlinUI::update() { ExtUI::onIdle(); }
|
void MarlinUI::update() { ExtUI::onIdle(); }
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,6 @@ MarlinUI ui;
|
||||||
#if HAS_DISPLAY
|
#if HAS_DISPLAY
|
||||||
#include "../gcode/queue.h"
|
#include "../gcode/queue.h"
|
||||||
#include "fontutils.h"
|
#include "fontutils.h"
|
||||||
#include "../sd/cardreader.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(DWIN_CREALITY_LCD)
|
#if ENABLED(DWIN_CREALITY_LCD)
|
||||||
|
@ -176,6 +175,77 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Encoder Handling
|
||||||
|
#if HAS_ENCODER_ACTION
|
||||||
|
uint32_t MarlinUI::encoderPosition;
|
||||||
|
volatile int8_t encoderDiff; // Updated in update_buttons, added to encoderPosition every LCD update
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void MarlinUI::init() {
|
||||||
|
|
||||||
|
init_lcd();
|
||||||
|
|
||||||
|
#if HAS_DIGITAL_BUTTONS
|
||||||
|
#if BUTTON_EXISTS(EN1)
|
||||||
|
SET_INPUT_PULLUP(BTN_EN1);
|
||||||
|
#endif
|
||||||
|
#if BUTTON_EXISTS(EN2)
|
||||||
|
SET_INPUT_PULLUP(BTN_EN2);
|
||||||
|
#endif
|
||||||
|
#if BUTTON_EXISTS(ENC)
|
||||||
|
SET_INPUT_PULLUP(BTN_ENC);
|
||||||
|
#endif
|
||||||
|
#if BUTTON_EXISTS(ENC_EN)
|
||||||
|
SET_INPUT_PULLUP(BTN_ENC_EN);
|
||||||
|
#endif
|
||||||
|
#if BUTTON_EXISTS(BACK)
|
||||||
|
SET_INPUT_PULLUP(BTN_BACK);
|
||||||
|
#endif
|
||||||
|
#if BUTTON_EXISTS(UP)
|
||||||
|
SET_INPUT(BTN_UP);
|
||||||
|
#endif
|
||||||
|
#if BUTTON_EXISTS(DWN)
|
||||||
|
SET_INPUT(BTN_DWN);
|
||||||
|
#endif
|
||||||
|
#if BUTTON_EXISTS(LFT)
|
||||||
|
SET_INPUT(BTN_LFT);
|
||||||
|
#endif
|
||||||
|
#if BUTTON_EXISTS(RT)
|
||||||
|
SET_INPUT(BTN_RT);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if HAS_SHIFT_ENCODER
|
||||||
|
|
||||||
|
#if ENABLED(SR_LCD_2W_NL) // Non latching 2 wire shift register
|
||||||
|
|
||||||
|
SET_OUTPUT(SR_DATA_PIN);
|
||||||
|
SET_OUTPUT(SR_CLK_PIN);
|
||||||
|
|
||||||
|
#elif PIN_EXISTS(SHIFT_CLK)
|
||||||
|
|
||||||
|
SET_OUTPUT(SHIFT_CLK_PIN);
|
||||||
|
OUT_WRITE(SHIFT_LD_PIN, HIGH);
|
||||||
|
#if PIN_EXISTS(SHIFT_EN)
|
||||||
|
OUT_WRITE(SHIFT_EN_PIN, LOW);
|
||||||
|
#endif
|
||||||
|
SET_INPUT_PULLUP(SHIFT_OUT_PIN);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // HAS_SHIFT_ENCODER
|
||||||
|
|
||||||
|
#if BOTH(HAS_ENCODER_ACTION, HAS_SLOW_BUTTONS)
|
||||||
|
slow_buttons = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
update_buttons();
|
||||||
|
|
||||||
|
TERN_(HAS_ENCODER_ACTION, encoderDiff = 0);
|
||||||
|
|
||||||
|
reset_status(); // Set welcome message
|
||||||
|
}
|
||||||
|
|
||||||
#if HAS_WIRED_LCD
|
#if HAS_WIRED_LCD
|
||||||
|
|
||||||
#if HAS_MARLINUI_U8GLIB
|
#if HAS_MARLINUI_U8GLIB
|
||||||
|
@ -184,8 +254,6 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
|
||||||
|
|
||||||
#include "lcdprint.h"
|
#include "lcdprint.h"
|
||||||
|
|
||||||
#include "../sd/cardreader.h"
|
|
||||||
|
|
||||||
#include "../module/temperature.h"
|
#include "../module/temperature.h"
|
||||||
#include "../module/planner.h"
|
#include "../module/planner.h"
|
||||||
#include "../module/motion.h"
|
#include "../module/motion.h"
|
||||||
|
@ -247,16 +315,8 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
|
||||||
bool MarlinUI::old_is_printing;
|
bool MarlinUI::old_is_printing;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Encoder Handling
|
|
||||||
#if HAS_ENCODER_ACTION
|
|
||||||
uint32_t MarlinUI::encoderPosition;
|
|
||||||
volatile int8_t encoderDiff; // Updated in update_buttons, added to encoderPosition every LCD update
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ENABLED(SDSUPPORT)
|
#if ENABLED(SDSUPPORT)
|
||||||
|
|
||||||
#include "../sd/cardreader.h"
|
|
||||||
|
|
||||||
#if MARLINUI_SCROLL_NAME
|
#if MARLINUI_SCROLL_NAME
|
||||||
uint8_t MarlinUI::filename_scroll_pos, MarlinUI::filename_scroll_max;
|
uint8_t MarlinUI::filename_scroll_pos, MarlinUI::filename_scroll_max;
|
||||||
#endif
|
#endif
|
||||||
|
@ -393,69 +453,6 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
|
||||||
|
|
||||||
#endif // HAS_LCD_MENU
|
#endif // HAS_LCD_MENU
|
||||||
|
|
||||||
void MarlinUI::init() {
|
|
||||||
|
|
||||||
init_lcd();
|
|
||||||
|
|
||||||
#if HAS_DIGITAL_BUTTONS
|
|
||||||
#if BUTTON_EXISTS(EN1)
|
|
||||||
SET_INPUT_PULLUP(BTN_EN1);
|
|
||||||
#endif
|
|
||||||
#if BUTTON_EXISTS(EN2)
|
|
||||||
SET_INPUT_PULLUP(BTN_EN2);
|
|
||||||
#endif
|
|
||||||
#if BUTTON_EXISTS(ENC)
|
|
||||||
SET_INPUT_PULLUP(BTN_ENC);
|
|
||||||
#endif
|
|
||||||
#if BUTTON_EXISTS(ENC_EN)
|
|
||||||
SET_INPUT_PULLUP(BTN_ENC_EN);
|
|
||||||
#endif
|
|
||||||
#if BUTTON_EXISTS(BACK)
|
|
||||||
SET_INPUT_PULLUP(BTN_BACK);
|
|
||||||
#endif
|
|
||||||
#if BUTTON_EXISTS(UP)
|
|
||||||
SET_INPUT(BTN_UP);
|
|
||||||
#endif
|
|
||||||
#if BUTTON_EXISTS(DWN)
|
|
||||||
SET_INPUT(BTN_DWN);
|
|
||||||
#endif
|
|
||||||
#if BUTTON_EXISTS(LFT)
|
|
||||||
SET_INPUT(BTN_LFT);
|
|
||||||
#endif
|
|
||||||
#if BUTTON_EXISTS(RT)
|
|
||||||
SET_INPUT(BTN_RT);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if HAS_SHIFT_ENCODER
|
|
||||||
|
|
||||||
#if ENABLED(SR_LCD_2W_NL) // Non latching 2 wire shift register
|
|
||||||
|
|
||||||
SET_OUTPUT(SR_DATA_PIN);
|
|
||||||
SET_OUTPUT(SR_CLK_PIN);
|
|
||||||
|
|
||||||
#elif PIN_EXISTS(SHIFT_CLK)
|
|
||||||
|
|
||||||
SET_OUTPUT(SHIFT_CLK_PIN);
|
|
||||||
OUT_WRITE(SHIFT_LD_PIN, HIGH);
|
|
||||||
#if PIN_EXISTS(SHIFT_EN)
|
|
||||||
OUT_WRITE(SHIFT_EN_PIN, LOW);
|
|
||||||
#endif
|
|
||||||
SET_INPUT_PULLUP(SHIFT_OUT_PIN);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // HAS_SHIFT_ENCODER
|
|
||||||
|
|
||||||
#if BOTH(HAS_ENCODER_ACTION, HAS_SLOW_BUTTONS)
|
|
||||||
slow_buttons = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
update_buttons();
|
|
||||||
|
|
||||||
TERN_(HAS_ENCODER_ACTION, encoderDiff = 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////
|
////////////////////////////////////////////
|
||||||
///////////// Keypad Handling //////////////
|
///////////// Keypad Handling //////////////
|
||||||
////////////////////////////////////////////
|
////////////////////////////////////////////
|
||||||
|
@ -629,9 +626,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
|
||||||
next_filament_display = millis() + 5000UL; // Show status message for 5s
|
next_filament_display = millis() + 5000UL; // Show status message for 5s
|
||||||
#endif
|
#endif
|
||||||
goto_screen(menu_main);
|
goto_screen(menu_main);
|
||||||
#if DISABLED(NO_LCD_REINIT)
|
IF_DISABLED(NO_LCD_REINIT, init_lcd()); // May revive the LCD if static electricity killed it
|
||||||
init_lcd(); // May revive the LCD if static electricity killed it
|
|
||||||
#endif
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "../sd/cardreader.h"
|
||||||
#include "../module/motion.h"
|
#include "../module/motion.h"
|
||||||
#include "buttons.h"
|
#include "buttons.h"
|
||||||
|
|
||||||
|
@ -30,10 +31,6 @@
|
||||||
#include "../libs/buzzer.h"
|
#include "../libs/buzzer.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(SDSUPPORT)
|
|
||||||
#include "../sd/cardreader.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ENABLED(TOUCH_SCREEN_CALIBRATION)
|
#if ENABLED(TOUCH_SCREEN_CALIBRATION)
|
||||||
#include "tft_io/touch_calibration.h"
|
#include "tft_io/touch_calibration.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -204,6 +201,20 @@ public:
|
||||||
TERN_(HAS_LCD_MENU, currentScreen = status_screen);
|
TERN_(HAS_LCD_MENU, currentScreen = status_screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void init();
|
||||||
|
|
||||||
|
#if HAS_DISPLAY || HAS_DWIN_E3V2
|
||||||
|
static void init_lcd();
|
||||||
|
#else
|
||||||
|
static void init_lcd() {}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if HAS_WIRED_LCD
|
||||||
|
static bool detected();
|
||||||
|
#else
|
||||||
|
static bool detected() { return true; }
|
||||||
|
#endif
|
||||||
|
|
||||||
#if HAS_MULTI_LANGUAGE
|
#if HAS_MULTI_LANGUAGE
|
||||||
static uint8_t language;
|
static uint8_t language;
|
||||||
static void set_language(const uint8_t lang);
|
static void set_language(const uint8_t lang);
|
||||||
|
@ -270,14 +281,6 @@ public:
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_WIRED_LCD
|
|
||||||
static bool detected();
|
|
||||||
static void init_lcd();
|
|
||||||
#else
|
|
||||||
static bool detected() { return true; }
|
|
||||||
static void init_lcd() {}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if HAS_PRINT_PROGRESS
|
#if HAS_PRINT_PROGRESS
|
||||||
#if HAS_PRINT_PROGRESS_PERMYRIAD
|
#if HAS_PRINT_PROGRESS_PERMYRIAD
|
||||||
typedef uint16_t progress_t;
|
typedef uint16_t progress_t;
|
||||||
|
@ -365,7 +368,6 @@ public:
|
||||||
|
|
||||||
#if HAS_DISPLAY
|
#if HAS_DISPLAY
|
||||||
|
|
||||||
static void init();
|
|
||||||
static void update();
|
static void update();
|
||||||
|
|
||||||
static void abort_print();
|
static void abort_print();
|
||||||
|
@ -480,7 +482,6 @@ public:
|
||||||
|
|
||||||
#else // No LCD
|
#else // No LCD
|
||||||
|
|
||||||
static void init() {}
|
|
||||||
static void update() {}
|
static void update() {}
|
||||||
static void return_to_status() {}
|
static void return_to_status() {}
|
||||||
|
|
||||||
|
|
|
@ -538,7 +538,7 @@ void menu_configuration() {
|
||||||
#if HAS_LCD_BRIGHTNESS
|
#if HAS_LCD_BRIGHTNESS
|
||||||
EDIT_ITEM_FAST(uint8, MSG_BRIGHTNESS, &ui.brightness, LCD_BRIGHTNESS_MIN, LCD_BRIGHTNESS_MAX, ui.refresh_brightness, true);
|
EDIT_ITEM_FAST(uint8, MSG_BRIGHTNESS, &ui.brightness, LCD_BRIGHTNESS_MIN, LCD_BRIGHTNESS_MAX, ui.refresh_brightness, true);
|
||||||
#endif
|
#endif
|
||||||
#if HAS_LCD_CONTRAST
|
#if HAS_LCD_CONTRAST && LCD_CONTRAST_MIN < LCD_CONTRAST_MAX
|
||||||
EDIT_ITEM_FAST(uint8, MSG_CONTRAST, &ui.contrast, LCD_CONTRAST_MIN, LCD_CONTRAST_MAX, ui.refresh_contrast, true);
|
EDIT_ITEM_FAST(uint8, MSG_CONTRAST, &ui.contrast, LCD_CONTRAST_MIN, LCD_CONTRAST_MAX, ui.refresh_contrast, true);
|
||||||
#endif
|
#endif
|
||||||
#if ENABLED(FWRETRACT)
|
#if ENABLED(FWRETRACT)
|
||||||
|
|
|
@ -1965,8 +1965,10 @@ void MarlinSettings::postprocess() {
|
||||||
//
|
//
|
||||||
#if HAS_USER_THERMISTORS
|
#if HAS_USER_THERMISTORS
|
||||||
{
|
{
|
||||||
|
user_thermistor_t user_thermistor[USER_THERMISTORS];
|
||||||
_FIELD_TEST(user_thermistor);
|
_FIELD_TEST(user_thermistor);
|
||||||
EEPROM_READ(thermalManager.user_thermistor);
|
EEPROM_READ(user_thermistor);
|
||||||
|
if (!validating) COPY(thermalManager.user_thermistor, user_thermistor);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1974,13 +1976,10 @@ void MarlinSettings::postprocess() {
|
||||||
// Power monitor
|
// Power monitor
|
||||||
//
|
//
|
||||||
{
|
{
|
||||||
#if HAS_POWER_MONITOR
|
|
||||||
uint8_t &power_monitor_flags = power_monitor.flags;
|
|
||||||
#else
|
|
||||||
uint8_t power_monitor_flags;
|
uint8_t power_monitor_flags;
|
||||||
#endif
|
|
||||||
_FIELD_TEST(power_monitor_flags);
|
_FIELD_TEST(power_monitor_flags);
|
||||||
EEPROM_READ(power_monitor_flags);
|
EEPROM_READ(power_monitor_flags);
|
||||||
|
TERN_(HAS_POWER_MONITOR, if (!validating) power_monitor.flags = power_monitor_flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1997,7 +1996,6 @@ void MarlinSettings::postprocess() {
|
||||||
// LCD Brightness
|
// LCD Brightness
|
||||||
//
|
//
|
||||||
{
|
{
|
||||||
_FIELD_TEST(lcd_brightness);
|
|
||||||
uint8_t lcd_brightness;
|
uint8_t lcd_brightness;
|
||||||
EEPROM_READ(lcd_brightness);
|
EEPROM_READ(lcd_brightness);
|
||||||
TERN_(HAS_LCD_BRIGHTNESS, if (!validating) ui.set_brightness(lcd_brightness));
|
TERN_(HAS_LCD_BRIGHTNESS, if (!validating) ui.set_brightness(lcd_brightness));
|
||||||
|
@ -2007,45 +2005,37 @@ void MarlinSettings::postprocess() {
|
||||||
// Controller Fan
|
// Controller Fan
|
||||||
//
|
//
|
||||||
{
|
{
|
||||||
_FIELD_TEST(controllerFan_settings);
|
|
||||||
#if ENABLED(CONTROLLER_FAN_EDITABLE)
|
|
||||||
const controllerFan_settings_t &cfs = controllerFan.settings;
|
|
||||||
#else
|
|
||||||
controllerFan_settings_t cfs = { 0 };
|
controllerFan_settings_t cfs = { 0 };
|
||||||
#endif
|
_FIELD_TEST(controllerFan_settings);
|
||||||
EEPROM_READ(cfs);
|
EEPROM_READ(cfs);
|
||||||
|
TERN_(CONTROLLER_FAN_EDITABLE, if (!validating) controllerFan.settings = cfs);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Power-Loss Recovery
|
// Power-Loss Recovery
|
||||||
//
|
//
|
||||||
{
|
{
|
||||||
_FIELD_TEST(recovery_enabled);
|
|
||||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
|
||||||
const bool &recovery_enabled = recovery.enabled;
|
|
||||||
#else
|
|
||||||
bool recovery_enabled;
|
bool recovery_enabled;
|
||||||
#endif
|
_FIELD_TEST(recovery_enabled);
|
||||||
EEPROM_READ(recovery_enabled);
|
EEPROM_READ(recovery_enabled);
|
||||||
|
TERN_(POWER_LOSS_RECOVERY, if (!validating) recovery.enabled = recovery_enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Firmware Retraction
|
// Firmware Retraction
|
||||||
//
|
//
|
||||||
{
|
{
|
||||||
|
fwretract_settings_t fwretract_settings;
|
||||||
|
bool autoretract_enabled;
|
||||||
_FIELD_TEST(fwretract_settings);
|
_FIELD_TEST(fwretract_settings);
|
||||||
|
EEPROM_READ(fwretract_settings);
|
||||||
|
EEPROM_READ(autoretract_enabled);
|
||||||
|
|
||||||
#if ENABLED(FWRETRACT)
|
#if ENABLED(FWRETRACT)
|
||||||
EEPROM_READ(fwretract.settings);
|
if (!validating) {
|
||||||
#else
|
fwretract.settings = fwretract_settings;
|
||||||
fwretract_settings_t fwretract_settings;
|
TERN_(FWRETRACT_AUTORETRACT, fwretract.autoretract_enabled = autoretract_enabled);
|
||||||
EEPROM_READ(fwretract_settings);
|
}
|
||||||
#endif
|
|
||||||
#if BOTH(FWRETRACT, FWRETRACT_AUTORETRACT)
|
|
||||||
EEPROM_READ(fwretract.autoretract_enabled);
|
|
||||||
#else
|
|
||||||
bool autoretract_enabled;
|
|
||||||
EEPROM_READ(autoretract_enabled);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@
|
||||||
|
|
||||||
#define LCD_RESET_PIN 16
|
#define LCD_RESET_PIN 16
|
||||||
|
|
||||||
#define DEFAULT_LCD_CONTRAST 220
|
#define LCD_CONTRAST_DEFAULT 220
|
||||||
|
|
||||||
#define LCD_BACKLIGHT_PIN -1
|
#define LCD_BACKLIGHT_PIN -1
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -107,7 +107,7 @@
|
||||||
|
|
||||||
#define LCD_CONTRAST_MIN 0
|
#define LCD_CONTRAST_MIN 0
|
||||||
#define LCD_CONTRAST_MAX 100
|
#define LCD_CONTRAST_MAX 100
|
||||||
#define DEFAULT_LCD_CONTRAST 30
|
#define LCD_CONTRAST_DEFAULT 30
|
||||||
//#define LCD_SCREEN_ROTATE 180 // 0, 90, 180, 270
|
//#define LCD_SCREEN_ROTATE 180 // 0, 90, 180, 270
|
||||||
|
|
||||||
#if IS_NEWPANEL
|
#if IS_NEWPANEL
|
||||||
|
|
|
@ -157,7 +157,7 @@
|
||||||
#define NEOPIXEL_PIN PB9
|
#define NEOPIXEL_PIN PB9
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DEFAULT_LCD_CONTRAST 255
|
#define LCD_CONTRAST_DEFAULT 255
|
||||||
#else
|
#else
|
||||||
#define LCD_PINS_RS PC15
|
#define LCD_PINS_RS PC15
|
||||||
#define LCD_PINS_ENABLE PB6
|
#define LCD_PINS_ENABLE PB6
|
||||||
|
|
Loading…
Reference in a new issue