diff --git a/.vscode/settings.json b/.vscode/settings.json index b09bd63..5daca96 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -43,6 +43,8 @@ "fluxpower.h": "c", "adc_cali_scheme.h": "c", "flux_button.h": "c", - "chrono": "c" + "chrono": "c", + "random": "c", + "time.h": "c" } } diff --git a/components/FluxUI/CMakeLists.txt b/components/FluxUI/CMakeLists.txt index 1178d31..ca45389 100644 --- a/components/FluxUI/CMakeLists.txt +++ b/components/FluxUI/CMakeLists.txt @@ -41,6 +41,7 @@ fonts/ui_font_symbols16.c fonts/ui_font_symbolsalibaba.c ui_event_wifi.c ui_event_debug.c +ui_event_light.c ) idf_component_register(SRCS ${SOURCES} diff --git a/components/FluxUI/ui_event_debug.c b/components/FluxUI/ui_event_debug.c index 177ac90..534764e 100644 --- a/components/FluxUI/ui_event_debug.c +++ b/components/FluxUI/ui_event_debug.c @@ -1,10 +1,14 @@ -/*此文件中专门实现Debug过程中的事件的处理*/ - -// This file was generated by SquareLine Studio -// SquareLine Studio version: SquareLine Studio 1.5.1 -// LVGL version: 8.3.6 -// Project name: ESP32S3_UI - +/** + * @file ui_event_debug.c + * @brief 此文件中专门实现Debug过程中的事件的处理 + * + * 仅仅Debug模式下运行 + * + * @author wang xiang en + * @date 2025-04-19 + * @version 版本号 + * @copyright 版权声明((C)2025, YUWELL MEDTECH Co.ltd) + */ #include "ui.h" #include "driver/ledc.h" #include "esp_err.h" @@ -18,10 +22,16 @@ #include "FluxProtocol.h" -/*选择是否使能Debug页面的操作*/ +/* 选择是否使能Debug页面的操作 */ #define MODE_TEST 0 -/*流量计当前示数回传函数——Debug模式*/ +/** + * @brief 流量读取按键按下事件 + * + * 流量计当前示数回传函数——Debug模式 + * + * @param[in] e not used + */ void on_buttonFluxRead_clicked(lv_event_t * e) { /*选择是否使用Debug中的操作*/ @@ -42,7 +52,13 @@ void on_buttonFluxRead_clicked(lv_event_t * e) } -/*流量计当前示数显示——Debug模式*/ +/** + * @brief 清空文本域事件 + * + * 清空文本域 + * + * @param[in] e not used + */ void on_buttonClearTextarea_clicked(lv_event_t * e) { #if MODE_TEST @@ -50,6 +66,13 @@ void on_buttonClearTextarea_clicked(lv_event_t * e) #endif } +/** + * @brief 获取当前北京时间事件 + * + * 获取当前北京时间 + * + * @param[in] e not used + */ void on_buttonGetTime_clicked(lv_event_t * e) { diff --git a/components/FluxUI/ui_event_light.c b/components/FluxUI/ui_event_light.c new file mode 100644 index 0000000..b1e7f79 --- /dev/null +++ b/components/FluxUI/ui_event_light.c @@ -0,0 +1,33 @@ +/** + * @file ui_event_light.c + * @brief 此文件中专门实现亮度调节的事件处理 + * + * 通过活动触摸屏来调节亮度 + * + * @author wang xiang en + * @date 2025-04-19 + * @version 版本号 + * @copyright 版权声明((C)2025, YUWELL MEDTECH Co.ltd) + */ +#include "ui.h" +#include "driver/ledc.h" +#include "esp_err.h" +#include "esp_log.h" + +/* 亮度最低值设定 */ +#define LOWERST_LIGHT_LEVEL (7222) + +/*亮度调节回调函数*/ +void on_sliderLight_valueChanged(lv_event_t * e) +{ + uint32_t value = 8192-lv_slider_get_value(e->target); + + if (value>LOWERST_LIGHT_LEVEL) + { + value = LOWERST_LIGHT_LEVEL; + } + + ESP_ERROR_CHECK(ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0, value)); + // Update duty to apply the new value + ESP_ERROR_CHECK(ledc_update_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0)); +} diff --git a/components/FluxUI/ui_event_wifi.c b/components/FluxUI/ui_event_wifi.c index 730cfe4..8d56715 100644 --- a/components/FluxUI/ui_event_wifi.c +++ b/components/FluxUI/ui_event_wifi.c @@ -1,11 +1,14 @@ - -/*此文件中专门实现WIFI事件的处理*/ - -// This file was generated by SquareLine Studio -// SquareLine Studio version: SquareLine Studio 1.5.1 -// LVGL version: 8.3.6 -// Project name: ESP32S3_UI - +/** + * @file ui_event_wifi.c + * @brief 此文件中专门实现WIFI事件的处理 + * + * 仅仅Debug模式下运行 + * + * @author wang xiang en + * @date 2025-04-19 + * @version 版本号 + * @copyright 版权声明((C)2025, YUWELL MEDTECH Co.ltd) + */ #include "ui.h" #include "esp_err.h" #include "esp_log.h" @@ -16,8 +19,13 @@ /************************************ WIFI调节函数 ******************************************* */ - -/*wifi搜索回调函数*/ +/** + * @brief 点击Wifi搜索事件 + * + * wifi搜索回调函数 + * + * @param[in] e not used + */ void on_buttonSearchWifi_clicked(lv_event_t * e) { /*部分电路板不具有WIFI连接功能*/ @@ -27,9 +35,13 @@ void on_buttonSearchWifi_clicked(lv_event_t * e) } - - -/*WiFi连接选项修改回调函数*/ +/** + * @brief 修改WIFI选定事件 + * + * WiFi连接选项修改回调函数 + * + * @param[in] e not used + */ void on_dropDownWifiName_valueChanged(lv_event_t * e) { // Your code here @@ -46,9 +58,13 @@ void on_dropDownWifiName_valueChanged(lv_event_t * e) } } - - -/*WIFI连接按键按下回调函数*/ +/** + * @brief Wifi连接按键按下回调函数 + * + * WIFI连接按键按下回调函数 + * + * @param[in] e not used + */ void on_buttonConnectWifi_clicked(lv_event_t * e) { /*部分电路板不具有WIFI连接功能*/ @@ -97,9 +113,13 @@ void on_buttonConnectWifi_clicked(lv_event_t * e) } - - -/*WIFI密码清空按键按下回调函数*/ +/** + * @brief 清空WIFI密码 + * + * WIFI密码清空按键按下回调函数 + * + * @param[in] e not used + */ void on_buttonClearPassword_clicked(lv_event_t * e) { // Your code here diff --git a/components/FluxUI/ui_events.c b/components/FluxUI/ui_events.c index 662bd78..02be496 100644 --- a/components/FluxUI/ui_events.c +++ b/components/FluxUI/ui_events.c @@ -1,8 +1,14 @@ -// This file was generated by SquareLine Studio -// SquareLine Studio version: SquareLine Studio 1.5.1 -// LVGL version: 8.3.6 -// Project name: ESP32S3_UI - +/** + * @file ui_event_wifi.c + * @brief 此文件中专门实现WIFI事件的处理 + * + * 仅仅Debug模式下运行 + * + * @author wang xiang en + * @date 2025-04-19 + * @version 版本号 + * @copyright 版权声明((C)2025, YUWELL MEDTECH Co.ltd) + */ #include "ui.h" #include "driver/ledc.h" #include "esp_err.h" @@ -22,10 +28,11 @@ #include "lwip/apps/sntp.h" #include -#define LOWERST_LIGHT_LEVEL (7222) + /*更新当前测试标准*/ static void standardVolumeRefresh(void); + /*根据呼吸频率调整积分时间*/ static void comulateTimeSend(void); @@ -40,27 +47,10 @@ static void comulateResultRead(lv_timer_t * timer) /*下发问询120个参数*/ ESP_ERROR_CHECK(ModbusRTU_Send_0306(ECHO_UART_PORT_NUM1,&flux_frame)); - lv_label_set_text(ui_pageHome_labelStartTest,"Test Complete!"); } -/*亮度调节回调函数*/ -void on_sliderLight_valueChanged(lv_event_t * e) -{ - uint32_t value = 8192-lv_slider_get_value(e->target); - - if (value>LOWERST_LIGHT_LEVEL) - { - value = LOWERST_LIGHT_LEVEL; - } - - ESP_ERROR_CHECK(ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0, value)); - // Update duty to apply the new value - ESP_ERROR_CHECK(ledc_update_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0)); -} - - /*设备类型选择回调函数*/ void on_dropdownDeviceType_valueChanged(lv_event_t * e) { diff --git a/components/FluxUart/FluxUart.c b/components/FluxUart/FluxUart.c index 0e20141..6783a4f 100644 --- a/components/FluxUart/FluxUart.c +++ b/components/FluxUart/FluxUart.c @@ -394,7 +394,7 @@ esp_err_t RefreshResult(void) break; } - /*获取当前测试流量*/ + /* 获取当前测试流量 */ float breathVolume = FluxMachineData.cumulativeVolume/FluxMachineData.breathTimes; lv_label_set_text_fmt(ui_pageHome_labelTestVolume,"%.2f",breathVolume);