diff --git a/esphome/bambu-display/README.md b/esphome/bambu-display/README.md index 9005acd..eae2d9a 100644 --- a/esphome/bambu-display/README.md +++ b/esphome/bambu-display/README.md @@ -17,10 +17,11 @@ Home Assistant must be running and its printer integrations must have current pr The configured swipe order is: -1. Print Status Overview — one steam gauge per printer. Each ring uses the - color of that printer's active filament. Black filament keeps a grey ring - behind the gauge so it stays visible on the black page. The center shows the percent - complete in white, with the printer name and estimated finish time underneath. +1. Print Status Overview — one steam gauge per printer. The filled part of + each ring is that printer's print progress, drawn in the active filament + color. Black filament keeps a grey ring behind the gauge so it stays visible + on the black page. The center shows the percent complete in white, with the + printer name and estimated finish time underneath. The local time is in the top-right corner. Tap a gauge to open that printer. 2. PrintsCharming — P1S, Office, both four-slot AMS units. 3. Polly-Pocket — A1 mini, Office, external spool. diff --git a/esphome/bambu-display/dashboard.h b/esphome/bambu-display/dashboard.h index 9111e4b..7a4f314 100644 --- a/esphome/bambu-display/dashboard.h +++ b/esphome/bambu-display/dashboard.h @@ -379,10 +379,11 @@ inline void render_overview(const Snapshot &data, const OverviewWidgets &widgets const uint32_t filament = data.active_filament_color(); const float shown = live && std::isfinite(data.progress) ? std::clamp(data.progress, 0.0f, 100.0f) : NAN; - lv_obj_set_style_arc_color(widgets.arc, lv_color_hex(filament), LV_PART_MAIN); + const bool black = filament_is_black(filament); + lv_obj_set_style_arc_color(widgets.arc, lv_color_hex(black ? RING_BACKING : TRACK), LV_PART_MAIN); lv_obj_set_style_arc_color(widgets.arc, lv_color_hex(filament), LV_PART_INDICATOR); - lv_arc_set_value(widgets.arc, 100); - if (filament_is_black(filament)) { + lv_arc_set_value(widgets.arc, live ? gauge_value(data.progress, 100) : 0); + if (black) { lv_obj_set_style_arc_color(widgets.backing, lv_color_hex(RING_BACKING), LV_PART_MAIN); lv_obj_set_style_arc_color(widgets.backing, lv_color_hex(RING_BACKING), LV_PART_INDICATOR); lv_obj_clear_flag(widgets.backing, LV_OBJ_FLAG_HIDDEN); diff --git a/esphome/bambu-display/generate.py b/esphome/bambu-display/generate.py index a28734a..de3814e 100644 --- a/esphome/bambu-display/generate.py +++ b/esphome/bambu-display/generate.py @@ -283,8 +283,8 @@ def overview_gauge(printer, x, y, arc): 'adjustable': False, 'hidden': True, 'gesture_bubble': True, 'clickable': True, 'on_click': open_page}}, {'arc': {'id': f'{pid}_overview_arc', 'x': inner_x, 'y': y, - 'width': arc, 'height': arc, 'min_value': 0, 'max_value': 100, 'value': 100, - 'start_angle': 135, 'end_angle': 45, 'arc_width': inner, 'arc_color': GREEN, + 'width': arc, 'height': arc, 'min_value': 0, 'max_value': 100, 'value': 0, + 'start_angle': 135, 'end_angle': 45, 'arc_width': inner, 'arc_color': TRACK, 'indicator': {'arc_color': GREEN, 'arc_width': inner}, 'adjustable': False, 'gesture_bubble': True, 'clickable': True, 'on_click': open_page}}, label('--', inner_x, number_y, arc, value_font, id=f'{pid}_overview_value', diff --git a/esphome/bambu-display/generated.yaml b/esphome/bambu-display/generated.yaml index db39cda..ad11961 100644 --- a/esphome/bambu-display/generated.yaml +++ b/esphome/bambu-display/generated.yaml @@ -1871,11 +1871,11 @@ lvgl: height: 145 min_value: 0 max_value: 100 - value: 100 + value: 0 start_angle: 135 end_angle: 45 arc_width: 12 - arc_color: 65280 + arc_color: 1647403 indicator: arc_color: 65280 arc_width: 12 @@ -1973,11 +1973,11 @@ lvgl: height: 145 min_value: 0 max_value: 100 - value: 100 + value: 0 start_angle: 135 end_angle: 45 arc_width: 12 - arc_color: 65280 + arc_color: 1647403 indicator: arc_color: 65280 arc_width: 12 @@ -2075,11 +2075,11 @@ lvgl: height: 145 min_value: 0 max_value: 100 - value: 100 + value: 0 start_angle: 135 end_angle: 45 arc_width: 12 - arc_color: 65280 + arc_color: 1647403 indicator: arc_color: 65280 arc_width: 12 @@ -2177,11 +2177,11 @@ lvgl: height: 145 min_value: 0 max_value: 100 - value: 100 + value: 0 start_angle: 135 end_angle: 45 arc_width: 12 - arc_color: 65280 + arc_color: 1647403 indicator: arc_color: 65280 arc_width: 12 @@ -2279,11 +2279,11 @@ lvgl: height: 145 min_value: 0 max_value: 100 - value: 100 + value: 0 start_angle: 135 end_angle: 45 arc_width: 12 - arc_color: 65280 + arc_color: 1647403 indicator: arc_color: 65280 arc_width: 12 @@ -2381,11 +2381,11 @@ lvgl: height: 145 min_value: 0 max_value: 100 - value: 100 + value: 0 start_angle: 135 end_angle: 45 arc_width: 12 - arc_color: 65280 + arc_color: 1647403 indicator: arc_color: 65280 arc_width: 12 @@ -2483,11 +2483,11 @@ lvgl: height: 145 min_value: 0 max_value: 100 - value: 100 + value: 0 start_angle: 135 end_angle: 45 arc_width: 12 - arc_color: 65280 + arc_color: 1647403 indicator: arc_color: 65280 arc_width: 12 diff --git a/esphome/bambu-display/preview.py b/esphome/bambu-display/preview.py index 0e5dfe1..b2e932b 100644 --- a/esphome/bambu-display/preview.py +++ b/esphome/bambu-display/preview.py @@ -98,6 +98,7 @@ inline void setup() { pid = printer['id'] steps.append({'lambda': Lambda( f'if (std::string(lv_label_get_text(id({pid}_overview_value))) != "67" || ' + f'lv_arc_get_value(id({pid}_overview_arc)) != 67 || ' f'std::string(lv_label_get_text(id({pid}_overview_percent))) != "%" || ' f'std::string(lv_label_get_text(id({pid}_overview_finish))) == "--") ' f'{{ ESP_LOGE("preview", "Fleet gauge render failed: {pid}"); exit(7); }}')}) diff --git a/esphome/bambu-display/test_generate.py b/esphome/bambu-display/test_generate.py index bf7d67f..273edd3 100644 --- a/esphome/bambu-display/test_generate.py +++ b/esphome/bambu-display/test_generate.py @@ -172,6 +172,8 @@ class FleetTests(unittest.TestCase): self.assertEqual(arc['on_click'], [{'lvgl.page.show': printer['id'] + '_page'}]) self.assertGreaterEqual(arc['width'], 120) self.assertLessEqual(arc['width'], 154) + self.assertEqual(arc['value'], 0) + self.assertEqual(arc['arc_color'], 0x19232B) self.assertEqual(arc['start_angle'], 135) self.assertLessEqual(arc['x'] + arc['width'], 800) self.assertLessEqual(arc['y'] + arc['height'], 480)