From 30a3db4f2234f2f0f148028c4024c383cd566823 Mon Sep 17 00:00:00 2001
From: "J.C. Nelson" <32139633+xC0000005@users.noreply.github.com>
Date: Wed, 26 Jun 2019 01:35:52 -0700
Subject: [PATCH] Fix Malyan M200 config and protocol (#14394)

---
 Marlin/src/lcd/extui_malyan_lcd.cpp         | 15 ++++++---------
 config/examples/Malyan/M200/Configuration.h |  4 ++--
 2 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/Marlin/src/lcd/extui_malyan_lcd.cpp b/Marlin/src/lcd/extui_malyan_lcd.cpp
index 657b001587..1acf2f715b 100644
--- a/Marlin/src/lcd/extui_malyan_lcd.cpp
+++ b/Marlin/src/lcd/extui_malyan_lcd.cpp
@@ -113,7 +113,8 @@ void write_to_lcd(const char * const message) {
  */
 void process_lcd_c_command(const char* command) {
   switch (command[0]) {
-    case 'C': {
+    case 'C': // Cope with both V1 early rev and later LCDs.
+    case 'S': {
       int raw_feedrate = atoi(command + 1);
       feedrate_percentage = raw_feedrate * 10;
       feedrate_percentage = constrain(feedrate_percentage, 10, 999);
@@ -319,11 +320,6 @@ void process_lcd_s_command(const char* command) {
       write_to_lcd(message_buffer);
     } break;
 
-    case 'H':
-      // Home all axis
-      queue.inject_P(PSTR("G28"));
-      break;
-
     case 'L': {
       #if ENABLED(SDSUPPORT)
         if (!card.isDetected()) card.initsd();
@@ -474,14 +470,15 @@ namespace ExtUI {
     #endif
   }
 
-  void onStatusChanged(const char * const msg) {
+  // {E:<msg>} is for error states.
+  void onPrinterKilled(PGM_P msg) {
     write_to_lcd_P(PSTR("{E:"));
-    write_to_lcd(msg);
+    write_to_lcd_P(msg);
     write_to_lcd_P("}");
   }
 
   // Not needed for Malyan LCD
-  void onPrinterKilled(PGM_P const msg) { UNUSED(msg); }
+  void onStatusChanged(const char * const msg) { UNUSED(msg); }
   void onMediaInserted() {};
   void onMediaError() {};
   void onMediaRemoved() {};
diff --git a/config/examples/Malyan/M200/Configuration.h b/config/examples/Malyan/M200/Configuration.h
index 7d7009a95d..eac455f740 100644
--- a/config/examples/Malyan/M200/Configuration.h
+++ b/config/examples/Malyan/M200/Configuration.h
@@ -104,7 +104,7 @@
  *
  * :[-1, 0, 1, 2, 3, 4, 5, 6, 7]
  */
-#define SERIAL_PORT 0
+#define SERIAL_PORT -1
 
 /**
  * Select a secondary serial port on the board to use for communication with the host.
@@ -132,7 +132,7 @@
 // The following define selects which electronics board you have.
 // Please choose the name from boards.h that matches your setup
 #ifndef MOTHERBOARD
-  #define MOTHERBOARD BOARD_RAMPS_14_EFB
+  #define MOTHERBOARD BOARD_MALYAN_M200
 #endif
 
 // Optional custom name for your RepStrap or other custom machine