Browse Source

Merge Part 5 (PR#2557)

Richard Wackerbarth 9 years ago
parent
commit
d3532bd2a6

+ 1
- 1
Marlin/MarlinSerial.cpp View File

287
 #endif // !USBCON
287
 #endif // !USBCON
288
 
288
 
289
 // For AT90USB targets use the UART for BT interfacing
289
 // For AT90USB targets use the UART for BT interfacing
290
-#if defined(USBCON) && defined(BTENABLED)
290
+#if defined(USBCON) && ENABLED(BTENABLED)
291
   HardwareSerial bt;
291
   HardwareSerial bt;
292
 #endif
292
 #endif

+ 1
- 1
Marlin/MarlinSerial.h View File

153
 #endif // !USBCON
153
 #endif // !USBCON
154
 
154
 
155
 // Use the UART for BT in AT90USB configurations
155
 // Use the UART for BT in AT90USB configurations
156
-#if defined(USBCON) && defined(BTENABLED)
156
+#if defined(USBCON) && ENABLED(BTENABLED)
157
   extern HardwareSerial bt;
157
   extern HardwareSerial bt;
158
 #endif
158
 #endif
159
 
159
 

+ 8
- 8
Marlin/Sd2Card.cpp View File

19
  */
19
  */
20
 #include "Marlin.h"
20
 #include "Marlin.h"
21
 
21
 
22
-#ifdef SDSUPPORT
22
+#if ENABLED(SDSUPPORT)
23
 #include "Sd2Card.h"
23
 #include "Sd2Card.h"
24
 //------------------------------------------------------------------------------
24
 //------------------------------------------------------------------------------
25
-#ifndef SOFTWARE_SPI
25
+#if DISABLED(SOFTWARE_SPI)
26
 // functions for hardware SPI
26
 // functions for hardware SPI
27
 //------------------------------------------------------------------------------
27
 //------------------------------------------------------------------------------
28
 // make sure SPCR rate is in expected bits
28
 // make sure SPCR rate is in expected bits
209
 }
209
 }
210
 //------------------------------------------------------------------------------
210
 //------------------------------------------------------------------------------
211
 void Sd2Card::chipSelectLow() {
211
 void Sd2Card::chipSelectLow() {
212
-#ifndef SOFTWARE_SPI
212
+#if DISABLED(SOFTWARE_SPI)
213
   spiInit(spiRate_);
213
   spiInit(spiRate_);
214
 #endif  // SOFTWARE_SPI
214
 #endif  // SOFTWARE_SPI
215
   digitalWrite(chipSelectPin_, LOW);
215
   digitalWrite(chipSelectPin_, LOW);
297
   pinMode(SPI_MOSI_PIN, OUTPUT);
297
   pinMode(SPI_MOSI_PIN, OUTPUT);
298
   pinMode(SPI_SCK_PIN, OUTPUT);
298
   pinMode(SPI_SCK_PIN, OUTPUT);
299
 
299
 
300
-#ifndef SOFTWARE_SPI
300
+#if DISABLED(SOFTWARE_SPI)
301
   // SS must be in output mode even it is not chip select
301
   // SS must be in output mode even it is not chip select
302
   pinMode(SS_PIN, OUTPUT);
302
   pinMode(SS_PIN, OUTPUT);
303
   // set SS high - may be chip select for another SPI device
303
   // set SS high - may be chip select for another SPI device
353
   }
353
   }
354
   chipSelectHigh();
354
   chipSelectHigh();
355
 
355
 
356
-#ifndef SOFTWARE_SPI
356
+#if DISABLED(SOFTWARE_SPI)
357
   return setSckRate(sckRateID);
357
   return setSckRate(sckRateID);
358
 #else  // SOFTWARE_SPI
358
 #else  // SOFTWARE_SPI
359
   return true;
359
   return true;
373
  * the value zero, false, is returned for failure.
373
  * the value zero, false, is returned for failure.
374
  */
374
  */
375
 bool Sd2Card::readBlock(uint32_t blockNumber, uint8_t* dst) {
375
 bool Sd2Card::readBlock(uint32_t blockNumber, uint8_t* dst) {
376
-#ifdef SD_CHECK_AND_RETRY
376
+#if ENABLED(SD_CHECK_AND_RETRY)
377
   uint8_t retryCnt = 3;
377
   uint8_t retryCnt = 3;
378
   // use address if not SDHC card
378
   // use address if not SDHC card
379
   if (type()!= SD_CARD_TYPE_SDHC) blockNumber <<= 9;
379
   if (type()!= SD_CARD_TYPE_SDHC) blockNumber <<= 9;
422
   return readData(dst, 512);
422
   return readData(dst, 512);
423
 }
423
 }
424
 
424
 
425
-#ifdef SD_CHECK_AND_RETRY
425
+#if ENABLED(SD_CHECK_AND_RETRY)
426
 static const uint16_t crctab[] PROGMEM = {
426
 static const uint16_t crctab[] PROGMEM = {
427
   0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7,
427
   0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7,
428
   0x8108, 0x9129, 0xA14A, 0xB16B, 0xC18C, 0xD1AD, 0xE1CE, 0xF1EF,
428
   0x8108, 0x9129, 0xA14A, 0xB16B, 0xC18C, 0xD1AD, 0xE1CE, 0xF1EF,
483
   // transfer data
483
   // transfer data
484
   spiRead(dst, count);
484
   spiRead(dst, count);
485
 
485
 
486
-#ifdef SD_CHECK_AND_RETRY
486
+#if ENABLED(SD_CHECK_AND_RETRY)
487
   {
487
   {
488
     uint16_t calcCrc = CRC_CCITT(dst, count);
488
     uint16_t calcCrc = CRC_CCITT(dst, count);
489
     uint16_t recvCrc = spiRec() << 8;
489
     uint16_t recvCrc = spiRec() << 8;

+ 2
- 2
Marlin/Sd2Card.h View File

19
  */
19
  */
20
 
20
 
21
 #include "Marlin.h"
21
 #include "Marlin.h"
22
-#ifdef SDSUPPORT
22
+#if ENABLED(SDSUPPORT)
23
 
23
 
24
 #ifndef Sd2Card_h
24
 #ifndef Sd2Card_h
25
 #define Sd2Card_h
25
 #define Sd2Card_h
125
 //------------------------------------------------------------------------------
125
 //------------------------------------------------------------------------------
126
 // SPI pin definitions - do not edit here - change in SdFatConfig.h
126
 // SPI pin definitions - do not edit here - change in SdFatConfig.h
127
 //
127
 //
128
-#ifndef SOFTWARE_SPI
128
+#if DISABLED(SOFTWARE_SPI)
129
 // hardware pin defs
129
 // hardware pin defs
130
 /** The default chip select pin for the SD card is SS. */
130
 /** The default chip select pin for the SD card is SS. */
131
 uint8_t const  SD_CHIP_SELECT_PIN = SS_PIN;
131
 uint8_t const  SD_CHIP_SELECT_PIN = SS_PIN;

+ 1
- 1
Marlin/Sd2PinMap.h View File

21
 #include "Marlin.h"
21
 #include "Marlin.h"
22
 #include "macros.h"
22
 #include "macros.h"
23
 
23
 
24
-#ifdef SDSUPPORT
24
+#if ENABLED(SDSUPPORT)
25
 
25
 
26
 #ifndef Sd2PinMap_h
26
 #ifndef Sd2PinMap_h
27
 #define Sd2PinMap_h
27
 #define Sd2PinMap_h

+ 1
- 1
Marlin/SdBaseFile.cpp View File

19
  */
19
  */
20
 
20
 
21
 #include "Marlin.h"
21
 #include "Marlin.h"
22
-#ifdef SDSUPPORT
22
+#if ENABLED(SDSUPPORT)
23
 
23
 
24
 #include "SdBaseFile.h"
24
 #include "SdBaseFile.h"
25
 //------------------------------------------------------------------------------
25
 //------------------------------------------------------------------------------

+ 1
- 1
Marlin/SdBaseFile.h View File

18
  * <http://www.gnu.org/licenses/>.
18
  * <http://www.gnu.org/licenses/>.
19
  */
19
  */
20
 #include "Marlin.h"
20
 #include "Marlin.h"
21
-#ifdef SDSUPPORT
21
+#if ENABLED(SDSUPPORT)
22
 
22
 
23
 #ifndef SdBaseFile_h
23
 #ifndef SdBaseFile_h
24
 #define SdBaseFile_h
24
 #define SdBaseFile_h

+ 1
- 1
Marlin/SdFatConfig.h View File

22
  * \brief configuration definitions
22
  * \brief configuration definitions
23
  */
23
  */
24
 #include "Marlin.h"
24
 #include "Marlin.h"
25
-#ifdef SDSUPPORT
25
+#if ENABLED(SDSUPPORT)
26
 
26
 
27
 #ifndef SdFatConfig_h
27
 #ifndef SdFatConfig_h
28
 #define SdFatConfig_h
28
 #define SdFatConfig_h

+ 1
- 1
Marlin/SdFatStructs.h View File

18
  * <http://www.gnu.org/licenses/>.
18
  * <http://www.gnu.org/licenses/>.
19
  */
19
  */
20
 #include "Marlin.h"
20
 #include "Marlin.h"
21
-#ifdef SDSUPPORT
21
+#if ENABLED(SDSUPPORT)
22
 
22
 
23
 #ifndef SdFatStructs_h
23
 #ifndef SdFatStructs_h
24
 #define SdFatStructs_h
24
 #define SdFatStructs_h

+ 1
- 1
Marlin/SdFatUtil.cpp View File

19
  */
19
  */
20
 #include "Marlin.h"
20
 #include "Marlin.h"
21
 
21
 
22
-#ifdef SDSUPPORT
22
+#if ENABLED(SDSUPPORT)
23
 #include "SdFatUtil.h"
23
 #include "SdFatUtil.h"
24
 
24
 
25
 //------------------------------------------------------------------------------
25
 //------------------------------------------------------------------------------

+ 1
- 1
Marlin/SdFatUtil.h View File

18
  * <http://www.gnu.org/licenses/>.
18
  * <http://www.gnu.org/licenses/>.
19
  */
19
  */
20
 #include "Marlin.h"
20
 #include "Marlin.h"
21
-#ifdef SDSUPPORT
21
+#if ENABLED(SDSUPPORT)
22
 
22
 
23
 #ifndef SdFatUtil_h
23
 #ifndef SdFatUtil_h
24
 #define SdFatUtil_h
24
 #define SdFatUtil_h

+ 1
- 1
Marlin/SdFile.cpp View File

19
  */
19
  */
20
 #include "Marlin.h"
20
 #include "Marlin.h"
21
 
21
 
22
-#ifdef SDSUPPORT
22
+#if ENABLED(SDSUPPORT)
23
 #include "SdFile.h"
23
 #include "SdFile.h"
24
 /**  Create a file object and open it in the current working directory.
24
 /**  Create a file object and open it in the current working directory.
25
  *
25
  *

+ 1
- 1
Marlin/SdFile.h View File

23
  */
23
  */
24
 #include "Marlin.h"
24
 #include "Marlin.h"
25
 
25
 
26
-#ifdef SDSUPPORT
26
+#if ENABLED(SDSUPPORT)
27
 #include "SdBaseFile.h"
27
 #include "SdBaseFile.h"
28
 #include <Print.h>
28
 #include <Print.h>
29
 #ifndef SdFile_h
29
 #ifndef SdFile_h

+ 1
- 1
Marlin/SdInfo.h View File

18
  * <http://www.gnu.org/licenses/>.
18
  * <http://www.gnu.org/licenses/>.
19
  */
19
  */
20
 #include "Marlin.h"
20
 #include "Marlin.h"
21
-#ifdef SDSUPPORT
21
+#if ENABLED(SDSUPPORT)
22
 
22
 
23
 #ifndef SdInfo_h
23
 #ifndef SdInfo_h
24
 #define SdInfo_h
24
 #define SdInfo_h

+ 1
- 1
Marlin/SdVolume.cpp View File

18
  * <http://www.gnu.org/licenses/>.
18
  * <http://www.gnu.org/licenses/>.
19
  */
19
  */
20
 #include "Marlin.h"
20
 #include "Marlin.h"
21
-#ifdef SDSUPPORT
21
+#if ENABLED(SDSUPPORT)
22
 
22
 
23
 #include "SdVolume.h"
23
 #include "SdVolume.h"
24
 //------------------------------------------------------------------------------
24
 //------------------------------------------------------------------------------

+ 1
- 1
Marlin/SdVolume.h View File

18
  * <http://www.gnu.org/licenses/>.
18
  * <http://www.gnu.org/licenses/>.
19
  */
19
  */
20
 #include "Marlin.h"
20
 #include "Marlin.h"
21
-#ifdef SDSUPPORT
21
+#if ENABLED(SDSUPPORT)
22
 #ifndef SdVolume_h
22
 #ifndef SdVolume_h
23
 #define SdVolume_h
23
 #define SdVolume_h
24
 /**
24
 /**

+ 2
- 1
Marlin/blinkm.cpp View File

3
   Created by Tim Koster, August 21 2013.
3
   Created by Tim Koster, August 21 2013.
4
 */
4
 */
5
 #include "Marlin.h"
5
 #include "Marlin.h"
6
-#ifdef BLINKM
6
+
7
+#if ENABLED(BLINKM)
7
 
8
 
8
 #include "blinkm.h"
9
 #include "blinkm.h"
9
 
10
 

+ 1
- 1
Marlin/buzzer.cpp View File

5
 #if HAS_BUZZER
5
 #if HAS_BUZZER
6
   void buzz(long duration, uint16_t freq) {
6
   void buzz(long duration, uint16_t freq) {
7
     if (freq > 0) {
7
     if (freq > 0) {
8
-      #ifdef LCD_USE_I2C_BUZZER
8
+      #if ENABLED(LCD_USE_I2C_BUZZER)
9
         lcd_buzz(duration, freq);
9
         lcd_buzz(duration, freq);
10
       #elif defined(BEEPER) && BEEPER >= 0 // on-board buzzers have no further condition
10
       #elif defined(BEEPER) && BEEPER >= 0 // on-board buzzers have no further condition
11
         SET_OUTPUT(BEEPER);
11
         SET_OUTPUT(BEEPER);

+ 3
- 3
Marlin/cardreader.cpp View File

5
 #include "temperature.h"
5
 #include "temperature.h"
6
 #include "language.h"
6
 #include "language.h"
7
 
7
 
8
-#ifdef SDSUPPORT
8
+#if ENABLED(SDSUPPORT)
9
 
9
 
10
 CardReader::CardReader() {
10
 CardReader::CardReader() {
11
   filesize = 0;
11
   filesize = 0;
128
   lsDive("", root);
128
   lsDive("", root);
129
 }
129
 }
130
 
130
 
131
-#ifdef LONG_FILENAME_HOST_SUPPORT
131
+#if ENABLED(LONG_FILENAME_HOST_SUPPORT)
132
 
132
 
133
   /**
133
   /**
134
    * Get a long pretty path based on a DOS 8.3 path
134
    * Get a long pretty path based on a DOS 8.3 path
195
   cardOK = false;
195
   cardOK = false;
196
   if (root.isOpen()) root.close();
196
   if (root.isOpen()) root.close();
197
 
197
 
198
-  #ifdef SDSLOW
198
+  #if ENABLED(SDSLOW)
199
     #define SPI_SPEED SPI_HALF_SPEED
199
     #define SPI_SPEED SPI_HALF_SPEED
200
   #else
200
   #else
201
     #define SPI_SPEED SPI_FULL_SPEED
201
     #define SPI_SPEED SPI_FULL_SPEED

+ 3
- 3
Marlin/cardreader.h View File

1
 #ifndef CARDREADER_H
1
 #ifndef CARDREADER_H
2
 #define CARDREADER_H
2
 #define CARDREADER_H
3
 
3
 
4
-#ifdef SDSUPPORT
4
+#if ENABLED(SDSUPPORT)
5
 
5
 
6
 #define MAX_DIR_DEPTH 10          // Maximum folder depth
6
 #define MAX_DIR_DEPTH 10          // Maximum folder depth
7
 
7
 
28
   void getStatus();
28
   void getStatus();
29
   void printingHasFinished();
29
   void printingHasFinished();
30
 
30
 
31
-  #ifdef LONG_FILENAME_HOST_SUPPORT
31
+  #if ENABLED(LONG_FILENAME_HOST_SUPPORT)
32
     void printLongPath(char *path);
32
     void printLongPath(char *path);
33
   #endif
33
   #endif
34
 
34
 
82
 #define IS_SD_PRINTING (card.sdprinting)
82
 #define IS_SD_PRINTING (card.sdprinting)
83
 
83
 
84
 #if (SDCARDDETECT > -1)
84
 #if (SDCARDDETECT > -1)
85
-  #ifdef SDCARDDETECTINVERTED
85
+  #if ENABLED(SDCARDDETECTINVERTED)
86
     #define IS_SD_INSERTED (READ(SDCARDDETECT) != 0)
86
     #define IS_SD_INSERTED (READ(SDCARDDETECT) != 0)
87
   #else
87
   #else
88
     #define IS_SD_INSERTED (READ(SDCARDDETECT) == 0)
88
     #define IS_SD_INSERTED (READ(SDCARDDETECT) == 0)

+ 2
- 2
Marlin/configurator/config/language.h View File

37
   #define LANGUAGE_INCLUDE GENERATE_LANGUAGE_INCLUDE(en)
37
   #define LANGUAGE_INCLUDE GENERATE_LANGUAGE_INCLUDE(en)
38
 #endif
38
 #endif
39
 
39
 
40
-#ifdef HAS_AUTOMATIC_VERSIONING
40
+#if ENABLED(HAS_AUTOMATIC_VERSIONING)
41
   #include "_Version.h"
41
   #include "_Version.h"
42
 #endif
42
 #endif
43
 
43
 
216
 
216
 
217
 // LCD Menu Messages
217
 // LCD Menu Messages
218
 
218
 
219
-#if !(defined( DISPLAY_CHARSET_HD44780_JAPAN ) || defined( DISPLAY_CHARSET_HD44780_WESTERN ) || defined( DISPLAY_CHARSET_HD44780_CYRILLIC ))
219
+#if DISABLED(DISPLAY_CHARSET_HD44780_JAPAN) && DISABLED(DISPLAY_CHARSET_HD44780_WESTERN) && DISABLED(DISPLAY_CHARSET_HD44780_CYRILLIC)
220
   #define DISPLAY_CHARSET_HD44780_JAPAN
220
   #define DISPLAY_CHARSET_HD44780_JAPAN
221
 #endif
221
 #endif
222
 
222
 

+ 1
- 1
Marlin/digipot_mcp4451.cpp View File

1
 #include "Configuration.h"
1
 #include "Configuration.h"
2
 
2
 
3
-#ifdef DIGIPOT_I2C
3
+#if ENABLED(DIGIPOT_I2C)
4
 
4
 
5
 #include "Stream.h"
5
 #include "Stream.h"
6
 #include "utility/twi.h"
6
 #include "utility/twi.h"

+ 1
- 1
Marlin/dogm_bitmaps.h View File

3
 // Please note that using the high-res version takes 402Bytes of PROGMEM. 
3
 // Please note that using the high-res version takes 402Bytes of PROGMEM. 
4
 //#define START_BMPHIGH
4
 //#define START_BMPHIGH
5
 
5
 
6
-#ifdef START_BMPHIGH
6
+#if ENABLED(START_BMPHIGH)
7
   #define START_BMPWIDTH      112
7
   #define START_BMPWIDTH      112
8
   #define START_BMPHEIGHT      38
8
   #define START_BMPHEIGHT      38
9
   #define START_BMPBYTEWIDTH   14
9
   #define START_BMPBYTEWIDTH   14

+ 1
- 1
Marlin/mesh_bed_leveling.cpp View File

1
 #include "mesh_bed_leveling.h"
1
 #include "mesh_bed_leveling.h"
2
 
2
 
3
-#ifdef MESH_BED_LEVELING
3
+#if ENABLED(MESH_BED_LEVELING)
4
 
4
 
5
   mesh_bed_leveling mbl;
5
   mesh_bed_leveling mbl;
6
 
6
 

+ 1
- 1
Marlin/mesh_bed_leveling.h View File

1
 #include "Marlin.h"
1
 #include "Marlin.h"
2
 
2
 
3
-#ifdef MESH_BED_LEVELING
3
+#if ENABLED(MESH_BED_LEVELING)
4
 
4
 
5
   #define MESH_X_DIST ((MESH_MAX_X - MESH_MIN_X)/(MESH_NUM_X_POINTS - 1))
5
   #define MESH_X_DIST ((MESH_MAX_X - MESH_MIN_X)/(MESH_NUM_X_POINTS - 1))
6
   #define MESH_Y_DIST ((MESH_MAX_Y - MESH_MIN_Y)/(MESH_NUM_Y_POINTS - 1))
6
   #define MESH_Y_DIST ((MESH_MAX_Y - MESH_MIN_Y)/(MESH_NUM_Y_POINTS - 1))

+ 1
- 1
Marlin/qr_solve.cpp View File

1
 #include "qr_solve.h"
1
 #include "qr_solve.h"
2
 
2
 
3
-#ifdef AUTO_BED_LEVELING_GRID
3
+#if ENABLED(AUTO_BED_LEVELING_GRID)
4
 
4
 
5
 #include <stdlib.h>
5
 #include <stdlib.h>
6
 #include <math.h>
6
 #include <math.h>

+ 1
- 1
Marlin/qr_solve.h View File

1
 #include "Configuration.h"
1
 #include "Configuration.h"
2
 
2
 
3
-#ifdef AUTO_BED_LEVELING_GRID
3
+#if ENABLED(AUTO_BED_LEVELING_GRID)
4
 
4
 
5
 void daxpy ( int n, double da, double dx[], int incx, double dy[], int incy );
5
 void daxpy ( int n, double da, double dx[], int incx, double dy[], int incy );
6
 double ddot ( int n, double dx[], int incx, double dy[], int incy );
6
 double ddot ( int n, double dx[], int incx, double dy[], int incy );

+ 12
- 12
Marlin/servo.cpp View File

42
  attached()  - Returns true if there is a servo attached.
42
  attached()  - Returns true if there is a servo attached.
43
  detach()    - Stops an attached servos from pulsing its i/o pin.
43
  detach()    - Stops an attached servos from pulsing its i/o pin.
44
 
44
 
45
- */
45
+*/
46
 #include "Configuration.h" 
46
 #include "Configuration.h" 
47
 
47
 
48
-#ifdef NUM_SERVOS
48
+#if HAS_SERVOS
49
 
49
 
50
 #include <avr/interrupt.h>
50
 #include <avr/interrupt.h>
51
 #include <Arduino.h>
51
 #include <Arduino.h>
103
 #ifndef WIRING // Wiring pre-defines signal handlers so don't define any if compiling for the Wiring platform
103
 #ifndef WIRING // Wiring pre-defines signal handlers so don't define any if compiling for the Wiring platform
104
 
104
 
105
   // Interrupt handlers for Arduino
105
   // Interrupt handlers for Arduino
106
-  #ifdef _useTimer1
106
+  #if ENABLED(_useTimer1)
107
     SIGNAL (TIMER1_COMPA_vect) { handle_interrupts(_timer1, &TCNT1, &OCR1A); }
107
     SIGNAL (TIMER1_COMPA_vect) { handle_interrupts(_timer1, &TCNT1, &OCR1A); }
108
   #endif
108
   #endif
109
 
109
 
110
-  #ifdef _useTimer3
110
+  #if ENABLED(_useTimer3)
111
     SIGNAL (TIMER3_COMPA_vect) { handle_interrupts(_timer3, &TCNT3, &OCR3A); }
111
     SIGNAL (TIMER3_COMPA_vect) { handle_interrupts(_timer3, &TCNT3, &OCR3A); }
112
   #endif
112
   #endif
113
 
113
 
114
-  #ifdef _useTimer4
114
+  #if ENABLED(_useTimer4)
115
     SIGNAL (TIMER4_COMPA_vect) { handle_interrupts(_timer4, &TCNT4, &OCR4A); }
115
     SIGNAL (TIMER4_COMPA_vect) { handle_interrupts(_timer4, &TCNT4, &OCR4A); }
116
   #endif
116
   #endif
117
 
117
 
118
-  #ifdef _useTimer5
118
+  #if ENABLED(_useTimer5)
119
     SIGNAL (TIMER5_COMPA_vect) { handle_interrupts(_timer5, &TCNT5, &OCR5A); }
119
     SIGNAL (TIMER5_COMPA_vect) { handle_interrupts(_timer5, &TCNT5, &OCR5A); }
120
   #endif
120
   #endif
121
 
121
 
122
 #else //!WIRING
122
 #else //!WIRING
123
 
123
 
124
   // Interrupt handlers for Wiring
124
   // Interrupt handlers for Wiring
125
-  #ifdef _useTimer1
125
+  #if ENABLED(_useTimer1)
126
     void Timer1Service() { handle_interrupts(_timer1, &TCNT1, &OCR1A); }
126
     void Timer1Service() { handle_interrupts(_timer1, &TCNT1, &OCR1A); }
127
   #endif
127
   #endif
128
-  #ifdef _useTimer3
128
+  #if ENABLED(_useTimer3)
129
     void Timer3Service() { handle_interrupts(_timer3, &TCNT3, &OCR3A); }
129
     void Timer3Service() { handle_interrupts(_timer3, &TCNT3, &OCR3A); }
130
   #endif
130
   #endif
131
 
131
 
133
 
133
 
134
 
134
 
135
 static void initISR(timer16_Sequence_t timer) {
135
 static void initISR(timer16_Sequence_t timer) {
136
-  #ifdef _useTimer1
136
+  #if ENABLED(_useTimer1)
137
     if (timer == _timer1) {
137
     if (timer == _timer1) {
138
       TCCR1A = 0;             // normal counting mode
138
       TCCR1A = 0;             // normal counting mode
139
       TCCR1B = _BV(CS11);     // set prescaler of 8
139
       TCCR1B = _BV(CS11);     // set prescaler of 8
152
     }
152
     }
153
   #endif
153
   #endif
154
 
154
 
155
-  #ifdef _useTimer3
155
+  #if ENABLED(_useTimer3)
156
     if (timer == _timer3) {
156
     if (timer == _timer3) {
157
       TCCR3A = 0;             // normal counting mode
157
       TCCR3A = 0;             // normal counting mode
158
       TCCR3B = _BV(CS31);     // set prescaler of 8
158
       TCCR3B = _BV(CS31);     // set prescaler of 8
170
     }
170
     }
171
   #endif
171
   #endif
172
 
172
 
173
-  #ifdef _useTimer4
173
+  #if ENABLED(_useTimer4)
174
     if (timer == _timer4) {
174
     if (timer == _timer4) {
175
       TCCR4A = 0;             // normal counting mode
175
       TCCR4A = 0;             // normal counting mode
176
       TCCR4B = _BV(CS41);     // set prescaler of 8
176
       TCCR4B = _BV(CS41);     // set prescaler of 8
180
     }
180
     }
181
   #endif
181
   #endif
182
 
182
 
183
-  #ifdef _useTimer5
183
+  #if ENABLED(_useTimer5)
184
     if (timer == _timer5) {
184
     if (timer == _timer5) {
185
       TCCR5A = 0;             // normal counting mode
185
       TCCR5A = 0;             // normal counting mode
186
       TCCR5B = _BV(CS51);     // set prescaler of 8
186
       TCCR5B = _BV(CS51);     // set prescaler of 8

+ 1
- 1
Marlin/ultralcd_st7920_u8glib_rrd.h View File

3
 
3
 
4
 #include "Marlin.h"
4
 #include "Marlin.h"
5
 
5
 
6
-#ifdef U8GLIB_ST7920
6
+#if ENABLED(U8GLIB_ST7920)
7
 
7
 
8
 //set optimization so ARDUINO optimizes this file
8
 //set optimization so ARDUINO optimizes this file
9
 #pragma GCC optimize (3)
9
 #pragma GCC optimize (3)

+ 1
- 1
Marlin/vector_3.cpp View File

19
 #include <math.h>
19
 #include <math.h>
20
 #include "Marlin.h"
20
 #include "Marlin.h"
21
 
21
 
22
-#ifdef ENABLE_AUTO_BED_LEVELING
22
+#if ENABLED(ENABLE_AUTO_BED_LEVELING)
23
 #include "vector_3.h"
23
 #include "vector_3.h"
24
 
24
 
25
 vector_3::vector_3() : x(0), y(0), z(0) { }
25
 vector_3::vector_3() : x(0), y(0), z(0) { }

+ 1
- 1
Marlin/vector_3.h View File

19
 #ifndef VECTOR_3_H
19
 #ifndef VECTOR_3_H
20
 #define VECTOR_3_H
20
 #define VECTOR_3_H
21
 
21
 
22
-#ifdef ENABLE_AUTO_BED_LEVELING
22
+#if ENABLED(ENABLE_AUTO_BED_LEVELING)
23
 class matrix_3x3;
23
 class matrix_3x3;
24
 
24
 
25
 struct vector_3
25
 struct vector_3

+ 5
- 5
Marlin/watchdog.cpp View File

1
 #include "Marlin.h"
1
 #include "Marlin.h"
2
 
2
 
3
-#ifdef USE_WATCHDOG
3
+#if ENABLED(USE_WATCHDOG)
4
 #include <avr/wdt.h>
4
 #include <avr/wdt.h>
5
 
5
 
6
 #include "watchdog.h"
6
 #include "watchdog.h"
18
 /// intialise watch dog with a 4 sec interrupt time
18
 /// intialise watch dog with a 4 sec interrupt time
19
 void watchdog_init()
19
 void watchdog_init()
20
 {
20
 {
21
-#ifdef WATCHDOG_RESET_MANUAL
21
+  #if ENABLED(WATCHDOG_RESET_MANUAL)
22
     //We enable the watchdog timer, but only for the interrupt.
22
     //We enable the watchdog timer, but only for the interrupt.
23
     //Take care, as this requires the correct order of operation, with interrupts disabled. See the datasheet of any AVR chip for details.
23
     //Take care, as this requires the correct order of operation, with interrupts disabled. See the datasheet of any AVR chip for details.
24
     wdt_reset();
24
     wdt_reset();
25
     _WD_CONTROL_REG = _BV(_WD_CHANGE_BIT) | _BV(WDE);
25
     _WD_CONTROL_REG = _BV(_WD_CHANGE_BIT) | _BV(WDE);
26
     _WD_CONTROL_REG = _BV(WDIE) | WDTO_4S;
26
     _WD_CONTROL_REG = _BV(WDIE) | WDTO_4S;
27
-#else
27
+  #else
28
     wdt_enable(WDTO_4S);
28
     wdt_enable(WDTO_4S);
29
-#endif
29
+  #endif
30
 }
30
 }
31
 
31
 
32
 /// reset watchdog. MUST be called every 1s after init or avr will reset.
32
 /// reset watchdog. MUST be called every 1s after init or avr will reset.
40
 //===========================================================================
40
 //===========================================================================
41
 
41
 
42
 //Watchdog timer interrupt, called if main program blocks >1sec and manual reset is enabled.
42
 //Watchdog timer interrupt, called if main program blocks >1sec and manual reset is enabled.
43
-#ifdef WATCHDOG_RESET_MANUAL
43
+#if ENABLED(WATCHDOG_RESET_MANUAL)
44
 ISR(WDT_vect)
44
 ISR(WDT_vect)
45
 { 
45
 { 
46
     SERIAL_ERROR_START;
46
     SERIAL_ERROR_START;

+ 1
- 1
Marlin/watchdog.h View File

3
 
3
 
4
 #include "Marlin.h"
4
 #include "Marlin.h"
5
 
5
 
6
-#ifdef USE_WATCHDOG
6
+#if ENABLED(USE_WATCHDOG)
7
   // initialize watch dog with a 1 sec interrupt time
7
   // initialize watch dog with a 1 sec interrupt time
8
   void watchdog_init();
8
   void watchdog_init();
9
   // pad the dog/reset watchdog. MUST be called at least every second after the first watchdog_init or AVR will go into emergency procedures..
9
   // pad the dog/reset watchdog. MUST be called at least every second after the first watchdog_init or AVR will go into emergency procedures..

Loading…
Cancel
Save