V0.005.0
This commit is contained in:
@@ -22,8 +22,8 @@
|
||||
|
||||
#include "gui_tjc_hmi.h"
|
||||
|
||||
const char *HwVersion = "V1.0";
|
||||
char SwVersion[24] = "V0.001.0";
|
||||
const char *HwVersion = "V2.0";
|
||||
char SwVersion[24] = "V0.004.0";
|
||||
void task_idle(void);
|
||||
void task_10ms(void);
|
||||
void task_50ms(void);
|
||||
@@ -57,7 +57,7 @@ app_timer_class_t app_timer_task[] =
|
||||
******************************************/
|
||||
void app_init(void)
|
||||
{
|
||||
// Wdg.Init();
|
||||
Wdg.Init();
|
||||
/*flash*/
|
||||
w25q32.init();
|
||||
|
||||
@@ -124,7 +124,7 @@ void task_idle(void)
|
||||
com_uart4.rx_task(&com_uart4);
|
||||
com_uart6.rx_task(&com_uart6);
|
||||
W5500.Task();
|
||||
// Wdg.Feed();
|
||||
Wdg.Feed();
|
||||
}
|
||||
|
||||
void task_10ms(void)
|
||||
@@ -155,7 +155,6 @@ void task_500ms(void)
|
||||
modbus_leakage[APP_COM4].tx_task(&modbus_leakage[APP_COM4]);
|
||||
}
|
||||
|
||||
|
||||
void task_1s(void)
|
||||
{
|
||||
leakage.task();
|
||||
|
||||
@@ -169,7 +169,7 @@ void app_leakage_task(void)
|
||||
}
|
||||
|
||||
/*<2A><>ʷ<EFBFBD><CAB7><EFBFBD><EFBFBD><EFBFBD>洢*/
|
||||
for(k = 0; k < APP_LEAKAGE_SUB_DEVICE_CH_NUM; k++)
|
||||
for(k = 0; k < APP_LEAKAGE_SUB_DEVICE_USE_CH_NUM; k++)
|
||||
{
|
||||
u16 current_state = p_leakage->sub_device_data[sub_device_index].ch_data[k].state;
|
||||
u16 prev_state = prev_ch_state[sub_device_index][k];
|
||||
@@ -190,11 +190,20 @@ void app_leakage_task(void)
|
||||
history_add_alarm_record(i, sub_device_index, k, APP_LEAKAGE_SUB_DEVICE_STATE_OPEN, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if((current_state & APP_LEAKAGE_SUB_DEVICE_STATE_TIME_OUT) &&
|
||||
!(prev_state & APP_LEAKAGE_SUB_DEVICE_STATE_TIME_OUT))
|
||||
{
|
||||
/* ͨѶ<CDA8><D1B6>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ - <20><>¼<EFBFBD><C2BC>ʷ<EFBFBD><CAB7><EFBFBD><EFBFBD> */
|
||||
history_add_alarm_record(i, sub_device_index, k, APP_LEAKAGE_SUB_DEVICE_STATE_TIME_OUT, 0);
|
||||
if( k > 0 && (p_leakage->sub_device_data[sub_device_index].ch_data[0].state & APP_LEAKAGE_SUB_DEVICE_STATE_TIME_OUT))
|
||||
{
|
||||
/*<2A><>һ<EFBFBD><D2BB>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>ʣ<EFBFBD><CAA3>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD>洢<EFBFBD><E6B4A2>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>*/
|
||||
}
|
||||
else
|
||||
{
|
||||
/* ͨѶ<CDA8><D1B6>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ - <20><>¼<EFBFBD><C2BC>ʷ<EFBFBD><CAB7><EFBFBD><EFBFBD> */
|
||||
history_add_alarm_record(i, sub_device_index, k, APP_LEAKAGE_SUB_DEVICE_STATE_TIME_OUT, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʷ״̬ */
|
||||
@@ -202,7 +211,7 @@ void app_leakage_task(void)
|
||||
}
|
||||
|
||||
/* ͳ<><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD> - <20><><EFBFBD>豸ͳ<E8B1B8><CDB3> */
|
||||
for(k = 0; k < APP_LEAKAGE_SUB_DEVICE_CH_NUM; k++)
|
||||
for(k = 0; k < APP_LEAKAGE_SUB_DEVICE_USE_CH_NUM; k++)
|
||||
{
|
||||
u16 current_state = p_leakage->sub_device_data[sub_device_index].ch_data[k].state;
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
#define APP_LEAKAGE_SUB_DEVICE_NUM (32)
|
||||
#define APP_LEAKAGE_SUB_DEVICE_CH_NUM (4)
|
||||
|
||||
#define APP_LEAKAGE_SUB_DEVICE_USE_CH_NUM (2)
|
||||
|
||||
void app_leakage_task(void);
|
||||
void app_leakage_region_classify(void);
|
||||
void history_add_alarm_record(u8 region_idx, u8 device_idx, u8 channel, u16 alarm_type, u16 leak_distance);
|
||||
|
||||
@@ -9,4 +9,6 @@
|
||||
|
||||
#define USR_ON (1U)
|
||||
#define USR_OFF (0U)
|
||||
|
||||
#define LEAKAGE_MULTIPLE (100.0)
|
||||
#endif
|
||||
|
||||
@@ -27,13 +27,14 @@ static void bsp_W5500_Init(void);
|
||||
static void bsp_W5500_Task(void);
|
||||
static void Write_SOCK_Data_Buffer(bsp_W5500_Class_t *pW5500_Class, u8 *dat_ptr, u16 size);
|
||||
static void network_monitor_task(void);
|
||||
void bsp_W5500_Socket_Set(bsp_W5500_Class_t *pW5500_Class);
|
||||
|
||||
bsp_W5500_t W5500 =
|
||||
{
|
||||
.Gateway_IP = {192,168,100,1}, /*<2A><><EFBFBD><EFBFBD>IP<49><50>ַ*/
|
||||
.Sub_Mask = {255,255,255,0}, /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
.Phy_Addr = {0x0c,0x29,0xab,0x7c,0x00,0x01}, /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ(MAC)*/
|
||||
.IP_Addr = {192,168,100,101}, /*<2A><><EFBFBD><EFBFBD>IP<49><50>ַ*/
|
||||
.IP_Addr = {192,168,100,201}, /*<2A><><EFBFBD><EFBFBD>IP<49><50>ַ*/
|
||||
|
||||
.Interrupt_Process = bsp_W5500_Interrupt_Process,
|
||||
|
||||
@@ -462,7 +463,9 @@ void W5500_Hardware_Reset(void)
|
||||
*******************************************************************************/
|
||||
void W5500_Init(void)
|
||||
{
|
||||
#define STM32F4_UID_BASE 0x1FFF7A10 // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>оƬϵ<C6AC><CFB5><EFBFBD>Ĵ˵<C4B4>ַ
|
||||
u16 i = 0;
|
||||
u32 uid[3] = {0};
|
||||
|
||||
Write_W5500_1Byte(MR, RST); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λW5500,<2C><>1<EFBFBD><31>Ч,<2C><>λ<EFBFBD><CEBB><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD>0
|
||||
|
||||
@@ -479,6 +482,23 @@ void W5500_Init(void)
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ,PHY_ADDRΪ6<CEAA>ֽ<EFBFBD>u8<75><38><EFBFBD><EFBFBD>,<2C>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>Ψһ<CEA8><D2BB>ʶ<EFBFBD><CAB6><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵַ
|
||||
// <20>õ<EFBFBD>ֵַ<D6B7><D6B5>Ҫ<EFBFBD><D2AA>IEEE<45><45><EFBFBD>룬<EFBFBD><EBA3AC><EFBFBD><EFBFBD>OUI<55>Ĺ涨<C4B9><E6B6A8>ǰ3<C7B0><33><EFBFBD>ֽ<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD>̴<EFBFBD><CCB4>룬<EFBFBD><EBA3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD>Ϊ<EFBFBD><CEAA>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7>ע<EFBFBD><D7A2><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ֽڱ<D6BD><DAB1><EFBFBD>Ϊż<CEAA><C5BC>
|
||||
//ʹ<>õ<EFBFBD>Ƭ<EFBFBD><C6AC>UID
|
||||
|
||||
uid[0] = *(u32*)(STM32F4_UID_BASE);
|
||||
uid[1] = *(u32*)(STM32F4_UID_BASE + 4);
|
||||
uid[2] = *(u32*)(STM32F4_UID_BASE + 8);
|
||||
|
||||
|
||||
pW5500->Phy_Addr[0] = uid[1] >> 8;
|
||||
pW5500->Phy_Addr[1] = uid[1];
|
||||
pW5500->Phy_Addr[2] = uid[2] >> 24;
|
||||
pW5500->Phy_Addr[3] = uid[2] >> 16;
|
||||
pW5500->Phy_Addr[4] = uid[2] >> 8;
|
||||
pW5500->Phy_Addr[5] = uid[2];
|
||||
|
||||
// <20><><EFBFBD>ñ<EFBFBD><C3B1>ع<EFBFBD><D8B9><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>
|
||||
pW5500->Phy_Addr[0] = (pW5500->Phy_Addr[0] & 0xFE) | 0x02;
|
||||
|
||||
Write_W5500_nByte(SHAR, pW5500->Phy_Addr, 6);
|
||||
|
||||
// <20><><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD>IP<49><50>ַ,IP_ADDRΪ4<CEAA>ֽ<EFBFBD>u8<75><38><EFBFBD><EFBFBD>,<2C>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD>
|
||||
@@ -694,10 +714,25 @@ IntDispose:
|
||||
{
|
||||
pW5500->W5500_Class[i].TR_Data_State |= BSP_W5500_PORT_DATA_RECEIVE; // <20>˿ڽ<CBBF><DABD>յ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD>
|
||||
}
|
||||
if (Socket_Flag & IR_TIMEOUT) // Socket<65><74><EFBFBD>ӻ<EFBFBD><D3BB><EFBFBD><EFBFBD>ݴ<EFBFBD><DDB4>䳬ʱ<E4B3AC><CAB1><EFBFBD><EFBFBD>
|
||||
{
|
||||
Write_W5500_SOCK_1Byte(pW5500->W5500_Class[i].SocketPort, Sn_CR, CLOSE); // <20>رն˿<D5B6>,<2C>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD>´<EFBFBD><C2B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
pW5500->W5500_Class[i].TR_Data_State = 0; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬0x00,<2C>˿<EFBFBD><CBBF><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>
|
||||
if (Socket_Flag & IR_TIMEOUT) {
|
||||
// 1. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>жϱ<D0B6>־λ (<28><><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
Write_W5500_SOCK_1Byte(pW5500->W5500_Class[i].SocketPort, Sn_IR, Socket_Flag);
|
||||
|
||||
// 2. ǿ<>ƹر<C6B9>Socket<65><74>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD>λ
|
||||
Write_W5500_SOCK_1Byte(pW5500->W5500_Class[i].SocketPort, Sn_CR, CLOSE);
|
||||
|
||||
// 3. (ǿ<><C7BF><EFBFBD>Ƽ<EFBFBD>) <20><><EFBFBD><EFBFBD>һС<D2BB><D0A1><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>ȴ<EFBFBD>Ӳ<EFBFBD><D3B2><EFBFBD><EFBFBD><EFBFBD>ɹرղ<D8B1><D5B2><EFBFBD>
|
||||
HAL_Delay(10);
|
||||
|
||||
// 4. <20>ؼ<EFBFBD><D8BC><EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>´<EFBFBD><C2B4><EFBFBD>Socket<65><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģʽ
|
||||
// bsp_W5500_Socket_Init <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Socket<65><74><EFBFBD><EFBFBD>
|
||||
bsp_W5500_Socket_Init(&pW5500->W5500_Class[i]);
|
||||
// bsp_W5500_Socket_Set <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD>ģʽ<C4A3><CABD>TCP Server<65><72><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Socket_Listen
|
||||
bsp_W5500_Socket_Set(&pW5500->W5500_Class[i]);
|
||||
|
||||
// 5. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>״̬<D7B4><CCAC>־λ
|
||||
pW5500->W5500_Class[i].Run_State = 0;
|
||||
pW5500->W5500_Class[i].TR_Data_State = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -707,6 +742,15 @@ IntDispose:
|
||||
goto IntDispose;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief <20><><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>Socket<65><74>Keep-Alive<76><65><EFBFBD><EFBFBD>
|
||||
* @param s: Socket<65>˿ں<CBBF> (0~7)
|
||||
* @param interval_5s: <20><><EFBFBD><EFBFBD>ʱ<EFBFBD>䣬<EFBFBD><E4A3AC>λ5<CEBB>룬<EFBFBD><EBA3AC><EFBFBD><EFBFBD>2<EFBFBD><32>ʾ10<31>롣0<EBA1A3><30>ʾ<EFBFBD><CABE><EFBFBD>á<EFBFBD>
|
||||
*/
|
||||
void w5500_set_keepalive(SOCKET s, uint8_t interval_5s)
|
||||
{
|
||||
Write_W5500_SOCK_1Byte(s, Sn_KPALVTR, interval_5s);
|
||||
}
|
||||
|
||||
void bsp_W5500_Socket_Set(bsp_W5500_Class_t *pW5500_Class)
|
||||
{
|
||||
@@ -718,7 +762,10 @@ void bsp_W5500_Socket_Set(bsp_W5500_Class_t *pW5500_Class)
|
||||
case BSP_W5500_PORT_RUN_MODE_TCP_SERVER:
|
||||
{
|
||||
if (Socket_Listen(pW5500_Class->SocketPort) == TRUE)
|
||||
{
|
||||
pW5500_Class->Run_State = BSP_W5500_PORT_RUN_STATE_INIT;
|
||||
w5500_set_keepalive(pW5500_Class->SocketPort, 2);
|
||||
}
|
||||
else
|
||||
pW5500_Class->Run_State = 0;
|
||||
}break;
|
||||
@@ -763,6 +810,7 @@ static void bsp_W5500_Init()
|
||||
static void bsp_W5500_Task(void)
|
||||
{
|
||||
u8 i;
|
||||
|
||||
for(i=0;i<BSP_W5500_PORT_NUM;i++)
|
||||
{
|
||||
bsp_W5500_Socket_Set(&pW5500->W5500_Class[i]); /*W5500<30>˿ڳ<CBBF>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
|
||||
@@ -654,7 +654,7 @@ void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart)
|
||||
}
|
||||
else if (huart->Instance == UART4)
|
||||
{
|
||||
bsp_uart_tx_dma_tc_int(&com_uart2);
|
||||
bsp_uart_tx_dma_tc_int(&com_uart4);
|
||||
}
|
||||
else if (huart->Instance == USART6)
|
||||
{
|
||||
|
||||
@@ -16,9 +16,9 @@
|
||||
|
||||
#include "app_leakage.h"
|
||||
#include "app_com.h"
|
||||
|
||||
#include "app.h"
|
||||
/*<2A><><EFBFBD>ڷ<EFBFBD><DAB7>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
#define HMI_TX_BUFFER_NUM (2048)
|
||||
#define HMI_TX_BUFFER_NUM (4096)
|
||||
/*<2A>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>ƴ<EFBFBD><C6B4> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
#define GUI_TJC_HMI_TEXT_BUFFER_NUM (256)
|
||||
|
||||
@@ -57,9 +57,13 @@
|
||||
#define W25Q32_PASSWORD_ADDR (W25Q32_USER_DATA_ADDR)/*<2A><><EFBFBD><EFBFBD><EFBFBD>洢<EFBFBD><E6B4A2>ַ*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static void gui_tjc_hmi_init(void);
|
||||
static void gui_tjc_hmi_communication_data_analysis(u8 *p_data, u16 len, void *rx_uart);
|
||||
|
||||
static void gui_tjc_hmi_all_page_index_clear(void);
|
||||
/*<2A><><EFBFBD>ڷ<EFBFBD><DAB7>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
static u8 hmi_tx_buffer[HMI_TX_BUFFER_NUM];
|
||||
/*<2A>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>ƴ<EFBFBD><C6B4> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
@@ -87,7 +91,8 @@ static bsp_uart_t * p_rx_uart = NULL;
|
||||
|
||||
gui_tjc_hmi_t tjc_hmi =
|
||||
{
|
||||
.init = gui_tjc_hmi_init,
|
||||
.all_page_index_clear = gui_tjc_hmi_all_page_index_clear,
|
||||
.init = gui_tjc_hmi_init,
|
||||
};
|
||||
|
||||
gui_tjc_hmi_t *p_tjc_hmi = &tjc_hmi;
|
||||
@@ -95,6 +100,7 @@ gui_tjc_hmi_t *p_tjc_hmi = &tjc_hmi;
|
||||
|
||||
static void gui_tjc_hmi_class_update(void)
|
||||
{
|
||||
gui_tjc_hmi_all_page_index_clear();
|
||||
leakage.class_update();
|
||||
app_com.class_update();
|
||||
}
|
||||
@@ -203,6 +209,11 @@ static void parse_ip_string(u8 *str, u8 len, u8 *ip)
|
||||
}
|
||||
|
||||
|
||||
static void gui_tjc_hmi_all_page_index_clear(void)
|
||||
{
|
||||
memset(&p_tjc_hmi->page,0,sizeof(gui_tjc_hmi_page_t));
|
||||
}
|
||||
|
||||
/*<2A><><EFBFBD>ö<EFBFBD>Ӧ<EFBFBD>Ŀؼ<C4BF>
|
||||
x<EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD><EFBFBD><EFBFBD>
|
||||
y<EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD><EFBFBD><EFBFBD>
|
||||
@@ -260,6 +271,12 @@ static void gui_tjc_hmi_main_send(u8 cmd,u8 opa,u8 *p_data)
|
||||
page_num++;
|
||||
}
|
||||
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_MAIN,0, 3,
|
||||
(char *)&hmi_tx_buffer[len],
|
||||
"%d/%d",
|
||||
p_tjc_hmi->page.main_index+1,page_num);
|
||||
|
||||
|
||||
char time[20];
|
||||
sprintf(time,"20%d-%02d-%02d %02d:%02d:%02d",
|
||||
DS1302.Time.Year,
|
||||
@@ -272,11 +289,12 @@ static void gui_tjc_hmi_main_send(u8 cmd,u8 opa,u8 *p_data)
|
||||
|
||||
/*IP<49><50>ַ*/
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_MAIN,0,1,(char *)&hmi_tx_buffer[len],
|
||||
"%d.%d.%d.%d",
|
||||
"%d.%d.%d.%d:%d",
|
||||
W5500.IP_Addr[0],
|
||||
W5500.IP_Addr[1],
|
||||
W5500.IP_Addr[2],
|
||||
W5500.IP_Addr[3]);
|
||||
W5500.IP_Addr[3],
|
||||
(W5500.W5500_Class[0].ConfigData.Port[0] << 8) | (W5500.W5500_Class[0].ConfigData.Port[1]) );
|
||||
|
||||
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬*/
|
||||
u8 buzzer_state = (buzzer.p_flash_data->sw == USR_ENABLE) ? 11 : 13;
|
||||
@@ -287,7 +305,10 @@ static void gui_tjc_hmi_main_send(u8 cmd,u8 opa,u8 *p_data)
|
||||
hmi_tx_buffer[len + i] = 0xFF;
|
||||
}
|
||||
len += 3;
|
||||
|
||||
/*<2A><><EFBFBD><EFBFBD><EFBFBD>汾<EFBFBD><E6B1BE>*/
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_MAIN,0,2,(char *)&hmi_tx_buffer[len],
|
||||
"%s",SwVersion);
|
||||
|
||||
if(HMI_PROTO_CMD_GET == cmd)/*<2A><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>*/
|
||||
{
|
||||
switch(opa)
|
||||
@@ -399,7 +420,7 @@ static void gui_tjc_hmi_main_send(u8 cmd,u8 opa,u8 *p_data)
|
||||
}break;
|
||||
case 0x03:/*<2A><>ҳ*/
|
||||
{
|
||||
if(0x01 == p_data[5])
|
||||
if(0x01 == p_data[0])
|
||||
{
|
||||
if(page_num - 1 <= p_tjc_hmi->page.main_index)
|
||||
{
|
||||
@@ -466,6 +487,7 @@ static void gui_tjc_hmi_curr_alarm_send(u8 cmd,u8 opa,u8 *p_data)
|
||||
|
||||
/*<2A><><EFBFBD>㱨<EFBFBD><E3B1A8><EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>*/
|
||||
alarm_device_count = 0;
|
||||
j = 0;
|
||||
for(i = 0;i<APP_LEAKAGE_SUB_DEVICE_NUM;i++)
|
||||
{
|
||||
if(ENABLE != leakage.sub_device_data[i].flash_data.state)
|
||||
@@ -490,10 +512,7 @@ static void gui_tjc_hmi_curr_alarm_send(u8 cmd,u8 opa,u8 *p_data)
|
||||
}
|
||||
}
|
||||
|
||||
if(alarm_device_count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*<2A><><EFBFBD><EFBFBD>ҳ<EFBFBD><D2B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
page_num = alarm_device_count / REAL_ALARM_PAGE_NUM;
|
||||
@@ -502,7 +521,13 @@ static void gui_tjc_hmi_curr_alarm_send(u8 cmd,u8 opa,u8 *p_data)
|
||||
{
|
||||
page_num++;
|
||||
}
|
||||
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,0, 0,
|
||||
(char *)&hmi_tx_buffer[len],
|
||||
"%d/%d",
|
||||
p_tjc_hmi->page.real_alarm_index+1,page_num);
|
||||
|
||||
|
||||
|
||||
|
||||
if(HMI_PROTO_CMD_GET == cmd)/*<2A><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>*/
|
||||
{
|
||||
@@ -510,167 +535,213 @@ static void gui_tjc_hmi_curr_alarm_send(u8 cmd,u8 opa,u8 *p_data)
|
||||
{
|
||||
case 0x01:/*<2A><>ȡʵʱ<CAB5><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ*/
|
||||
{
|
||||
if(p_tjc_hmi->page.real_alarm_index == page_num - 1 && remain_alrm_device_num > 0)
|
||||
{
|
||||
for(j=0;j<remain_alrm_device_num;j++)
|
||||
{
|
||||
index = p_tjc_hmi->page.real_alarm_index * REAL_ALARM_PAGE_NUM + j;
|
||||
device_index = alarm_device_index[index];
|
||||
x = j;
|
||||
|
||||
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
y = 0;
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"%s",leakage.sub_device_data[device_index].flash_data.region_name);
|
||||
|
||||
/*<2A>豸ID*/
|
||||
y = 1;
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"%d",leakage.sub_device_data[device_index].flash_data.modbus_id);
|
||||
|
||||
/*<2A>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>*/
|
||||
y = 2;
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"%s",leakage.sub_device_data[device_index].flash_data.device_name);
|
||||
|
||||
/*ͨѶ״̬*/
|
||||
y =3;
|
||||
u16 comm_state = 0;
|
||||
for(ch=0;ch<APP_LEAKAGE_SUB_DEVICE_CH_NUM;ch++)
|
||||
{
|
||||
if(leakage.sub_device_data[device_index].ch_data[ch].state & APP_LEAKAGE_SUB_DEVICE_STATE_TIME_OUT)
|
||||
{
|
||||
comm_state = APP_LEAKAGE_SUB_DEVICE_STATE_TIME_OUT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(comm_state & APP_LEAKAGE_SUB_DEVICE_STATE_TIME_OUT)
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"<EFBFBD>쳣");
|
||||
}else
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||
}
|
||||
|
||||
/*ͨ<><CDA8>״̬*/
|
||||
for(ch=0;ch<APP_LEAKAGE_SUB_DEVICE_CH_NUM;ch++)
|
||||
{
|
||||
u16 ch_state = leakage.sub_device_data[device_index].ch_data[ch].state;
|
||||
u16 ch_distance = leakage.sub_device_data[device_index].ch_data[ch].distance;
|
||||
|
||||
y = 4 + (ch * 3);
|
||||
if(ch_state & APP_LEAKAGE_SUB_DEVICE_STATE_LEAKAGE)
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"©Һ");
|
||||
}else
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||
}
|
||||
|
||||
y =5 + (ch * 3);
|
||||
if(ch_state & APP_LEAKAGE_SUB_DEVICE_STATE_OPEN)
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"<EFBFBD>ϴ<EFBFBD>");
|
||||
}else
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||
}
|
||||
|
||||
y = 6 + (ch * 3);
|
||||
if(ch_state & APP_LEAKAGE_SUB_DEVICE_STATE_LEAKAGE)
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"%d",ch_distance);
|
||||
}else
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"0");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(j=0;j<REAL_ALARM_PAGE_NUM;j++)
|
||||
{
|
||||
index = p_tjc_hmi->page.real_alarm_index * REAL_ALARM_PAGE_NUM + j;
|
||||
device_index = alarm_device_index[index];
|
||||
|
||||
x = j;
|
||||
|
||||
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
y = 0;
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"%s",leakage.sub_device_data[device_index].flash_data.region_name);
|
||||
|
||||
/*<2A>豸ID*/
|
||||
y = 1;
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"%d",leakage.sub_device_data[device_index].flash_data.modbus_id);
|
||||
|
||||
/*<2A>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>*/
|
||||
y = 2;
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"%s",leakage.sub_device_data[device_index].flash_data.device_name);
|
||||
|
||||
/*ͨѶ״̬*/
|
||||
y =3;
|
||||
u16 comm_state = 0;
|
||||
for(ch=0;ch<APP_LEAKAGE_SUB_DEVICE_CH_NUM;ch++)
|
||||
{
|
||||
if(leakage.sub_device_data[device_index].ch_data[ch].state & APP_LEAKAGE_SUB_DEVICE_STATE_TIME_OUT)
|
||||
{
|
||||
comm_state = APP_LEAKAGE_SUB_DEVICE_STATE_TIME_OUT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(comm_state & APP_LEAKAGE_SUB_DEVICE_STATE_TIME_OUT)
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"<EFBFBD>쳣");
|
||||
}else
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||
}
|
||||
|
||||
/*ͨ<><CDA8>״̬*/
|
||||
for(ch=0;ch<APP_LEAKAGE_SUB_DEVICE_CH_NUM;ch++)
|
||||
{
|
||||
u16 ch_state = leakage.sub_device_data[device_index].ch_data[ch].state;
|
||||
u16 ch_distance = leakage.sub_device_data[device_index].ch_data[ch].distance;
|
||||
|
||||
y = 4 + (ch * 3);
|
||||
if(ch_state & APP_LEAKAGE_SUB_DEVICE_STATE_LEAKAGE)
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"©Һ");
|
||||
}else
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||
}
|
||||
|
||||
y =5 + (ch * 3);
|
||||
if(ch_state & APP_LEAKAGE_SUB_DEVICE_STATE_OPEN)
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"<EFBFBD>ϴ<EFBFBD>");
|
||||
}else
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||
}
|
||||
|
||||
y = 6 + (ch * 3);
|
||||
if(ch_state & APP_LEAKAGE_SUB_DEVICE_STATE_LEAKAGE)
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"%d",ch_distance);
|
||||
}else
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"0");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (; j < REAL_ALARM_PAGE_NUM; j++)
|
||||
if(alarm_device_count == 0)
|
||||
{
|
||||
x = j;
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x + 1, 1, (char *)&hmi_tx_buffer[len], ""); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x + 1, 2, (char *)&hmi_tx_buffer[len], ""); // <20>豸ID
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x + 1, 3, (char *)&hmi_tx_buffer[len], ""); // <20>豸<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x + 1, 4, (char *)&hmi_tx_buffer[len], ""); // ͨѶ״̬
|
||||
for (ch = 0; ch < APP_LEAKAGE_SUB_DEVICE_CH_NUM; ch++)
|
||||
for (i= 0; i < REAL_ALARM_PAGE_NUM; i++)
|
||||
{
|
||||
x = i;
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x + 1, 1, (char *)&hmi_tx_buffer[len], ""); // <20><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x + 1, 2, (char *)&hmi_tx_buffer[len], ""); // <EFBFBD>豸ID
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x + 1, 3, (char *)&hmi_tx_buffer[len], ""); // <20>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x + 1, 4, (char *)&hmi_tx_buffer[len], ""); // ͨѶ״̬
|
||||
for (ch = 0; ch < APP_LEAKAGE_SUB_DEVICE_CH_NUM; ch++)
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x + 1, 5 + (ch * 3), (char *)&hmi_tx_buffer[len], "");
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x + 1, 6 + (ch * 3), (char *)&hmi_tx_buffer[len], "");
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x + 1, 7 + (ch * 3), (char *)&hmi_tx_buffer[len], "");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(p_tjc_hmi->page.real_alarm_index == page_num - 1 && remain_alrm_device_num > 0)
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x + 1, 5 + (ch * 3), (char *)&hmi_tx_buffer[len], "");
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x + 1, 6 + (ch * 3), (char *)&hmi_tx_buffer[len], "");
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x + 1, 7 + (ch * 3), (char *)&hmi_tx_buffer[len], "");
|
||||
for(j=0;j<remain_alrm_device_num;j++)
|
||||
{
|
||||
index = p_tjc_hmi->page.real_alarm_index * REAL_ALARM_PAGE_NUM + j;
|
||||
device_index = alarm_device_index[index];
|
||||
x = j;
|
||||
|
||||
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
y = 0;
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"%s",leakage.sub_device_data[device_index].flash_data.region_name);
|
||||
|
||||
/*<2A>豸ID*/
|
||||
y = 1;
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"%d",leakage.sub_device_data[device_index].flash_data.modbus_id);
|
||||
|
||||
/*<2A>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>*/
|
||||
y = 2;
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"%s",leakage.sub_device_data[device_index].flash_data.device_name);
|
||||
|
||||
/*ͨѶ״̬*/
|
||||
y =3;
|
||||
u16 comm_state = 0;
|
||||
for(ch=0;ch<APP_LEAKAGE_SUB_DEVICE_CH_NUM;ch++)
|
||||
{
|
||||
if(leakage.sub_device_data[device_index].ch_data[ch].state & APP_LEAKAGE_SUB_DEVICE_STATE_TIME_OUT)
|
||||
{
|
||||
comm_state = APP_LEAKAGE_SUB_DEVICE_STATE_TIME_OUT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(comm_state & APP_LEAKAGE_SUB_DEVICE_STATE_TIME_OUT)
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"ͨѶ<EFBFBD>쳣");
|
||||
}
|
||||
else
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"ͨѶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||
}
|
||||
|
||||
/*ͨ<><CDA8>״̬*/
|
||||
for(ch=0;ch<APP_LEAKAGE_SUB_DEVICE_USE_CH_NUM;ch++)
|
||||
{
|
||||
u16 ch_state = leakage.sub_device_data[device_index].ch_data[ch].state;
|
||||
u16 ch_distance = leakage.sub_device_data[device_index].ch_data[ch].distance;
|
||||
|
||||
y = 4 + (ch * 3);
|
||||
if(comm_state & APP_LEAKAGE_SUB_DEVICE_STATE_TIME_OUT)
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"-");
|
||||
}
|
||||
else if(ch_state & APP_LEAKAGE_SUB_DEVICE_STATE_LEAKAGE)
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"©Һ");
|
||||
}else
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||
}
|
||||
|
||||
y =5 + (ch * 3);
|
||||
if(comm_state & APP_LEAKAGE_SUB_DEVICE_STATE_TIME_OUT)
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"-");
|
||||
}
|
||||
else if(ch_state & APP_LEAKAGE_SUB_DEVICE_STATE_OPEN)
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"<EFBFBD>ϴ<EFBFBD>");
|
||||
}else
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||
}
|
||||
|
||||
y = 6 + (ch * 3);
|
||||
if(comm_state & APP_LEAKAGE_SUB_DEVICE_STATE_TIME_OUT)
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"-");
|
||||
}
|
||||
else if(ch_state & APP_LEAKAGE_SUB_DEVICE_STATE_LEAKAGE)
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"%.2f",ch_distance/LEAKAGE_MULTIPLE);
|
||||
}else
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"0");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(j=0;j<REAL_ALARM_PAGE_NUM;j++)
|
||||
{
|
||||
index = p_tjc_hmi->page.real_alarm_index * REAL_ALARM_PAGE_NUM + j;
|
||||
device_index = alarm_device_index[index];
|
||||
|
||||
x = j;
|
||||
|
||||
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
y = 0;
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"%s",leakage.sub_device_data[device_index].flash_data.region_name);
|
||||
|
||||
/*<2A>豸ID*/
|
||||
y = 1;
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"%d",leakage.sub_device_data[device_index].flash_data.modbus_id);
|
||||
|
||||
/*<2A>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>*/
|
||||
y = 2;
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"%s",leakage.sub_device_data[device_index].flash_data.device_name);
|
||||
|
||||
/*ͨѶ״̬*/
|
||||
y =3;
|
||||
u16 comm_state = 0;
|
||||
for(ch=0;ch<APP_LEAKAGE_SUB_DEVICE_CH_NUM;ch++)
|
||||
{
|
||||
if(leakage.sub_device_data[device_index].ch_data[ch].state & APP_LEAKAGE_SUB_DEVICE_STATE_TIME_OUT)
|
||||
{
|
||||
comm_state = APP_LEAKAGE_SUB_DEVICE_STATE_TIME_OUT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(comm_state & APP_LEAKAGE_SUB_DEVICE_STATE_TIME_OUT)
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"ͨѶ<EFBFBD>쳣");
|
||||
}else
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"ͨѶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||
}
|
||||
|
||||
|
||||
/*ͨ<><CDA8>״̬*/
|
||||
for(ch=0;ch<APP_LEAKAGE_SUB_DEVICE_USE_CH_NUM;ch++)
|
||||
{
|
||||
u16 ch_state = leakage.sub_device_data[device_index].ch_data[ch].state;
|
||||
u16 ch_distance = leakage.sub_device_data[device_index].ch_data[ch].distance;
|
||||
|
||||
y = 4 + (ch * 3);
|
||||
if(comm_state & APP_LEAKAGE_SUB_DEVICE_STATE_TIME_OUT)
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"-");
|
||||
}
|
||||
else if(ch_state & APP_LEAKAGE_SUB_DEVICE_STATE_LEAKAGE)
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"©Һ");
|
||||
}else
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||
}
|
||||
|
||||
y =5 + (ch * 3);
|
||||
if(comm_state & APP_LEAKAGE_SUB_DEVICE_STATE_TIME_OUT)
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"-");
|
||||
}
|
||||
else if(ch_state & APP_LEAKAGE_SUB_DEVICE_STATE_OPEN)
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"<EFBFBD>ϴ<EFBFBD>");
|
||||
}else
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||
}
|
||||
|
||||
y = 6 + (ch * 3);
|
||||
if(comm_state & APP_LEAKAGE_SUB_DEVICE_STATE_TIME_OUT)
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"-");
|
||||
}
|
||||
else if(ch_state & APP_LEAKAGE_SUB_DEVICE_STATE_LEAKAGE)
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"%.2f",ch_distance/LEAKAGE_MULTIPLE);
|
||||
}else
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x+1,y+1,(char *)&hmi_tx_buffer[len],"0");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (; j < REAL_ALARM_PAGE_NUM; j++)
|
||||
{
|
||||
x = j;
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x + 1, 1, (char *)&hmi_tx_buffer[len], ""); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x + 1, 2, (char *)&hmi_tx_buffer[len], ""); // <20>豸ID
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x + 1, 3, (char *)&hmi_tx_buffer[len], ""); // <20>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x + 1, 4, (char *)&hmi_tx_buffer[len], ""); // ͨѶ״̬
|
||||
for (ch = 0; ch < APP_LEAKAGE_SUB_DEVICE_CH_NUM; ch++)
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x + 1, 5 + (ch * 3), (char *)&hmi_tx_buffer[len], "");
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x + 1, 6 + (ch * 3), (char *)&hmi_tx_buffer[len], "");
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_CURR_ALARM,x + 1, 7 + (ch * 3), (char *)&hmi_tx_buffer[len], "");
|
||||
}
|
||||
}
|
||||
}
|
||||
}break;
|
||||
@@ -728,20 +799,31 @@ static void gui_tjc_hmi_detail_main_send(u8 cmd, u8 opa, u8 *p_data)
|
||||
{
|
||||
#define DETAIL_MAIN_NUM (4) /* ÿҳ<C3BF><D2B3>ʾ4<CABE><34><EFBFBD>豸 */
|
||||
|
||||
u16 len = 0, i, sub_device_index, ch, x, y, index;
|
||||
u8 page_num, remain_device_num, display_count;
|
||||
u16 len=0 , i, sub_device_index, ch, x, y, index;
|
||||
u8 page_num=0, remain_device_num, display_count;
|
||||
u8 region_idx; /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
||||
app_leakage_region_data_class_t *region_data;
|
||||
|
||||
memset(hmi_tx_buffer, 0, sizeof(hmi_tx_buffer));
|
||||
|
||||
// /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҳ<EFBFBD><D2B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿҳ<C3BF><D2B3>ʾ4<CABE><34><EFBFBD>豸 */
|
||||
// page_num = region_data->sub_device_num / DETAIL_MAIN_NUM;
|
||||
// remain_device_num = region_data->sub_device_num % DETAIL_MAIN_NUM;
|
||||
// if (remain_device_num > 0)
|
||||
// {
|
||||
// page_num++;
|
||||
// }
|
||||
region_idx = p_tjc_hmi->page.deliniter_main_index;
|
||||
if (region_idx >= leakage.region_num) return;
|
||||
|
||||
region_data = &leakage.region_data[region_idx];
|
||||
|
||||
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҳ<EFBFBD><D2B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿҳ<C3BF><D2B3>ʾ4<CABE><34><EFBFBD>豸 */
|
||||
page_num = region_data->sub_device_num / DETAIL_MAIN_NUM;
|
||||
remain_device_num = region_data->sub_device_num % DETAIL_MAIN_NUM;
|
||||
if (remain_device_num > 0)
|
||||
{
|
||||
page_num++;
|
||||
}
|
||||
/*ҳ<><D2B3>*/
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_DETALL_MAIN,0, 0,
|
||||
(char *)&hmi_tx_buffer[len],
|
||||
"%d/%d",
|
||||
p_tjc_hmi->page.detail_main_index+1,page_num);
|
||||
|
||||
|
||||
if (HMI_PROTO_CMD_GET == cmd) /* <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD> */
|
||||
{
|
||||
@@ -787,7 +869,7 @@ static void gui_tjc_hmi_detail_main_send(u8 cmd, u8 opa, u8 *p_data)
|
||||
y = 0;
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_DETALL_MAIN,x+1, y+1,
|
||||
(char *)&hmi_tx_buffer[len],
|
||||
"%d",
|
||||
"ID:%d",
|
||||
leakage.sub_device_data[sub_device_index].flash_data.modbus_id);
|
||||
|
||||
/* <20>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>: t(x+1)_2 */
|
||||
@@ -815,13 +897,13 @@ static void gui_tjc_hmi_detail_main_send(u8 cmd, u8 opa, u8 *p_data)
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_DETALL_MAIN,x+1, y+1,
|
||||
(char *)&hmi_tx_buffer[len],
|
||||
"<EFBFBD><EFBFBD>ʱ");
|
||||
"ͨѶ<EFBFBD>쳣");
|
||||
}
|
||||
else
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_DETALL_MAIN,x+1, y+1,
|
||||
(char *)&hmi_tx_buffer[len],
|
||||
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||
"ͨѶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||
}
|
||||
}else
|
||||
{
|
||||
@@ -832,7 +914,7 @@ static void gui_tjc_hmi_detail_main_send(u8 cmd, u8 opa, u8 *p_data)
|
||||
|
||||
|
||||
/* ͨ<><CDA8>1-4״̬ */
|
||||
for (ch = 0; ch < APP_LEAKAGE_SUB_DEVICE_CH_NUM; ch++)
|
||||
for (ch = 0; ch < APP_LEAKAGE_SUB_DEVICE_USE_CH_NUM; ch++)
|
||||
{
|
||||
u16 ch_state = leakage.sub_device_data[sub_device_index].ch_data[ch].state;
|
||||
u16 ch_distance = leakage.sub_device_data[sub_device_index].ch_data[ch].distance;
|
||||
@@ -841,7 +923,14 @@ static void gui_tjc_hmi_detail_main_send(u8 cmd, u8 opa, u8 *p_data)
|
||||
y = 3 + (ch * 3);
|
||||
if(leakage.sub_device_data[sub_device_index].shield == UNBLOCKED)
|
||||
{
|
||||
if (ch_state & APP_LEAKAGE_SUB_DEVICE_STATE_LEAKAGE)
|
||||
|
||||
if (comm_state)
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_DETALL_MAIN,x+1, y+1,
|
||||
(char *)&hmi_tx_buffer[len],
|
||||
"-");
|
||||
}
|
||||
else if (ch_state & APP_LEAKAGE_SUB_DEVICE_STATE_LEAKAGE)
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_DETALL_MAIN,x+1, y+1,
|
||||
(char *)&hmi_tx_buffer[len],
|
||||
@@ -853,7 +942,8 @@ static void gui_tjc_hmi_detail_main_send(u8 cmd, u8 opa, u8 *p_data)
|
||||
(char *)&hmi_tx_buffer[len],
|
||||
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||
}
|
||||
}else
|
||||
}
|
||||
else
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_DETALL_MAIN,x+1, y+1,
|
||||
(char *)&hmi_tx_buffer[len],
|
||||
@@ -865,7 +955,13 @@ static void gui_tjc_hmi_detail_main_send(u8 cmd, u8 opa, u8 *p_data)
|
||||
y = 4 + (ch * 3);
|
||||
if(leakage.sub_device_data[sub_device_index].shield == UNBLOCKED)
|
||||
{
|
||||
if (ch_state & APP_LEAKAGE_SUB_DEVICE_STATE_OPEN)
|
||||
if (comm_state)
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_DETALL_MAIN,x+1, y+1,
|
||||
(char *)&hmi_tx_buffer[len],
|
||||
"-");
|
||||
}
|
||||
else if (ch_state & APP_LEAKAGE_SUB_DEVICE_STATE_OPEN)
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_DETALL_MAIN,x+1, y+1,
|
||||
(char *)&hmi_tx_buffer[len],
|
||||
@@ -889,12 +985,18 @@ static void gui_tjc_hmi_detail_main_send(u8 cmd, u8 opa, u8 *p_data)
|
||||
y = 5 + (ch * 3);
|
||||
if(leakage.sub_device_data[sub_device_index].shield == UNBLOCKED)
|
||||
{
|
||||
if (ch_state & APP_LEAKAGE_SUB_DEVICE_STATE_LEAKAGE)
|
||||
if (comm_state)
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_DETALL_MAIN,x+1, y+1,
|
||||
(char *)&hmi_tx_buffer[len],
|
||||
"%d",
|
||||
ch_distance);
|
||||
"-");
|
||||
}
|
||||
else if (ch_state & APP_LEAKAGE_SUB_DEVICE_STATE_LEAKAGE)
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_DETALL_MAIN,x+1, y+1,
|
||||
(char *)&hmi_tx_buffer[len],
|
||||
"%.2f",
|
||||
ch_distance/LEAKAGE_MULTIPLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -942,16 +1044,13 @@ static void gui_tjc_hmi_detail_main_send(u8 cmd, u8 opa, u8 *p_data)
|
||||
|
||||
case 0x03: /* <20><>ҳ */
|
||||
{
|
||||
region_idx = p_tjc_hmi->page.deliniter_main_index;
|
||||
if (region_idx >= leakage.region_num) return;
|
||||
|
||||
region_data = &leakage.region_data[region_idx];
|
||||
|
||||
/*<2A><><EFBFBD>¼<EFBFBD><C2BC><EFBFBD>ҳ<EFBFBD><D2B3>*/
|
||||
page_num = region_data->sub_device_num / DETAIL_MAIN_NUM;
|
||||
remain_device_num = region_data->sub_device_num % DETAIL_MAIN_NUM;
|
||||
if (remain_device_num > 0) page_num++;
|
||||
if (page_num == 0) page_num = 1;
|
||||
// /*<2A><><EFBFBD>¼<EFBFBD><C2BC><EFBFBD>ҳ<EFBFBD><D2B3>*/
|
||||
// page_num = region_data->sub_device_num / DETAIL_MAIN_NUM;
|
||||
// remain_device_num = region_data->sub_device_num % DETAIL_MAIN_NUM;
|
||||
// if (remain_device_num > 0) page_num++;
|
||||
// if (page_num == 0) page_num = 1;
|
||||
|
||||
if(0x01 == p_data[0]) /* <20><>һҳ */
|
||||
{
|
||||
@@ -995,6 +1094,7 @@ static void gui_tjc_hmi_detail_main_send(u8 cmd, u8 opa, u8 *p_data)
|
||||
u8 len_id = 0;
|
||||
u8 device_id = 0;
|
||||
|
||||
p_data = p_data + 3; /*<2A><>ID:ƫ<>Ƴ<EFBFBD>ȥ*/
|
||||
/* <20><><EFBFBD><EFBFBD><EFBFBD>豸ID<49><44><EFBFBD><EFBFBD>p_data[0]<5D><>ʼ<EFBFBD><CABC>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD> */
|
||||
while (p_data[len_id] != HMI_PROTO_ASCII_RX_DELINITER) {
|
||||
if (p_data[len_id] < '0' || p_data[len_id] > '9') {
|
||||
@@ -1129,10 +1229,7 @@ static void gui_tjc_hmi_history_alarm_send(u8 cmd,u8 opa,u8 *p_data)
|
||||
/* <20><>ȡ<EFBFBD>ܼ<EFBFBD>¼<EFBFBD><C2BC> */
|
||||
total_records = leakage.history_metadata.total_records;
|
||||
|
||||
if(total_records == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* <20><><EFBFBD><EFBFBD>ҳ<EFBFBD><D2B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
||||
page_num = total_records / HISTORY_ALARM_PER_PAGE;
|
||||
@@ -1144,6 +1241,12 @@ static void gui_tjc_hmi_history_alarm_send(u8 cmd,u8 opa,u8 *p_data)
|
||||
|
||||
memset(hmi_tx_buffer, 0, sizeof(hmi_tx_buffer));
|
||||
|
||||
/*ҳ<><D2B3>*/
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_HISTORY_ALARM,0, 0,
|
||||
(char *)&hmi_tx_buffer[len],
|
||||
"%d/%d",
|
||||
p_tjc_hmi->page.history_alarm_index+1, page_num == 0 ? 1 : page_num);
|
||||
|
||||
if(HMI_PROTO_CMD_GET == cmd) /* <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD> */
|
||||
{
|
||||
switch(opa)
|
||||
@@ -1166,6 +1269,11 @@ static void gui_tjc_hmi_history_alarm_send(u8 cmd,u8 opa,u8 *p_data)
|
||||
display_count = HISTORY_ALARM_PER_PAGE;
|
||||
}
|
||||
|
||||
if(total_records == 0)/*û<><C3BB><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>Ϣ*/
|
||||
{
|
||||
display_count = 0;
|
||||
}
|
||||
|
||||
/* <20><>ʾ<EFBFBD><CABE>ʷ<EFBFBD><CAB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼ */
|
||||
for(i = 0; i < display_count; i++)
|
||||
{
|
||||
@@ -1182,6 +1290,11 @@ static void gui_tjc_hmi_history_alarm_send(u8 cmd,u8 opa,u8 *p_data)
|
||||
/* <20><>ȡ<EFBFBD><C8A1>ʷ<EFBFBD><CAB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼ */
|
||||
if(history.read_history(record_index, &history_record))
|
||||
{
|
||||
u8 com_time_out_flag = 0;
|
||||
if(history_record.alarm_type == APP_LEAKAGE_SUB_DEVICE_STATE_TIME_OUT)
|
||||
{
|
||||
com_time_out_flag = 1;
|
||||
}
|
||||
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: t(i+1)_1 */
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_HISTORY_ALARM,i+1, 1,
|
||||
(char *)&hmi_tx_buffer[len],
|
||||
@@ -1194,11 +1307,22 @@ static void gui_tjc_hmi_history_alarm_send(u8 cmd,u8 opa,u8 *p_data)
|
||||
"%d",
|
||||
history_record.device_id);
|
||||
|
||||
/*ͨ<><CDA8><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>t(i+1)_3*/
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_HISTORY_ALARM,i+1,3,
|
||||
(char *)&hmi_tx_buffer[len],
|
||||
"%d",
|
||||
history_record.channel+1);
|
||||
if(com_time_out_flag)
|
||||
{
|
||||
/*ͨ<><CDA8><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>t(i+1)_3*/
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_HISTORY_ALARM,i+1,3,
|
||||
(char *)&hmi_tx_buffer[len],
|
||||
"-");
|
||||
}
|
||||
else
|
||||
{
|
||||
/*ͨ<><CDA8><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>t(i+1)_3*/
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_HISTORY_ALARM,i+1,3,
|
||||
(char *)&hmi_tx_buffer[len],
|
||||
"%d",
|
||||
history_record.channel+1);
|
||||
}
|
||||
|
||||
|
||||
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: t(i+1)_4 */
|
||||
alarm_type_str[0] = '\0';
|
||||
@@ -1207,7 +1331,9 @@ static void gui_tjc_hmi_history_alarm_send(u8 cmd,u8 opa,u8 *p_data)
|
||||
else if(history_record.alarm_type == APP_LEAKAGE_SUB_DEVICE_STATE_OPEN)
|
||||
strcat(alarm_type_str, "<EFBFBD>ϴ<EFBFBD>");
|
||||
else if(history_record.alarm_type == APP_LEAKAGE_SUB_DEVICE_STATE_TIME_OUT)
|
||||
strcat(alarm_type_str, "ͨѶ<EFBFBD><EFBFBD>ʱ");
|
||||
{
|
||||
strcat(alarm_type_str, "ͨѶ<EFBFBD>쳣");
|
||||
}
|
||||
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_HISTORY_ALARM,i+1, 4,
|
||||
(char *)&hmi_tx_buffer[len],
|
||||
@@ -1225,14 +1351,14 @@ static void gui_tjc_hmi_history_alarm_send(u8 cmd,u8 opa,u8 *p_data)
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_HISTORY_ALARM,i+1, 6,
|
||||
(char *)&hmi_tx_buffer[len],
|
||||
"%d",
|
||||
history_record.leak_distance);
|
||||
"%.2f",
|
||||
history_record.leak_distance/LEAKAGE_MULTIPLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_HISTORY_ALARM,i+1, 6,
|
||||
(char *)&hmi_tx_buffer[len],
|
||||
"0");
|
||||
"-");
|
||||
}
|
||||
|
||||
/* <20><>ʼʱ<CABC><CAB1>: t(i+1)_7 */
|
||||
@@ -1507,6 +1633,31 @@ static void gui_tjc_hmi_device_config_send(u8 cmd,u8 opa,u8 *p_data)
|
||||
|
||||
memset(hmi_tx_buffer,0,sizeof(hmi_tx_buffer));
|
||||
|
||||
// enabled_device_count = 0;
|
||||
// for (i = 0; i < APP_LEAKAGE_SUB_DEVICE_NUM; i++)
|
||||
// {
|
||||
// if (leakage.sub_device_data[i].flash_data.state == ENABLE)
|
||||
// {
|
||||
// enabled_device_count++;
|
||||
// }
|
||||
// }
|
||||
|
||||
enabled_device_count = leakage.sub_device_num;
|
||||
page_num = enabled_device_count / DEVICES_PER_PAGE;
|
||||
remain_region_num = enabled_device_count % DEVICES_PER_PAGE;
|
||||
if (remain_region_num > 0)
|
||||
{
|
||||
page_num++;
|
||||
}
|
||||
if (page_num == 0) page_num = 1;
|
||||
|
||||
/*ҳ<><D2B3>*/
|
||||
len += gui_tjc_hmi_tx_text_display(GUI_DEVICE_CONFIG,0, 0,
|
||||
(char *)&hmi_tx_buffer[len],
|
||||
"%d/%d",
|
||||
p_tjc_hmi->page.device_config_index+1,page_num);
|
||||
|
||||
|
||||
if(HMI_PROTO_CMD_GET == cmd)/*<2A><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>*/
|
||||
{
|
||||
switch(opa)
|
||||
@@ -1519,23 +1670,23 @@ static void gui_tjc_hmi_device_config_send(u8 cmd,u8 opa,u8 *p_data)
|
||||
u8 device_index;
|
||||
|
||||
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>*/
|
||||
enabled_device_count = 0;
|
||||
for(i = 0; i < APP_LEAKAGE_SUB_DEVICE_NUM; i++)
|
||||
{
|
||||
if(leakage.sub_device_data[i].flash_data.state == ENABLE && leakage.sub_device_data[i].flash_data.modbus_id > 0)
|
||||
{
|
||||
enabled_device_count++;
|
||||
}
|
||||
}
|
||||
|
||||
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҳ<EFBFBD><D2B3>*/
|
||||
page_num = enabled_device_count / DEVICES_PER_PAGE;
|
||||
remain_region_num = enabled_device_count % DEVICES_PER_PAGE;
|
||||
if(remain_region_num > 0)
|
||||
{
|
||||
page_num++;
|
||||
}
|
||||
|
||||
// enabled_device_count = 0;
|
||||
// for(i = 0; i < APP_LEAKAGE_SUB_DEVICE_NUM; i++)
|
||||
// {
|
||||
// if(leakage.sub_device_data[i].flash_data.state == ENABLE)
|
||||
// {
|
||||
// enabled_device_count++;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҳ<EFBFBD><D2B3>*/
|
||||
// page_num = enabled_device_count / DEVICES_PER_PAGE;
|
||||
// remain_region_num = enabled_device_count % DEVICES_PER_PAGE;
|
||||
// if(remain_region_num > 0)
|
||||
// {
|
||||
// page_num++;
|
||||
// }
|
||||
//
|
||||
/*ȷ<><C8B7>ҳ<EFBFBD><D2B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7>Χ<EFBFBD><CEA7>*/
|
||||
if(p_tjc_hmi->page.device_config_index >= page_num)
|
||||
{
|
||||
@@ -1680,22 +1831,7 @@ static void gui_tjc_hmi_device_config_send(u8 cmd,u8 opa,u8 *p_data)
|
||||
|
||||
case 0x03:/*<2A><>ҳ<EFBFBD><D2B3><EFBFBD>ܣ<EFBFBD>ÿҳ<C3BF><D2B3>ʾ8<CABE><38><EFBFBD>豸*/
|
||||
{
|
||||
enabled_device_count = 0;
|
||||
for (i = 0; i < APP_LEAKAGE_SUB_DEVICE_NUM; i++)
|
||||
{
|
||||
if (leakage.sub_device_data[i].flash_data.state == ENABLE)
|
||||
{
|
||||
enabled_device_count++;
|
||||
}
|
||||
}
|
||||
|
||||
page_num = enabled_device_count / DEVICES_PER_PAGE;
|
||||
remain_region_num = enabled_device_count % DEVICES_PER_PAGE;
|
||||
if (remain_region_num > 0)
|
||||
{
|
||||
page_num++;
|
||||
}
|
||||
if (page_num == 0) page_num = 1;
|
||||
|
||||
|
||||
if(0x01 == p_data[0]) /*<2A><>һҳ*/
|
||||
{
|
||||
@@ -1730,8 +1866,7 @@ static void gui_tjc_hmi_device_config_send(u8 cmd,u8 opa,u8 *p_data)
|
||||
else if(HMI_PROTO_CMD_SET == cmd)/*<2A><><EFBFBD><EFBFBD>*/
|
||||
{
|
||||
switch(opa)
|
||||
{
|
||||
|
||||
{
|
||||
case 0x01:
|
||||
{
|
||||
found_empty_slot = 0;
|
||||
@@ -1863,7 +1998,7 @@ static void gui_tjc_hmi_device_config_send(u8 cmd,u8 opa,u8 *p_data)
|
||||
id_str[i] = '\0';
|
||||
new_device.modbus_id = atoi(id_str);
|
||||
|
||||
if(new_device.modbus_id < 1 && new_device.modbus_id > 255)
|
||||
if(new_device.modbus_id < 1 || new_device.modbus_id > 255)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -1928,6 +2063,16 @@ static void gui_tjc_hmi_device_config_send(u8 cmd,u8 opa,u8 *p_data)
|
||||
/*<2A><><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
gui_tjc_hmi_class_update();
|
||||
|
||||
page_num = leakage.sub_device_num / DEVICES_PER_PAGE;
|
||||
remain_region_num = leakage.sub_device_num % DEVICES_PER_PAGE;
|
||||
if (remain_region_num > 0)
|
||||
{
|
||||
page_num++;
|
||||
}
|
||||
if (page_num == 0) page_num = 1;
|
||||
p_tjc_hmi->page.device_config_index = page_num - 1;//xian
|
||||
|
||||
|
||||
// if (new_device.com < APP_COM_NUM && new_device.baudrate < 4) {
|
||||
// app_com.com[new_device.com].set.baud_rate(
|
||||
// &app_com.com[new_device.com],
|
||||
@@ -1944,9 +2089,7 @@ static void gui_tjc_hmi_device_config_send(u8 cmd,u8 opa,u8 *p_data)
|
||||
|
||||
}break;
|
||||
case 0x02:/*ɾ<><C9BE><EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8>Ϣ<EFBFBD><CFA2>w25q<35><71>ɾ<EFBFBD><C9BE>*/
|
||||
{
|
||||
|
||||
u8 page_device_indices[8] = {0}; /*<2A>洢<EFBFBD><E6B4A2>ǰҳ8<D2B3><38><EFBFBD>豸<EFBFBD><E8B1B8>app_leakage<67>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
{ u8 page_device_indices[8] = {0}; /*<2A>洢<EFBFBD><E6B4A2>ǰҳ8<D2B3><38><EFBFBD>豸<EFBFBD><E8B1B8>app_leakage<67>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
u8 page_device_count = 0; /*<2A><>ǰҳʵ<D2B3><CAB5><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>*/
|
||||
u8 current_enabled_index = 0; /*<2A><>ǰ<EFBFBD>ǵڼ<C7B5><DABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5>豸*/
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#include "main.h"
|
||||
|
||||
|
||||
|
||||
/*ҳ<><D2B3>*/
|
||||
typedef struct
|
||||
{
|
||||
@@ -18,6 +20,8 @@ typedef struct
|
||||
{
|
||||
gui_tjc_hmi_page_t page;
|
||||
u8 password[4];
|
||||
|
||||
void (*all_page_index_clear)(void);
|
||||
void (*init)(void);
|
||||
}gui_tjc_hmi_t;
|
||||
|
||||
|
||||
@@ -10,7 +10,9 @@
|
||||
#include "proto_print.h"
|
||||
#include "proto_modbus_lib.h"
|
||||
|
||||
#define PROTO_LEAKAGE_READ_DATA_NUM (14) /*<2A><>ȡһ<C8A1><D2BB><EFBFBD>豸<EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
#define PROTO_LEAKAGE_2CH_READ_DATA_NUM (8)
|
||||
#define PROTO_LEAKAGE_4CH_READ_DATA_NUM (14)
|
||||
#define PROTO_LEAKAGE_READ_DATA_NUM (PROTO_LEAKAGE_2CH_READ_DATA_NUM) /*<2A><>ȡһ<C8A1><D2BB><EFBFBD>豸<EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
#define PROTO_LEAKAGE_GET_CURR_DATA_START_ADDR (0x0000)
|
||||
|
||||
static void proto_leakage_init(proto_leakage_t *p_leakage);
|
||||
@@ -107,7 +109,7 @@ static void proto_leakage_switch(proto_leakage_t *p_leakage)
|
||||
static void proto_leakage_tx_curr_data_get(proto_leakage_t *p_leakage)
|
||||
{
|
||||
u16 addr = PROTO_LEAKAGE_GET_CURR_DATA_START_ADDR;
|
||||
u8 len = 14;
|
||||
u8 len = PROTO_LEAKAGE_READ_DATA_NUM;
|
||||
u8 id = p_leakage->sensor[p_leakage->sensor_index].comm.id;
|
||||
modbus_lib_data_read(id,addr,len,p_leakage->uart_send);
|
||||
}
|
||||
@@ -128,10 +130,6 @@ static void proto_leakage_tx_task(proto_leakage_t *p_leakage)
|
||||
if((++p_sensor->comm.tx_time_out_count) > 10)/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ10<31><30> ͨѶ<CDA8><D1B6>ʱ*/
|
||||
{
|
||||
p_sensor->comm.sensor_state_code |= (PROTO_LEAKAGE_STATE_CODE_TIME_OUT);
|
||||
|
||||
|
||||
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
//memset(&gas_data[p_sensor->sensor_index],0,sizeof(gas_data_t));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,9 +152,10 @@ static void proto_leakage_tx_task(proto_leakage_t *p_leakage)
|
||||
/*ͨѶ<CDA8><D1B6>ʱ*/
|
||||
if(p_sensor->comm.sensor_state_code & (PROTO_LEAKAGE_STATE_CODE_TIME_OUT))
|
||||
{
|
||||
for(i=0;i<APP_LEAKAGE_SUB_DEVICE_CH_NUM;i++)
|
||||
for(i=0;i<APP_LEAKAGE_SUB_DEVICE_CH_NUM;i++) /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
{
|
||||
leakage.sub_device_data[p_sensor->comm.leakage_data_index].ch_data[i].state |= APP_LEAKAGE_SUB_DEVICE_STATE_TIME_OUT;
|
||||
leakage.sub_device_data[p_sensor->comm.leakage_data_index].ch_data[i].state = APP_LEAKAGE_SUB_DEVICE_STATE_TIME_OUT;
|
||||
leakage.sub_device_data[p_sensor->comm.leakage_data_index].ch_data[i].distance = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -186,8 +185,8 @@ static void proto_leakage_rx_task(u8 *p_data,u16 len,void *other_data)
|
||||
u8 modbus_id,cmd;
|
||||
u16 check_crc16,modbus_crc16;
|
||||
u16 *p_u16_temp;
|
||||
u16 i,ch;
|
||||
u8 *p_rx_valid,temp_value;
|
||||
u16 i,ch,temp_value;
|
||||
u8 *p_rx_valid;
|
||||
|
||||
proto_sensor_class_t *p_sensor;
|
||||
proto_leakage_t *p_leakage = NULL;
|
||||
@@ -251,20 +250,36 @@ static void proto_leakage_rx_task(u8 *p_data,u16 len,void *other_data)
|
||||
{
|
||||
/*<2A><><EFBFBD>㵱ǰ<E3B5B1>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>*/
|
||||
u8 sensor_index = p_sensor->comm.leakage_data_index;
|
||||
// u16 ch_addr_offset[4] = {0,4,8,11}; /*©Һ<C2A9><D2BA><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD>ַƫ<D6B7><C6AB>*/
|
||||
u8 sub_device_ch;
|
||||
u16 ch_addr_offset[4] = {0,8,16,22}; /*©Һ<C2A9><D2BA><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD>ַƫ<D6B7><C6AB>*/
|
||||
u16 temp;
|
||||
|
||||
|
||||
|
||||
/*<2A><>©Һ<C2A9><D2BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>ͨ<EFBFBD><CDA8>*/
|
||||
if(PROTO_LEAKAGE_4CH_READ_DATA_NUM == PROTO_LEAKAGE_READ_DATA_NUM)
|
||||
{
|
||||
sub_device_ch = APP_LEAKAGE_SUB_DEVICE_CH_NUM;
|
||||
}
|
||||
else if(PROTO_LEAKAGE_2CH_READ_DATA_NUM == PROTO_LEAKAGE_READ_DATA_NUM)
|
||||
{
|
||||
sub_device_ch = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
sub_device_ch = APP_LEAKAGE_SUB_DEVICE_CH_NUM;
|
||||
}
|
||||
|
||||
|
||||
if(sensor_index >= APP_LEAKAGE_SUB_DEVICE_NUM)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
/*ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
for(ch = 0;ch < APP_LEAKAGE_SUB_DEVICE_CH_NUM;ch++)
|
||||
for(ch = 0;ch < sub_device_ch;ch++)
|
||||
{
|
||||
leakage.sub_device_data[sensor_index].ch_data[ch].state = 0;
|
||||
leakage.sub_device_data[sensor_index].ch_data[ch].state = 0;
|
||||
leakage.sub_device_data[sensor_index].ch_data[ch].state = 0;
|
||||
leakage.sub_device_data[sensor_index].ch_data[ch].distance = 0;
|
||||
}
|
||||
|
||||
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0x0003*/
|
||||
@@ -276,26 +291,27 @@ static void proto_leakage_rx_task(u8 *p_data,u16 len,void *other_data)
|
||||
leakage.sub_device_data[sensor_index].test_mode = temp_value & 0xFF;
|
||||
|
||||
/*©Һ<C2A9><D2BA><EFBFBD><EFBFBD>*/
|
||||
for(i=0;i<4;i++)
|
||||
for(i=0;i<sub_device_ch;i++)
|
||||
{
|
||||
ch = i;
|
||||
temp = ch_addr_offset[i];
|
||||
/*©Һ*/
|
||||
temp_value = (p_rx_valid[temp + 0] << 8) | p_rx_valid[temp + 1];
|
||||
if(temp_value == 1)
|
||||
{
|
||||
leakage.sub_device_data[sensor_index].ch_data[ch].state |=
|
||||
APP_LEAKAGE_SUB_DEVICE_STATE_LEAKAGE;
|
||||
}
|
||||
|
||||
/*<2A>ϴ<EFBFBD>*/
|
||||
temp_value = (p_rx_valid[temp + 2] << 8) | p_rx_valid[temp + 3];
|
||||
if(temp_value == 1)
|
||||
{
|
||||
leakage.sub_device_data[sensor_index].ch_data[ch].state |=
|
||||
APP_LEAKAGE_SUB_DEVICE_STATE_OPEN;
|
||||
}
|
||||
|
||||
/*©Һ<C2A9><D2BA><EFBFBD><EFBFBD>*/
|
||||
temp_value = (p_rx_valid[temp + 4] << 8) | p_rx_valid[temp + 5];
|
||||
leakage.sub_device_data[sensor_index].ch_data[ch].distance = temp_value *0.01;
|
||||
leakage.sub_device_data[sensor_index].ch_data[ch].distance = temp_value;
|
||||
}
|
||||
}break;
|
||||
}
|
||||
|
||||
@@ -288,14 +288,21 @@ static u16 proto_modbus_data_read(u16 addr)
|
||||
}break;
|
||||
case 11 ... 18:/*ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
{
|
||||
sensor_ch = (addr - 11) / 2;
|
||||
if( (addr - 11) & 0x0001) /*©Һλ<D2BA><CEBB>*/
|
||||
if (leakage.sub_device_data[sensor_index].shield == BLOCKED)/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
{
|
||||
data = leakage.sub_device_data[sensor_index].ch_data[sensor_ch].distance;
|
||||
data = 0;
|
||||
}
|
||||
else /*<2A>豸״̬*/
|
||||
else
|
||||
{
|
||||
data = leakage.sub_device_data[sensor_index].ch_data[sensor_ch].state;
|
||||
sensor_ch = (reg - 11) / 2;
|
||||
if( (reg - 11) & 0x0001) /*©Һλ<D2BA><CEBB>*/
|
||||
{
|
||||
data = leakage.sub_device_data[sensor_index].ch_data[sensor_ch].distance;
|
||||
}
|
||||
else /*<2A>豸״̬*/
|
||||
{
|
||||
data = leakage.sub_device_data[sensor_index].ch_data[sensor_ch].state;
|
||||
}
|
||||
}
|
||||
}break;
|
||||
default:data = 0;
|
||||
|
||||
Reference in New Issue
Block a user