From 1ef9face5abe109850802cf5d0c8570d3b650150 Mon Sep 17 00:00:00 2001 From: anschrammh Date: Thu, 30 Mar 2023 13:27:24 +0200 Subject: [PATCH] Updated lvgl simulated screen files --- .../lv_port_win_codeblocks/altimeter_screen.c | 2 +- .../lv_port_win_codeblocks/settings_screen.c | 15 ++++++++++++--- .../lv_port_win_codeblocks/watch_face.c | 15 +++++++++++++-- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/lvgl_win_sim/lv_port_win_codeblocks/altimeter_screen.c b/src/lvgl_win_sim/lv_port_win_codeblocks/altimeter_screen.c index 40bf7f2..05f13cf 100644 --- a/src/lvgl_win_sim/lv_port_win_codeblocks/altimeter_screen.c +++ b/src/lvgl_win_sim/lv_port_win_codeblocks/altimeter_screen.c @@ -183,7 +183,7 @@ static void apply_altitude_event_cb(lv_event_t *e) { AltimeterScreen_t *altimeterScreen = e->user_data; - uint32_t spinbox_value = lv_spinbox_get_value(altimeterScreen->altitudeOffset_spinbox); + int32_t spinbox_value = lv_spinbox_get_value(altimeterScreen->altitudeOffset_spinbox); destroy_altitude_setting_content(altimeterScreen); //Show the main value diff --git a/src/lvgl_win_sim/lv_port_win_codeblocks/settings_screen.c b/src/lvgl_win_sim/lv_port_win_codeblocks/settings_screen.c index 7b1286f..a404cc5 100644 --- a/src/lvgl_win_sim/lv_port_win_codeblocks/settings_screen.c +++ b/src/lvgl_win_sim/lv_port_win_codeblocks/settings_screen.c @@ -356,14 +356,14 @@ static void load_connectivity_side_screen(SettingsScreen_t *settingsScreen) lv_obj_align_to(label, ble_switch, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5); lv_obj_t *dev_name_label = lv_label_create(settingsScreen->side_screen); - lv_label_set_text_static(dev_name_label, "W800SW"); + lv_label_set_text_static(dev_name_label, NULL/*"W800SW"*/); lv_obj_set_style_text_color(dev_name_label, lv_color_make(130, 130, 130), LV_PART_MAIN); lv_obj_align_to(dev_name_label, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5); lv_obj_t *wifi_switch = lv_switch_create(settingsScreen->side_screen); lv_obj_align_to(wifi_switch, dev_name_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10); - + lv_obj_add_state(wifi_switch, LV_STATE_DISABLED); label = lv_label_create(settingsScreen->side_screen); lv_label_set_text_static(label, "WiFi"); lv_obj_align_to(label, wifi_switch, LV_ALIGN_OUT_RIGHT_MID, 10, 0); @@ -417,9 +417,18 @@ static void load_about_side_screen(SettingsScreen_t *settingsScreen) lv_obj_set_style_text_color(settingsScreen->currentTime.current_time_label, lv_color_make(130, 130, 130), LV_PART_MAIN); lv_obj_align_to(settingsScreen->currentTime.current_time_label, rtc_time, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5); + lv_obj_t *battery_label = lv_label_create(settingsScreen->side_screen); + lv_label_set_text_static(battery_label, "Battery Voltage :"); + lv_obj_align_to(battery_label, settingsScreen->currentTime.current_time_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5); + + lv_obj_t *battery_voltage = lv_label_create(settingsScreen->side_screen); + lv_label_set_text_static(battery_voltage, "4277 mV"); + lv_obj_set_style_text_color(battery_voltage, lv_color_make(130, 130, 130), LV_PART_MAIN); + lv_obj_align_to(battery_voltage, battery_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5); + label = lv_label_create(settingsScreen->side_screen); lv_label_set_text_static(label, "Factory Reset :"); - lv_obj_align_to(label, settingsScreen->currentTime.current_time_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5); + lv_obj_align_to(label, battery_voltage, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5); lv_obj_t *factory_rst_btn = lv_btn_create(settingsScreen->side_screen); lv_obj_align_to(factory_rst_btn, label, LV_ALIGN_OUT_BOTTOM_MID, 0, 5); diff --git a/src/lvgl_win_sim/lv_port_win_codeblocks/watch_face.c b/src/lvgl_win_sim/lv_port_win_codeblocks/watch_face.c index 1379598..5b460a4 100644 --- a/src/lvgl_win_sim/lv_port_win_codeblocks/watch_face.c +++ b/src/lvgl_win_sim/lv_port_win_codeblocks/watch_face.c @@ -180,7 +180,18 @@ static void hide_hour_and_minutes_hand_cb(lv_event_t *e) { WatchFace_t *watchFace = e->user_data; - if(lv_obj_has_flag(watchFace->hourHand.handImg, LV_OBJ_FLAG_HIDDEN)) + if(255 == lv_obj_get_style_opa(watchFace->hourHand.handImg, LV_PART_MAIN)) + { + lv_obj_set_style_opa(watchFace->hourHand.handImg, 120, LV_PART_MAIN); + lv_obj_set_style_opa(watchFace->minuteHand.handImg, 120, LV_PART_MAIN); + } + else + { + lv_obj_set_style_opa(watchFace->hourHand.handImg, 255, LV_PART_MAIN); + lv_obj_set_style_opa(watchFace->minuteHand.handImg, 255, LV_PART_MAIN); + } + + /*if(lv_obj_has_flag(watchFace->hourHand.handImg, LV_OBJ_FLAG_HIDDEN)) { lv_obj_clear_flag(watchFace->hourHand.handImg, LV_OBJ_FLAG_HIDDEN); lv_obj_clear_flag(watchFace->minuteHand.handImg, LV_OBJ_FLAG_HIDDEN); @@ -189,7 +200,7 @@ static void hide_hour_and_minutes_hand_cb(lv_event_t *e) { lv_obj_add_flag(watchFace->hourHand.handImg, LV_OBJ_FLAG_HIDDEN); lv_obj_add_flag(watchFace->minuteHand.handImg, LV_OBJ_FLAG_HIDDEN); - } + }*/ } void watch_face_init(WatchFace_t * const watchFace)