|
|
|
|
@ -354,6 +354,7 @@ namespace esphome
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void EHMTX::tick()
|
|
|
|
|
{
|
|
|
|
|
this->hue_++;
|
|
|
|
|
@ -371,36 +372,23 @@ namespace esphome
|
|
|
|
|
{
|
|
|
|
|
if (ts > this->next_action_time)
|
|
|
|
|
{
|
|
|
|
|
this->scroll_step++;
|
|
|
|
|
|
|
|
|
|
this->remove_expired_queue_element();
|
|
|
|
|
this->screen_pointer = this->find_last_clock();
|
|
|
|
|
if (this->screen_pointer == MAXQUEUE)
|
|
|
|
|
{
|
|
|
|
|
this->screen_pointer = find_oldest_queue_element();
|
|
|
|
|
}
|
|
|
|
|
switch (this->queue[this->screen_pointer]->mode)
|
|
|
|
|
if (millis() - this->last_scroll_time >= this->scroll_interval)
|
|
|
|
|
{
|
|
|
|
|
case MODE_ICON_SCREEN:
|
|
|
|
|
case MODE_RAINBOW_ICON:
|
|
|
|
|
if (this->scroll_step > this->queue[this->screen_pointer]->pixels_ + 8)
|
|
|
|
|
{
|
|
|
|
|
this->scroll_step = 0;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case MODE_RAINBOW_TEXT:
|
|
|
|
|
case MODE_TEXT_SCREEN:
|
|
|
|
|
if (this->scroll_step > this->queue[this->screen_pointer]->pixels_ + 31)
|
|
|
|
|
this->scroll_step++;
|
|
|
|
|
this->last_scroll_time = millis();
|
|
|
|
|
|
|
|
|
|
if (this->scroll_step > this->queue[this->screen_pointer]->pixels_ + 32)
|
|
|
|
|
{
|
|
|
|
|
this->scroll_step = 0;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
ESP_LOGD(TAG, "tick action Pointer: %d",this->screen_pointer);
|
|
|
|
|
|
|
|
|
|
if (this->screen_pointer != MAXQUEUE)
|
|
|
|
|
{
|
|
|
|
|
this->queue[this->screen_pointer]->shiftx_ = 0;
|
|
|
|
|
this->scroll_step = 0;
|
|
|
|
|
this->queue[this->screen_pointer]->last_time = ts + this->queue[this->screen_pointer]->screen_time_;
|
|
|
|
|
if (this->queue[this->screen_pointer]->icon < this->icon_count)
|
|
|
|
|
@ -433,9 +421,9 @@ namespace esphome
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ESP_LOGD(TAG, "tick rectangle %d", this->is_running);
|
|
|
|
|
uint8_t w = (1 + (uint8_t)(32 / 16) * (this->boot_anim / 16)) % 32;
|
|
|
|
|
this->display->rectangle(0, 2, w, 4, this->rainbow_color); // Color(120, 190, 40));
|
|
|
|
|
this->boot_anim++;
|
|
|
|
|
@ -617,7 +605,14 @@ namespace esphome
|
|
|
|
|
ESP_LOGD(TAG, "rainbow_clock_screen lifetime: %d screen_time: %d", lifetime, screen_time);
|
|
|
|
|
screen->mode = MODE_RAINBOW_CLOCK;
|
|
|
|
|
screen->default_font = default_font;
|
|
|
|
|
screen->screen_time_ = (screen_time > this->clock_interval) ? screen_time : this->clock_interval - 1;
|
|
|
|
|
if (this->clock_interval == 0 || (this->clock_interval > screen_time))
|
|
|
|
|
{
|
|
|
|
|
screen->screen_time_ = screen_time;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
screen->screen_time_ = this->clock_interval - 2;
|
|
|
|
|
}
|
|
|
|
|
screen->endtime = this->clock->now().timestamp + lifetime * 60;
|
|
|
|
|
screen->status();
|
|
|
|
|
}
|
|
|
|
|
@ -694,10 +689,13 @@ namespace esphome
|
|
|
|
|
ESP_LOGD(TAG, "clock_screen_color lifetime: %d screen_time: %d red: %d green: %d blue: %d", lifetime, screen_time, r, g, b);
|
|
|
|
|
screen->mode = MODE_CLOCK;
|
|
|
|
|
screen->default_font = default_font;
|
|
|
|
|
if (this->clock_interval ==0 || (this->clock_interval > screen_time )) {
|
|
|
|
|
if (this->clock_interval == 0 || (this->clock_interval > screen_time))
|
|
|
|
|
{
|
|
|
|
|
screen->screen_time_ = screen_time;
|
|
|
|
|
} else {
|
|
|
|
|
screen->screen_time_ = this->clock_interval-2;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
screen->screen_time_ = this->clock_interval - 2;
|
|
|
|
|
}
|
|
|
|
|
screen->endtime = this->clock->now().timestamp + lifetime * 60;
|
|
|
|
|
screen->status();
|
|
|
|
|
|