mirror of
https://github.com/esphome/esphome.git
synced 2024-11-10 09:17:46 +01:00
Fix WLED minor issues (#1193)
This commit is contained in:
parent
7524493c3c
commit
43d5e7a8cc
2 changed files with 6 additions and 3 deletions
|
@ -31,6 +31,7 @@ void E131Component::setup() {
|
|||
if (!udp_->begin(PORT)) {
|
||||
ESP_LOGE(TAG, "Cannot bind E131 to %d.", PORT);
|
||||
mark_failed();
|
||||
return;
|
||||
}
|
||||
|
||||
join_igmp_groups_();
|
||||
|
|
|
@ -50,12 +50,13 @@ void WLEDLightEffect::apply(light::AddressableLight &it, const light::ESPColor &
|
|||
udp_.reset(new WiFiUDP());
|
||||
|
||||
if (!udp_->begin(port_)) {
|
||||
ESP_LOGE(TAG, "Cannot bind WLEDLightEffect to %d.", port_);
|
||||
ESP_LOGW(TAG, "Cannot bind WLEDLightEffect to %d.", port_);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
while (uint16_t packet_size = udp_->parsePacket()) {
|
||||
std::vector<uint8_t> payload;
|
||||
while (uint16_t packet_size = udp_->parsePacket()) {
|
||||
payload.resize(packet_size);
|
||||
|
||||
if (!udp_->read(&payload[0], payload.size())) {
|
||||
|
@ -63,11 +64,12 @@ void WLEDLightEffect::apply(light::AddressableLight &it, const light::ESPColor &
|
|||
}
|
||||
|
||||
if (!this->parse_frame_(it, &payload[0], payload.size())) {
|
||||
ESP_LOGD(TAG, "Frame: Invalid (size=%zu, first=%c/%d).", payload.size(), payload[0], payload[0]);
|
||||
ESP_LOGD(TAG, "Frame: Invalid (size=%zu, first=0x%02X).", payload.size(), payload[0]);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: Use roll-over safe arithmetic
|
||||
if (blank_at_ < millis()) {
|
||||
blank_all_leds_(it);
|
||||
blank_at_ = millis() + DEFAULT_BLANK_TIME;
|
||||
|
|
Loading…
Reference in a new issue