mirror of
https://github.com/wled/WLED.git
synced 2025-07-19 08:46:34 +00:00
Have at least one button defined
This commit is contained in:
parent
e670b26cd0
commit
6c3f4a7c33
@ -421,7 +421,7 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
|
|||||||
for (size_t s = 0; s < WLED_MAX_BUTTONS && s < numPins; s++) {
|
for (size_t s = 0; s < WLED_MAX_BUTTONS && s < numPins; s++) {
|
||||||
type = defTypes[s < numTypes ? s : numTypes - 1]; // use last known type to set current type if types less than pins
|
type = defTypes[s < numTypes ? s : numTypes - 1]; // use last known type to set current type if types less than pins
|
||||||
if (type == BTN_TYPE_NONE || defPins[s] < 0 || !PinManager::allocatePin(defPins[s], false, PinOwner::Button)) {
|
if (type == BTN_TYPE_NONE || defPins[s] < 0 || !PinManager::allocatePin(defPins[s], false, PinOwner::Button)) {
|
||||||
//buttons.emplace_back(-1, BTN_TYPE_NONE); // add disabled button to vector
|
if (buttons.size() == 0) buttons.emplace_back(-1, BTN_TYPE_NONE); // add disabled button to vector (so we have at least one button defined)
|
||||||
continue; // pin not available or invalid, skip configuring this GPIO
|
continue; // pin not available or invalid, skip configuring this GPIO
|
||||||
}
|
}
|
||||||
if (disablePullUp) {
|
if (disablePullUp) {
|
||||||
@ -1334,4 +1334,4 @@ void serializeConfigSec() {
|
|||||||
if (f) serializeJson(root, f);
|
if (f) serializeJson(root, f);
|
||||||
f.close();
|
f.close();
|
||||||
releaseJSONBufferLock();
|
releaseJSONBufferLock();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user