Bladeren bron

Split up sdcard G-codes

Scott Lahteine 5 jaren geleden
bovenliggende
commit
35ae5daf2d

+ 0
- 303
Marlin/src/gcode/sdcard/M20-M30_M32-M34_M524_M928.cpp Bestand weergeven

@@ -1,303 +0,0 @@
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 "../../inc/MarlinConfig.h"
24
-
25
-#if ENABLED(SDSUPPORT)
26
-
27
-#include "../gcode.h"
28
-#include "../../sd/cardreader.h"
29
-#include "../../module/printcounter.h"
30
-#include "../../module/stepper.h"
31
-#include "../../lcd/ultralcd.h"
32
-
33
-#if ENABLED(POWER_LOSS_RECOVERY)
34
-  #include "../../feature/power_loss_recovery.h"
35
-#endif
36
-
37
-#if ENABLED(PARK_HEAD_ON_PAUSE)
38
-  #include "../../feature/pause.h"
39
-#endif
40
-
41
-#if ENABLED(PARK_HEAD_ON_PAUSE) || NUM_SERIAL > 1
42
-  #include "../queue.h"
43
-#endif
44
-
45
-#if ENABLED(HOST_ACTION_COMMANDS)
46
-  #include "../../feature/host_actions.h"
47
-#endif
48
-
49
-/**
50
- * M20: List SD card to serial output
51
- */
52
-void GcodeSuite::M20() {
53
-  SERIAL_ECHOLNPGM(MSG_BEGIN_FILE_LIST);
54
-  card.ls();
55
-  SERIAL_ECHOLNPGM(MSG_END_FILE_LIST);
56
-}
57
-
58
-/**
59
- * M21: Init SD Card
60
- */
61
-void GcodeSuite::M21() { card.initsd(); }
62
-
63
-/**
64
- * M22: Release SD Card
65
- */
66
-void GcodeSuite::M22() { card.release(); }
67
-
68
-/**
69
- * M23: Open a file
70
- */
71
-void GcodeSuite::M23() {
72
-  #if ENABLED(POWER_LOSS_RECOVERY)
73
-    card.removeJobRecoveryFile();
74
-  #endif
75
-  // Simplify3D includes the size, so zero out all spaces (#7227)
76
-  for (char *fn = parser.string_arg; *fn; ++fn) if (*fn == ' ') *fn = '\0';
77
-  card.openFile(parser.string_arg, true);
78
-}
79
-
80
-/**
81
- * M24: Start or Resume SD Print
82
- */
83
-void GcodeSuite::M24() {
84
-
85
-  #if ENABLED(POWER_LOSS_RECOVERY)
86
-    if (parser.seenval('S')) card.setIndex(parser.value_long());
87
-    if (parser.seenval('T')) print_job_timer.resume(parser.value_long());
88
-  #endif
89
-
90
-  #if ENABLED(PARK_HEAD_ON_PAUSE)
91
-    if (did_pause_print) {
92
-      resume_print();
93
-      return;
94
-    }
95
-  #endif
96
-
97
-  if (card.isFileOpen()) {
98
-    card.startFileprint();
99
-    print_job_timer.start();
100
-  }
101
-
102
-  #if ENABLED(HOST_ACTION_COMMANDS)
103
-    #if ENABLED(HOST_PROMPT_SUPPORT)
104
-      host_prompt_open(PROMPT_INFO, PSTR("Resume SD"));
105
-    #endif
106
-    #ifdef ACTION_ON_RESUME
107
-      host_action_resume();
108
-    #endif
109
-  #endif
110
-
111
-  ui.reset_status();
112
-}
113
-
114
-/**
115
- * M25: Pause SD Print
116
- */
117
-void GcodeSuite::M25() {
118
-
119
-  // Set initial pause flag to prevent more commands from landing in the queue while we try to pause
120
-  #if ENABLED(SDSUPPORT)
121
-    if (IS_SD_PRINTING()) card.pauseSDPrint();
122
-  #endif
123
-
124
-  #if ENABLED(PARK_HEAD_ON_PAUSE)
125
-
126
-    M125();
127
-
128
-  #else
129
-
130
-    print_job_timer.pause();
131
-    ui.reset_status();
132
-
133
-    #if ENABLED(HOST_ACTION_COMMANDS)
134
-      #if ENABLED(HOST_PROMPT_SUPPORT)
135
-        host_prompt_open(PROMPT_PAUSE_RESUME, PSTR("Pause SD"), PSTR("Resume"));
136
-      #endif
137
-      #ifdef ACTION_ON_PAUSE
138
-        host_action_pause();
139
-      #endif
140
-    #endif
141
-
142
-  #endif
143
-}
144
-
145
-/**
146
- * M26: Set SD Card file index
147
- */
148
-void GcodeSuite::M26() {
149
-  if (card.isDetected() && parser.seenval('S'))
150
-    card.setIndex(parser.value_long());
151
-}
152
-
153
-/**
154
- * M27: Get SD Card status
155
- *      OR, with 'S<seconds>' set the SD status auto-report interval. (Requires AUTO_REPORT_SD_STATUS)
156
- *      OR, with 'C' get the current filename.
157
- */
158
-void GcodeSuite::M27() {
159
-  if (parser.seen('C')) {
160
-    SERIAL_ECHOPGM("Current file: ");
161
-    card.printFilename();
162
-  }
163
-
164
-  #if ENABLED(AUTO_REPORT_SD_STATUS)
165
-    else if (parser.seenval('S'))
166
-      card.set_auto_report_interval(parser.value_byte());
167
-  #endif
168
-
169
-  else
170
-    card.report_status();
171
-}
172
-
173
-/**
174
- * M28: Start SD Write
175
- */
176
-void GcodeSuite::M28() {
177
-
178
-  #if ENABLED(BINARY_FILE_TRANSFER)
179
-
180
-    bool binary_mode = false;
181
-    char *p = parser.string_arg;
182
-    if (p[0] == 'B' && NUMERIC(p[1])) {
183
-      binary_mode = p[1] > '0';
184
-      p += 2;
185
-      while (*p == ' ') ++p;
186
-    }
187
-
188
-    // Binary transfer mode
189
-    if ((card.flag.binary_mode = binary_mode)) {
190
-      SERIAL_ECHO_START();
191
-      SERIAL_ECHO(" preparing to receive: ");
192
-      SERIAL_ECHOLN(p);
193
-      card.openFile(p, false);
194
-      #if NUM_SERIAL > 1
195
-        card.transfer_port_index = command_queue_port[cmd_queue_index_r];
196
-      #endif
197
-    }
198
-    else
199
-      card.openFile(p, false);
200
-
201
-  #else
202
-
203
-    card.openFile(parser.string_arg, false);
204
-
205
-  #endif
206
-}
207
-
208
-/**
209
- * M29: Stop SD Write
210
- * Processed in write to file routine
211
- */
212
-void GcodeSuite::M29() {
213
-  card.flag.saving = false;
214
-}
215
-
216
-/**
217
- * M30 <filename>: Delete SD Card file
218
- */
219
-void GcodeSuite::M30() {
220
-  if (card.isDetected()) {
221
-    card.closefile();
222
-    card.removeFile(parser.string_arg);
223
-  }
224
-}
225
-
226
-/**
227
- * M32: Select file and start SD Print
228
- *
229
- * Examples:
230
- *
231
- *    M32 !PATH/TO/FILE.GCO#      ; Start FILE.GCO
232
- *    M32 P !PATH/TO/FILE.GCO#    ; Start FILE.GCO as a procedure
233
- *    M32 S60 !PATH/TO/FILE.GCO#  ; Start FILE.GCO at byte 60
234
- *
235
- */
236
-void GcodeSuite::M32() {
237
-  if (IS_SD_PRINTING()) planner.synchronize();
238
-
239
-  if (card.isDetected()) {
240
-    const bool call_procedure = parser.boolval('P');
241
-
242
-    card.openFile(parser.string_arg, true, call_procedure);
243
-
244
-    if (parser.seenval('S')) card.setIndex(parser.value_long());
245
-
246
-    card.startFileprint();
247
-
248
-    // Procedure calls count as normal print time.
249
-    if (!call_procedure) print_job_timer.start();
250
-  }
251
-}
252
-
253
-#if ENABLED(LONG_FILENAME_HOST_SUPPORT)
254
-
255
-  /**
256
-   * M33: Get the long full path of a file or folder
257
-   *
258
-   * Parameters:
259
-   *   <dospath> Case-insensitive DOS-style path to a file or folder
260
-   *
261
-   * Example:
262
-   *   M33 miscel~1/armchair/armcha~1.gco
263
-   *
264
-   * Output:
265
-   *   /Miscellaneous/Armchair/Armchair.gcode
266
-   */
267
-  void GcodeSuite::M33() {
268
-    card.printLongPath(parser.string_arg);
269
-  }
270
-
271
-#endif // LONG_FILENAME_HOST_SUPPORT
272
-
273
-#if ENABLED(SDCARD_SORT_ALPHA) && ENABLED(SDSORT_GCODE)
274
-
275
-  /**
276
-   * M34: Set SD Card Sorting Options
277
-   */
278
-  void GcodeSuite::M34() {
279
-    if (parser.seen('S')) card.setSortOn(parser.value_bool());
280
-    if (parser.seenval('F')) {
281
-      const int v = parser.value_long();
282
-      card.setSortFolders(v < 0 ? -1 : v > 0 ? 1 : 0);
283
-    }
284
-    //if (parser.seen('R')) card.setSortReverse(parser.value_bool());
285
-  }
286
-
287
-#endif // SDCARD_SORT_ALPHA && SDSORT_GCODE
288
-
289
-/**
290
- * M524: Abort the current SD print job (started with M24)
291
- */
292
-void GcodeSuite::M524() {
293
-  if (IS_SD_PRINTING()) card.flag.abort_sd_printing = true;
294
-}
295
-
296
-/**
297
- * M928: Start SD Write
298
- */
299
-void GcodeSuite::M928() {
300
-  card.openLogFile(parser.string_arg);
301
-}
302
-
303
-#endif // SDSUPPORT

+ 39
- 0
Marlin/src/gcode/sdcard/M20.cpp Bestand weergeven

@@ -0,0 +1,39 @@
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 "../../inc/MarlinConfig.h"
24
+
25
+#if ENABLED(SDSUPPORT)
26
+
27
+#include "../gcode.h"
28
+#include "../../sd/cardreader.h"
29
+
30
+/**
31
+ * M20: List SD card to serial output
32
+ */
33
+void GcodeSuite::M20() {
34
+  SERIAL_ECHOLNPGM(MSG_BEGIN_FILE_LIST);
35
+  card.ls();
36
+  SERIAL_ECHOLNPGM(MSG_END_FILE_LIST);
37
+}
38
+
39
+#endif // SDSUPPORT

+ 40
- 0
Marlin/src/gcode/sdcard/M21_M22.cpp Bestand weergeven

@@ -0,0 +1,40 @@
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 "../../inc/MarlinConfig.h"
24
+
25
+#if ENABLED(SDSUPPORT)
26
+
27
+#include "../gcode.h"
28
+#include "../../sd/cardreader.h"
29
+
30
+/**
31
+ * M21: Init SD Card
32
+ */
33
+void GcodeSuite::M21() { card.initsd(); }
34
+
35
+/**
36
+ * M22: Release SD Card
37
+ */
38
+void GcodeSuite::M22() { card.release(); }
39
+
40
+#endif // SDSUPPORT

+ 42
- 0
Marlin/src/gcode/sdcard/M23.cpp Bestand weergeven

@@ -0,0 +1,42 @@
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 "../../inc/MarlinConfig.h"
24
+
25
+#if ENABLED(SDSUPPORT)
26
+
27
+#include "../gcode.h"
28
+#include "../../sd/cardreader.h"
29
+
30
+/**
31
+ * M23: Open a file
32
+ */
33
+void GcodeSuite::M23() {
34
+  #if ENABLED(POWER_LOSS_RECOVERY)
35
+    card.removeJobRecoveryFile();
36
+  #endif
37
+  // Simplify3D includes the size, so zero out all spaces (#7227)
38
+  for (char *fn = parser.string_arg; *fn; ++fn) if (*fn == ' ') *fn = '\0';
39
+  card.openFile(parser.string_arg, true);
40
+}
41
+
42
+#endif // SDSUPPORT

+ 106
- 0
Marlin/src/gcode/sdcard/M24_M25.cpp Bestand weergeven

@@ -0,0 +1,106 @@
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 "../../inc/MarlinConfig.h"
24
+
25
+#if ENABLED(SDSUPPORT)
26
+
27
+#include "../gcode.h"
28
+#include "../../sd/cardreader.h"
29
+#include "../../module/printcounter.h"
30
+#include "../../lcd/ultralcd.h"
31
+
32
+#if ENABLED(PARK_HEAD_ON_PAUSE)
33
+  #include "../../feature/pause.h"
34
+  #include "../queue.h"
35
+#endif
36
+
37
+#if ENABLED(HOST_ACTION_COMMANDS)
38
+  #include "../../feature/host_actions.h"
39
+#endif
40
+
41
+/**
42
+ * M24: Start or Resume SD Print
43
+ */
44
+void GcodeSuite::M24() {
45
+
46
+  #if ENABLED(POWER_LOSS_RECOVERY)
47
+    if (parser.seenval('S')) card.setIndex(parser.value_long());
48
+    if (parser.seenval('T')) print_job_timer.resume(parser.value_long());
49
+  #endif
50
+
51
+  #if ENABLED(PARK_HEAD_ON_PAUSE)
52
+    if (did_pause_print) {
53
+      resume_print();
54
+      return;
55
+    }
56
+  #endif
57
+
58
+  if (card.isFileOpen()) {
59
+    card.startFileprint();
60
+    print_job_timer.start();
61
+  }
62
+
63
+  #if ENABLED(HOST_ACTION_COMMANDS)
64
+    #if ENABLED(HOST_PROMPT_SUPPORT)
65
+      host_prompt_open(PROMPT_INFO, PSTR("Resume SD"));
66
+    #endif
67
+    #ifdef ACTION_ON_RESUME
68
+      host_action_resume();
69
+    #endif
70
+  #endif
71
+
72
+  ui.reset_status();
73
+}
74
+
75
+/**
76
+ * M25: Pause SD Print
77
+ */
78
+void GcodeSuite::M25() {
79
+
80
+  // Set initial pause flag to prevent more commands from landing in the queue while we try to pause
81
+  #if ENABLED(SDSUPPORT)
82
+    if (IS_SD_PRINTING()) card.pauseSDPrint();
83
+  #endif
84
+
85
+  #if ENABLED(PARK_HEAD_ON_PAUSE)
86
+
87
+    M125();
88
+
89
+  #else
90
+
91
+    print_job_timer.pause();
92
+    ui.reset_status();
93
+
94
+    #if ENABLED(HOST_ACTION_COMMANDS)
95
+      #if ENABLED(HOST_PROMPT_SUPPORT)
96
+        host_prompt_open(PROMPT_PAUSE_RESUME, PSTR("Pause SD"), PSTR("Resume"));
97
+      #endif
98
+      #ifdef ACTION_ON_PAUSE
99
+        host_action_pause();
100
+      #endif
101
+    #endif
102
+
103
+  #endif
104
+}
105
+
106
+#endif // SDSUPPORT

+ 38
- 0
Marlin/src/gcode/sdcard/M26.cpp Bestand weergeven

@@ -0,0 +1,38 @@
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 "../../inc/MarlinConfig.h"
24
+
25
+#if ENABLED(SDSUPPORT)
26
+
27
+#include "../gcode.h"
28
+#include "../../sd/cardreader.h"
29
+
30
+/**
31
+ * M26: Set SD Card file index
32
+ */
33
+void GcodeSuite::M26() {
34
+  if (card.isDetected() && parser.seenval('S'))
35
+    card.setIndex(parser.value_long());
36
+}
37
+
38
+#endif // SDSUPPORT

+ 50
- 0
Marlin/src/gcode/sdcard/M27.cpp Bestand weergeven

@@ -0,0 +1,50 @@
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 "../../inc/MarlinConfig.h"
24
+
25
+#if ENABLED(SDSUPPORT)
26
+
27
+#include "../gcode.h"
28
+#include "../../sd/cardreader.h"
29
+
30
+/**
31
+ * M27: Get SD Card status
32
+ *      OR, with 'S<seconds>' set the SD status auto-report interval. (Requires AUTO_REPORT_SD_STATUS)
33
+ *      OR, with 'C' get the current filename.
34
+ */
35
+void GcodeSuite::M27() {
36
+  if (parser.seen('C')) {
37
+    SERIAL_ECHOPGM("Current file: ");
38
+    card.printFilename();
39
+  }
40
+
41
+  #if ENABLED(AUTO_REPORT_SD_STATUS)
42
+    else if (parser.seenval('S'))
43
+      card.set_auto_report_interval(parser.value_byte());
44
+  #endif
45
+
46
+  else
47
+    card.report_status();
48
+}
49
+
50
+#endif // SDSUPPORT

+ 73
- 0
Marlin/src/gcode/sdcard/M28_M29.cpp Bestand weergeven

@@ -0,0 +1,73 @@
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 "../../inc/MarlinConfig.h"
24
+
25
+#if ENABLED(SDSUPPORT)
26
+
27
+#include "../gcode.h"
28
+#include "../../sd/cardreader.h"
29
+
30
+/**
31
+ * M28: Start SD Write
32
+ */
33
+void GcodeSuite::M28() {
34
+
35
+  #if ENABLED(BINARY_FILE_TRANSFER)
36
+
37
+    bool binary_mode = false;
38
+    char *p = parser.string_arg;
39
+    if (p[0] == 'B' && NUMERIC(p[1])) {
40
+      binary_mode = p[1] > '0';
41
+      p += 2;
42
+      while (*p == ' ') ++p;
43
+    }
44
+
45
+    // Binary transfer mode
46
+    if ((card.flag.binary_mode = binary_mode)) {
47
+      SERIAL_ECHO_START();
48
+      SERIAL_ECHO(" preparing to receive: ");
49
+      SERIAL_ECHOLN(p);
50
+      card.openFile(p, false);
51
+      #if NUM_SERIAL > 1
52
+        card.transfer_port_index = command_queue_port[cmd_queue_index_r];
53
+      #endif
54
+    }
55
+    else
56
+      card.openFile(p, false);
57
+
58
+  #else
59
+
60
+    card.openFile(parser.string_arg, false);
61
+
62
+  #endif
63
+}
64
+
65
+/**
66
+ * M29: Stop SD Write
67
+ * (Processed in write-to-file routine)
68
+ */
69
+void GcodeSuite::M29() {
70
+  card.flag.saving = false;
71
+}
72
+
73
+#endif // SDSUPPORT

+ 40
- 0
Marlin/src/gcode/sdcard/M30.cpp Bestand weergeven

@@ -0,0 +1,40 @@
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 "../../inc/MarlinConfig.h"
24
+
25
+#if ENABLED(SDSUPPORT)
26
+
27
+#include "../gcode.h"
28
+#include "../../sd/cardreader.h"
29
+
30
+/**
31
+ * M30 <filename>: Delete SD Card file
32
+ */
33
+void GcodeSuite::M30() {
34
+  if (card.isDetected()) {
35
+    card.closefile();
36
+    card.removeFile(parser.string_arg);
37
+  }
38
+}
39
+
40
+#endif // SDSUPPORT

+ 59
- 0
Marlin/src/gcode/sdcard/M32.cpp Bestand weergeven

@@ -0,0 +1,59 @@
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 "../../inc/MarlinConfig.h"
24
+
25
+#if ENABLED(SDSUPPORT)
26
+
27
+#include "../gcode.h"
28
+#include "../../sd/cardreader.h"
29
+#include "../../module/printcounter.h"
30
+#include "../../module/planner.h"
31
+
32
+/**
33
+ * M32: Select file and start SD Print
34
+ *
35
+ * Examples:
36
+ *
37
+ *    M32 !PATH/TO/FILE.GCO#      ; Start FILE.GCO
38
+ *    M32 P !PATH/TO/FILE.GCO#    ; Start FILE.GCO as a procedure
39
+ *    M32 S60 !PATH/TO/FILE.GCO#  ; Start FILE.GCO at byte 60
40
+ *
41
+ */
42
+void GcodeSuite::M32() {
43
+  if (IS_SD_PRINTING()) planner.synchronize();
44
+
45
+  if (card.isDetected()) {
46
+    const bool call_procedure = parser.boolval('P');
47
+
48
+    card.openFile(parser.string_arg, true, call_procedure);
49
+
50
+    if (parser.seenval('S')) card.setIndex(parser.value_long());
51
+
52
+    card.startFileprint();
53
+
54
+    // Procedure calls count as normal print time.
55
+    if (!call_procedure) print_job_timer.start();
56
+  }
57
+}
58
+
59
+#endif // SDSUPPORT

+ 48
- 0
Marlin/src/gcode/sdcard/M33.cpp Bestand weergeven

@@ -0,0 +1,48 @@
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 "../../inc/MarlinConfig.h"
24
+
25
+#if ENABLED(LONG_FILENAME_HOST_SUPPORT)
26
+
27
+#include "../gcode.h"
28
+#include "../../sd/cardreader.h"
29
+
30
+/**
31
+ * M33: Get the long full path of a file or folder
32
+ *
33
+ * Parameters:
34
+ *   <dospath> Case-insensitive DOS-style path to a file or folder
35
+ *
36
+ * Example:
37
+ *   M33 miscel~1/armchair/armcha~1.gco
38
+ *
39
+ * Output:
40
+ *   /Miscellaneous/Armchair/Armchair.gcode
41
+ */
42
+void GcodeSuite::M33() {
43
+
44
+  card.printLongPath(parser.string_arg);
45
+
46
+}
47
+
48
+#endif // LONG_FILENAME_HOST_SUPPORT

+ 42
- 0
Marlin/src/gcode/sdcard/M34.cpp Bestand weergeven

@@ -0,0 +1,42 @@
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 "../../inc/MarlinConfig.h"
24
+
25
+#if ENABLED(SDCARD_SORT_ALPHA) && ENABLED(SDSORT_GCODE)
26
+
27
+#include "../gcode.h"
28
+#include "../../sd/cardreader.h"
29
+
30
+/**
31
+ * M34: Set SD Card Sorting Options
32
+ */
33
+void GcodeSuite::M34() {
34
+  if (parser.seen('S')) card.setSortOn(parser.value_bool());
35
+  if (parser.seenval('F')) {
36
+    const int v = parser.value_long();
37
+    card.setSortFolders(v < 0 ? -1 : v > 0 ? 1 : 0);
38
+  }
39
+  //if (parser.seen('R')) card.setSortReverse(parser.value_bool());
40
+}
41
+
42
+#endif // SDCARD_SORT_ALPHA && SDSORT_GCODE

+ 40
- 0
Marlin/src/gcode/sdcard/M524.cpp Bestand weergeven

@@ -0,0 +1,40 @@
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 "../../inc/MarlinConfig.h"
24
+
25
+#if ENABLED(SDSUPPORT)
26
+
27
+#include "../gcode.h"
28
+#include "../../sd/cardreader.h"
29
+
30
+/**
31
+ * M524: Abort the current SD print job (started with M24)
32
+ */
33
+void GcodeSuite::M524() {
34
+
35
+  if (IS_SD_PRINTING())
36
+    card.flag.abort_sd_printing = true;
37
+
38
+}
39
+
40
+#endif // SDSUPPORT

+ 39
- 0
Marlin/src/gcode/sdcard/M928.cpp Bestand weergeven

@@ -0,0 +1,39 @@
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 "../../inc/MarlinConfig.h"
24
+
25
+#if ENABLED(SDSUPPORT)
26
+
27
+#include "../gcode.h"
28
+#include "../../sd/cardreader.h"
29
+
30
+/**
31
+ * M928: Start SD Logging
32
+ */
33
+void GcodeSuite::M928() {
34
+
35
+  card.openLogFile(parser.string_arg);
36
+
37
+}
38
+
39
+#endif // SDSUPPORT

Laden…
Annuleren
Opslaan