mirror of
https://github.com/esphome/esphome.git
synced 2026-02-26 14:03:14 -07:00
Remove redundant early guard
This commit is contained in:
@@ -310,14 +310,8 @@ void LD2412Component::restart_and_read_all_info() {
|
||||
}
|
||||
|
||||
void LD2412Component::loop() {
|
||||
// All current UART available() implementations return >= 0,
|
||||
// use <= 0 to future-proof against any that may return negative on error.
|
||||
int avail = this->available();
|
||||
if (avail <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Read all available bytes in batches to reduce UART call overhead.
|
||||
int avail = this->available();
|
||||
uint8_t buf[MAX_LINE_LENGTH];
|
||||
while (avail > 0) {
|
||||
size_t to_read = std::min(static_cast<size_t>(avail), sizeof(buf));
|
||||
|
||||
Reference in New Issue
Block a user