Better ADALights pin 3 handling.

This commit is contained in:
Blaz Kristan
2021-03-21 10:34:47 +01:00
parent f8df7ebb7c
commit 0a7df86f3f
2 changed files with 34 additions and 9 deletions

View File

@@ -286,7 +286,24 @@ void getSettingsJS(byte subPage, char* dest)
oappend(SET_F(",2")); // DMX hardcoded pin
#endif
#ifdef WLED_ENABLE_ADALIGHT
oappend(SET_F(",3")); // ADALight (RX) pin
// inform settings page that pin 3 is used by ADALights if not aleready used by strip (previous setup)
// NOTE: this will prohibit pin 3 use on new installs
{
bool pin3used = false;
for (uint8_t s=0; s < busses.getNumBusses(); s++) {
Bus* bus = busses.getBus(s);
uint8_t pins[5];
uint8_t nPins = bus->getPins(pins);
for (uint8_t i = 0; i < nPins; i++) {
if (pins[i] == 3) {
pin3used = true;
break;
}
}
if (pin3used) break;
}
if (!pin3used && pinManager.isPinAllocated(3)) oappend(SET_F(",3")); // ADALight (RX) pin
}
#endif
#ifdef WLED_DEBUG
oappend(SET_F(",1")); // debug output (TX) pin