Static PinManager & UsermodManager

- saves a few bytes of flash
This commit is contained in:
Blaz Kristan
2024-09-19 21:44:11 +02:00
parent 72455ccde1
commit b50e6e0d90
49 changed files with 2401 additions and 385 deletions

View File

@@ -135,7 +135,7 @@ void appendGPIOinfo() {
if (requestJSONBufferLock(6)) {
// if we can't allocate JSON buffer ignore usermod pins
JsonObject mods = pDoc->createNestedObject(F("um"));
usermods.addToConfig(mods);
UsermodManager::addToConfig(mods);
if (!mods.isNull()) fillUMPins(mods);
releaseJSONBufferLock();
}
@@ -144,7 +144,7 @@ void appendGPIOinfo() {
// add reserved (unusable) pins
oappend(SET_F("d.rsvd=["));
for (unsigned i = 0; i < WLED_NUM_PINS; i++) {
if (!pinManager.isPinOk(i, false)) { // include readonly pins
if (!PinManager::isPinOk(i, false)) { // include readonly pins
oappendi(i); oappend(",");
}
}
@@ -181,7 +181,7 @@ void appendGPIOinfo() {
oappend(SET_F("d.ro_gpio=["));
bool firstPin = true;
for (unsigned i = 0; i < WLED_NUM_PINS; i++) {
if (pinManager.isReadOnlyPin(i)) {
if (PinManager::isReadOnlyPin(i)) {
// No comma before the first pin
if (!firstPin) oappend(SET_F(","));
oappendi(i);
@@ -370,7 +370,7 @@ void getSettingsJS(byte subPage, char* dest)
int nPins = bus->getPins(pins);
for (int i = 0; i < nPins; i++) {
lp[1] = offset+i;
if (pinManager.isPinOk(pins[i]) || bus->isVirtual()) sappend('v',lp,pins[i]);
if (PinManager::isPinOk(pins[i]) || bus->isVirtual()) sappend('v',lp,pins[i]);
}
sappend('v',lc,bus->getLength());
sappend('v',lt,bus->getType());
@@ -694,7 +694,7 @@ void getSettingsJS(byte subPage, char* dest)
{
appendGPIOinfo();
oappend(SET_F("numM="));
oappendi(usermods.getModCount());
oappendi(UsermodManager::getModCount());
oappend(";");
sappend('v',SET_F("SDA"),i2c_sda);
sappend('v',SET_F("SCL"),i2c_scl);
@@ -706,7 +706,7 @@ void getSettingsJS(byte subPage, char* dest)
oappend(SET_F("addInfo('MOSI','")); oappendi(HW_PIN_DATASPI); oappend(SET_F("');"));
oappend(SET_F("addInfo('MISO','")); oappendi(HW_PIN_MISOSPI); oappend(SET_F("');"));
oappend(SET_F("addInfo('SCLK','")); oappendi(HW_PIN_CLOCKSPI); oappend(SET_F("');"));
usermods.appendConfigData();
UsermodManager::appendConfigData();
}
if (subPage == SUBPAGE_UPDATE) // update