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

Method readStringUntil

src/fl/system/serial.cpp.hpp:158–177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156}
157
158fl::string SerialPort::readStringUntil(char delimiter) {
159 fl::string result;
160 u32 startTime = fl::millis();
161
162 while (fl::millis() - startTime < mTimeoutMs) {
163 if (available() > 0) {
164 int c = read();
165 if (c == -1) {
166 continue; // No data
167 }
168 if (c == delimiter) {
169 break; // Found delimiter, stop reading
170 }
171 result += static_cast<char>(c);
172 startTime = fl::millis(); // Reset timeout on successful read
173 }
174 }
175
176 return result;
177}
178
179size_t SerialPort::readBytes(u8* buffer, size_t length) {
180 if (!buffer || length == 0) {

Callers

nothing calls this directly

Calls 3

millisFunction · 0.50
availableFunction · 0.50
readFunction · 0.50

Tested by

no test coverage detected