FastLED 3.10.6
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 80 of file cled_controller.cpp.hpp.

80 {
81 if (controller == nullptr) {
82 return;
83 }
84
85 // Remove the specified controller from the linked list
86 CLEDController* prev = nullptr;
87 CLEDController* curr = mPHead;
88
89 // Find the controller in the linked list
90 while (curr != nullptr) {
91 if (curr == controller) {
92 // Found it - remove from list
93 if (prev == nullptr) {
94 // Removing head
96 if (mPHead == nullptr) {
97 // List is now empty
98 mPTail = nullptr;
99 }
100 } else {
101 // Removing from middle or end
102 prev->mPNext = controller->mPNext;
103 if (controller->mPNext == nullptr) {
104 // Removing tail
105 mPTail = prev;
106 }
107 }
108
109 // Clear the controller's next pointer
110 controller->mPNext = nullptr;
111 break;
112 }
113 prev = curr;
114 curr = curr->mPNext;
115 }
116}
CLEDController * controller
static CLEDController * mPTail
pointer to the last LED controller in the linked list
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
CLEDController(RegistrationMode mode) FL_NO_EXCEPT
Protected constructor with registration mode.

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: