Show each printer on the fleet page as a status gauge.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -290,7 +290,7 @@ struct Widgets {
|
||||
lv_obj_t *elapsed = nullptr;
|
||||
};
|
||||
struct OverviewWidgets {
|
||||
lv_obj_t *status, *task, *meta, *progress, *accent;
|
||||
lv_obj_t *arc, *value, *detail;
|
||||
};
|
||||
|
||||
inline void set_text(lv_obj_t *label, const std::string &text) {
|
||||
@@ -362,13 +362,14 @@ inline void render(const Snapshot &data, const Widgets &widgets) {
|
||||
inline void render_overview(const Snapshot &data, const OverviewWidgets &widgets) {
|
||||
const bool live = data.live();
|
||||
const uint32_t color = data.status_color();
|
||||
set_text(widgets.status, data.status_text());
|
||||
lv_obj_set_style_text_color(widgets.status, lv_color_hex(color), 0);
|
||||
if (widgets.task) set_text(widgets.task, data.overview_task());
|
||||
set_text(widgets.meta, data.overview_meta());
|
||||
lv_bar_set_value(widgets.progress, live ? gauge_value(data.progress, 100) : 0, LV_ANIM_OFF);
|
||||
lv_obj_set_style_bg_color(widgets.progress, lv_color_hex(color), LV_PART_INDICATOR);
|
||||
lv_obj_set_style_bg_color(widgets.accent, lv_color_hex(color), 0);
|
||||
const float shown = live && std::isfinite(data.progress)
|
||||
? std::clamp(data.progress, 0.0f, 100.0f) : NAN;
|
||||
lv_arc_set_value(widgets.arc, live ? gauge_value(data.progress, 100) : 0);
|
||||
lv_obj_set_style_arc_color(widgets.arc, lv_color_hex(color), LV_PART_INDICATOR);
|
||||
set_text(widgets.value, number(shown));
|
||||
lv_obj_set_style_text_color(widgets.value, lv_color_hex(live ? color : MUTED), 0);
|
||||
set_text(widgets.detail, data.status_text());
|
||||
lv_obj_set_style_text_color(widgets.detail, lv_color_hex(color), 0);
|
||||
}
|
||||
|
||||
inline void render_fleet_summary(lv_obj_t *label, const FleetCounts &counts) {
|
||||
|
||||
Reference in New Issue
Block a user