Browse Source

Save over 100 bytes SRAM in pin_is_protected

pull/1/head
Scott Lahteine 8 years ago
parent
commit
97e13a30ba
  1. 10
      Marlin/Marlin_main.cpp

10
Marlin/Marlin_main.cpp

@ -660,8 +660,8 @@ static bool send_ok[BUFSIZE];
#define host_keepalive() NOOP #define host_keepalive() NOOP
#endif #endif
static inline float pgm_read_any(const float *p) { return pgm_read_float_near(p); } FORCE_INLINE float pgm_read_any(const float *p) { return pgm_read_float_near(p); }
static inline signed char pgm_read_any(const signed char *p) { return pgm_read_byte_near(p); } FORCE_INLINE signed char pgm_read_any(const signed char *p) { return pgm_read_byte_near(p); }
#define XYZ_CONSTS_FROM_CONFIG(type, array, CONFIG) \ #define XYZ_CONSTS_FROM_CONFIG(type, array, CONFIG) \
static const PROGMEM type array##_P[XYZ] = { X_##CONFIG, Y_##CONFIG, Z_##CONFIG }; \ static const PROGMEM type array##_P[XYZ] = { X_##CONFIG, Y_##CONFIG, Z_##CONFIG }; \
@ -6270,10 +6270,10 @@ inline void gcode_M31() {
/** /**
* Sensitive pin test for M42, M226 * Sensitive pin test for M42, M226
*/ */
static bool pin_is_protected(uint8_t pin) { static bool pin_is_protected(const int8_t pin) {
static const int sensitive_pins[] = SENSITIVE_PINS; static const int8_t sensitive_pins[] PROGMEM = SENSITIVE_PINS;
for (uint8_t i = 0; i < COUNT(sensitive_pins); i++) for (uint8_t i = 0; i < COUNT(sensitive_pins); i++)
if (sensitive_pins[i] == pin) return true; if (pin == (int8_t)pgm_read_byte(&sensitive_pins[i])) return true;
return false; return false;
} }

Loading…
Cancel
Save