marlin bugfix + SKR + BLTOUCH

This commit is contained in:
Xavier Perignon
2020-06-23 13:14:49 +02:00
parent 770c424d07
commit 131a9f3214
240 changed files with 23983 additions and 1307 deletions

View File

@@ -59,6 +59,22 @@
#include "gcode/parser.h"
#include "gcode/queue.h"
#if ENABLED(TFT_LITTLE_VGL_UI)
#include "lvgl.h"
#include "lcd/extui/lib/mks_ui/inc/tft_lvgl_configuration.h"
#include "lcd/extui/lib/mks_ui/inc/draw_ui.h"
#endif
#if ENABLED(DWIN_CREALITY_LCD)
#include "lcd/dwin/dwin.h"
#include "lcd/dwin/dwin_lcd.h"
#include "lcd/dwin/rotary_encoder.h"
#endif
#if ENABLED(IIC_BL24CXX_EEPROM)
#include "lcd/dwin/eeprom_BL24CXX.h"
#endif
#if ENABLED(DIRECT_STEPPING)
#include "feature/direct_stepping.h"
#endif
@@ -695,8 +711,8 @@ void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) {
// Update the Beeper queue
TERN_(USE_BEEPER, buzzer.tick());
// Read Buttons and Update the LCD
ui.update();
// Handle UI input / draw events
TERN(DWIN_CREALITY_LCD, DWIN_Update(), ui.update());
// Run i2c Position Encoders
#if ENABLED(I2C_POSITION_ENCODERS)
@@ -726,6 +742,10 @@ void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) {
// Direct Stepping
TERN_(DIRECT_STEPPING, page_manager.write_responses());
#if ENABLED(TFT_LITTLE_VGL_UI)
LV_TASK_HANDLER();
#endif
}
/**
@@ -837,7 +857,7 @@ void setup() {
#if ENABLED(MARLIN_DEV_MODE)
auto log_current_ms = [&](PGM_P const msg) {
SERIAL_ECHO_START();
SERIAL_CHAR('['); SERIAL_ECHO(millis()); SERIAL_ECHO("] ");
SERIAL_CHAR('['); SERIAL_ECHO(millis()); SERIAL_ECHOPGM("] ");
serialprintPGM(msg);
SERIAL_EOL();
};
@@ -952,11 +972,18 @@ void setup() {
// UI must be initialized before EEPROM
// (because EEPROM code calls the UI).
SETUP_RUN(ui.init());
SETUP_RUN(ui.reset_status()); // Load welcome message early. (Retained if no errors exist.)
#if BOTH(HAS_SPI_LCD, SHOW_BOOTSCREEN)
SETUP_RUN(ui.show_bootscreen());
#if ENABLED(DWIN_CREALITY_LCD)
delay(800); // Required delay (since boot?)
SERIAL_ECHOPGM("\nDWIN handshake ");
if (DWIN_Handshake()) SERIAL_ECHOLNPGM("ok."); else SERIAL_ECHOLNPGM("error.");
DWIN_Frame_SetDir(1); // Orientation 90°
DWIN_UpdateLCD(); // Show bootscreen (first image)
#else
SETUP_RUN(ui.init());
#if HAS_SPI_LCD && ENABLED(SHOW_BOOTSCREEN)
SETUP_RUN(ui.show_bootscreen());
#endif
SETUP_RUN(ui.reset_status()); // Load welcome message early. (Retained if no errors exist.)
#endif
#if BOTH(SDSUPPORT, SDCARD_EEPROM_EMULATION)
@@ -966,10 +993,6 @@ void setup() {
SETUP_RUN(settings.first_load()); // Load data from EEPROM if available (or use defaults)
// This also updates variables in the planner, elsewhere
#if HAS_SERVICE_INTERVALS
SETUP_RUN(ui.reset_status(true)); // Show service messages or keep current status
#endif
#if ENABLED(TOUCH_BUTTONS)
SETUP_RUN(touch.init());
#endif
@@ -1133,6 +1156,22 @@ void setup() {
SETUP_RUN(mmu2.init());
#endif
#if ENABLED(IIC_BL24CXX_EEPROM)
BL24CXX::init();
const uint8_t err = BL24CXX::check();
SERIAL_ECHO_TERNARY(err, "I2C_EEPROM Check ", "failed", "succeeded", "!\n");
#endif
#if ENABLED(DWIN_CREALITY_LCD)
Encoder_Configuration();
HMI_Init();
HMI_StartFrame(true);
#endif
#if HAS_SERVICE_INTERVALS && DISABLED(DWIN_CREALITY_LCD)
ui.reset_status(true); // Show service messages or keep current status
#endif
#if ENABLED(MAX7219_DEBUG)
SETUP_RUN(max7219.init());
#endif
@@ -1141,6 +1180,10 @@ void setup() {
SETUP_RUN(page_manager.init());
#endif
#if ENABLED(TFT_LITTLE_VGL_UI)
SETUP_RUN(tft_lvgl_init());
#endif
marlin_state = MF_RUNNING;
SETUP_LOG("setup() completed.");
@@ -1173,5 +1216,7 @@ void loop() {
endstops.event_handler();
TERN_(TFT_LITTLE_VGL_UI, printer_state_polling());
} while (ENABLED(__AVR__)); // Loop forever on slower (AVR) boards
}