diff --git a/code/espurna/button.ino b/code/espurna/button.ino index e45b5e11..3bb70e79 100644 --- a/code/espurna/button.ino +++ b/code/espurna/button.ino @@ -159,12 +159,16 @@ void buttonSetup() { #if defined(ITEAD_SONOFF_DUAL) + _buttons.reserve(3); + buttonAdd(GPIO_NONE, BUTTON_PUSHBUTTON, 0, _buttonRelay(0)); buttonAdd(GPIO_NONE, BUTTON_PUSHBUTTON, 0, _buttonRelay(1)); buttonAdd(GPIO_NONE, BUTTON_PUSHBUTTON, 0, _buttonRelay(2)); #elif defined(FOXEL_LIGHTFOX_DUAL) + _buttons.reserve(4); + const auto actions = _buttonConstructActions( BUTTON_MODE_NONE, BUTTON_MODE_TOGGLE, BUTTON_MODE_NONE, BUTTON_MODE_NONE, BUTTON_MODE_NONE, BUTTON_MODE_NONE @@ -208,6 +212,8 @@ void buttonSetup() { ++buttons; #endif + _buttons.reserve(buttons); + // TODO: load based on index button_t::DebounceDelay = getSetting("btnDebounce", BUTTON_DEBOUNCE_DELAY); button_t::DblclickDelay = getSetting("btnDelay", BUTTON_DBLCLICK_DELAY);