Browse Source

Save over 100 bytes SRAM in pin_is_protected

Scott Lahteine 8 years ago
parent
commit
97e13a30ba
1 changed files with 5 additions and 5 deletions
  1. 5
    5
      Marlin/Marlin_main.cpp

+ 5
- 5
Marlin/Marlin_main.cpp View File

660
   #define host_keepalive() NOOP
660
   #define host_keepalive() NOOP
661
 #endif
661
 #endif
662
 
662
 
663
-static inline float pgm_read_any(const float *p) { return pgm_read_float_near(p); }
664
-static inline signed char pgm_read_any(const signed char *p) { return pgm_read_byte_near(p); }
663
+FORCE_INLINE float pgm_read_any(const float *p) { return pgm_read_float_near(p); }
664
+FORCE_INLINE signed char pgm_read_any(const signed char *p) { return pgm_read_byte_near(p); }
665
 
665
 
666
 #define XYZ_CONSTS_FROM_CONFIG(type, array, CONFIG) \
666
 #define XYZ_CONSTS_FROM_CONFIG(type, array, CONFIG) \
667
   static const PROGMEM type array##_P[XYZ] = { X_##CONFIG, Y_##CONFIG, Z_##CONFIG }; \
667
   static const PROGMEM type array##_P[XYZ] = { X_##CONFIG, Y_##CONFIG, Z_##CONFIG }; \
6270
 /**
6270
 /**
6271
  * Sensitive pin test for M42, M226
6271
  * Sensitive pin test for M42, M226
6272
  */
6272
  */
6273
-static bool pin_is_protected(uint8_t pin) {
6274
-  static const int sensitive_pins[] = SENSITIVE_PINS;
6273
+static bool pin_is_protected(const int8_t pin) {
6274
+  static const int8_t sensitive_pins[] PROGMEM = SENSITIVE_PINS;
6275
   for (uint8_t i = 0; i < COUNT(sensitive_pins); i++)
6275
   for (uint8_t i = 0; i < COUNT(sensitive_pins); i++)
6276
-    if (sensitive_pins[i] == pin) return true;
6276
+    if (pin == (int8_t)pgm_read_byte(&sensitive_pins[i])) return true;
6277
   return false;
6277
   return false;
6278
 }
6278
 }
6279
 
6279
 

Loading…
Cancel
Save