From 92037a480d291a5d9b38b24c9b2d375c0d96e91e Mon Sep 17 00:00:00 2001 From: Blaz Kristan Date: Fri, 16 Sep 2022 23:12:57 +0200 Subject: [PATCH] Bugfix for BusOnOff --- wled00/bus_manager.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/wled00/bus_manager.h b/wled00/bus_manager.h index b3dc29d0..2e52cd01 100644 --- a/wled00/bus_manager.h +++ b/wled00/bus_manager.h @@ -504,7 +504,7 @@ class BusOnOff : public Bus { uint8_t currentPin = bc.pins[0]; if (!pinManager.allocatePin(currentPin, true, PinOwner::BusOnOff)) { - deallocatePins(); return; + return; } _pin = currentPin; //store only after allocatePin() succeeds pinMode(_pin, OUTPUT); @@ -540,7 +540,7 @@ class BusOnOff : public Bus { } void cleanup() { - deallocatePins(); + pinManager.deallocatePin(_pin, PinOwner::BusOnOff); } ~BusOnOff() { @@ -550,10 +550,6 @@ class BusOnOff : public Bus { private: uint8_t _pin = 255; uint8_t _data = 0; - - void deallocatePins() { - pinManager.deallocatePin(_pin, PinOwner::BusOnOff); - } }; @@ -689,6 +685,8 @@ class BusManager { busses[numBusses] = new BusNetwork(bc); } else if (IS_DIGITAL(bc.type)) { busses[numBusses] = new BusDigital(bc, numBusses, colorOrderMap); + } else if (bc.type == TYPE_ONOFF) { + busses[numBusses] = new BusOnOff(bc); } else { busses[numBusses] = new BusPwm(bc); }