|
@@ -282,19 +282,22 @@ bool wait_for_heatup = true;
|
282
|
282
|
#pragma GCC diagnostic push
|
283
|
283
|
#pragma GCC diagnostic ignored "-Wnarrowing"
|
284
|
284
|
|
285
|
|
-#ifdef RUNTIME_ONLY_ANALOG_TO_DIGITAL
|
286
|
|
- static const pin_t sensitive_pins[] PROGMEM = { SENSITIVE_PINS };
|
287
|
|
-#else
|
|
285
|
+#ifndef RUNTIME_ONLY_ANALOG_TO_DIGITAL
|
288
|
286
|
template <pin_t ...D>
|
289
|
|
- constexpr pin_t OnlyPins<-2, D...>::table[sizeof...(D)];
|
290
|
|
- #define sensitive_pins OnlyPins<SENSITIVE_PINS>::table
|
|
287
|
+ constexpr pin_t OnlyPins<_SP_END, D...>::table[sizeof...(D)];
|
291
|
288
|
#endif
|
292
|
289
|
|
293
|
290
|
bool pin_is_protected(const pin_t pin) {
|
294
|
|
- LOOP_L_N(i, COUNT(sensitive_pins)) {
|
295
|
|
- pin_t sensitive_pin;
|
296
|
|
- memcpy_P(&sensitive_pin, &sensitive_pins[i], sizeof(pin_t));
|
297
|
|
- if (pin == sensitive_pin) return true;
|
|
291
|
+ #ifdef RUNTIME_ONLY_ANALOG_TO_DIGITAL
|
|
292
|
+ static const pin_t sensitive_pins[] PROGMEM = { SENSITIVE_PINS };
|
|
293
|
+ const size_t pincount = COUNT(sensitive_pins);
|
|
294
|
+ #else
|
|
295
|
+ static constexpr size_t pincount = OnlyPins<SENSITIVE_PINS>::size;
|
|
296
|
+ static const pin_t (&sensitive_pins)[pincount] PROGMEM = OnlyPins<SENSITIVE_PINS>::table;
|
|
297
|
+ #endif
|
|
298
|
+ LOOP_L_N(i, pincount) {
|
|
299
|
+ const pin_t * const pptr = &sensitive_pins[i];
|
|
300
|
+ if (pin == (sizeof(pin_t) == 2 ? (pin_t)pgm_read_word(pptr) : (pin_t)pgm_read_byte(pptr))) return true;
|
298
|
301
|
}
|
299
|
302
|
return false;
|
300
|
303
|
}
|