Переглянути джерело

✨ M21 P / S / U - Select Volume (#23780)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
kisslorand 2 роки тому
джерело
коміт
9ea6a588c3
Аккаунт користувача з таким Email не знайдено

+ 4
- 1
Marlin/Configuration_adv.h Переглянути файл

@@ -1631,7 +1631,10 @@
1631 1631
   // Enable if SD detect is rendered useless (e.g., by using an SD extender)
1632 1632
   //#define NO_SD_DETECT
1633 1633
 
1634
-  // Multiple volume support - EXPERIMENTAL.
1634
+  /**
1635
+   * Multiple volume support - EXPERIMENTAL.
1636
+   * Adds 'M21 Pm' / 'M21 S' / 'M21 U' to mount SD Card / USB Drive.
1637
+   */
1635 1638
   //#define MULTI_VOLUME
1636 1639
   #if ENABLED(MULTI_VOLUME)
1637 1640
     #define VOLUME_SD_ONBOARD

+ 1
- 1
Marlin/src/gcode/gcode.h Переглянути файл

@@ -91,7 +91,7 @@
91 91
  *
92 92
  *** Print from Media (SDSUPPORT) ***
93 93
  * M20  - List SD card. (Requires SDSUPPORT)
94
- * M21  - Init SD card. (Requires SDSUPPORT)
94
+ * M21  - Init SD card. (Requires SDSUPPORT) With MULTI_VOLUME select a drive with `M21 Pn` / 'M21 S' / 'M21 U'.
95 95
  * M22  - Release SD card. (Requires SDSUPPORT)
96 96
  * M23  - Select SD file: "M23 /path/file.gco". (Requires SDSUPPORT)
97 97
  * M24  - Start/resume SD print. (Requires SDSUPPORT)

+ 5
- 0
Marlin/src/gcode/host/M115.cpp Переглянути файл

@@ -142,6 +142,11 @@ void GcodeSuite::M115() {
142 142
     // SDCARD (M20, M23, M24, etc.)
143 143
     cap_line(F("SDCARD"), ENABLED(SDSUPPORT));
144 144
 
145
+    // MULTI_VOLUME (M21 S/M21 U)
146
+    #if ENABLED(SDSUPPORT)
147
+      cap_line(F("MULTI_VOLUME"), ENABLED(MULTI_VOLUME));
148
+    #endif
149
+
145 150
     // REPEAT (M808)
146 151
     cap_line(F("REPEAT"), ENABLED(GCODE_REPEAT_MARKERS));
147 152
 

+ 14
- 1
Marlin/src/gcode/sd/M21_M22.cpp Переглянути файл

@@ -29,8 +29,21 @@
29 29
 
30 30
 /**
31 31
  * M21: Init SD Card
32
+ *
33
+ * With MULTI_VOLUME:
34
+ *  P0 or S - Change to the SD Card and mount it
35
+ *  P1 or U - Change to the USB Drive and mount it
32 36
  */
33
-void GcodeSuite::M21() { card.mount(); }
37
+void GcodeSuite::M21() {
38
+  #if ENABLED(MULTI_VOLUME)
39
+    const int8_t vol = parser.intval('P', -1);
40
+    if (vol == 0 || parser.seen_test('S'))       // "S" for SD Card
41
+      card.changeMedia(&card.media_driver_sdcard);
42
+    else if (vol == 1 || parser.seen_test('U'))  // "U" for USB
43
+      card.changeMedia(&card.media_driver_usbFlash);
44
+  #endif
45
+  card.mount();
46
+}
34 47
 
35 48
 /**
36 49
  * M22: Release SD Card

Завантаження…
Відмінити
Зберегти