7static const char *
const TAG = 
"adalight_light_effect";
 
    9static const uint32_t ADALIGHT_ACK_INTERVAL = 1000;
 
   10static const uint32_t ADALIGHT_RECEIVE_TIMEOUT = 1000;
 
   15  AddressableLightEffect::start();
 
 
   25  AddressableLightEffect::stop();
 
 
   33  return 3 + 2 + 1 + led_count * 3;
 
 
   40  frame_.reserve(buffer_capacity);
 
 
   44  for (
int led = it.
size(); led-- > 0;) {
 
 
   51  const uint32_t now = 
millis();
 
   53  if (now - this->
last_ack_ >= ADALIGHT_ACK_INTERVAL) {
 
   54    ESP_LOGV(TAG, 
"Sending ACK");
 
   60    ESP_LOGW(TAG, 
"Frame: Reset.");
 
   66  if (!this->
frame_.empty() && now - this->last_byte_ >= ADALIGHT_RECEIVE_TIMEOUT) {
 
   67    ESP_LOGW(TAG, 
"Frame: Receive timeout (size=%zu).", this->
frame_.size());
 
   73    ESP_LOGV(TAG, 
"Frame: Available (size=%d).", this->
available());
 
   80    this->
frame_.push_back(data);
 
   85        ESP_LOGD(TAG, 
"Frame: Invalid (size=%zu, first=%d).", this->
frame_.size(), this->frame_[0]);
 
   93        ESP_LOGV(TAG, 
"Frame: Consumed (size=%zu).", this->
frame_.size());
 
 
  124  if (
frame_.size() < buffer_size)
 
  128  auto accepted_led_count = std::min<int>(led_count, it.
size());
 
  129  uint8_t *led_data = &
frame_[6];
 
  131  for (
int led = 0; led < accepted_led_count; led++, led_data += 3) {
 
  132    auto white = std::min(std::min(led_data[0], led_data[1]), led_data[2]);
 
  134    it[led].set(
Color(led_data[0], led_data[1], led_data[2], white));
 
 
 
unsigned int get_frame_size_(int led_count) const
void blank_all_leds_(light::AddressableLight &it)
Frame parse_frame_(light::AddressableLight &it)
std::vector< uint8_t > frame_
void reset_frame_(light::AddressableLight &it)
AdalightLightEffect(const std::string &name)
virtual int32_t size() const =0
void write_str(const char *str)
bool read_byte(uint8_t *data)
Providing packet encoding functions for exchanging data with a remote host.
uint32_t IRAM_ATTR HOT millis()