MCPcopy Create free account
hub / github.com/FastLED/FastLED / show

Method show

src/platforms/esp/32/drivers/uart/channel_driver_uart.cpp.hpp:82–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80}
81
82void ChannelEngineUART::show() FL_NOEXCEPT {
83 FL_SCOPED_TRACE;
84
85 if (!mEnqueuedChannels.empty()) {
86 // Move enqueued channels to transmitting channels
87 mTransmittingChannels = fl::move(mEnqueuedChannels);
88 mEnqueuedChannels.clear();
89
90 // Group channels by chipset timing configuration
91 mChipsetGroups.clear();
92 mCurrentGroupIndex = 0;
93
94 for (size_t i = 0; i < mTransmittingChannels.size(); i++) {
95 const ChannelDataPtr& channel = mTransmittingChannels[i];
96 const ChipsetTimingConfig& timing = channel->getTiming();
97
98 // Find existing group with matching timing
99 bool found = false;
100 for (size_t j = 0; j < mChipsetGroups.size(); j++) {
101 if (mChipsetGroups[j].mTiming == timing) {
102 mChipsetGroups[j].mChannels.push_back(channel);
103 found = true;
104 break;
105 }
106 }
107
108 // Create new group if no match found
109 if (!found) {
110 ChipsetGroup newGroup{timing, {}};
111 newGroup.mChannels.push_back(channel);
112 mChipsetGroups.push_back(fl::move(newGroup));
113 }
114 }
115
116 // Sort groups by transmission time (fastest first)
117 fl::sort(mChipsetGroups.begin(), mChipsetGroups.end(),
118 [](const ChipsetGroup& a, const ChipsetGroup& b) FL_NOEXCEPT {
119 size_t maxSizeA = 0;
120 for (const auto& channel : a.mChannels) {
121 size_t size = channel->getSize();
122 if (size > maxSizeA) {
123 maxSizeA = size;
124 }
125 }
126
127 size_t maxSizeB = 0;
128 for (const auto& channel : b.mChannels) {
129 size_t size = channel->getSize();
130 if (size > maxSizeB) {
131 maxSizeB = size;
132 }
133 }
134
135 u64 transmissionTimeA =
136 static_cast<u64>(maxSizeA) *
137 a.mTiming.total_period_ns();
138 u64 transmissionTimeB =
139 static_cast<u64>(maxSizeB) *

Callers

nothing calls this directly

Calls 10

sortFunction · 0.85
total_period_nsMethod · 0.80
emptyMethod · 0.45
clearMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
getSizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected