Fill overview gauges to each printer's actual progress.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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); }}')})
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user