diff --git a/src/image_label.cpp b/src/image_label.cpp index 059cc15..177256a 100644 --- a/src/image_label.cpp +++ b/src/image_label.cpp @@ -29,13 +29,15 @@ ImageLabel::ImageLabel(lv_obj_t *parent, lv_obj_set_size(cont, LV_PCT(width_pct), LV_PCT(height_pct)); lv_obj_set_style_border_width(cont, 2, 0); lv_obj_set_style_radius(cont, 4, 0); + lv_obj_set_style_pad_left(cont, 5, 0); + lv_obj_set_style_pad_right(cont, 5, 0); lv_img_set_src(image, img); lv_label_set_text(label, value); auto scale = (double)lv_disp_get_physical_hor_res(NULL) / 800.0; - lv_obj_align(image, LV_ALIGN_LEFT_MID, -30 * scale, 0); + lv_obj_align(image, LV_ALIGN_LEFT_MID, 0, 0); lv_obj_align(label, LV_ALIGN_RIGHT_MID, 0, 0); } @@ -47,7 +49,9 @@ ImageLabel::ImageLabel(lv_obj_t *parent, const char *v) : ImageLabel(parent, img, width_pct, height_pct, v) { - lv_img_set_zoom(image, img_scale); + auto wscale = lv_disp_get_physical_hor_res(NULL) / 800.0; + lv_img_set_size_mode(image, LV_IMG_SIZE_MODE_REAL); + lv_img_set_zoom(image, img_scale * wscale); } ImageLabel::ImageLabel(lv_obj_t *parent, diff --git a/src/main.cpp b/src/main.cpp index 2fb1f79..4a3a6e3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -91,6 +91,7 @@ static void hal_init(void) { evdev_init(); static lv_indev_drv_t indev_drv_1; + lv_indev_drv_init(&indev_drv_1); indev_drv_1.read_cb = evdev_read; // no calibration indev_drv_1.type = LV_INDEV_TYPE_POINTER; diff --git a/src/main_panel.cpp b/src/main_panel.cpp index 2ac503c..e24258d 100644 --- a/src/main_panel.cpp +++ b/src/main_panel.cpp @@ -212,7 +212,8 @@ void MainPanel::create_main(lv_obj_t * parent) lv_obj_clear_flag(temp_cont, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_size(temp_cont, LV_PCT(50), LV_PCT(50)); - + lv_obj_set_style_pad_all(temp_cont, 0, 0); + lv_obj_set_flex_flow(temp_cont, LV_FLEX_FLOW_ROW_WRAP); lv_obj_set_grid_cell(temp_cont, LV_GRID_ALIGN_START, 0, 2, LV_GRID_ALIGN_CENTER, 0, 2); diff --git a/src/sensor_container.cpp b/src/sensor_container.cpp index 89f61bb..c43d0c2 100644 --- a/src/sensor_container.cpp +++ b/src/sensor_container.cpp @@ -40,9 +40,12 @@ SensorContainer::SensorContainer(KWebSocketClient &c, // cont_height = cont_height > 60 ? 60 : cont_height; auto width_scale = (double)lv_disp_get_physical_hor_res(NULL) / 800.0; - lv_obj_set_size(sensor_cont, 330 * width_scale, 60 * width_scale); + auto height_scale = (double)lv_disp_get_physical_ver_res(NULL) / 480.0; + lv_obj_set_size(sensor_cont, 330 * width_scale, 60 * height_scale); + lv_obj_set_style_pad_all(sensor_cont, 0, 0); + lv_img_set_src(sensor_img, img); - lv_obj_align(sensor_img, LV_ALIGN_LEFT_MID, -25 * width_scale, 0); + lv_obj_align(sensor_img, LV_ALIGN_LEFT_MID, 0, 0); lv_label_set_text(sensor_label, text); lv_obj_align_to(sensor_label, sensor_img, LV_ALIGN_OUT_RIGHT_MID, -7 * width_scale, 0);