Save over 100 bytes SRAM in pin_is_protected

This commit is contained in:
Scott Lahteine 2017-06-05 18:32:14 -05:00
parent 45c74406cf
commit 97e13a30ba

View file

@ -660,8 +660,8 @@ static bool send_ok[BUFSIZE];
#define host_keepalive() NOOP
#endif
static 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 float pgm_read_any(const float *p) { return pgm_read_float_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) \
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
*/
static bool pin_is_protected(uint8_t pin) {
static const int sensitive_pins[] = SENSITIVE_PINS;
static bool pin_is_protected(const int8_t pin) {
static const int8_t sensitive_pins[] PROGMEM = SENSITIVE_PINS;
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;
}