修改了部分event代码
This commit is contained in:
parent
58cde461c9
commit
627c12e37e
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
@ -43,6 +43,8 @@
|
|||||||
"fluxpower.h": "c",
|
"fluxpower.h": "c",
|
||||||
"adc_cali_scheme.h": "c",
|
"adc_cali_scheme.h": "c",
|
||||||
"flux_button.h": "c",
|
"flux_button.h": "c",
|
||||||
"chrono": "c"
|
"chrono": "c",
|
||||||
|
"random": "c",
|
||||||
|
"time.h": "c"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,6 +41,7 @@ fonts/ui_font_symbols16.c
|
|||||||
fonts/ui_font_symbolsalibaba.c
|
fonts/ui_font_symbolsalibaba.c
|
||||||
ui_event_wifi.c
|
ui_event_wifi.c
|
||||||
ui_event_debug.c
|
ui_event_debug.c
|
||||||
|
ui_event_light.c
|
||||||
)
|
)
|
||||||
|
|
||||||
idf_component_register(SRCS ${SOURCES}
|
idf_component_register(SRCS ${SOURCES}
|
||||||
|
|||||||
@ -1,10 +1,14 @@
|
|||||||
/*此文件中专门实现Debug过程中的事件的处理*/
|
/**
|
||||||
|
* @file ui_event_debug.c
|
||||||
// This file was generated by SquareLine Studio
|
* @brief 此文件中专门实现Debug过程中的事件的处理
|
||||||
// SquareLine Studio version: SquareLine Studio 1.5.1
|
*
|
||||||
// LVGL version: 8.3.6
|
* 仅仅Debug模式下运行
|
||||||
// Project name: ESP32S3_UI
|
*
|
||||||
|
* @author wang xiang en
|
||||||
|
* @date 2025-04-19
|
||||||
|
* @version 版本号
|
||||||
|
* @copyright 版权声明((C)2025, YUWELL MEDTECH Co.ltd)
|
||||||
|
*/
|
||||||
#include "ui.h"
|
#include "ui.h"
|
||||||
#include "driver/ledc.h"
|
#include "driver/ledc.h"
|
||||||
#include "esp_err.h"
|
#include "esp_err.h"
|
||||||
@ -18,10 +22,16 @@
|
|||||||
#include "FluxProtocol.h"
|
#include "FluxProtocol.h"
|
||||||
|
|
||||||
|
|
||||||
/*选择是否使能Debug页面的操作*/
|
/* 选择是否使能Debug页面的操作 */
|
||||||
#define MODE_TEST 0
|
#define MODE_TEST 0
|
||||||
|
|
||||||
/*流量计当前示数回传函数——Debug模式*/
|
/**
|
||||||
|
* @brief 流量读取按键按下事件
|
||||||
|
*
|
||||||
|
* 流量计当前示数回传函数——Debug模式
|
||||||
|
*
|
||||||
|
* @param[in] e not used
|
||||||
|
*/
|
||||||
void on_buttonFluxRead_clicked(lv_event_t * e)
|
void on_buttonFluxRead_clicked(lv_event_t * e)
|
||||||
{
|
{
|
||||||
/*选择是否使用Debug中的操作*/
|
/*选择是否使用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)
|
void on_buttonClearTextarea_clicked(lv_event_t * e)
|
||||||
{
|
{
|
||||||
#if MODE_TEST
|
#if MODE_TEST
|
||||||
@ -50,6 +66,13 @@ void on_buttonClearTextarea_clicked(lv_event_t * e)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 获取当前北京时间事件
|
||||||
|
*
|
||||||
|
* 获取当前北京时间
|
||||||
|
*
|
||||||
|
* @param[in] e not used
|
||||||
|
*/
|
||||||
void on_buttonGetTime_clicked(lv_event_t * e)
|
void on_buttonGetTime_clicked(lv_event_t * e)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
33
components/FluxUI/ui_event_light.c
Normal file
33
components/FluxUI/ui_event_light.c
Normal file
@ -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));
|
||||||
|
}
|
||||||
@ -1,11 +1,14 @@
|
|||||||
|
/**
|
||||||
/*此文件中专门实现WIFI事件的处理*/
|
* @file ui_event_wifi.c
|
||||||
|
* @brief 此文件中专门实现WIFI事件的处理
|
||||||
// This file was generated by SquareLine Studio
|
*
|
||||||
// SquareLine Studio version: SquareLine Studio 1.5.1
|
* 仅仅Debug模式下运行
|
||||||
// LVGL version: 8.3.6
|
*
|
||||||
// Project name: ESP32S3_UI
|
* @author wang xiang en
|
||||||
|
* @date 2025-04-19
|
||||||
|
* @version 版本号
|
||||||
|
* @copyright 版权声明((C)2025, YUWELL MEDTECH Co.ltd)
|
||||||
|
*/
|
||||||
#include "ui.h"
|
#include "ui.h"
|
||||||
#include "esp_err.h"
|
#include "esp_err.h"
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
@ -16,8 +19,13 @@
|
|||||||
|
|
||||||
|
|
||||||
/************************************ WIFI调节函数 ******************************************* */
|
/************************************ WIFI调节函数 ******************************************* */
|
||||||
|
/**
|
||||||
/*wifi搜索回调函数*/
|
* @brief 点击Wifi搜索事件
|
||||||
|
*
|
||||||
|
* wifi搜索回调函数
|
||||||
|
*
|
||||||
|
* @param[in] e not used
|
||||||
|
*/
|
||||||
void on_buttonSearchWifi_clicked(lv_event_t * e)
|
void on_buttonSearchWifi_clicked(lv_event_t * e)
|
||||||
{
|
{
|
||||||
/*部分电路板不具有WIFI连接功能*/
|
/*部分电路板不具有WIFI连接功能*/
|
||||||
@ -27,9 +35,13 @@ void on_buttonSearchWifi_clicked(lv_event_t * e)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 修改WIFI选定事件
|
||||||
/*WiFi连接选项修改回调函数*/
|
*
|
||||||
|
* WiFi连接选项修改回调函数
|
||||||
|
*
|
||||||
|
* @param[in] e not used
|
||||||
|
*/
|
||||||
void on_dropDownWifiName_valueChanged(lv_event_t * e)
|
void on_dropDownWifiName_valueChanged(lv_event_t * e)
|
||||||
{
|
{
|
||||||
// Your code here
|
// Your code here
|
||||||
@ -46,9 +58,13 @@ void on_dropDownWifiName_valueChanged(lv_event_t * e)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Wifi连接按键按下回调函数
|
||||||
/*WIFI连接按键按下回调函数*/
|
*
|
||||||
|
* WIFI连接按键按下回调函数
|
||||||
|
*
|
||||||
|
* @param[in] e not used
|
||||||
|
*/
|
||||||
void on_buttonConnectWifi_clicked(lv_event_t * e)
|
void on_buttonConnectWifi_clicked(lv_event_t * e)
|
||||||
{
|
{
|
||||||
/*部分电路板不具有WIFI连接功能*/
|
/*部分电路板不具有WIFI连接功能*/
|
||||||
@ -97,9 +113,13 @@ void on_buttonConnectWifi_clicked(lv_event_t * e)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 清空WIFI密码
|
||||||
/*WIFI密码清空按键按下回调函数*/
|
*
|
||||||
|
* WIFI密码清空按键按下回调函数
|
||||||
|
*
|
||||||
|
* @param[in] e not used
|
||||||
|
*/
|
||||||
void on_buttonClearPassword_clicked(lv_event_t * e)
|
void on_buttonClearPassword_clicked(lv_event_t * e)
|
||||||
{
|
{
|
||||||
// Your code here
|
// Your code here
|
||||||
|
|||||||
@ -1,8 +1,14 @@
|
|||||||
// This file was generated by SquareLine Studio
|
/**
|
||||||
// SquareLine Studio version: SquareLine Studio 1.5.1
|
* @file ui_event_wifi.c
|
||||||
// LVGL version: 8.3.6
|
* @brief 此文件中专门实现WIFI事件的处理
|
||||||
// Project name: ESP32S3_UI
|
*
|
||||||
|
* 仅仅Debug模式下运行
|
||||||
|
*
|
||||||
|
* @author wang xiang en
|
||||||
|
* @date 2025-04-19
|
||||||
|
* @version 版本号
|
||||||
|
* @copyright 版权声明((C)2025, YUWELL MEDTECH Co.ltd)
|
||||||
|
*/
|
||||||
#include "ui.h"
|
#include "ui.h"
|
||||||
#include "driver/ledc.h"
|
#include "driver/ledc.h"
|
||||||
#include "esp_err.h"
|
#include "esp_err.h"
|
||||||
@ -22,10 +28,11 @@
|
|||||||
#include "lwip/apps/sntp.h"
|
#include "lwip/apps/sntp.h"
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#define LOWERST_LIGHT_LEVEL (7222)
|
|
||||||
|
|
||||||
/*更新当前测试标准*/
|
/*更新当前测试标准*/
|
||||||
static void standardVolumeRefresh(void);
|
static void standardVolumeRefresh(void);
|
||||||
|
|
||||||
/*根据呼吸频率调整积分时间*/
|
/*根据呼吸频率调整积分时间*/
|
||||||
static void comulateTimeSend(void);
|
static void comulateTimeSend(void);
|
||||||
|
|
||||||
@ -40,27 +47,10 @@ static void comulateResultRead(lv_timer_t * timer)
|
|||||||
/*下发问询120个参数*/
|
/*下发问询120个参数*/
|
||||||
ESP_ERROR_CHECK(ModbusRTU_Send_0306(ECHO_UART_PORT_NUM1,&flux_frame));
|
ESP_ERROR_CHECK(ModbusRTU_Send_0306(ECHO_UART_PORT_NUM1,&flux_frame));
|
||||||
|
|
||||||
|
|
||||||
lv_label_set_text(ui_pageHome_labelStartTest,"Test Complete!");
|
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)
|
void on_dropdownDeviceType_valueChanged(lv_event_t * e)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -394,7 +394,7 @@ esp_err_t RefreshResult(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*获取当前测试流量*/
|
/* 获取当前测试流量 */
|
||||||
float breathVolume = FluxMachineData.cumulativeVolume/FluxMachineData.breathTimes;
|
float breathVolume = FluxMachineData.cumulativeVolume/FluxMachineData.breathTimes;
|
||||||
lv_label_set_text_fmt(ui_pageHome_labelTestVolume,"%.2f",breathVolume);
|
lv_label_set_text_fmt(ui_pageHome_labelTestVolume,"%.2f",breathVolume);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user