Browse Source

Merge pull request #8554 from tcm0116/2.0.x-cleanup

[2.0.x] Fix for #8525 and other cleanup
Scott Lahteine 7 years ago
parent
commit
7576ad7fc2
No account linked to committer's email address

+ 0
- 4
Marlin/src/HAL/HAL_AVR/fastio_AVR.h View File

55
   #error "Pins for this chip not defined in Arduino.h! If you have a working pins definition, please contribute!"
55
   #error "Pins for this chip not defined in Arduino.h! If you have a working pins definition, please contribute!"
56
 #endif
56
 #endif
57
 
57
 
58
-#ifndef _BV
59
-  #define _BV(bit) (1UL << (bit))
60
-#endif
61
-
62
 /**
58
 /**
63
  * Magic I/O routines
59
  * Magic I/O routines
64
  *
60
  *

+ 0
- 2
Marlin/src/HAL/HAL_DUE/HAL_Due.h View File

53
   #define MYSERIAL customizedSerial
53
   #define MYSERIAL customizedSerial
54
 #endif
54
 #endif
55
 
55
 
56
-#define _BV(bit) (1 << (bit))
57
-
58
 // We need the previous define before the include, or compilation bombs...
56
 // We need the previous define before the include, or compilation bombs...
59
 #include "MarlinSerial_Due.h"
57
 #include "MarlinSerial_Due.h"
60
 
58
 

+ 0
- 2
Marlin/src/HAL/HAL_LPC1768/include/arduino.h View File

38
 #define OUTPUT       0x01
38
 #define OUTPUT       0x01
39
 #define INPUT_PULLUP 0x02
39
 #define INPUT_PULLUP 0x02
40
 
40
 
41
-#define _BV(bit) (1 << (bit))
42
-
43
 #define E2END 0xFFF // EEPROM end address
41
 #define E2END 0xFFF // EEPROM end address
44
 
42
 
45
 typedef uint8_t byte;
43
 typedef uint8_t byte;

+ 2
- 2
Marlin/src/HAL/HAL_LPC1768/pinmapping.cpp View File

27
 #include "../../gcode/parser.h"
27
 #include "../../gcode/parser.h"
28
 
28
 
29
 // Get the digital pin for an analog index
29
 // Get the digital pin for an analog index
30
-pin_t analogInputToDigitalPin(const uint8_t p) {
31
-  return (p < COUNT(adc_pin_table) ? adc_pin_table[p] : P_NC);
30
+pin_t analogInputToDigitalPin(const int8_t p) {
31
+  return (WITHIN(p, 0, NUM_ANALOG_INPUTS) ? adc_pin_table[p] : P_NC);
32
 }
32
 }
33
 
33
 
34
 // Return the index of a pin number
34
 // Return the index of a pin number

+ 2
- 2
Marlin/src/HAL/HAL_LPC1768/pinmapping.h View File

239
   P_NC,  P_NC,  P_NC,  P_NC,  P4_28, P4_29, P_NC,  P_NC
239
   P_NC,  P_NC,  P_NC,  P_NC,  P4_28, P4_29, P_NC,  P_NC
240
 };
240
 };
241
 
241
 
242
-constexpr int16_t NUM_DIGITAL_PINS = COUNT(pin_map);
242
+constexpr int8_t NUM_DIGITAL_PINS = COUNT(pin_map);
243
 
243
 
244
 constexpr pin_t adc_pin_table[] = {
244
 constexpr pin_t adc_pin_table[] = {
245
   P0_23, P0_24, P0_25, P0_26, P1_30, P1_31,
245
   P0_23, P0_24, P0_25, P0_26, P1_30, P1_31,
255
 #define HAL_SENSITIVE_PINS P0_06, P0_07, P0_08, P0_09, P0_29, P0_30
255
 #define HAL_SENSITIVE_PINS P0_06, P0_07, P0_08, P0_09, P0_29, P0_30
256
 
256
 
257
 // Get the digital pin for an analog index
257
 // Get the digital pin for an analog index
258
-pin_t analogInputToDigitalPin(const uint8_t p);
258
+pin_t analogInputToDigitalPin(const int8_t p);
259
 
259
 
260
 // Return the index of a pin number
260
 // Return the index of a pin number
261
 // The pin number given here is in the form ppp:nnnnn
261
 // The pin number given here is in the form ppp:nnnnn

+ 0
- 2
Marlin/src/HAL/HAL_STM32F1/HAL_Stm32f1.h View File

77
   #define MYSERIAL Serial3
77
   #define MYSERIAL Serial3
78
 #endif
78
 #endif
79
 
79
 
80
-#define _BV(bit) 	(1 << (bit))
81
-
82
 /**
80
 /**
83
  * TODO: review this to return 1 for pins that are not analog input
81
  * TODO: review this to return 1 for pins that are not analog input
84
  */
82
  */

+ 3
- 0
Marlin/src/HAL/HAL_TEENSY35_36/HAL_Teensy.h View File

30
 // Includes
30
 // Includes
31
 // --------------------------------------------------------------------------
31
 // --------------------------------------------------------------------------
32
 
32
 
33
+// _BV is re-defined in Arduino.h
34
+#undef _BV
35
+
33
 #include <Arduino.h>
36
 #include <Arduino.h>
34
 
37
 
35
 // Redefine sq macro defined by teensy3/wiring.h
38
 // Redefine sq macro defined by teensy3/wiring.h

+ 1
- 1
Marlin/src/inc/SanityCheck.h View File

637
   , "Please enable only one probe option: PROBE_MANUALLY, FIX_MOUNTED_PROBE, BLTOUCH, SOLENOID_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, or Z Servo."
637
   , "Please enable only one probe option: PROBE_MANUALLY, FIX_MOUNTED_PROBE, BLTOUCH, SOLENOID_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, or Z Servo."
638
 );
638
 );
639
 
639
 
640
-#if HAS_BED_PROBE
640
+#if PROBE_SELECTED && DISABLED(PROBE_MANUALLY)
641
 
641
 
642
   /**
642
   /**
643
    * Z_PROBE_SLED is incompatible with DELTA
643
    * Z_PROBE_SLED is incompatible with DELTA

+ 6
- 9
Marlin/src/pins/pins.h View File

485
   #define MAX_EXTRUDERS 5
485
   #define MAX_EXTRUDERS 5
486
 #endif
486
 #endif
487
 
487
 
488
-// Marlin needs to account for pins that equal -1
489
-#define marlinAnalogInputToDigitalPin(p) ((p) == -1 ? -1 : analogInputToDigitalPin(p))
490
-
491
 //
488
 //
492
 // Assign auto fan pins if needed
489
 // Assign auto fan pins if needed
493
 //
490
 //
541
   #endif // EXTRUDERS > 2
538
   #endif // EXTRUDERS > 2
542
 #endif // EXTRUDERS > 1
539
 #endif // EXTRUDERS > 1
543
 
540
 
544
-#define _H0_PINS HEATER_0_PIN, E0_AUTO_FAN_PIN, marlinAnalogInputToDigitalPin(TEMP_0_PIN),
541
+#define _H0_PINS HEATER_0_PIN, E0_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_0_PIN),
545
 #define _H1_PINS
542
 #define _H1_PINS
546
 #define _H2_PINS
543
 #define _H2_PINS
547
 #define _H3_PINS
544
 #define _H3_PINS
549
 
546
 
550
 #if HOTENDS > 1
547
 #if HOTENDS > 1
551
   #undef _H1_PINS
548
   #undef _H1_PINS
552
-  #define _H1_PINS HEATER_1_PIN, E1_AUTO_FAN_PIN, marlinAnalogInputToDigitalPin(TEMP_1_PIN),
549
+  #define _H1_PINS HEATER_1_PIN, E1_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_1_PIN),
553
   #if HOTENDS > 2
550
   #if HOTENDS > 2
554
     #undef _H2_PINS
551
     #undef _H2_PINS
555
-    #define _H2_PINS HEATER_2_PIN, E2_AUTO_FAN_PIN, marlinAnalogInputToDigitalPin(TEMP_2_PIN),
552
+    #define _H2_PINS HEATER_2_PIN, E2_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_2_PIN),
556
     #if HOTENDS > 3
553
     #if HOTENDS > 3
557
       #undef _H3_PINS
554
       #undef _H3_PINS
558
-      #define _H3_PINS HEATER_3_PIN, E3_AUTO_FAN_PIN, marlinAnalogInputToDigitalPin(TEMP_3_PIN),
555
+      #define _H3_PINS HEATER_3_PIN, E3_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_3_PIN),
559
       #if HOTENDS > 4
556
       #if HOTENDS > 4
560
         #undef _H4_PINS
557
         #undef _H4_PINS
561
-        #define _H4_PINS HEATER_4_PIN, marlinAnalogInputToDigitalPin(TEMP_4_PIN),
558
+        #define _H4_PINS HEATER_4_PIN, analogInputToDigitalPin(TEMP_4_PIN),
562
       #endif // HOTENDS > 4
559
       #endif // HOTENDS > 4
563
     #endif // HOTENDS > 3
560
     #endif // HOTENDS > 3
564
   #endif // HOTENDS > 2
561
   #endif // HOTENDS > 2
579
   #endif // MIXING_STEPPERS > 2
576
   #endif // MIXING_STEPPERS > 2
580
 #endif // MIXING_STEPPERS > 1
577
 #endif // MIXING_STEPPERS > 1
581
 
578
 
582
-#define BED_PINS HEATER_BED_PIN, marlinAnalogInputToDigitalPin(TEMP_BED_PIN),
579
+#define BED_PINS HEATER_BED_PIN, analogInputToDigitalPin(TEMP_BED_PIN),
583
 
580
 
584
 //
581
 //
585
 // Assign endstop pins for boards with only 3 connectors
582
 // Assign endstop pins for boards with only 3 connectors

Loading…
Cancel
Save