⚡️ Optimize Sensitive Pins array (except STM32) (#22080)
This commit is contained in:
@@ -282,8 +282,15 @@ bool wait_for_heatup = true;
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wnarrowing"
|
||||
|
||||
#ifdef RUNTIME_ONLY_ANALOG_TO_DIGITAL
|
||||
static const pin_t sensitive_pins[] PROGMEM = { SENSITIVE_PINS };
|
||||
#else
|
||||
template <pin_t ...D>
|
||||
constexpr pin_t OnlyPins<-2, D...>::table[sizeof...(D)];
|
||||
#define sensitive_pins OnlyPins<SENSITIVE_PINS>::table
|
||||
#endif
|
||||
|
||||
bool pin_is_protected(const pin_t pin) {
|
||||
static const pin_t sensitive_pins[] PROGMEM = SENSITIVE_PINS;
|
||||
LOOP_L_N(i, COUNT(sensitive_pins)) {
|
||||
pin_t sensitive_pin;
|
||||
memcpy_P(&sensitive_pin, &sensitive_pins[i], sizeof(pin_t));
|
||||
|
||||
Reference in New Issue
Block a user