Rebuild update to climate chip in Home page

Improves #1802
This commit is contained in:
Edward Firmo
2024-02-19 20:48:05 +01:00
parent cfd0c51bfe
commit 88888d0f38
2 changed files with 22 additions and 37 deletions

View File

@@ -471,10 +471,19 @@ api:
if (!id(is_uploading_tft) and !(id.empty())) {
if (!(icon.empty())) disp1->set_component_text_printf("%s_icon", id.c_str(), icon.c_str());
if (icon_color.size() == 3) set_component_color->execute((id + "_icon").c_str(), icon_color);
if (visible) {
disp1->show_component(id.c_str());
} else {
disp1->hide_component(id.c_str());
bool IsCurrentPage = true;
size_t dotPos = id.find(".");
if (dotPos != std::string::npos) {
std::string left_side = id.substr(0, dotPos);
if (left_side == "alarm_control_panel") left_side = "alarm";
if (left_side != current_page->state) IsCurrentPage = false;
}
if (IsCurrentPage) {
if (visible) {
disp1->show_component(id.c_str());
} else {
disp1->hide_component(id.c_str());
}
}
}