FluxDC/components/FluxUI/ui_event_debug.c

51 lines
1.2 KiB
C
Raw Normal View History

/*此文件中专门实现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
#include "ui.h"
#include "driver/ledc.h"
#include "esp_err.h"
#include "esp_log.h"
#include "FluxWifi.h"
#include "FluxUart.h"
#include "FluxSD.h"
#include "FluxProtocol.h"
/*选择是否使能Debug页面的操作*/
#define MODE_TEST 0
/*流量计当前示数回传函数——Debug模式*/
void on_buttonFluxRead_clicked(lv_event_t * e)
{
/*选择是否使用Debug中的操作*/
#if MODE_TEST
flux_frame.DATA[1] = (unsigned char)lv_spinbox_get_value(ui_pageDebug_spinboxAddr);
flux_frame.DATA[3] = (unsigned char)lv_spinbox_get_value(ui_pageDebug_spinboxNum);
/*测试模式可手动设置功能码*/
if (lv_dropdown_get_selected(ui_pageDebug_dropdownFunctionCode) == 0)
{
flux_frame.FUNC = FLUX_FUNC_READ;
}else{
flux_frame.FUNC = FLUX_FUNC_SET;
}
ESP_ERROR_CHECK(ModbusRTU_Send_0306(ECHO_UART_PORT_NUM1,&flux_frame));
#endif
}
/*流量计当前示数显示——Debug模式*/
void on_buttonClearTextarea_clicked(lv_event_t * e)
{
#if MODE_TEST
lv_textarea_set_text(ui_pageDebug_textAreaContent, "");
#endif
}