|
|
|
@ -127,14 +127,14 @@ namespace esphome
|
|
|
|
ESP_LOGD(TAG, "hide gauge");
|
|
|
|
ESP_LOGD(TAG, "hide gauge");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void EHMTX::show_gauge(int percent, int r, int g, int)
|
|
|
|
void EHMTX::show_gauge(int percent, int r, int g, int b)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
this->display_gauge = false;
|
|
|
|
this->display_gauge = false;
|
|
|
|
if (percent <= 100)
|
|
|
|
if (percent <= 100)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
this->gauge_color = Color(r, g, b);
|
|
|
|
this->display_gauge = true;
|
|
|
|
this->display_gauge = true;
|
|
|
|
this->gauge_value = percent; // (uint8_t)(100 - percent) * 7 / 100;
|
|
|
|
this->gauge_value = (uint8_t)(100 - percent) * 7 / 100;
|
|
|
|
ESP_LOGD(TAG, "set gauge value: %d", percent);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -144,11 +144,7 @@ namespace esphome
|
|
|
|
{
|
|
|
|
{
|
|
|
|
this->display->line(0, 7, 0, 0, esphome::display::COLOR_OFF);
|
|
|
|
this->display->line(0, 7, 0, 0, esphome::display::COLOR_OFF);
|
|
|
|
this->display->line(1, 7, 1, 0, esphome::display::COLOR_OFF);
|
|
|
|
this->display->line(1, 7, 1, 0, esphome::display::COLOR_OFF);
|
|
|
|
if (this->gauge_value > 11)
|
|
|
|
this->display->line(0, 7, 0, this->gauge_value, this->gauge_color);
|
|
|
|
{
|
|
|
|
|
|
|
|
uint8_t height = 7 - (int)(this->gauge_value / 12.5);
|
|
|
|
|
|
|
|
this->display->line(0, 7, 0, height, this->gauge_color);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -442,7 +438,6 @@ namespace esphome
|
|
|
|
this->rainbow_interval = si;
|
|
|
|
this->rainbow_interval = si;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void EHMTX::del_screen(std::string icon_name, int mode)
|
|
|
|
void EHMTX::del_screen(std::string icon_name, int mode)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
for (uint8_t i = 0; i < MAXQUEUE; i++)
|
|
|
|
for (uint8_t i = 0; i < MAXQUEUE; i++)
|
|
|
|
@ -833,7 +828,8 @@ namespace esphome
|
|
|
|
this->icon_count++;
|
|
|
|
this->icon_count++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void EHMTX::draw_alarm(){
|
|
|
|
void EHMTX::draw_alarm()
|
|
|
|
|
|
|
|
{
|
|
|
|
if (this->display_alarm > 2)
|
|
|
|
if (this->display_alarm > 2)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
this->display->line(31, 2, 29, 0, this->alarm_color);
|
|
|
|
this->display->line(31, 2, 29, 0, this->alarm_color);
|
|
|
|
@ -849,13 +845,15 @@ void EHMTX::draw_alarm(){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void EHMTX::draw_indicator(){
|
|
|
|
void EHMTX::draw_indicator()
|
|
|
|
|
|
|
|
{
|
|
|
|
if (this->display_indicator > 2)
|
|
|
|
if (this->display_indicator > 2)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
this->display->line(31, 5, 29, 7, this->indicator_color);
|
|
|
|
this->display->line(31, 5, 29, 7, this->indicator_color);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (this->display_indicator>1){
|
|
|
|
if (this->display_indicator > 1)
|
|
|
|
|
|
|
|
{
|
|
|
|
this->display->draw_pixel_at(30, 7, this->indicator_color);
|
|
|
|
this->display->draw_pixel_at(30, 7, this->indicator_color);
|
|
|
|
this->display->draw_pixel_at(31, 6, this->indicator_color);
|
|
|
|
this->display->draw_pixel_at(31, 6, this->indicator_color);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -866,17 +864,19 @@ void EHMTX::draw_indicator(){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void EHMTX::draw()
|
|
|
|
void EHMTX::draw()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ((this->is_running) && (this->show_display) && (this->screen_pointer != MAXQUEUE))
|
|
|
|
if ((this->is_running) && (this->show_display) && (this->screen_pointer != MAXQUEUE))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
this->queue[this->screen_pointer]->draw();
|
|
|
|
this->queue[this->screen_pointer]->draw();
|
|
|
|
|
|
|
|
if (this->queue[this->screen_pointer]->mode != MODE_FULLSCREEN)
|
|
|
|
|
|
|
|
{
|
|
|
|
this->draw_gauge();
|
|
|
|
this->draw_gauge();
|
|
|
|
if (this->queue[this->screen_pointer]->mode != MODE_CLOCK && this->queue[this->screen_pointer]->mode != MODE_DATE && this->queue[this->screen_pointer]->mode != MODE_FULLSCREEN) {
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this->queue[this->screen_pointer]->mode != MODE_CLOCK && this->queue[this->screen_pointer]->mode != MODE_DATE && this->queue[this->screen_pointer]->mode != MODE_FULLSCREEN)
|
|
|
|
|
|
|
|
{
|
|
|
|
this->draw_indicator();
|
|
|
|
this->draw_indicator();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// this->draw_indicator();
|
|
|
|
|
|
|
|
this->draw_alarm();
|
|
|
|
this->draw_alarm();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|