mirror of
https://github.com/wled/WLED.git
synced 2025-07-19 08:46:34 +00:00
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
|
#ifdef ESP8266
|
||||||
// turn off built-in LED if strip is turned off
|
// turn off built-in LED if strip is turned off
|
||||||
// this will break digital bus so will need to be reinitialised on On
|
// this will break digital bus so will need to be reinitialised on On
|
||||||
pinMode(LED_BUILTIN, OUTPUT);
|
PinOwner ledPinOwner = pinManager.getPinOwner(LED_BUILTIN);
|
||||||
digitalWrite(LED_BUILTIN, HIGH);
|
if (!strip.isOffRefreshRequred && (ledPinOwner == PinOwner::None || ledPinOwner == PinOwner::BusDigital)) {
|
||||||
|
pinMode(LED_BUILTIN, OUTPUT);
|
||||||
|
digitalWrite(LED_BUILTIN, HIGH);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
if (rlyPin>=0) {
|
if (rlyPin>=0) {
|
||||||
pinMode(rlyPin, OUTPUT);
|
pinMode(rlyPin, OUTPUT);
|
||||||
|
@ -125,6 +125,11 @@ bool PinManagerClass::isPinOk(byte gpio, bool output)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PinOwner PinManagerClass::getPinOwner(byte gpio) {
|
||||||
|
if (!isPinOk(gpio, false)) return PinOwner::None;
|
||||||
|
return ownerTag[gpio];
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef ARDUINO_ARCH_ESP32
|
#ifdef ARDUINO_ARCH_ESP32
|
||||||
byte PinManagerClass::allocateLedc(byte channels)
|
byte PinManagerClass::allocateLedc(byte channels)
|
||||||
{
|
{
|
||||||
|
@ -92,6 +92,8 @@ class PinManagerClass {
|
|||||||
bool isPinAllocated(byte gpio, PinOwner tag = PinOwner::None);
|
bool isPinAllocated(byte gpio, PinOwner tag = PinOwner::None);
|
||||||
bool isPinOk(byte gpio, bool output = true);
|
bool isPinOk(byte gpio, bool output = true);
|
||||||
|
|
||||||
|
PinOwner getPinOwner(byte gpio);
|
||||||
|
|
||||||
#ifdef ARDUINO_ARCH_ESP32
|
#ifdef ARDUINO_ARCH_ESP32
|
||||||
byte allocateLedc(byte channels);
|
byte allocateLedc(byte channels);
|
||||||
void deallocateLedc(byte pos, byte channels);
|
void deallocateLedc(byte pos, byte channels);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user