Browse Source

MKS H43 controller (#20609)

Sola 4 years ago
parent
commit
c76008bd6a

+ 1 - 0
Marlin/Configuration.h

@@ -2349,6 +2349,7 @@
 //#define DGUS_LCD_UI_ORIGIN
 //#define DGUS_LCD_UI_FYSETC
 //#define DGUS_LCD_UI_HIPRECY
+//#define DGUS_LCD_UI_MKS
 
 //
 // Touch-screen LCD for Malyan M200/M300 printers

+ 3 - 3
Marlin/Configuration_adv.h

@@ -1517,12 +1517,12 @@
 
   #define DGUS_UPDATE_INTERVAL_MS  500    // (ms) Interval between automatic screen updates
 
-  #if EITHER(DGUS_LCD_UI_FYSETC, DGUS_LCD_UI_HIPRECY)
+  #if ANY(DGUS_LCD_UI_FYSETC, DGUS_LCD_UI_MKS, DGUS_LCD_UI_HIPRECY)
     #define DGUS_PRINT_FILENAME           // Display the filename during printing
     #define DGUS_PREHEAT_UI               // Display a preheat screen during heatup
 
-    #if ENABLED(DGUS_LCD_UI_FYSETC)
-      //#define DGUS_UI_MOVE_DIS_OPTION   // Disabled by default for UI_FYSETC
+    #if EITHER(DGUS_LCD_UI_FYSETC, DGUS_LCD_UI_MKS)
+      //#define DGUS_UI_MOVE_DIS_OPTION   // Disabled by default for FYSETC and MKS
     #else
       #define DGUS_UI_MOVE_DIS_OPTION     // Enabled by default for UI_HIPRECY
     #endif

+ 1 - 1
Marlin/src/HAL/STM32/eeprom_flash.cpp

@@ -48,7 +48,7 @@
   #include "stm32_def.h"
 
   #define DEBUG_OUT ENABLED(EEPROM_CHITCHAT)
-  #include "src/core/debug_out.h"
+  #include "../../core/debug_out.h"
 
   #ifndef MARLIN_EEPROM_SIZE
     #define MARLIN_EEPROM_SIZE    0x1000 // 4KB

+ 1 - 1
Marlin/src/HAL/shared/cpu_exception/exception_arm.cpp

@@ -283,7 +283,7 @@ void CommonHandler_C(ContextStateFrame * frame, unsigned long lr, unsigned long
     savedFrame.CFSR = 0;
 
     frame->pc = (uint32_t)resume_from_fault; // Patch where to return to
-    frame->lr = 0xdeadbeef;  // If our handler returns (it shouldn't), let's make it trigger an exception immediately
+    frame->lr = 0xDEADBEEF;  // If our handler returns (it shouldn't), let's make it trigger an exception immediately
     frame->xpsr = _BV(24);   // Need to clean the PSR register to thumb II only
     MinSerial::force_using_default_output = true;
     return; // The CPU will resume in our handler hopefully, and we'll try to use default serial output

+ 7 - 1
Marlin/src/HAL/shared/eeprom_if_i2c.cpp

@@ -32,7 +32,13 @@
 #include "eeprom_if.h"
 #include <Wire.h>
 
-void eeprom_init() { Wire.begin(); }
+void eeprom_init() {
+  Wire.begin(
+    #if PINS_EXIST(I2C_SCL, I2C_SDA)
+      uint8_t(I2C_SDA_PIN), uint8_t(I2C_SCL_PIN)
+    #endif
+  );
+}
 
 #if ENABLED(USE_SHARED_EEPROM)
 

+ 5 - 0
Marlin/src/MarlinCore.cpp

@@ -231,6 +231,10 @@
   #include "feature/password/password.h"
 #endif
 
+#if ENABLED(DGUS_LCD_UI_MKS)
+  #include "lcd/extui/lib/dgus/DGUSScreenHandler.h"
+#endif
+
 PGMSTR(M112_KILL_STR, "M112 Shutdown");
 
 MarlinState marlin_state = MF_INITIALIZING;
@@ -388,6 +392,7 @@ void startOrResumeJob() {
     if (queue.enqueue_one_P(PSTR("M1001"))) {
       marlin_state = MF_RUNNING;
       TERN_(PASSWORD_AFTER_SD_PRINT_END, password.lock_machine());
+      TERN_(DGUS_LCD_UI_MKS, ScreenHandler.SDPrintingFinished());
     }
   }
 

+ 12 - 3
Marlin/src/gcode/sd/M24_M25.cpp

@@ -41,6 +41,10 @@
   #include "../../feature/powerloss.h"
 #endif
 
+#if ENABLED(DGUS_LCD_UI_MKS)
+  #include "../../lcd/extui/lib/dgus/DGUSDisplayDef.h"
+#endif
+
 #include "../../MarlinCore.h" // for startOrResumeJob
 
 /**
@@ -48,6 +52,11 @@
  */
 void GcodeSuite::M24() {
 
+  #if ENABLED(DGUS_LCD_UI_MKS)
+    if ((print_job_timer.isPaused() || print_job_timer.isRunning()) && !parser.seen("ST"))
+      MKS_resume_print_move();
+  #endif
+
   #if ENABLED(POWER_LOSS_RECOVERY)
     if (parser.seenval('S')) card.setIndex(parser.value_long());
     if (parser.seenval('T')) print_job_timer.resume(parser.value_long());
@@ -98,9 +107,9 @@ void GcodeSuite::M25() {
 
     print_job_timer.pause();
 
-    #if DISABLED(DWIN_CREALITY_LCD)
-      ui.reset_status();
-    #endif
+    TERN_(DGUS_LCD_UI_MKS, MKS_pause_print_move());
+
+    IF_DISABLED(DWIN_CREALITY_LCD, ui.reset_status());
 
     #if ENABLED(HOST_ACTION_COMMANDS)
       TERN_(HOST_PROMPT_SUPPORT, host_prompt_open(PROMPT_PAUSE_RESUME, PSTR("Pause SD"), PSTR("Resume")));

+ 1 - 1
Marlin/src/inc/Conditionals_LCD.h

@@ -451,7 +451,7 @@
 #endif
 
 // Aliases for LCD features
-#if ANY(DGUS_LCD_UI_ORIGIN, DGUS_LCD_UI_FYSETC, DGUS_LCD_UI_HIPRECY)
+#if ANY(DGUS_LCD_UI_ORIGIN, DGUS_LCD_UI_FYSETC, DGUS_LCD_UI_HIPRECY,DGUS_LCD_UI_MKS)
   #define HAS_DGUS_LCD 1
 #endif
 

+ 1 - 1
Marlin/src/inc/SanityCheck.h

@@ -2324,7 +2324,7 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
   + (DISABLED(IS_LEGACY_TFT) && ENABLED(TFT_GENERIC)) \
   + (ENABLED(IS_LEGACY_TFT) && COUNT_ENABLED(TFT_320x240, TFT_320x240_SPI, TFT_480x320, TFT_480x320_SPI)) \
   + COUNT_ENABLED(ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON, ANYCUBIC_TFT35) \
-  + COUNT_ENABLED(DGUS_LCD_UI_ORIGIN, DGUS_LCD_UI_FYSETC, DGUS_LCD_UI_HIPRECY) \
+  + COUNT_ENABLED(DGUS_LCD_UI_ORIGIN, DGUS_LCD_UI_FYSETC, DGUS_LCD_UI_HIPRECY,DGUS_LCD_UI_MKS) \
   + COUNT_ENABLED(ENDER2_STOCKDISPLAY, CR10_STOCKDISPLAY, DWIN_CREALITY_LCD) \
   + COUNT_ENABLED(FYSETC_MINI_12864_X_X, FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0, FYSETC_MINI_12864_2_1, FYSETC_GENERIC_12864_1_1) \
   + COUNT_ENABLED(LCD_SAINSMART_I2C_1602, LCD_SAINSMART_I2C_2004) \

+ 2 - 5
Marlin/src/lcd/extui/dgus_lcd.cpp

@@ -21,9 +21,7 @@
  */
 
 /**
- * dgus_lcd.cpp
- *
- * DGUS implementation for Marlin by coldtobi, Feb-May 2019
+ * lcd/extui/dgus_lcd.cpp
  */
 
 #include "../../inc/MarlinConfigPre.h"
@@ -125,11 +123,10 @@ namespace ExtUI {
   #if ENABLED(POWER_LOSS_RECOVERY)
     void onPowerLossResume() {
       // Called on resume from power-loss
-      ScreenHandler.GotoScreen(DGUSLCD_SCREEN_POWER_LOSS);
+      IF_DISABLED(DGUS_LCD_UI_MKS, ScreenHandler.GotoScreen(DGUSLCD_SCREEN_POWER_LOSS));
     }
   #endif
 
-
   #if HAS_PID_HEATING
     void onPidTuning(const result_t rst) {
       // Called for temperature PID tuning result

Some files were not shown because too many files changed in this diff