Browse Source

Cleanup narrowing warning in pin_is_protected

pull/1/head
Thomas Moore 7 years ago
parent
commit
5f9592a523
  1. 4
      Marlin/src/HAL/HAL_LPC1768/pinmapping.cpp
  2. 4
      Marlin/src/HAL/HAL_LPC1768/pinmapping.h
  3. 15
      Marlin/src/pins/pins.h

4
Marlin/src/HAL/HAL_LPC1768/pinmapping.cpp

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

4
Marlin/src/HAL/HAL_LPC1768/pinmapping.h

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

15
Marlin/src/pins/pins.h

@ -485,9 +485,6 @@
#define MAX_EXTRUDERS 5 #define MAX_EXTRUDERS 5
#endif #endif
// Marlin needs to account for pins that equal -1
#define marlinAnalogInputToDigitalPin(p) ((p) == -1 ? -1 : analogInputToDigitalPin(p))
// //
// Assign auto fan pins if needed // Assign auto fan pins if needed
// //
@ -541,7 +538,7 @@
#endif // EXTRUDERS > 2 #endif // EXTRUDERS > 2
#endif // EXTRUDERS > 1 #endif // EXTRUDERS > 1
#define _H0_PINS HEATER_0_PIN, E0_AUTO_FAN_PIN, marlinAnalogInputToDigitalPin(TEMP_0_PIN), #define _H0_PINS HEATER_0_PIN, E0_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_0_PIN),
#define _H1_PINS #define _H1_PINS
#define _H2_PINS #define _H2_PINS
#define _H3_PINS #define _H3_PINS
@ -549,16 +546,16 @@
#if HOTENDS > 1 #if HOTENDS > 1
#undef _H1_PINS #undef _H1_PINS
#define _H1_PINS HEATER_1_PIN, E1_AUTO_FAN_PIN, marlinAnalogInputToDigitalPin(TEMP_1_PIN), #define _H1_PINS HEATER_1_PIN, E1_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_1_PIN),
#if HOTENDS > 2 #if HOTENDS > 2
#undef _H2_PINS #undef _H2_PINS
#define _H2_PINS HEATER_2_PIN, E2_AUTO_FAN_PIN, marlinAnalogInputToDigitalPin(TEMP_2_PIN), #define _H2_PINS HEATER_2_PIN, E2_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_2_PIN),
#if HOTENDS > 3 #if HOTENDS > 3
#undef _H3_PINS #undef _H3_PINS
#define _H3_PINS HEATER_3_PIN, E3_AUTO_FAN_PIN, marlinAnalogInputToDigitalPin(TEMP_3_PIN), #define _H3_PINS HEATER_3_PIN, E3_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_3_PIN),
#if HOTENDS > 4 #if HOTENDS > 4
#undef _H4_PINS #undef _H4_PINS
#define _H4_PINS HEATER_4_PIN, marlinAnalogInputToDigitalPin(TEMP_4_PIN), #define _H4_PINS HEATER_4_PIN, analogInputToDigitalPin(TEMP_4_PIN),
#endif // HOTENDS > 4 #endif // HOTENDS > 4
#endif // HOTENDS > 3 #endif // HOTENDS > 3
#endif // HOTENDS > 2 #endif // HOTENDS > 2
@ -579,7 +576,7 @@
#endif // MIXING_STEPPERS > 2 #endif // MIXING_STEPPERS > 2
#endif // MIXING_STEPPERS > 1 #endif // MIXING_STEPPERS > 1
#define BED_PINS HEATER_BED_PIN, marlinAnalogInputToDigitalPin(TEMP_BED_PIN), #define BED_PINS HEATER_BED_PIN, analogInputToDigitalPin(TEMP_BED_PIN),
// //
// Assign endstop pins for boards with only 3 connectors // Assign endstop pins for boards with only 3 connectors

Loading…
Cancel
Save