更新UI。增加时间和IP显示
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
objects_t objects;
|
||||
|
||||
static const char *screen_names[] = { "Main" };
|
||||
static const char *object_names[] = { "main", "background_pic", "obj0", "obj1", "obj2", "obj3", "obj4", "obj5", "obj6", "obj7", "obj8", "obj9", "obj10", "obj11" };
|
||||
static const char *object_names[] = { "main", "background_pic", "obj0", "obj1", "obj2", "obj3", "obj4", "obj5", "obj6", "obj7", "obj8", "obj9", "obj10", "obj11", "obj12", "obj13" };
|
||||
|
||||
//
|
||||
// Event handlers
|
||||
@@ -45,28 +45,28 @@ void create_screen_main() {
|
||||
}
|
||||
{
|
||||
lv_obj_t *obj = lv_label_create(parent_obj);
|
||||
lv_obj_set_pos(obj, 24, 12);
|
||||
lv_obj_set_pos(obj, 15, 22);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_style_text_font(obj, &ui_font_chinese_24, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_label_set_text(obj, "智能粮仓");
|
||||
}
|
||||
{
|
||||
lv_obj_t *obj = lv_label_create(parent_obj);
|
||||
lv_obj_set_pos(obj, 15, 49);
|
||||
lv_obj_set_pos(obj, 15, 55);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_style_text_font(obj, &ui_font_chinese_16, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_label_set_text(obj, "温度");
|
||||
}
|
||||
{
|
||||
lv_obj_t *obj = lv_label_create(parent_obj);
|
||||
lv_obj_set_pos(obj, 15, 83);
|
||||
lv_obj_set_pos(obj, 15, 88);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_style_text_font(obj, &ui_font_chinese_16, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_label_set_text(obj, "湿度");
|
||||
}
|
||||
{
|
||||
lv_obj_t *obj = lv_label_create(parent_obj);
|
||||
lv_obj_set_pos(obj, 162, 40);
|
||||
lv_obj_set_pos(obj, 159, 55);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_style_text_font(obj, &ui_font_chinese_16, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_label_set_text(obj, "光照强度");
|
||||
@@ -74,7 +74,7 @@ void create_screen_main() {
|
||||
{
|
||||
lv_obj_t *obj = lv_label_create(parent_obj);
|
||||
objects.obj0 = obj;
|
||||
lv_obj_set_pos(obj, 15, 67);
|
||||
lv_obj_set_pos(obj, 17, 72);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_style_text_font(obj, &ui_font_number_16, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_color(obj, lv_color_hex(0xffd17f7f), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
@@ -83,7 +83,7 @@ void create_screen_main() {
|
||||
{
|
||||
lv_obj_t *obj = lv_label_create(parent_obj);
|
||||
objects.obj1 = obj;
|
||||
lv_obj_set_pos(obj, 166, 59);
|
||||
lv_obj_set_pos(obj, 167, 73);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_style_text_font(obj, &ui_font_number_16, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_color(obj, lv_color_hex(0xffd17f7f), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
@@ -92,7 +92,7 @@ void create_screen_main() {
|
||||
{
|
||||
lv_obj_t *obj = lv_label_create(parent_obj);
|
||||
objects.obj2 = obj;
|
||||
lv_obj_set_pos(obj, 16, 101);
|
||||
lv_obj_set_pos(obj, 17, 107);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_style_text_font(obj, &ui_font_number_16, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_color(obj, lv_color_hex(0xffd17f7f), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
@@ -100,7 +100,7 @@ void create_screen_main() {
|
||||
}
|
||||
{
|
||||
lv_obj_t *obj = lv_label_create(parent_obj);
|
||||
lv_obj_set_pos(obj, 171, 109);
|
||||
lv_obj_set_pos(obj, 151, 122);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_style_text_font(obj, &ui_font_chinese_16, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_label_set_text(obj, "门状态");
|
||||
@@ -108,7 +108,7 @@ void create_screen_main() {
|
||||
{
|
||||
lv_obj_t *obj = lv_label_create(parent_obj);
|
||||
objects.obj3 = obj;
|
||||
lv_obj_set_pos(obj, 171, 127);
|
||||
lv_obj_set_pos(obj, 163, 140);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_style_text_font(obj, &ui_font_chinese_16, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_color(obj, lv_color_hex(0xffd17f7f), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
@@ -116,7 +116,7 @@ void create_screen_main() {
|
||||
}
|
||||
{
|
||||
lv_obj_t *obj = lv_label_create(parent_obj);
|
||||
lv_obj_set_pos(obj, 16, 120);
|
||||
lv_obj_set_pos(obj, 14, 124);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_style_text_font(obj, &ui_font_chinese_16, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_label_set_text(obj, "粮食存量");
|
||||
@@ -124,7 +124,7 @@ void create_screen_main() {
|
||||
{
|
||||
lv_obj_t *obj = lv_label_create(parent_obj);
|
||||
objects.obj4 = obj;
|
||||
lv_obj_set_pos(obj, 17, 138);
|
||||
lv_obj_set_pos(obj, 17, 142);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_style_text_font(obj, &ui_font_number_16, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_color(obj, lv_color_hex(0xffd17f7f), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
@@ -132,7 +132,7 @@ void create_screen_main() {
|
||||
}
|
||||
{
|
||||
lv_obj_t *obj = lv_label_create(parent_obj);
|
||||
lv_obj_set_pos(obj, 15, 154);
|
||||
lv_obj_set_pos(obj, 14, 158);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_style_text_font(obj, &ui_font_chinese_16, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_label_set_text(obj, "粮食状态");
|
||||
@@ -140,7 +140,7 @@ void create_screen_main() {
|
||||
{
|
||||
lv_obj_t *obj = lv_label_create(parent_obj);
|
||||
objects.obj5 = obj;
|
||||
lv_obj_set_pos(obj, 16, 172);
|
||||
lv_obj_set_pos(obj, 14, 176);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_style_text_font(obj, &ui_font_chinese_16, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_color(obj, lv_color_hex(0xffd17f7f), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
@@ -148,7 +148,7 @@ void create_screen_main() {
|
||||
}
|
||||
{
|
||||
lv_obj_t *obj = lv_label_create(parent_obj);
|
||||
lv_obj_set_pos(obj, 163, 75);
|
||||
lv_obj_set_pos(obj, 160, 88);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_style_text_font(obj, &ui_font_chinese_16, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_label_set_text(obj, "空气质量");
|
||||
@@ -156,7 +156,7 @@ void create_screen_main() {
|
||||
{
|
||||
lv_obj_t *obj = lv_label_create(parent_obj);
|
||||
objects.obj6 = obj;
|
||||
lv_obj_set_pos(obj, 164, 93);
|
||||
lv_obj_set_pos(obj, 167, 106);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_style_text_font(obj, &ui_font_number_16, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_color(obj, lv_color_hex(0xffd17f7f), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
@@ -164,7 +164,7 @@ void create_screen_main() {
|
||||
}
|
||||
{
|
||||
lv_obj_t *obj = lv_label_create(parent_obj);
|
||||
lv_obj_set_pos(obj, 138, 146);
|
||||
lv_obj_set_pos(obj, 135, 158);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_style_text_font(obj, &ui_font_chinese_16, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_label_set_text(obj, "人存在状态");
|
||||
@@ -172,7 +172,7 @@ void create_screen_main() {
|
||||
{
|
||||
lv_obj_t *obj = lv_label_create(parent_obj);
|
||||
objects.obj7 = obj;
|
||||
lv_obj_set_pos(obj, 139, 164);
|
||||
lv_obj_set_pos(obj, 139, 176);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_style_text_font(obj, &ui_font_chinese_16, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_color(obj, lv_color_hex(0xffd17f7f), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
@@ -180,28 +180,28 @@ void create_screen_main() {
|
||||
}
|
||||
{
|
||||
lv_obj_t *obj = lv_label_create(parent_obj);
|
||||
lv_obj_set_pos(obj, 22, 190);
|
||||
lv_obj_set_pos(obj, 17, 206);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_style_text_font(obj, &ui_font_chinese_16, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_label_set_text(obj, "加热");
|
||||
}
|
||||
{
|
||||
lv_obj_t *obj = lv_label_create(parent_obj);
|
||||
lv_obj_set_pos(obj, 74, 189);
|
||||
lv_obj_set_pos(obj, 63, 206);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_style_text_font(obj, &ui_font_chinese_16, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_label_set_text(obj, "制冷");
|
||||
}
|
||||
{
|
||||
lv_obj_t *obj = lv_label_create(parent_obj);
|
||||
lv_obj_set_pos(obj, 122, 188);
|
||||
lv_obj_set_pos(obj, 111, 206);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_style_text_font(obj, &ui_font_chinese_16, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_label_set_text(obj, "通风");
|
||||
}
|
||||
{
|
||||
lv_obj_t *obj = lv_label_create(parent_obj);
|
||||
lv_obj_set_pos(obj, 178, 188);
|
||||
lv_obj_set_pos(obj, 159, 206);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_style_text_font(obj, &ui_font_chinese_16, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_label_set_text(obj, "照明");
|
||||
@@ -209,7 +209,7 @@ void create_screen_main() {
|
||||
{
|
||||
lv_obj_t *obj = lv_label_create(parent_obj);
|
||||
objects.obj8 = obj;
|
||||
lv_obj_set_pos(obj, 29, 206);
|
||||
lv_obj_set_pos(obj, 49, 206);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_style_text_font(obj, &ui_font_chinese_16, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_color(obj, lv_color_hex(0xffd17f7f), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
@@ -218,7 +218,7 @@ void create_screen_main() {
|
||||
{
|
||||
lv_obj_t *obj = lv_label_create(parent_obj);
|
||||
objects.obj9 = obj;
|
||||
lv_obj_set_pos(obj, 81, 207);
|
||||
lv_obj_set_pos(obj, 95, 206);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_style_text_font(obj, &ui_font_chinese_16, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_color(obj, lv_color_hex(0xffd17f7f), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
@@ -227,7 +227,7 @@ void create_screen_main() {
|
||||
{
|
||||
lv_obj_t *obj = lv_label_create(parent_obj);
|
||||
objects.obj10 = obj;
|
||||
lv_obj_set_pos(obj, 131, 206);
|
||||
lv_obj_set_pos(obj, 143, 206);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_style_text_font(obj, &ui_font_chinese_16, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_color(obj, lv_color_hex(0xffd17f7f), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
@@ -236,12 +236,30 @@ void create_screen_main() {
|
||||
{
|
||||
lv_obj_t *obj = lv_label_create(parent_obj);
|
||||
objects.obj11 = obj;
|
||||
lv_obj_set_pos(obj, 187, 207);
|
||||
lv_obj_set_pos(obj, 192, 206);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_style_text_font(obj, &ui_font_chinese_16, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_color(obj, lv_color_hex(0xffd17f7f), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_label_set_text(obj, "");
|
||||
}
|
||||
{
|
||||
lv_obj_t *obj = lv_label_create(parent_obj);
|
||||
objects.obj12 = obj;
|
||||
lv_obj_set_pos(obj, 88, 8);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_style_text_font(obj, &ui_font_number_14, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_color(obj, lv_color_hex(0xff000000), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_label_set_text(obj, "");
|
||||
}
|
||||
{
|
||||
lv_obj_t *obj = lv_label_create(parent_obj);
|
||||
objects.obj13 = obj;
|
||||
lv_obj_set_pos(obj, 124, 28);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_style_text_font(obj, &ui_font_number_16, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_color(obj, lv_color_hex(0xff000000), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_label_set_text(obj, "");
|
||||
}
|
||||
}
|
||||
|
||||
tick_screen_main();
|
||||
@@ -358,6 +376,24 @@ void tick_screen_main() {
|
||||
tick_value_change_obj = NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
const char *new_val = evalTextProperty(flowState, 27, 3, "Failed to evaluate Text in Label widget");
|
||||
const char *cur_val = lv_label_get_text(objects.obj12);
|
||||
if (strcmp(new_val, cur_val) != 0) {
|
||||
tick_value_change_obj = objects.obj12;
|
||||
lv_label_set_text(objects.obj12, new_val);
|
||||
tick_value_change_obj = NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
const char *new_val = evalTextProperty(flowState, 28, 3, "Failed to evaluate Text in Label widget");
|
||||
const char *cur_val = lv_label_get_text(objects.obj13);
|
||||
if (strcmp(new_val, cur_val) != 0) {
|
||||
tick_value_change_obj = objects.obj13;
|
||||
lv_label_set_text(objects.obj13, new_val);
|
||||
tick_value_change_obj = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
typedef void (*tick_screen_func_t)();
|
||||
@@ -380,6 +416,7 @@ ext_font_desc_t fonts[] = {
|
||||
{ "chinese_24", &ui_font_chinese_24 },
|
||||
{ "chinese_16", &ui_font_chinese_16 },
|
||||
{ "number_16", &ui_font_number_16 },
|
||||
{ "number_14", &ui_font_number_14 },
|
||||
#if LV_FONT_MONTSERRAT_8
|
||||
{ "MONTSERRAT_8", &lv_font_montserrat_8 },
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user