diff --git a/README.md b/README.md index d2598c3..53f9f32 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ## Important information -If you like my work, please donate me a star on GitHub and consider sponsoring me!! +If you like my work, please donate me a star on GitHub and consider [sponsoring](https://www.paypal.com/donate/?hosted_button_id=FZDKSLQ46HJTU) me!! ## Introduction diff --git a/components/ehmtxv2/EHMTX.cpp b/components/ehmtxv2/EHMTX.cpp index 45c3945..e25d500 100644 --- a/components/ehmtxv2/EHMTX.cpp +++ b/components/ehmtxv2/EHMTX.cpp @@ -370,24 +370,15 @@ namespace esphome esphome::hsv_to_rgb(this->hue_, 0.8, 0.8, red, green, blue); this->rainbow_color = Color(uint8_t(255 * red), uint8_t(255 * green), uint8_t(255 * blue)); - this->scroll_step++; - - switch (this->queue[this->screen_pointer]->mode) - { - 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 = 0; - } - break; + if (millis() - this->last_scroll_time >= this->scroll_interval){ + this->scroll_step++; + this->last_scroll_time = millis(); + + if (this->scroll_step > this->queue[this->screen_pointer]->pixels_ + 32) { + this->scroll_step = 0; } - + } + time_t ts = this->clock->now().timestamp; if (this->is_running) @@ -402,7 +393,6 @@ namespace esphome } 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) diff --git a/components/ehmtxv2/EHMTX.h b/components/ehmtxv2/EHMTX.h index f01855b..b80be31 100644 --- a/components/ehmtxv2/EHMTX.h +++ b/components/ehmtxv2/EHMTX.h @@ -176,7 +176,6 @@ namespace esphome public: uint8_t centerx_; - uint16_t shiftx_; uint16_t pixels_; uint16_t screen_time_; bool default_font; diff --git a/components/ehmtxv2/EHMTX_queue.cpp b/components/ehmtxv2/EHMTX_queue.cpp index 0b0fdc6..192a6df 100644 --- a/components/ehmtxv2/EHMTX_queue.cpp +++ b/components/ehmtxv2/EHMTX_queue.cpp @@ -9,7 +9,6 @@ namespace esphome this->endtime = 0; this->last_time = 0; this->centerx_ = 0; - this->shiftx_ = 0; this->screen_time_ = 0; this->mode = MODE_EMPTY; this->icon_name = ""; @@ -91,7 +90,7 @@ namespace esphome } else { - return startx + this->shiftx_; + return startx + this->config_->scroll_step; } } else @@ -102,7 +101,7 @@ namespace esphome } else { - return startx - this->shiftx_ + width; + return startx - this->config_->scroll_step + width; } } } @@ -122,32 +121,6 @@ namespace esphome this->config_->last_rainbow_time = millis(); } - if ((this->mode == MODE_ICON_SCREEN) || (this->mode == MODE_RAINBOW_ICON)) - { - if (millis() - this->config_->last_scroll_time >= this->config_->scroll_interval && this->pixels_ > TEXTSTARTOFFSET) - { - this->shiftx_++; - if (this->shiftx_ > this->pixels_ + TEXTSTARTOFFSET) - { - this->shiftx_ = 0; - } - this->config_->last_scroll_time = millis(); - } - } - if ((this->mode == MODE_TEXT_SCREEN) || (this->mode == MODE_RAINBOW_TEXT)) - { - if (millis() - this->config_->last_scroll_time >= this->config_->scroll_interval && this->pixels_ >= 32) - { - this->shiftx_++; - if (this->shiftx_ > this->pixels_ + 32) - { - this->shiftx_ = 0; - - } - this->config_->last_scroll_time = millis(); - } - } - if (millis() - this->config_->last_anim_time >= this->config_->icons[this->icon]->frame_duration) { this->config_->icons[this->icon]->next_frame(); @@ -295,7 +268,6 @@ namespace esphome this->pixels_ = w; this->centerx_ = 0; - this->shiftx_ = 0; switch (this->mode) {