mirror of
https://github.com/wled/WLED.git
synced 2025-07-23 02:36:39 +00:00
remove getReadOnlyPins() function
This commit is contained in:
parent
9bb979f2e8
commit
d79d5dbadd
@ -267,26 +267,17 @@ bool PinManagerClass::isPinOk(byte gpio, bool output) const
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned *PinManagerClass::getReadOnlyPins()
|
||||
{
|
||||
#ifdef READ_ONLY_PINS
|
||||
static unsigned readOnlyPins[] = {READ_ONLY_PINS};
|
||||
#else
|
||||
static unsigned readOnlyPins[] = {255};
|
||||
#endif
|
||||
return readOnlyPins;
|
||||
}
|
||||
|
||||
bool PinManagerClass::isReadOnlyPin(byte gpio)
|
||||
{
|
||||
const unsigned* pins = PinManagerClass::getReadOnlyPins();
|
||||
const unsigned numPins = (sizeof *pins) / (sizeof pins[0]);
|
||||
#ifdef READ_ONLY_PINS
|
||||
const unsigned pins[] = {READ_ONLY_PINS};
|
||||
const unsigned numPins = ((sizeof pins) / (sizeof pins[0]));
|
||||
|
||||
for (unsigned i = 0; i < numPins; i++) {
|
||||
if (pins[i] == gpio) {
|
||||
return true;
|
||||
}
|
||||
if (gpio <= WLED_NUM_PINS) {
|
||||
for (unsigned i = 0; i < numPins; i++) if (gpio == pins[i]) return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -111,8 +111,7 @@ class PinManagerClass {
|
||||
bool isPinAllocated(byte gpio, PinOwner tag = PinOwner::None) const;
|
||||
// will return false for reserved pins
|
||||
bool isPinOk(byte gpio, bool output = true) const;
|
||||
|
||||
static unsigned* getReadOnlyPins();
|
||||
|
||||
static bool isReadOnlyPin(byte gpio);
|
||||
|
||||
PinOwner getPinOwner(byte gpio) const;
|
||||
|
@ -191,14 +191,14 @@ void appendGPIOinfo() {
|
||||
|
||||
// add info for read-only GPIO
|
||||
oappend(SET_F("d.ro_gpio=["));
|
||||
const unsigned* readOnlyPins = pinManager.getReadOnlyPins();
|
||||
const unsigned numReadOnlyPins = (sizeof *readOnlyPins) / (sizeof readOnlyPins[0]);
|
||||
for (unsigned i = 0; i < numReadOnlyPins; i++) {
|
||||
// Ignore 255
|
||||
if (readOnlyPins[i] <= WLED_NUM_PINS) {
|
||||
oappendi(readOnlyPins[i]);
|
||||
if (i != numReadOnlyPins) oappend(SET_F(","));
|
||||
}
|
||||
bool firstPin = true;
|
||||
for (unsigned i = 0; i < WLED_NUM_PINS; i++) {
|
||||
if (pinManager.isReadOnlyPin(i)) {
|
||||
// No comma before the first pin
|
||||
if (!firstPin) oappend(SET_F(","));
|
||||
oappendi(i);
|
||||
firstPin = false;
|
||||
}
|
||||
}
|
||||
oappend(SET_F("];"));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user