Revert "optimize update_display with dirty flags, remove blocking lv_refr_now from periodic loop"
This reverts commit 26daea34f2.
This commit is contained in:
@@ -543,6 +543,7 @@ static void lvgl_work(void *parameter)
|
||||
update_ui();
|
||||
else
|
||||
packer_ui_update();
|
||||
lv_refr_now(NULL);
|
||||
}
|
||||
|
||||
rt_thread_mdelay(5);
|
||||
|
||||
+23
-40
@@ -32,11 +32,6 @@ static volatile uint32_t pack_count = 2340;
|
||||
static lv_anim_t breath_anim;
|
||||
static bool breath_active = false;
|
||||
|
||||
static uint32_t disp_weight = 0xFFFFFFFF;
|
||||
static uint32_t disp_count = 0xFFFFFFFF;
|
||||
static bool disp_running = false;
|
||||
static uint8_t disp_step = 0xFF;
|
||||
|
||||
static void status_breath_anim(void *obj, int32_t v)
|
||||
{
|
||||
lv_obj_set_style_shadow_opa((lv_obj_t *)obj, v, 0);
|
||||
@@ -460,45 +455,33 @@ static void update_display(void)
|
||||
{
|
||||
char tmp[32];
|
||||
|
||||
if (current_weight != disp_weight)
|
||||
snprintf(tmp, sizeof(tmp), "%lu.%lu", (unsigned long)(current_weight / 10), (unsigned long)(current_weight % 10));
|
||||
lv_label_set_text(label_current_weight, tmp);
|
||||
|
||||
snprintf(tmp, sizeof(tmp), "%lu", (unsigned long)pack_count);
|
||||
lv_label_set_text(label_pack_count, tmp);
|
||||
|
||||
if (is_running)
|
||||
{
|
||||
disp_weight = current_weight;
|
||||
snprintf(tmp, sizeof(tmp), "%lu.%lu", (unsigned long)(current_weight / 10), (unsigned long)(current_weight % 10));
|
||||
lv_label_set_text(label_current_weight, tmp);
|
||||
lv_label_set_text(label_status, "运行中");
|
||||
lv_obj_set_style_text_color(label_status, COLOR_TEXT_MAIN, 0);
|
||||
lv_obj_set_style_bg_color(status_dot, COLOR_GREEN, 0);
|
||||
start_breathing(status_dot);
|
||||
}
|
||||
else
|
||||
{
|
||||
lv_label_set_text(label_status, "已停止");
|
||||
lv_obj_set_style_text_color(label_status, COLOR_TEXT_MAIN, 0);
|
||||
lv_obj_set_style_bg_color(status_dot, COLOR_RED, 0);
|
||||
lv_obj_set_style_shadow_opa(status_dot, 0, 0);
|
||||
lv_anim_del(status_dot, NULL);
|
||||
breath_active = false;
|
||||
}
|
||||
|
||||
if (pack_count != disp_count)
|
||||
static const char *step_name[] = {"进料", "称重", "压缩", "打包", "封包", "出料"};
|
||||
if (current_step < 6)
|
||||
{
|
||||
disp_count = pack_count;
|
||||
snprintf(tmp, sizeof(tmp), "%lu", (unsigned long)pack_count);
|
||||
lv_label_set_text(label_pack_count, tmp);
|
||||
}
|
||||
|
||||
if (is_running != disp_running)
|
||||
{
|
||||
disp_running = is_running;
|
||||
if (is_running)
|
||||
{
|
||||
lv_label_set_text(label_status, "运行中");
|
||||
lv_obj_set_style_bg_color(status_dot, COLOR_GREEN, 0);
|
||||
start_breathing(status_dot);
|
||||
}
|
||||
else
|
||||
{
|
||||
lv_label_set_text(label_status, "已停止");
|
||||
lv_obj_set_style_bg_color(status_dot, COLOR_RED, 0);
|
||||
lv_obj_set_style_shadow_opa(status_dot, 0, 0);
|
||||
lv_anim_del(status_dot, NULL);
|
||||
breath_active = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (current_step != disp_step)
|
||||
{
|
||||
disp_step = current_step;
|
||||
static const char *step_name[] = {"进料", "称重", "压缩", "打包", "封包", "出料"};
|
||||
if (current_step < 6)
|
||||
lv_label_set_text(label_step, step_name[current_step]);
|
||||
lv_label_set_text(label_step, step_name[current_step]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user