Skip to content

Commit f6dc14c

Browse files
committed
Rework Multi Volume support
1 parent fc4e98b commit f6dc14c

119 files changed

Lines changed: 469 additions & 473 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Marlin/Configuration.h

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2575,22 +2575,14 @@
25752575
#define LCD_INFO_SCREEN_STYLE 0
25762576

25772577
/**
2578-
* SD CARD
2579-
*
2580-
* SD Card support is disabled by default. If your controller has an SD slot,
2581-
* you must uncomment the following option or it won't work.
2582-
*/
2583-
//#define SDSUPPORT
2584-
#if ENABLED(SDSUPPORT) // SDSUPPORT enables SPI Storage by default
2585-
//#define SDIO_SUPPORT // Enable SDIO storage
2586-
#if ENABLED(SDIO_SUPPORT)
2587-
//#define SDIO_IS_ONBOARD // Use friendly label for SDIO on UI menu
2588-
#if ENABLED(SDIO_IS_ONBOARD)
2589-
//#define SPI_IS_EXTERNAL // Use friendly label to specify that the SPI SD card is external if SDIO is onboard
2590-
#endif
2591-
#endif
2592-
//#define USB_FLASH_DRIVE_SUPPORT // Enable USD Flash drive storage
2593-
#endif
2578+
* Media Drives
2579+
*
2580+
* If your controller has any SD Card readers or
2581+
* USB Flash Drives set the following options:
2582+
*/
2583+
//#define VOLUME0 ONBOARD
2584+
//#define VOLUME1 LCD
2585+
//#define VOLUME2 USBFD
25942586

25952587
/**
25962588
* SD CARD: ENABLE CRC

Marlin/Configuration_adv.h

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1782,8 +1782,7 @@
17821782
*
17831783
* [1] On AVR an interrupt-capable pin is best for UHS3 compatibility.
17841784
*/
1785-
//#define USB_FLASH_DRIVE_SUPPORT
1786-
#if ENABLED(USB_FLASH_DRIVE_SUPPORT)
1785+
#if HAS_USB_FLASH_DRIVE
17871786
/**
17881787
* USB Host Shield Library
17891788
*
@@ -1842,33 +1841,21 @@
18421841
//#define CUSTOM_FIRMWARE_UPLOAD
18431842
#endif
18441843

1845-
/**
1846-
* Set this option to one of the following (or the board's defaults apply):
1847-
*
1848-
* LCD - Use the SD drive in the external LCD controller.
1849-
* ONBOARD - Use the SD drive on the control board.
1850-
* CUSTOM_CABLE - Use a custom cable to access the SD (as defined in a pins file).
1851-
*
1852-
* :[ 'LCD', 'ONBOARD', 'CUSTOM_CABLE' ]
1853-
*/
1854-
//#define SDCARD_CONNECTION LCD
1855-
18561844
// Enable if SD detect is rendered useless (e.g., by using an SD extender)
18571845
//#define NO_SD_DETECT
18581846

18591847
/**
18601848
* Multiple volume support - EXPERIMENTAL.
18611849
* Adds 'M21 Pm' / 'M21 S' / 'M21 U' / 'M21 O' to mount SD Card / USB Drive / SDIO Card.
18621850
*/
1863-
//#define MULTI_VOLUME
1864-
#if ENABLED(MULTI_VOLUME)
1865-
#define VOLUME_SD_ONBOARD
1866-
#if ENABLED(USB_FLASH_DRIVE_SUPPORT)
1851+
#if HAS_MULTI_VOLUME
1852+
#define VOLUME_SD_ONBOARD 0
1853+
#if HAS_USB_FLASH_DRIVE
18671854
#define VOLUME_USB_FLASH_DRIVE
18681855
#if ENABLED(VOLUME_USB_FLASH_DRIVE)
18691856
#define DEFAULT_SHARED_VOLUME SV_USB_FLASH_DRIVE
18701857
#endif
1871-
#elif ENABLED(VOLUME_SD_ONBOARD)
1858+
#elif defined(VOLUME_SD_ONBOARD)
18721859
#define DEFAULT_SHARED_VOLUME SV_SD_ONBOARD
18731860
#else
18741861
#define DEFAULT_SHARED_VOLUME SV_SDIO_ONBOARD

Marlin/src/HAL/SAMD21/HAL.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ void MarlinHAL::dma_init() {}
106106
void MarlinHAL::init() {
107107
TERN_(DMA_IS_REQUIRED, dma_init());
108108
#if HAS_MEDIA
109-
#if HAS_SD_DETECT && SD_CONNECTION_IS(ONBOARD)
109+
#if HAS_SD_DETECT && ANY_VOLUME_IS(ONBOARD)
110110
SET_INPUT_PULLUP(SD_DETECT_PIN);
111111
#endif
112112
OUT_WRITE(SDSS, HIGH); // Try to set SDSS inactive before any other SPI users start up

Marlin/src/HAL/SAMD51/HAL.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ void MarlinHAL::dma_init() {
603603
void MarlinHAL::init() {
604604
TERN_(DMA_IS_REQUIRED, dma_init());
605605
#if HAS_MEDIA
606-
#if HAS_SD_DETECT && SD_CONNECTION_IS(ONBOARD)
606+
#if HAS_SD_DETECT && ANY_VOLUME_IS(ONBOARD)
607607
SET_INPUT_PULLUP(SD_DETECT_PIN);
608608
#endif
609609
OUT_WRITE(SDSS, HIGH); // Try to set SDSS inactive before any other SPI users start up

Marlin/src/HAL/SAMD51/HAL_SPI.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
#else // !SOFTWARE_SPI
5555

5656
#ifdef ADAFRUIT_GRAND_CENTRAL_M4
57-
#if SD_CONNECTION_IS(ONBOARD)
57+
#if ANY_VOLUME_IS(ONBOARD)
5858
#define sdSPI SDCARD_SPI
5959
#else
6060
#define sdSPI SPI

Marlin/src/HAL/SAMD51/inc/SanityCheck.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
#warning "Did you activate the SmartEEPROM? See https://github.com/GMagician/SAMD51-SmartEEprom-Manager/releases"
3838
#endif
3939

40-
#if defined(ADAFRUIT_GRAND_CENTRAL_M4) && SD_CONNECTION_IS(CUSTOM_CABLE)
41-
#error "No custom SD drive cable defined for this board."
40+
#if defined(ADAFRUIT_GRAND_CENTRAL_M4) && ANY_VOLUME_IS(CUSTOM)
41+
#error "No custom SD pins defined for this board."
4242
#endif
4343

4444
#if (defined(TEMP_0_SCK_PIN) && defined(TEMP_0_MISO_PIN) && (TEMP_0_SCK_PIN == SCK1 || TEMP_0_MISO_PIN == MISO1)) || \

Marlin/src/HAL/STM32/msc_sd.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
class Sd2CardUSBMscHandler : public USBMscHandler {
3737
public:
3838
DiskIODriver* diskIODriver() {
39-
#if ENABLED(MULTI_VOLUME)
39+
#if HAS_MULTI_VOLUME
4040
#if SHARED_VOLUME_IS(SD_ONBOARD)
4141
return &card.media_driver_sdcard;
4242
#elif SHARED_VOLUME_IS(USB_FLASH_DRIVE)

Marlin/src/HAL/STM32F1/msc_sd.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Serial1Class<USBCompositeSerial> MarlinCompositeSerial(true);
3030

3131
#include "../../inc/MarlinConfig.h"
3232

33-
#if SD_CONNECTION_IS(ONBOARD)
33+
#if ANY_VOLUME_IS(ONBOARD)
3434

3535
#include "onboard_sd.h"
3636

@@ -77,7 +77,7 @@ void MSC_SD_init() {
7777
USBComposite.end();
7878
USBComposite.clear();
7979
// Set api and register mass storage
80-
#if SD_CONNECTION_IS(ONBOARD)
80+
#if ANY_VOLUME_IS(ONBOARD)
8181
uint32_t cardSize;
8282
if (disk_initialize(0) == RES_OK) {
8383
if (disk_ioctl(0, GET_SECTOR_COUNT, (void *)(&cardSize)) == RES_OK) {

Marlin/src/HAL/STM32F1/onboard_sd.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
#include "../../inc/MarlinConfig.h"
1717

18-
#if SD_CONNECTION_IS(ONBOARD)
18+
#if ANY_VOLUME_IS(ONBOARD)
1919

2020
#include "onboard_sd.h"
2121
#include "SPI.h"
@@ -567,5 +567,5 @@ DRESULT disk_read (
567567

568568
#endif // _DISKIO_IOCTL
569569

570-
#endif // SD_CONNECTION_IS(ONBOARD)
570+
#endif // ANY_VOLUME_IS(ONBOARD)
571571
#endif // __STM32F1__

Marlin/src/MarlinCore.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,7 @@ void idle(const bool no_stepper_sleep/*=false*/) {
837837
TERN_(HAS_MEDIA, card.manage_media());
838838

839839
// Handle USB Flash Drive insert / remove
840-
TERN_(USB_FLASH_DRIVE_SUPPORT, card.diskIODriver()->idle());
840+
TERN_(HAS_USB_FLASH_DRIVE, card.diskIODriver()->idle());
841841

842842
// Announce Host Keepalive state (if any)
843843
TERN_(HOST_KEEPALIVE_FEATURE, gcode.host_keepalive());

0 commit comments

Comments
 (0)