Skip to content

Commit 5664c02

Browse files
committed
πŸ§‘β€πŸ’» Generalize SDSUPPORT as HAS_MEDIA
In preparation for single- and multi-volume refactoring.
1 parent ce85b98 commit 5664c02

File tree

164 files changed

+399
-397
lines changed

Some content is hidden

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

164 files changed

+399
-397
lines changed

β€ŽMarlin/Configuration_adv.h

+7-7
Original file line numberDiff line numberDiff line change
@@ -1601,13 +1601,13 @@
16011601
#define SET_REMAINING_TIME // Add 'R' parameter to set remaining time
16021602
//#define SET_INTERACTION_TIME // Add 'C' parameter to set time until next filament change or other user interaction
16031603
//#define M73_REPORT // Report M73 values to host
1604-
#if BOTH(M73_REPORT, SDSUPPORT)
1604+
#if BOTH(M73_REPORT, HAS_MEDIA)
16051605
#define M73_REPORT_SD_ONLY // Report only when printing from SD
16061606
#endif
16071607
#endif
16081608

16091609
// LCD Print Progress options. Multiple times may be displayed in turn.
1610-
#if HAS_DISPLAY && EITHER(SDSUPPORT, SET_PROGRESS_MANUALLY)
1610+
#if HAS_DISPLAY && EITHER(HAS_MEDIA, SET_PROGRESS_MANUALLY)
16111611
#define SHOW_PROGRESS_PERCENT // Show print progress percentage (doesn't affect progress bar)
16121612
#define SHOW_ELAPSED_TIME // Display elapsed printing time (prefix 'E')
16131613
//#define SHOW_REMAINING_TIME // Display estimated time to completion (prefix 'R')
@@ -1628,7 +1628,7 @@
16281628
#endif
16291629
#endif
16301630

1631-
#if ENABLED(SDSUPPORT)
1631+
#if HAS_MEDIA
16321632
/**
16331633
* SD Card SPI Speed
16341634
* May be required to resolve "volume init" errors.
@@ -1868,7 +1868,7 @@
18681868
#define DEFAULT_SHARED_VOLUME SV_USB_FLASH_DRIVE
18691869
#endif
18701870

1871-
#endif // SDSUPPORT
1871+
#endif // HAS_MEDIA
18721872

18731873
/**
18741874
* By default an onboard SD card reader may be shared as a USB mass-
@@ -2492,9 +2492,9 @@
24922492

24932493
// The number of linear moves that can be in the planner at once.
24942494
// The value of BLOCK_BUFFER_SIZE must be a power of 2 (e.g., 8, 16, 32)
2495-
#if BOTH(SDSUPPORT, DIRECT_STEPPING)
2495+
#if BOTH(HAS_MEDIA, DIRECT_STEPPING)
24962496
#define BLOCK_BUFFER_SIZE 8
2497-
#elif ENABLED(SDSUPPORT)
2497+
#elif HAS_MEDIA
24982498
#define BLOCK_BUFFER_SIZE 16
24992499
#else
25002500
#define BLOCK_BUFFER_SIZE 16
@@ -2527,7 +2527,7 @@
25272527
//#define SERIAL_XON_XOFF
25282528
#endif
25292529

2530-
#if ENABLED(SDSUPPORT)
2530+
#if HAS_MEDIA
25312531
// Enable this option to collect and display the maximum
25322532
// RX queue usage after transferring a file to SD.
25332533
//#define SERIAL_STATS_MAX_RX_QUEUED

β€ŽMarlin/src/HAL/AVR/HAL.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,12 @@ void MarlinHAL::reboot() {
145145
// Free Memory Accessor
146146
// ------------------------
147147

148-
#if ENABLED(SDSUPPORT)
148+
#if HAS_MEDIA
149149

150150
#include "../../sd/SdFatUtil.h"
151151
int freeMemory() { return SdFatUtil::FreeRam(); }
152152

153-
#else // !SDSUPPORT
153+
#else // !HAS_MEDIA
154154

155155
extern "C" {
156156
extern char __bss_end;
@@ -167,6 +167,6 @@ void MarlinHAL::reboot() {
167167
}
168168
}
169169

170-
#endif // !SDSUPPORT
170+
#endif // !HAS_MEDIA
171171

172172
#endif // __AVR__

β€ŽMarlin/src/HAL/DUE/HAL.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ uint16_t MarlinHAL::adc_result;
4545
#endif
4646

4747
void MarlinHAL::init() {
48-
#if ENABLED(SDSUPPORT)
48+
#if HAS_MEDIA
4949
OUT_WRITE(SDSS, HIGH); // Try to set SDSS inactive before any other SPI users start up
5050
#endif
5151
usb_task_init(); // Initialize the USB stack

β€ŽMarlin/src/HAL/DUE/inc/SanityCheck.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
*/
7171
#define _IS_HW_SPI(P) (defined(TMC_SPI_##P) && (TMC_SPI_##P == SD_MOSI_PIN || TMC_SPI_##P == SD_MISO_PIN || TMC_SPI_##P == SD_SCK_PIN))
7272

73-
#if ENABLED(SDSUPPORT) && HAS_DRIVER(TMC2130)
73+
#if HAS_MEDIA && HAS_DRIVER(TMC2130)
7474
#if ENABLED(TMC_USE_SW_SPI)
7575
#if DISABLED(DUE_SOFTWARE_SPI) && (_IS_HW_SPI(MOSI) || _IS_HW_SPI(MISO) || _IS_HW_SPI(SCK))
7676
#error "DUE hardware SPI is required but is incompatible with TMC2130 software SPI. Either disable TMC_USE_SW_SPI or use separate pins for the two SPIs."

β€ŽMarlin/src/HAL/DUE/usb/conf_usb.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
#define USB_DEVICE_SPECIFIC_REQUEST() usb_task_other_requests()
102102
//@}
103103

104-
#if ENABLED(SDSUPPORT)
104+
#if HAS_MEDIA
105105
/**
106106
* USB Device low level configuration
107107
* When only one interface is used, these configurations are defined by the class module.
@@ -185,7 +185,7 @@
185185
//! Enable id string of interface to add an extra USB string
186186
#define UDI_CDC_IAD_STRING_ID 4
187187

188-
#if ENABLED(SDSUPPORT)
188+
#if HAS_MEDIA
189189
/**
190190
* USB CDC low level configuration
191191
* In standalone these configurations are defined by the CDC module.

β€ŽMarlin/src/HAL/DUE/usb/sd_mmc_spi_mem.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
#include "../../../inc/MarlinConfig.h"
88

9-
#if ENABLED(SDSUPPORT)
9+
#if HAS_MEDIA
1010

1111
#include "../../../sd/cardreader.h"
1212
extern "C" {
@@ -138,5 +138,5 @@ Ctrl_status sd_mmc_spi_usb_write_10(uint32_t addr, uint16_t nb_sector) {
138138

139139
#endif // ACCESS_USB == true
140140

141-
#endif // SDSUPPORT
141+
#endif // HAS_MEDIA
142142
#endif // ARDUINO_ARCH_SAM

β€ŽMarlin/src/HAL/DUE/usb/udi_cdc_desc.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
#include "udc_desc.h"
5252
#include "udi_cdc.h"
5353

54-
#if DISABLED(SDSUPPORT)
54+
#if !HAS_MEDIA
5555

5656
/**
5757
* \defgroup udi_cdc_group_single_desc USB device descriptors for a single interface
@@ -256,6 +256,6 @@ UDC_DESC_STORAGE udc_config_t udc_config = {
256256
//@}
257257
//@}
258258

259-
#endif // SDSUPPORT
259+
#endif // HAS_MEDIA
260260

261261
#endif // ARDUINO_ARCH_SAM

β€ŽMarlin/src/HAL/DUE/usb/udi_composite_desc.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
#include "udd.h"
5151
#include "udc_desc.h"
5252

53-
#if ENABLED(SDSUPPORT)
53+
#if HAS_MEDIA
5454

5555
/**
5656
* \defgroup udi_group_desc Descriptors for a USB Device
@@ -189,4 +189,4 @@ UDC_DESC_STORAGE udc_config_t udc_config = {
189189

190190
#endif // ARDUINO_ARCH_SAM
191191

192-
#endif // SDSUPPORT
192+
#endif // HAS_MEDIA

β€ŽMarlin/src/HAL/DUE/usb/udi_msc.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
#include "ctrl_access.h"
5858
#include <string.h>
5959

60-
#if ENABLED(SDSUPPORT)
60+
#if HAS_MEDIA
6161

6262
#ifndef UDI_MSC_NOTIFY_TRANS_EXT
6363
# define UDI_MSC_NOTIFY_TRANS_EXT()
@@ -1127,6 +1127,6 @@ bool udi_msc_trans_block(bool b_read, uint8_t * block, iram_size_t block_size,
11271127

11281128
//@}
11291129

1130-
#endif // SDSUPPORT
1130+
#endif // HAS_MEDIA
11311131

11321132
#endif // ARDUINO_ARCH_SAM

β€ŽMarlin/src/HAL/DUE/usb/usb_task.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@
5151
#include "conf_usb.h"
5252
#include "udc.h"
5353

54-
#if ENABLED(SDSUPPORT)
54+
#if HAS_MEDIA
5555
static volatile bool main_b_msc_enable = false;
5656
#endif
5757
static volatile bool main_b_cdc_enable = false;
5858
static volatile bool main_b_dtr_active = false;
5959

6060
void usb_task_idle(void) {
61-
#if ENABLED(SDSUPPORT)
61+
#if HAS_MEDIA
6262
// Attend SD card access from the USB MSD -- Prioritize access to improve speed
6363
int delay = 2;
6464
while (main_b_msc_enable && --delay > 0) {
@@ -70,7 +70,7 @@ void usb_task_idle(void) {
7070
#endif
7171
}
7272

73-
#if ENABLED(SDSUPPORT)
73+
#if HAS_MEDIA
7474
bool usb_task_msc_enable(void) { return ((main_b_msc_enable = true)); }
7575
void usb_task_msc_disable(void) { main_b_msc_enable = false; }
7676
bool usb_task_msc_isenabled(void) { return main_b_msc_enable; }
@@ -206,13 +206,13 @@ static USB_MicrosoftExtendedPropertiesDescriptor microsoft_extended_properties_d
206206
bool usb_task_extra_string(void) {
207207
static uint8_t udi_msft_magic[] = "MSFT100\xEE";
208208
static uint8_t udi_cdc_name[] = "CDC interface";
209-
#if ENABLED(SDSUPPORT)
209+
#if HAS_MEDIA
210210
static uint8_t udi_msc_name[] = "MSC interface";
211211
#endif
212212

213213
struct extra_strings_desc_t {
214214
usb_str_desc_t header;
215-
#if ENABLED(SDSUPPORT)
215+
#if HAS_MEDIA
216216
le16_t string[Max(Max(sizeof(udi_cdc_name) - 1, sizeof(udi_msc_name) - 1), sizeof(udi_msft_magic) - 1)];
217217
#else
218218
le16_t string[Max(sizeof(udi_cdc_name) - 1, sizeof(udi_msft_magic) - 1)];
@@ -231,7 +231,7 @@ bool usb_task_extra_string(void) {
231231
str_lgt = sizeof(udi_cdc_name) - 1;
232232
str = udi_cdc_name;
233233
break;
234-
#if ENABLED(SDSUPPORT)
234+
#if HAS_MEDIA
235235
case UDI_MSC_STRING_ID:
236236
str_lgt = sizeof(udi_msc_name) - 1;
237237
str = udi_msc_name;

β€ŽMarlin/src/HAL/ESP32/HAL_SPI.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ static SPISettings spiConfig;
5353
// ------------------------
5454

5555
void spiBegin() {
56-
#if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_SS)
56+
#if HAS_MEDIA && PIN_EXISTS(SD_SS)
5757
OUT_WRITE(SD_SS_PIN, HIGH);
5858
#endif
5959
}

β€ŽMarlin/src/HAL/ESP32/u8g_esp32_spi.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#include "HAL.h"
3333
#include "SPI.h"
3434

35-
#if ENABLED(SDSUPPORT)
35+
#if HAS_MEDIA
3636
#include "../../sd/cardreader.h"
3737
#if ENABLED(ESP3D_WIFISUPPORT)
3838
#include "sd_ESP32.h"

β€ŽMarlin/src/HAL/LINUX/spi_pins.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include "../../core/macros.h"
2525
#include "../../inc/MarlinConfigPre.h"
2626

27-
#if BOTH(HAS_MARLINUI_U8GLIB, SDSUPPORT) && (LCD_PINS_D4 == SD_SCK_PIN || LCD_PINS_EN == SD_MOSI_PIN || DOGLCD_SCK == SD_SCK_PIN || DOGLCD_MOSI == SD_MOSI_PIN)
27+
#if BOTH(HAS_MARLINUI_U8GLIB, HAS_MEDIA) && (LCD_PINS_D4 == SD_SCK_PIN || LCD_PINS_EN == SD_MOSI_PIN || DOGLCD_SCK == SD_SCK_PIN || DOGLCD_MOSI == SD_MOSI_PIN)
2828
#define SOFTWARE_SPI // If the SD card and LCD adapter share the same SPI pins, then software SPI is currently
2929
// needed due to the speed and mode required for communicating with each device being different.
3030
// This requirement can be removed if the SPI access to these devices is updated to use

β€ŽMarlin/src/HAL/LPC1768/inc/SanityCheck.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o
201201
#if USEDI2CDEV_M == 0 // P0_27 [D57] (AUX-1) .......... P0_28 [D58] (AUX-1)
202202
#define PIN_IS_SDA0(P) (P##_PIN == P0_27)
203203
#define IS_SCL0(P) (P == P0_28)
204-
#if ENABLED(SDSUPPORT) && PIN_IS_SDA0(SD_DETECT)
204+
#if HAS_MEDIA && PIN_IS_SDA0(SD_DETECT)
205205
#error "SDA0 overlaps with SD_DETECT_PIN!"
206206
#elif PIN_IS_SDA0(E0_AUTO_FAN)
207207
#error "SDA0 overlaps with E0_AUTO_FAN_PIN!"

β€ŽMarlin/src/HAL/LPC1768/spi_pins.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
#include "../../core/macros.h"
2525

26-
#if BOTH(SDSUPPORT, HAS_MARLINUI_U8GLIB) && (LCD_PINS_D4 == SD_SCK_PIN || LCD_PINS_EN == SD_MOSI_PIN || DOGLCD_SCK == SD_SCK_PIN || DOGLCD_MOSI == SD_MOSI_PIN)
26+
#if BOTH(HAS_MEDIA, HAS_MARLINUI_U8GLIB) && (LCD_PINS_D4 == SD_SCK_PIN || LCD_PINS_EN == SD_MOSI_PIN || DOGLCD_SCK == SD_SCK_PIN || DOGLCD_MOSI == SD_MOSI_PIN)
2727
#define SOFTWARE_SPI // If the SD card and LCD adapter share the same SPI pins, then software SPI is currently
2828
// needed due to the speed and mode required for communicating with each device being different.
2929
// This requirement can be removed if the SPI access to these devices is updated to use

β€ŽMarlin/src/HAL/NATIVE_SIM/spi_pins.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include "../../core/macros.h"
2525
#include "../../inc/MarlinConfigPre.h"
2626

27-
#if BOTH(HAS_MARLINUI_U8GLIB, SDSUPPORT) && (LCD_PINS_D4 == SD_SCK_PIN || LCD_PINS_EN == SD_MOSI_PIN || DOGLCD_SCK == SD_SCK_PIN || DOGLCD_MOSI == SD_MOSI_PIN)
27+
#if BOTH(HAS_MARLINUI_U8GLIB, HAS_MEDIA) && (LCD_PINS_D4 == SD_SCK_PIN || LCD_PINS_EN == SD_MOSI_PIN || DOGLCD_SCK == SD_SCK_PIN || DOGLCD_MOSI == SD_MOSI_PIN)
2828
#define SOFTWARE_SPI // If the SD card and LCD adapter share the same SPI pins, then software SPI is currently
2929
// needed due to the speed and mode required for communicating with each device being different.
3030
// This requirement can be removed if the SPI access to these devices is updated to use

β€ŽMarlin/src/HAL/SAMD21/HAL.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ void MarlinHAL::dma_init() {}
105105
// HAL initialization task
106106
void MarlinHAL::init() {
107107
TERN_(DMA_IS_REQUIRED, dma_init());
108-
#if ENABLED(SDSUPPORT)
108+
#if HAS_MEDIA
109109
#if HAS_SD_DETECT && SD_CONNECTION_IS(ONBOARD)
110110
SET_INPUT_PULLUP(SD_DETECT_PIN);
111111
#endif

β€ŽMarlin/src/HAL/SAMD51/HAL.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ void MarlinHAL::dma_init() {
602602
// HAL initialization task
603603
void MarlinHAL::init() {
604604
TERN_(DMA_IS_REQUIRED, dma_init());
605-
#if ENABLED(SDSUPPORT)
605+
#if HAS_MEDIA
606606
#if HAS_SD_DETECT && SD_CONNECTION_IS(ONBOARD)
607607
SET_INPUT_PULLUP(SD_DETECT_PIN);
608608
#endif

β€ŽMarlin/src/HAL/STM32/HAL.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ void MarlinHAL::init() {
7070
constexpr int cpuFreq = F_CPU;
7171
UNUSED(cpuFreq);
7272

73-
#if ENABLED(SDSUPPORT) && DISABLED(SDIO_SUPPORT) && (defined(SDSS) && SDSS != -1)
73+
#if HAS_MEDIA && DISABLED(SDIO_SUPPORT) && (defined(SDSS) && SDSS != -1)
7474
OUT_WRITE(SDSS, HIGH); // Try to set SDSS inactive before any other SPI users start up
7575
#endif
7676

β€ŽMarlin/src/HAL/STM32/inc/Conditionals_adv.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*/
2222
#pragma once
2323

24-
#if BOTH(SDSUPPORT, USBD_USE_CDC_MSC) && DISABLED(NO_SD_HOST_DRIVE)
24+
#if BOTH(HAS_MEDIA, USBD_USE_CDC_MSC) && DISABLED(NO_SD_HOST_DRIVE)
2525
#define HAS_SD_HOST_DRIVE 1
2626
#endif
2727

β€ŽMarlin/src/HAL/STM32/inc/SanityCheck.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
//#endif
3030

3131

32-
#if ENABLED(SDCARD_EEPROM_EMULATION) && DISABLED(SDSUPPORT)
32+
#if ENABLED(SDCARD_EEPROM_EMULATION) && !HAS_MEDIA
3333
#undef SDCARD_EEPROM_EMULATION // Avoid additional error noise
3434
#if USE_FALLBACK_EEPROM
3535
#warning "EEPROM type not specified. Fallback is SDCARD_EEPROM_EMULATION."

β€ŽMarlin/src/HAL/STM32F1/inc/Conditionals_post.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#define USE_SHARED_EEPROM 1
2929
#endif
3030

31-
// Allow SDSUPPORT to be disabled
32-
#if DISABLED(SDSUPPORT)
31+
// Allow for no media drives
32+
#if !HAS_MEDIA
3333
#undef SDIO_SUPPORT
3434
#endif

β€ŽMarlin/src/HAL/STM32F1/inc/SanityCheck.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
* Test STM32F1-specific configuration values for errors at compile-time.
2626
*/
2727

28-
#if ENABLED(SDCARD_EEPROM_EMULATION) && DISABLED(SDSUPPORT)
28+
#if ENABLED(SDCARD_EEPROM_EMULATION) && !HAS_MEDIA
2929
#undef SDCARD_EEPROM_EMULATION // Avoid additional error noise
3030
#if USE_FALLBACK_EEPROM
3131
#warning "EEPROM type not specified. Fallback is SDCARD_EEPROM_EMULATION."

0 commit comments

Comments
Β (0)