testversion with rainbow

pull/2/head
LuBeDa 3 years ago
parent 6239a15fe5
commit 6e58a932ba

@ -9,6 +9,7 @@ namespace esphome
this->display_indicator = false;
this->display_alarm = false;
this->icon_count = 0;
this->hue_ = 0;
this->text_color = Color(C_RED, C_GREEN, C_BLUE);
this->today_color = Color(C_RED, C_GREEN, C_BLUE);
this->weekday_color = Color(CD_RED, CD_GREEN, CD_BLUE);
@ -315,6 +316,7 @@ namespace esphome
}
void EHMTX::tick()
{
if (this->is_running)
{
time_t ts = this->clock->now().timestamp;

@ -52,7 +52,8 @@ namespace esphome
void setup() override;
EHMTX();
Color text_color, alarm_color, gauge_color,indicator_color,clock_color;
Color today_color,weekday_color;
Color today_color,weekday_color,rainbow_color;
int hue_;
void dump_config();
std::string time_fmt;
std::string date_fmt;

@ -69,6 +69,18 @@ namespace esphome
void EHMTX_queue::update_screen()
{
if (millis() - this->config_->last_scroll_time >= this->config_->scroll_interval )
{
this->config_->hue_++;
if (this->config_->hue_ == 360)
{
this->config_->hue_ = 0;
}
float red, green,blue ;
esphome::hsv_to_rgb ( this->config_->hue_,0.8,0.8,red,green, blue );
this->config_->rainbow_color = Color(uint8_t (255 * red),uint8_t (255 * green),uint8_t (255 * blue));
}
if (this->mode == MODE_ICONSCREEN)
{
if (millis() - this->config_->last_scroll_time >= this->config_->scroll_interval && this->pixels_ > TEXTSTARTOFFSET)
@ -206,7 +218,7 @@ namespace esphome
break;
case MODE_TIMER:
this->config_->display->image(0, 0, this->config_->icons[this->icon]);
this->config_->display->print(9+xoffset, yoffset, font, this->text_color, esphome::display::TextAlign::BASELINE_LEFT,
this->config_->display->print(9+xoffset, yoffset, font, this->config_->rainbow_color, esphome::display::TextAlign::BASELINE_LEFT,
this->text.c_str());
break;
default:

Loading…
Cancel
Save