Ver código fonte

Add M997 support and simple implementation for LPC176x (#13281)

Chris Pepper 5 anos atrás
pai
commit
b0553d2d97

+ 4
- 0
Marlin/src/HAL/HAL_LPC1768/HAL.cpp Ver arquivo

@@ -59,4 +59,8 @@ int16_t PARSED_PIN_INDEX(const char code, const int16_t dval) {
59 59
   return ind > -2 ? ind : dval;
60 60
 }
61 61
 
62
+void flashFirmware(int16_t value) {
63
+  NVIC_SystemReset();
64
+}
65
+
62 66
 #endif // TARGET_LPC1768

+ 3
- 0
Marlin/src/HAL/HAL_LPC1768/HAL.h Ver arquivo

@@ -154,3 +154,6 @@ int16_t PARSED_PIN_INDEX(const char code, const int16_t dval);
154 154
 
155 155
 #define HAL_IDLETASK 1
156 156
 void HAL_idletask(void);
157
+
158
+#define PLATFORM_M997_SUPPORT
159
+void flashFirmware(int16_t value);

+ 34
- 0
Marlin/src/gcode/control/M997.cpp Ver arquivo

@@ -0,0 +1,34 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+#include "../gcode.h"
24
+
25
+#if ENABLED(PLATFORM_M997_SUPPORT)
26
+
27
+/**
28
+ * M997: Perform in-application firmware update
29
+ */
30
+void GcodeSuite::M997() {
31
+  flashFirmware(parser.intval('S'));
32
+}
33
+
34
+#endif

+ 4
- 0
Marlin/src/gcode/gcode.cpp Ver arquivo

@@ -723,6 +723,10 @@ void GcodeSuite::process_parsed_command(
723 723
         case 422: M422(); break;                                  // M422: Set Z Stepper automatic alignment position using probe
724 724
       #endif
725 725
 
726
+      #if ENABLED(PLATFORM_M997_SUPPORT)
727
+        case 997: M997(); break;                                  // M997: Perform in-application firmware update
728
+      #endif
729
+
726 730
       case 999: M999(); break;                                    // M999: Restart after being Stopped
727 731
 
728 732
       #if ENABLED(POWER_LOSS_RECOVERY)

+ 5
- 0
Marlin/src/gcode/gcode.h Ver arquivo

@@ -254,6 +254,7 @@
254 254
  *
255 255
  * ************ Custom codes - This can change to suit future G-code regulations
256 256
  * M928 - Start SD logging: "M928 filename.gco". Stop with M29. (Requires SDSUPPORT)
257
+ * M997 - Perform in-application firmware update
257 258
  * M999 - Restart after being stopped by error
258 259
  *
259 260
  * "T" Codes
@@ -858,6 +859,10 @@ private:
858 859
     static void M951();
859 860
   #endif
860 861
 
862
+  #if ENABLED(PLATFORM_M997_SUPPORT)
863
+    static void M997();
864
+  #endif
865
+
861 866
   static void M999();
862 867
 
863 868
   #if ENABLED(POWER_LOSS_RECOVERY)

Carregando…
Cancelar
Salvar