Added getPinOwner
Only disable builtin LED if bus to avoid breaking other things on the pin
This commit is contained in:
parent
4af1f62aab
commit
d31e4c7815
@ -299,8 +299,11 @@ void handleIO()
|
||||
#ifdef ESP8266
|
||||
// turn off built-in LED if strip is turned off
|
||||
// this will break digital bus so will need to be reinitialised on On
|
||||
PinOwner ledPinOwner = pinManager.getPinOwner(LED_BUILTIN);
|
||||
if (!strip.isOffRefreshRequred && (ledPinOwner == PinOwner::None || ledPinOwner == PinOwner::BusDigital)) {
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
digitalWrite(LED_BUILTIN, HIGH);
|
||||
}
|
||||
#endif
|
||||
if (rlyPin>=0) {
|
||||
pinMode(rlyPin, OUTPUT);
|
||||
|
@ -125,6 +125,11 @@ bool PinManagerClass::isPinOk(byte gpio, bool output)
|
||||
return false;
|
||||
}
|
||||
|
||||
PinOwner PinManagerClass::getPinOwner(byte gpio) {
|
||||
if (!isPinOk(gpio, false)) return PinOwner::None;
|
||||
return ownerTag[gpio];
|
||||
}
|
||||
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
byte PinManagerClass::allocateLedc(byte channels)
|
||||
{
|
||||
|
@ -92,6 +92,8 @@ class PinManagerClass {
|
||||
bool isPinAllocated(byte gpio, PinOwner tag = PinOwner::None);
|
||||
bool isPinOk(byte gpio, bool output = true);
|
||||
|
||||
PinOwner getPinOwner(byte gpio);
|
||||
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
byte allocateLedc(byte channels);
|
||||
void deallocateLedc(byte pos, byte channels);
|
||||
|
Loading…
Reference in New Issue
Block a user