FastLED 3.9.15
Loading...
Searching...
No Matches

◆ removeFromList()

void CLEDController::removeFromList ( CLEDController * controller)
static

Remove a controller from the linked list.

Parameters
controllerThe controller to remove from the list
Note
Protected static method - subclasses can call this in their cleanup methods

Definition at line 68 of file cled_controller.cpp.hpp.

68 {
69 if (controller == nullptr) {
70 return;
71 }
72
73 // Remove the specified controller from the linked list
74 CLEDController* prev = nullptr;
75 CLEDController* curr = mPHead;
76
77 // Find the controller in the linked list
78 while (curr != nullptr) {
79 if (curr == controller) {
80 // Found it - remove from list
81 if (prev == nullptr) {
82 // Removing head
84 if (mPHead == nullptr) {
85 // List is now empty
86 mPTail = nullptr;
87 }
88 } else {
89 // Removing from middle or end
90 prev->mPNext = controller->mPNext;
91 if (controller->mPNext == nullptr) {
92 // Removing tail
93 mPTail = prev;
94 }
95 }
96
97 // Clear the controller's next pointer
98 controller->mPNext = nullptr;
99 break;
100 }
101 prev = curr;
102 curr = curr->mPNext;
103 }
104}
CLEDController * controller
static CLEDController * mPTail
pointer to the last LED controller in the linked list
CLEDController(RegistrationMode mode) FL_NOEXCEPT
Protected constructor with registration mode.
CLEDController * mPNext
pointer to the next LED controller in the linked list
static CLEDController * mPHead
pointer to the first LED controller in the linked list

References CLEDController(), controller, mPHead, mPNext, and mPTail.

Referenced by removeFromDrawList().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: