Bladeren bron

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

Chris Pepper 6 jaren geleden
bovenliggende
commit
b0553d2d97

+ 4
- 0
Marlin/src/HAL/HAL_LPC1768/HAL.cpp Bestand weergeven

59
   return ind > -2 ? ind : dval;
59
   return ind > -2 ? ind : dval;
60
 }
60
 }
61
 
61
 
62
+void flashFirmware(int16_t value) {
63
+  NVIC_SystemReset();
64
+}
65
+
62
 #endif // TARGET_LPC1768
66
 #endif // TARGET_LPC1768

+ 3
- 0
Marlin/src/HAL/HAL_LPC1768/HAL.h Bestand weergeven

154
 
154
 
155
 #define HAL_IDLETASK 1
155
 #define HAL_IDLETASK 1
156
 void HAL_idletask(void);
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 Bestand weergeven

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 Bestand weergeven

723
         case 422: M422(); break;                                  // M422: Set Z Stepper automatic alignment position using probe
723
         case 422: M422(); break;                                  // M422: Set Z Stepper automatic alignment position using probe
724
       #endif
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
       case 999: M999(); break;                                    // M999: Restart after being Stopped
730
       case 999: M999(); break;                                    // M999: Restart after being Stopped
727
 
731
 
728
       #if ENABLED(POWER_LOSS_RECOVERY)
732
       #if ENABLED(POWER_LOSS_RECOVERY)

+ 5
- 0
Marlin/src/gcode/gcode.h Bestand weergeven

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

Laden…
Annuleren
Opslaan