Deactivate all indicator lights on meter disconnect.
This commit is contained in:
@@ -375,16 +375,17 @@ class Meter {
|
|||||||
const Color orange(255, 165, 0);
|
const Color orange(255, 165, 0);
|
||||||
|
|
||||||
it.fill(bg);
|
it.fill(bg);
|
||||||
this->draw_icon_(it, 12, 8, 16, 16, ACCU_BMP, this->low_battery ? red : green);
|
bool status_active = this->connected && this->has_reading;
|
||||||
|
this->draw_icon_(it, 12, 8, 16, 16, ACCU_BMP, status_active ? (this->low_battery ? red : green) : inactive);
|
||||||
this->draw_icon_(it, 46, 8, 16, 16, BLE_BMP, this->connected ? blue : inactive);
|
this->draw_icon_(it, 46, 8, 16, 16, BLE_BMP, this->connected ? blue : inactive);
|
||||||
this->label_(it, font, 86, 8, "AUTO", this->auto_range() ? fg : inactive);
|
this->label_(it, font, 86, 8, "AUTO", status_active && this->auto_range() ? fg : inactive);
|
||||||
this->label_(it, font, 138, 8, "MAX", this->max_mode() ? red : inactive);
|
this->label_(it, font, 138, 8, "MAX", status_active && this->max_mode() ? red : inactive);
|
||||||
this->label_(it, font, 178, 8, "MIN", this->min_mode() ? green : inactive);
|
this->label_(it, font, 178, 8, "MIN", status_active && this->min_mode() ? green : inactive);
|
||||||
this->label_(it, font, 218, 8, "HOLD", this->hold() ? blue : inactive);
|
this->label_(it, font, 218, 8, "HOLD", status_active && this->hold() ? blue : inactive);
|
||||||
this->label_(it, font, 270, 8, "REL", this->relative() ? Color(128, 128, 0) : inactive);
|
this->label_(it, font, 270, 8, "REL", status_active && this->relative() ? Color(128, 128, 0) : inactive);
|
||||||
|
|
||||||
this->label_(it, font, 8, 66, "DC", this->dc() ? cyan : inactive);
|
this->label_(it, font, 8, 66, "DC", status_active && this->dc() ? cyan : inactive);
|
||||||
this->label_(it, font, 8, 102, "AC", this->ac() ? magenta : inactive);
|
this->label_(it, font, 8, 102, "AC", status_active && this->ac() ? magenta : inactive);
|
||||||
|
|
||||||
if (!this->connected) {
|
if (!this->connected) {
|
||||||
this->draw_digits_(it, "----", false, inactive);
|
this->draw_digits_(it, "----", false, inactive);
|
||||||
@@ -405,13 +406,15 @@ class Meter {
|
|||||||
this->draw_decimal_points_(it, fg);
|
this->draw_decimal_points_(it, fg);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string unit_line = std::string(this->scale()) + this->unit();
|
if (status_active) {
|
||||||
it.print(270, 140, font, yellow, esphome::display::TextAlign::CENTER, unit_line.c_str());
|
std::string unit_line = std::string(this->scale()) + this->unit();
|
||||||
|
it.print(270, 140, font, yellow, esphome::display::TextAlign::CENTER, unit_line.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
bool bargraph_active = this->connected && this->has_reading && !this->overload;
|
bool bargraph_active = status_active && !this->overload;
|
||||||
this->draw_bargraph_(it, bargraph_active ? this->digits_from_buffer_() : 0, bargraph_active);
|
this->draw_bargraph_(it, bargraph_active ? this->digits_from_buffer_() : 0, bargraph_active);
|
||||||
this->draw_icon_(it, 300, 148, 16, 16, DIODE_BMP, this->diode() ? magenta : inactive);
|
this->draw_icon_(it, 300, 148, 16, 16, DIODE_BMP, status_active && this->diode() ? magenta : inactive);
|
||||||
this->draw_icon_(it, 300, 174, 16, 16, BUZZ_BMP, this->continuity() ? orange : inactive);
|
this->draw_icon_(it, 300, 174, 16, 16, BUZZ_BMP, status_active && this->continuity() ? orange : inactive);
|
||||||
|
|
||||||
it.filled_rectangle(34, 212, 40, 24, this->write_available ? fg : inactive);
|
it.filled_rectangle(34, 212, 40, 24, this->write_available ? fg : inactive);
|
||||||
it.filled_rectangle(108, 212, 100, 24, this->write_available ? fg : inactive);
|
it.filled_rectangle(108, 212, 100, 24, this->write_available ? fg : inactive);
|
||||||
|
|||||||
Reference in New Issue
Block a user