Skip to content

Commit 3814bbb

Browse files
author
Bernhard
committed
made sd code only compile with SDSUPPORT defined. safes 10k of codespace
1 parent 729cde4 commit 3814bbb

14 files changed

+72
-0
lines changed

Marlin/Sd2Card.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
* <http://www.gnu.org/licenses/>.
1919
*/
2020
#include "Marlin.h"
21+
22+
#ifdef SDSUPPORT
2123
#include "Sd2Card.h"
2224
//------------------------------------------------------------------------------
2325
#ifndef SOFTWARE_SPI
@@ -636,3 +638,6 @@ bool Sd2Card::writeStop() {
636638
chipSelectHigh();
637639
return false;
638640
}
641+
642+
643+
#endif

Marlin/Sd2Card.h

+7
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
* along with the Arduino Sd2Card Library. If not, see
1818
* <http://www.gnu.org/licenses/>.
1919
*/
20+
21+
#include "Marlin.h"
22+
#ifdef SDSUPPORT
23+
2024
#ifndef Sd2Card_h
2125
#define Sd2Card_h
2226
/**
@@ -232,3 +236,6 @@ class Sd2Card {
232236
bool writeData(uint8_t token, const uint8_t* src);
233237
};
234238
#endif // Sd2Card_h
239+
240+
241+
#endif

Marlin/Sd2PinMap.h

+6
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
* <http://www.gnu.org/licenses/>.
1919
*/
2020
// Warning this file was generated by a program.
21+
#include "Marlin.h"
22+
#ifdef SDSUPPORT
23+
2124
#ifndef Sd2PinMap_h
2225
#define Sd2PinMap_h
2326
#include <avr/io.h>
@@ -360,3 +363,6 @@ static inline __attribute__((always_inline))
360363
}
361364
}
362365
#endif // Sd2PinMap_h
366+
367+
368+
#endif

Marlin/SdBaseFile.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
*/
2020

2121
#define SERIAL MSerial
22+
23+
#include "Marlin.h"
24+
#ifdef SDSUPPORT
25+
2226
#include "SdBaseFile.h"
2327
//------------------------------------------------------------------------------
2428
// pointer to cwd directory
@@ -1784,3 +1788,6 @@ int16_t SdBaseFile::write(const void* buf, uint16_t nbyte) {
17841788
#if ALLOW_DEPRECATED_FUNCTIONS && !defined(DOXYGEN)
17851789
void (*SdBaseFile::oldDateTime_)(uint16_t& date, uint16_t& time) = 0; // NOLINT
17861790
#endif // ALLOW_DEPRECATED_FUNCTIONS
1791+
1792+
1793+
#endif

Marlin/SdBaseFile.h

+4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
* along with the Arduino SdFat Library. If not, see
1818
* <http://www.gnu.org/licenses/>.
1919
*/
20+
#include "Marlin.h"
21+
#ifdef SDSUPPORT
22+
2023
#ifndef SdBaseFile_h
2124
#define SdBaseFile_h
2225
/**
@@ -477,3 +480,4 @@ class SdBaseFile {
477480
};
478481

479482
#endif // SdBaseFile_h
483+
#endif

Marlin/SdFatConfig.h

+6
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
* \file
2222
* \brief configuration definitions
2323
*/
24+
#include "Marlin.h"
25+
#ifdef SDSUPPORT
26+
2427
#ifndef SdFatConfig_h
2528
#define SdFatConfig_h
2629
#include <stdint.h>
@@ -106,3 +109,6 @@ uint8_t const SOFT_SPI_SCK_PIN = 13;
106109
*/
107110
#define USE_CXA_PURE_VIRTUAL 1
108111
#endif // SdFatConfig_h
112+
113+
114+
#endif

Marlin/SdFatStructs.h

+6
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
* along with the Arduino SdFat Library. If not, see
1818
* <http://www.gnu.org/licenses/>.
1919
*/
20+
#include "Marlin.h"
21+
#ifdef SDSUPPORT
22+
2023
#ifndef SdFatStructs_h
2124
#define SdFatStructs_h
2225
/**
@@ -602,3 +605,6 @@ static inline uint8_t DIR_IS_FILE_OR_SUBDIR(const dir_t* dir) {
602605
return (dir->attributes & DIR_ATT_VOLUME_ID) == 0;
603606
}
604607
#endif // SdFatStructs_h
608+
609+
610+
#endif

Marlin/SdFatUtil.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
* <http://www.gnu.org/licenses/>.
1919
*/
2020
#include "Marlin.h"
21+
22+
#ifdef SDSUPPORT
2123
#include "SdFatUtil.h"
2224

2325
//------------------------------------------------------------------------------
@@ -74,3 +76,4 @@ void SdFatUtil::SerialPrint_P(PGM_P str) {
7476
void SdFatUtil::SerialPrintln_P(PGM_P str) {
7577
println_P( str);
7678
}
79+
#endif

Marlin/SdFatUtil.h

+6
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
* along with the Arduino SdFat Library. If not, see
1818
* <http://www.gnu.org/licenses/>.
1919
*/
20+
#include "Marlin.h"
21+
#ifdef SDSUPPORT
22+
2023
#ifndef SdFatUtil_h
2124
#define SdFatUtil_h
2225
/**
@@ -40,3 +43,6 @@ namespace SdFatUtil {
4043

4144
using namespace SdFatUtil; // NOLINT
4245
#endif // #define SdFatUtil_h
46+
47+
48+
#endif

Marlin/SdFile.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
* <http://www.gnu.org/licenses/>.
1919
*/
2020
#include "Marlin.h"
21+
22+
#ifdef SDSUPPORT
2123
#include "SdFile.h"
2224
/** Create a file object and open it in the current working directory.
2325
*
@@ -85,3 +87,6 @@ void SdFile::writeln_P(PGM_P str) {
8587
write_P(str);
8688
write_P(PSTR("\r\n"));
8789
}
90+
91+
92+
#endif

Marlin/SdFile.h

+5
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
* \brief SdFile class
2323
*/
2424
#include "Marlin.h"
25+
26+
#ifdef SDSUPPORT
2527
#include "SdBaseFile.h"
2628
#include <Print.h>
2729
#ifndef SdFile_h
@@ -47,3 +49,6 @@ class SdFile : public SdBaseFile, public Print {
4749
void writeln_P(PGM_P str);
4850
};
4951
#endif // SdFile_h
52+
53+
54+
#endif

Marlin/SdInfo.h

+5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
* along with the Arduino Sd2Card Library. If not, see
1818
* <http://www.gnu.org/licenses/>.
1919
*/
20+
#include "Marlin.h"
21+
#ifdef SDSUPPORT
22+
2023
#ifndef SdInfo_h
2124
#define SdInfo_h
2225
#include <stdint.h>
@@ -273,3 +276,5 @@ union csd_t {
273276
csd2_t v2;
274277
};
275278
#endif // SdInfo_h
279+
280+
#endif

Marlin/SdVolume.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
* along with the Arduino SdFat Library. If not, see
1818
* <http://www.gnu.org/licenses/>.
1919
*/
20+
#include "Marlin.h"
21+
#ifdef SDSUPPORT
22+
2023
#include "SdVolume.h"
2124
//------------------------------------------------------------------------------
2225
#if !USE_MULTIPLE_CARDS
@@ -399,3 +402,4 @@ bool SdVolume::init(Sd2Card* dev, uint8_t part) {
399402
fail:
400403
return false;
401404
}
405+
#endif

Marlin/SdVolume.h

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
* along with the Arduino SdFat Library. If not, see
1818
* <http://www.gnu.org/licenses/>.
1919
*/
20+
#include "Marlin.h"
21+
#ifdef SDSUPPORT
2022
#ifndef SdVolume_h
2123
#define SdVolume_h
2224
/**
@@ -209,3 +211,4 @@ class SdVolume {
209211
#endif // ALLOW_DEPRECATED_FUNCTIONS
210212
};
211213
#endif // SdVolume
214+
#endif

0 commit comments

Comments
 (0)