update:main V0.005.0、hmi V1.4
main 1、MODBUS_TCP增加3个port口,总计4个port口供主机读取数据; 2、修复历史报警记录靠前条数不是最新的报警信息BUG; 3、修复MODBUS_TCP写寄存器时解析数据的异常BUG; hmi 1、MODBUS_TCP设置界面增加3个port口,总计4个port口进行设置;
This commit is contained in:
@@ -11,11 +11,5 @@
|
|||||||
#define RTE_COMPONENTS_H
|
#define RTE_COMPONENTS_H
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Define the Device Header File:
|
|
||||||
*/
|
|
||||||
#define CMSIS_device_header "stm32f4xx.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* RTE_COMPONENTS_H */
|
#endif /* RTE_COMPONENTS_H */
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -132,11 +132,6 @@
|
|||||||
<Key>ARMDBGFLAGS</Key>
|
<Key>ARMDBGFLAGS</Key>
|
||||||
<Name></Name>
|
<Name></Name>
|
||||||
</SetRegEntry>
|
</SetRegEntry>
|
||||||
<SetRegEntry>
|
|
||||||
<Number>0</Number>
|
|
||||||
<Key>DLGUARM</Key>
|
|
||||||
<Name>d</Name>
|
|
||||||
</SetRegEntry>
|
|
||||||
<SetRegEntry>
|
<SetRegEntry>
|
||||||
<Number>0</Number>
|
<Number>0</Number>
|
||||||
<Key>JL2CM3</Key>
|
<Key>JL2CM3</Key>
|
||||||
@@ -148,24 +143,7 @@
|
|||||||
<Name>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F4xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F407VGTx$CMSIS\Flash\STM32F4xx_1024.FLM))</Name>
|
<Name>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F4xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F407VGTx$CMSIS\Flash\STM32F4xx_1024.FLM))</Name>
|
||||||
</SetRegEntry>
|
</SetRegEntry>
|
||||||
</TargetDriverDllRegistry>
|
</TargetDriverDllRegistry>
|
||||||
<Breakpoint>
|
<Breakpoint/>
|
||||||
<Bp>
|
|
||||||
<Number>0</Number>
|
|
||||||
<Type>0</Type>
|
|
||||||
<LineNumber>71</LineNumber>
|
|
||||||
<EnabledFlag>1</EnabledFlag>
|
|
||||||
<Address>134256418</Address>
|
|
||||||
<ByteObject>0</ByteObject>
|
|
||||||
<HtxType>0</HtxType>
|
|
||||||
<ManyObjects>0</ManyObjects>
|
|
||||||
<SizeOfObject>0</SizeOfObject>
|
|
||||||
<BreakByAccess>0</BreakByAccess>
|
|
||||||
<BreakIfRCount>1</BreakIfRCount>
|
|
||||||
<Filename>D:\code\Git\Leakage-Control(鏈€鏂扮増)\Leakage-Control\leakage_system\usr\app\app.c</Filename>
|
|
||||||
<ExecCommand></ExecCommand>
|
|
||||||
<Expression>\\leakage_system\../usr/app/app.c\71</Expression>
|
|
||||||
</Bp>
|
|
||||||
</Breakpoint>
|
|
||||||
<WatchWindow1>
|
<WatchWindow1>
|
||||||
<Ww>
|
<Ww>
|
||||||
<count>0</count>
|
<count>0</count>
|
||||||
@@ -257,6 +235,11 @@
|
|||||||
<WinNumber>1</WinNumber>
|
<WinNumber>1</WinNumber>
|
||||||
<ItemText>W5500,0x0A</ItemText>
|
<ItemText>W5500,0x0A</ItemText>
|
||||||
</Ww>
|
</Ww>
|
||||||
|
<Ww>
|
||||||
|
<count>18</count>
|
||||||
|
<WinNumber>1</WinNumber>
|
||||||
|
<ItemText>W5500,0x0A</ItemText>
|
||||||
|
</Ww>
|
||||||
</WatchWindow1>
|
</WatchWindow1>
|
||||||
<Tracepoint>
|
<Tracepoint>
|
||||||
<THDelay>0</THDelay>
|
<THDelay>0</THDelay>
|
||||||
|
|||||||
@@ -10,14 +10,14 @@
|
|||||||
<TargetName>leakage_system</TargetName>
|
<TargetName>leakage_system</TargetName>
|
||||||
<ToolsetNumber>0x4</ToolsetNumber>
|
<ToolsetNumber>0x4</ToolsetNumber>
|
||||||
<ToolsetName>ARM-ADS</ToolsetName>
|
<ToolsetName>ARM-ADS</ToolsetName>
|
||||||
<pCCUsed>5060750::V5.06 update 6 (build 750)::ARMCC</pCCUsed>
|
<pCCUsed>5060960::V5.06 update 7 (build 960)::.\ARMCC</pCCUsed>
|
||||||
<uAC6>0</uAC6>
|
<uAC6>0</uAC6>
|
||||||
<TargetOption>
|
<TargetOption>
|
||||||
<TargetCommonOption>
|
<TargetCommonOption>
|
||||||
<Device>STM32F407VGTx</Device>
|
<Device>STM32F407VGTx</Device>
|
||||||
<Vendor>STMicroelectronics</Vendor>
|
<Vendor>STMicroelectronics</Vendor>
|
||||||
<PackID>Keil.STM32F4xx_DFP.2.15.0</PackID>
|
<PackID>Keil.STM32F4xx_DFP.3.0.0</PackID>
|
||||||
<PackURL>http://www.keil.com/pack/</PackURL>
|
<PackURL>https://www.keil.com/pack/</PackURL>
|
||||||
<Cpu>IRAM(0x20000000,0x00020000) IRAM2(0x10000000,0x00010000) IROM(0x08000000,0x00100000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE</Cpu>
|
<Cpu>IRAM(0x20000000,0x00020000) IRAM2(0x10000000,0x00010000) IROM(0x08000000,0x00100000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE</Cpu>
|
||||||
<FlashUtilSpec></FlashUtilSpec>
|
<FlashUtilSpec></FlashUtilSpec>
|
||||||
<StartupFile></StartupFile>
|
<StartupFile></StartupFile>
|
||||||
@@ -185,6 +185,7 @@
|
|||||||
<uocXRam>0</uocXRam>
|
<uocXRam>0</uocXRam>
|
||||||
<RvdsVP>2</RvdsVP>
|
<RvdsVP>2</RvdsVP>
|
||||||
<RvdsMve>0</RvdsMve>
|
<RvdsMve>0</RvdsMve>
|
||||||
|
<RvdsCdeCp>0</RvdsCdeCp>
|
||||||
<hadIRAM2>1</hadIRAM2>
|
<hadIRAM2>1</hadIRAM2>
|
||||||
<hadIROM2>0</hadIROM2>
|
<hadIROM2>0</hadIROM2>
|
||||||
<StupSel>8</StupSel>
|
<StupSel>8</StupSel>
|
||||||
@@ -351,7 +352,7 @@
|
|||||||
<NoWarn>0</NoWarn>
|
<NoWarn>0</NoWarn>
|
||||||
<uSurpInc>0</uSurpInc>
|
<uSurpInc>0</uSurpInc>
|
||||||
<useXO>0</useXO>
|
<useXO>0</useXO>
|
||||||
<uClangAs>0</uClangAs>
|
<ClangAsOpt>4</ClangAsOpt>
|
||||||
<VariousControls>
|
<VariousControls>
|
||||||
<MiscControls></MiscControls>
|
<MiscControls></MiscControls>
|
||||||
<Define></Define>
|
<Define></Define>
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
#include "gui_tjc_hmi.h"
|
#include "gui_tjc_hmi.h"
|
||||||
|
|
||||||
const char *HwVersion = "V2.0";
|
const char *HwVersion = "V2.0";
|
||||||
char SwVersion[24] = "V0.004.0";
|
char SwVersion[24] = "V0.005.0";
|
||||||
void task_idle(void);
|
void task_idle(void);
|
||||||
void task_10ms(void);
|
void task_10ms(void);
|
||||||
void task_50ms(void);
|
void task_50ms(void);
|
||||||
@@ -60,7 +60,7 @@ void app_init(void)
|
|||||||
Wdg.Init();
|
Wdg.Init();
|
||||||
/*flash*/
|
/*flash*/
|
||||||
w25q32.init();
|
w25q32.init();
|
||||||
|
Wdg.Feed();
|
||||||
// HAL_Delay(5000);
|
// HAL_Delay(5000);
|
||||||
|
|
||||||
/*<2A><><EFBFBD>ڳ<EFBFBD>ʼ<EFBFBD><CABC>*/
|
/*<2A><><EFBFBD>ڳ<EFBFBD>ʼ<EFBFBD><CABC>*/
|
||||||
@@ -69,10 +69,10 @@ void app_init(void)
|
|||||||
com_uart3.init(&com_uart3);
|
com_uart3.init(&com_uart3);
|
||||||
com_uart4.init(&com_uart4);
|
com_uart4.init(&com_uart4);
|
||||||
com_uart6.init(&com_uart6);
|
com_uart6.init(&com_uart6);
|
||||||
|
Wdg.Feed();
|
||||||
/*<2A><><EFBFBD><EFBFBD>*/
|
/*<2A><><EFBFBD><EFBFBD>*/
|
||||||
W5500.Init();
|
W5500.Init();
|
||||||
|
Wdg.Feed();
|
||||||
/*<2A><>ĻͨѶ*/
|
/*<2A><>ĻͨѶ*/
|
||||||
tjc_hmi.init();
|
tjc_hmi.init();
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ static void app_leakage_init(void);
|
|||||||
/*<2A><>ʷ<EFBFBD><CAB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
/*<2A><>ʷ<EFBFBD><CAB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||||
uint8_t sector_buf[2][W25Q32_SECTOR_SIZE];
|
uint8_t sector_buf[2][W25Q32_SECTOR_SIZE];
|
||||||
|
|
||||||
|
|
||||||
app_leakage_t leakage =
|
app_leakage_t leakage =
|
||||||
{
|
{
|
||||||
.region_num = 0,
|
.region_num = 0,
|
||||||
@@ -31,9 +30,7 @@ app_hitory_t history =
|
|||||||
{
|
{
|
||||||
.read_history = history_read_record,
|
.read_history = history_read_record,
|
||||||
.clean_history = history_clear_all,
|
.clean_history = history_clear_all,
|
||||||
.init_history = history_init
|
.init_history = history_init};
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static void app_leakage_init(void)
|
static void app_leakage_init(void)
|
||||||
{
|
{
|
||||||
@@ -94,7 +91,6 @@ void app_leakage_region_classify(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*<2A><><EFBFBD><EFBFBD> <20><> <20><> <20>̵<EFBFBD><CCB5><EFBFBD> <20><><EFBFBD><EFBFBD>*/
|
/*<2A><><EFBFBD><EFBFBD> <20><> <20><> <20>̵<EFBFBD><CCB5><EFBFBD> <20><><EFBFBD><EFBFBD>*/
|
||||||
static void app_leakage_alarm_contorl(void)
|
static void app_leakage_alarm_contorl(void)
|
||||||
{
|
{
|
||||||
@@ -138,7 +134,6 @@ static void app_leakage_alarm_contorl(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*<2A>쳣״̬<D7B4>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>ͳ<EFBFBD><CDB3>*/
|
/*<2A>쳣״̬<D7B4>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>ͳ<EFBFBD><CDB3>*/
|
||||||
void app_leakage_task(void)
|
void app_leakage_task(void)
|
||||||
{
|
{
|
||||||
@@ -194,8 +189,6 @@ void app_leakage_task(void)
|
|||||||
history_add_alarm_record(i, sub_device_index, k, APP_LEAKAGE_SUB_DEVICE_STATE_OPEN, 0);
|
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) &&
|
if ((current_state & APP_LEAKAGE_SUB_DEVICE_STATE_TIME_OUT) &&
|
||||||
!(prev_state & APP_LEAKAGE_SUB_DEVICE_STATE_TIME_OUT))
|
!(prev_state & APP_LEAKAGE_SUB_DEVICE_STATE_TIME_OUT))
|
||||||
{
|
{
|
||||||
@@ -236,7 +229,6 @@ void app_leakage_task(void)
|
|||||||
p_leakage->alarm_state |= APP_LEAKAGE_SUB_DEVICE_STATE_LEAKAGE;
|
p_leakage->alarm_state |= APP_LEAKAGE_SUB_DEVICE_STATE_LEAKAGE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ⱨ<EFBFBD><E2B1A8>*/
|
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ⱨ<EFBFBD><E2B1A8>*/
|
||||||
@@ -266,7 +258,6 @@ static void history_read_metadata(void)
|
|||||||
(uint8_t *)&temp_metadata,
|
(uint8_t *)&temp_metadata,
|
||||||
sizeof(app_leakage_history_metadata_t));
|
sizeof(app_leakage_history_metadata_t));
|
||||||
|
|
||||||
|
|
||||||
if (temp_metadata.total_records <= temp_metadata.max_records &&
|
if (temp_metadata.total_records <= temp_metadata.max_records &&
|
||||||
temp_metadata.write_index < temp_metadata.max_records)
|
temp_metadata.write_index < temp_metadata.max_records)
|
||||||
{
|
{
|
||||||
@@ -320,13 +311,15 @@ void history_add_alarm_record(u8 region_idx, u8 device_idx, u8 channel, u16 alar
|
|||||||
memset(&new_alarm, 0, sizeof(app_leakage_history_alarm_t));
|
memset(&new_alarm, 0, sizeof(app_leakage_history_alarm_t));
|
||||||
|
|
||||||
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
||||||
if (region_idx < leakage.region_num) {
|
if (region_idx < leakage.region_num)
|
||||||
|
{
|
||||||
memcpy(new_alarm.region_name, leakage.region_data[region_idx].name,
|
memcpy(new_alarm.region_name, leakage.region_data[region_idx].name,
|
||||||
APP_LEAKAGE_STRING_NANE_LEN);
|
APP_LEAKAGE_STRING_NANE_LEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* <20>豸ID<49><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
/* <20>豸ID<49><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
||||||
if (device_idx < APP_LEAKAGE_SUB_DEVICE_NUM) {
|
if (device_idx < APP_LEAKAGE_SUB_DEVICE_NUM)
|
||||||
|
{
|
||||||
new_alarm.device_id = leakage.sub_device_data[device_idx].flash_data.modbus_id;
|
new_alarm.device_id = leakage.sub_device_data[device_idx].flash_data.modbus_id;
|
||||||
memcpy(new_alarm.device_name, leakage.sub_device_data[device_idx].flash_data.device_name,
|
memcpy(new_alarm.device_name, leakage.sub_device_data[device_idx].flash_data.device_name,
|
||||||
APP_LEAKAGE_STRING_NANE_LEN);
|
APP_LEAKAGE_STRING_NANE_LEN);
|
||||||
@@ -353,12 +346,14 @@ void history_add_alarm_record(u8 region_idx, u8 device_idx, u8 channel, u16 alar
|
|||||||
uint32_t sectors[2] = {start_sector, (num_sectors > 1) ? end_sector : 0};
|
uint32_t sectors[2] = {start_sector, (num_sectors > 1) ? end_sector : 0};
|
||||||
|
|
||||||
/* 1. <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>漰<EFBFBD><E6BCB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>RAM */
|
/* 1. <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>漰<EFBFBD><E6BCB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>RAM */
|
||||||
for (uint32_t i = 0; i < num_sectors; i++) {
|
for (uint32_t i = 0; i < num_sectors; i++)
|
||||||
|
{
|
||||||
w25q32.read(sectors[i], sector_buf[i], W25Q32_SECTOR_SIZE);
|
w25q32.read(sectors[i], sector_buf[i], W25Q32_SECTOR_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 2. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Щ<EFBFBD><D0A9><EFBFBD><EFBFBD> */
|
/* 2. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Щ<EFBFBD><D0A9><EFBFBD><EFBFBD> */
|
||||||
for (uint32_t i = 0; i < num_sectors; i++) {
|
for (uint32_t i = 0; i < num_sectors; i++)
|
||||||
|
{
|
||||||
w25q32_sector_erase(sectors[i]);
|
w25q32_sector_erase(sectors[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -366,22 +361,26 @@ void history_add_alarm_record(u8 region_idx, u8 device_idx, u8 channel, u16 alar
|
|||||||
uint32_t offset_in_start = write_addr - start_sector;
|
uint32_t offset_in_start = write_addr - start_sector;
|
||||||
uint32_t first_part_len = (num_sectors == 1) ? HISTORY_ALARM_RECORD_SIZE : (W25Q32_SECTOR_SIZE - offset_in_start);
|
uint32_t first_part_len = (num_sectors == 1) ? HISTORY_ALARM_RECORD_SIZE : (W25Q32_SECTOR_SIZE - offset_in_start);
|
||||||
memcpy(sector_buf[0] + offset_in_start, &new_alarm, first_part_len);
|
memcpy(sector_buf[0] + offset_in_start, &new_alarm, first_part_len);
|
||||||
if (num_sectors > 1) {
|
if (num_sectors > 1)
|
||||||
|
{
|
||||||
uint32_t second_part_len = HISTORY_ALARM_RECORD_SIZE - first_part_len;
|
uint32_t second_part_len = HISTORY_ALARM_RECORD_SIZE - first_part_len;
|
||||||
memcpy(sector_buf[1], (uint8_t *)&new_alarm + first_part_len, second_part_len);
|
memcpy(sector_buf[1], (uint8_t *)&new_alarm + first_part_len, second_part_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 4. <20><><EFBFBD>ĺ<DEB8><C4BA>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4>Flash */
|
/* 4. <20><><EFBFBD>ĺ<DEB8><C4BA>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4>Flash */
|
||||||
for (uint32_t i = 0; i < num_sectors; i++) {
|
for (uint32_t i = 0; i < num_sectors; i++)
|
||||||
|
{
|
||||||
w25q32.write(sectors[i], sector_buf[i], W25Q32_SECTOR_SIZE);
|
w25q32.write(sectors[i], sector_buf[i], W25Q32_SECTOR_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 5. <20><><EFBFBD><EFBFBD>Ԫ<EFBFBD><D4AA><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD>ζ<EFBFBD><CEB6>У<EFBFBD> */
|
/* 5. <20><><EFBFBD><EFBFBD>Ԫ<EFBFBD><D4AA><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD>ζ<EFBFBD><CEB6>У<EFBFBD> */
|
||||||
leakage.history_metadata.write_index++;
|
leakage.history_metadata.write_index++;
|
||||||
if (leakage.history_metadata.write_index >= leakage.history_metadata.max_records) {
|
if (leakage.history_metadata.write_index >= leakage.history_metadata.max_records)
|
||||||
|
{
|
||||||
leakage.history_metadata.write_index = 0;
|
leakage.history_metadata.write_index = 0;
|
||||||
}
|
}
|
||||||
if (leakage.history_metadata.total_records < leakage.history_metadata.max_records) {
|
if (leakage.history_metadata.total_records < leakage.history_metadata.max_records)
|
||||||
|
{
|
||||||
leakage.history_metadata.total_records++;
|
leakage.history_metadata.total_records++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -399,24 +398,21 @@ static u8 history_read_record(u32 record_index, app_leakage_history_alarm_t *rec
|
|||||||
|
|
||||||
/* <20><><EFBFBD><EFBFBD>ʵ<EFBFBD>ʴ洢<CAB4><E6B4A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѭ<EFBFBD><D1AD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD> */
|
/* <20><><EFBFBD><EFBFBD>ʵ<EFBFBD>ʴ洢<CAB4><E6B4A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѭ<EFBFBD><D1AD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD> */
|
||||||
uint32_t actual_index;
|
uint32_t actual_index;
|
||||||
if(leakage.history_metadata.total_records == leakage.history_metadata.max_records) {
|
if (leakage.history_metadata.total_records == leakage.history_metadata.max_records)
|
||||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>write_index ָ<><D6B8><EFBFBD><EFBFBD><EFBFBD>ɼ<EFBFBD>¼
|
|
||||||
actual_index = (leakage.history_metadata.write_index - 1 - record_index
|
|
||||||
+ leakage.history_metadata.max_records) % leakage.history_metadata.max_records;
|
|
||||||
} else {
|
|
||||||
// δ<><CEB4><EFBFBD><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>洢<EFBFBD><E6B4A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 <20><><EFBFBD>磬<EFBFBD><E7A3AC><EFBFBD><EFBFBD> total_records-1 <20><><EFBFBD><EFBFBD>
|
|
||||||
actual_index = leakage.history_metadata.total_records - 1 - record_index;
|
|
||||||
}
|
|
||||||
if(actual_index == 125)
|
|
||||||
{
|
{
|
||||||
actual_index =125;
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
||||||
|
actual_index = (leakage.history_metadata.write_index + record_index) %
|
||||||
|
leakage.history_metadata.max_records;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD>ֱ<EFBFBD>Ӷ<EFBFBD>ȡ */
|
||||||
|
actual_index = record_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t read_addr = history_calc_record_addr(actual_index);
|
uint32_t read_addr = history_calc_record_addr(actual_index);
|
||||||
w25q32.read(read_addr, (uint8_t *)record, HISTORY_ALARM_RECORD_SIZE);
|
w25q32.read(read_addr, (uint8_t *)record, HISTORY_ALARM_RECORD_SIZE);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -438,7 +434,6 @@ static void history_clear_all(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>ʷ<EFBFBD><CAB7><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3> */
|
/* <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>ʷ<EFBFBD><CAB7><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3> */
|
||||||
static void history_init(void)
|
static void history_init(void)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#define _APP_LEAKAGE_H_
|
#define _APP_LEAKAGE_H_
|
||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
#include "bsp_W5500.h"
|
||||||
|
|
||||||
#define ENABLE (1)
|
#define ENABLE (1)
|
||||||
#define DISABLE (0)
|
#define DISABLE (0)
|
||||||
@@ -24,6 +25,8 @@ 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);
|
void history_add_alarm_record(u8 region_idx, u8 device_idx, u8 channel, u16 alarm_type, u16 leak_distance);
|
||||||
|
|
||||||
|
|
||||||
|
#define NETWORK_PORT_NUM BSP_W5500_PORT_NUM
|
||||||
|
|
||||||
/*<2A><><EFBFBD>豸<EFBFBD>洢<EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>*/
|
/*<2A><><EFBFBD>豸<EFBFBD>洢<EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>*/
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
@@ -66,7 +69,7 @@ typedef struct {
|
|||||||
u8 ip[4];
|
u8 ip[4];
|
||||||
u8 mask[4];
|
u8 mask[4];
|
||||||
u8 gateway[4];
|
u8 gateway[4];
|
||||||
u16 port;
|
u16 port[NETWORK_PORT_NUM];
|
||||||
}network_config_t;
|
}network_config_t;
|
||||||
|
|
||||||
/* <20><>ʷ<EFBFBD><CAB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>ṹ */
|
/* <20><>ʷ<EFBFBD><CAB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>ṹ */
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ bsp_W5500_t W5500 =
|
|||||||
{
|
{
|
||||||
.Gateway_IP = {192,168,100,1}, /*<2A><><EFBFBD><EFBFBD>IP<49><50>ַ*/
|
.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>*/
|
.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)*/
|
.Phy_Addr = {0x0c,0x29,0xab,0x7c,0x00,0x01}, /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ(MAC) <20><><EFBFBD>ݵ<EFBFBD>Ƭ<EFBFBD><C6AC>UID<49><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>MAC*/
|
||||||
.IP_Addr = {192,168,100,201}, /*<2A><><EFBFBD><EFBFBD>IP<49><50>ַ*/
|
.IP_Addr = {192,168,100,201}, /*<2A><><EFBFBD><EFBFBD>IP<49><50>ַ*/
|
||||||
|
|
||||||
.Interrupt_Process = bsp_W5500_Interrupt_Process,
|
.Interrupt_Process = bsp_W5500_Interrupt_Process,
|
||||||
@@ -49,6 +49,24 @@ bsp_W5500_t W5500 =
|
|||||||
.ConfigData.Port = {0x01,0xF6},
|
.ConfigData.Port = {0x01,0xF6},
|
||||||
.Run_Mode = BSP_W5500_PORT_RUN_MODE_TCP_SERVER,
|
.Run_Mode = BSP_W5500_PORT_RUN_MODE_TCP_SERVER,
|
||||||
},
|
},
|
||||||
|
.W5500_Class[1] =
|
||||||
|
{
|
||||||
|
.SocketPort = 1, /*ʹ<>ö˿<C3B6>1*/
|
||||||
|
.ConfigData.Port = {0x01,0xF7},
|
||||||
|
.Run_Mode = BSP_W5500_PORT_RUN_MODE_TCP_SERVER,
|
||||||
|
},
|
||||||
|
.W5500_Class[2] =
|
||||||
|
{
|
||||||
|
.SocketPort = 2, /*ʹ<>ö˿<C3B6>2*/
|
||||||
|
.ConfigData.Port = {0x01,0xF8},
|
||||||
|
.Run_Mode = BSP_W5500_PORT_RUN_MODE_TCP_SERVER,
|
||||||
|
},
|
||||||
|
.W5500_Class[3] =
|
||||||
|
{
|
||||||
|
.SocketPort = 3, /*ʹ<>ö˿<C3B6>3*/
|
||||||
|
.ConfigData.Port = {0x01,0xF9},
|
||||||
|
.Run_Mode = BSP_W5500_PORT_RUN_MODE_TCP_SERVER,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
bsp_W5500_t *pW5500 = &W5500;
|
bsp_W5500_t *pW5500 = &W5500;
|
||||||
@@ -822,7 +840,7 @@ static void bsp_W5500_Task(void)
|
|||||||
if ((pW5500->W5500_Class[i].TR_Data_State & BSP_W5500_PORT_DATA_RECEIVE) == BSP_W5500_PORT_DATA_RECEIVE) // <20><><EFBFBD><EFBFBD>Socket0<74><30><EFBFBD>յ<EFBFBD><D5B5><EFBFBD><EFBFBD><EFBFBD>
|
if ((pW5500->W5500_Class[i].TR_Data_State & BSP_W5500_PORT_DATA_RECEIVE) == BSP_W5500_PORT_DATA_RECEIVE) // <20><><EFBFBD><EFBFBD>Socket0<74><30><EFBFBD>յ<EFBFBD><D5B5><EFBFBD><EFBFBD><EFBFBD>
|
||||||
{
|
{
|
||||||
pW5500->W5500_Class[i].TR_Data_State &= ~BSP_W5500_PORT_DATA_RECEIVE;
|
pW5500->W5500_Class[i].TR_Data_State &= ~BSP_W5500_PORT_DATA_RECEIVE;
|
||||||
u16 Len = Read_SOCK_Data_Buffer(0, pW5500->W5500_Class[i].Rx_Buffer);
|
u16 Len = Read_SOCK_Data_Buffer(i, pW5500->W5500_Class[i].Rx_Buffer);
|
||||||
// Write_SOCK_Data_Buffer(&pW5500->W5500_Class[i], pW5500->W5500_Class[i].Rx_Buffer, Len);
|
// Write_SOCK_Data_Buffer(&pW5500->W5500_Class[i], pW5500->W5500_Class[i].Rx_Buffer, Len);
|
||||||
// printf("RX");
|
// printf("RX");
|
||||||
// Debug_UartSend(pW5500->W5500_Class[i].Rx_Buffer, Len);
|
// Debug_UartSend(pW5500->W5500_Class[i].Rx_Buffer, Len);
|
||||||
|
|||||||
@@ -215,7 +215,7 @@
|
|||||||
#define W5500_INT_PORT W5500_INT_GPIO_Port
|
#define W5500_INT_PORT W5500_INT_GPIO_Port
|
||||||
|
|
||||||
typedef u8 SOCKET; // <20>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD>˿ں<CBBF><DABA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
typedef u8 SOCKET; // <20>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD>˿ں<CBBF><DABA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
#define BSP_W5500_PORT_NUM 1
|
#define BSP_W5500_PORT_NUM 4
|
||||||
|
|
||||||
#define BSP_W5500_TX_DATA_LEN 2048
|
#define BSP_W5500_TX_DATA_LEN 2048
|
||||||
#define BSP_W5500_RX_DATA_LEN 2048
|
#define BSP_W5500_RX_DATA_LEN 2048
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ static void gui_tjc_hmi_read_device_info_from_w25q(void)
|
|||||||
|
|
||||||
static void gui_tjc_hmi_read_network_config_from_w25q(void)
|
static void gui_tjc_hmi_read_network_config_from_w25q(void)
|
||||||
{
|
{
|
||||||
|
u16 i;
|
||||||
network_config_t config;
|
network_config_t config;
|
||||||
w25q32.read(W25Q32_NETWORK_CONFIG_ADDR, (uint8_t*)&config, sizeof(config));
|
w25q32.read(W25Q32_NETWORK_CONFIG_ADDR, (uint8_t*)&config, sizeof(config));
|
||||||
|
|
||||||
@@ -106,8 +107,12 @@ static void gui_tjc_hmi_read_network_config_from_w25q(void)
|
|||||||
memcpy(W5500.IP_Addr, config.ip, 4);
|
memcpy(W5500.IP_Addr, config.ip, 4);
|
||||||
memcpy(W5500.Sub_Mask, config.mask, 4);
|
memcpy(W5500.Sub_Mask, config.mask, 4);
|
||||||
memcpy(W5500.Gateway_IP, config.gateway, 4);
|
memcpy(W5500.Gateway_IP, config.gateway, 4);
|
||||||
W5500.W5500_Class[0].ConfigData.Port[0] = (config.port >> 8) & 0xFF;
|
|
||||||
W5500.W5500_Class[0].ConfigData.Port[1] = config.port & 0xFF;
|
for(i=0;i<NETWORK_PORT_NUM;i++)
|
||||||
|
{
|
||||||
|
W5500.W5500_Class[i].ConfigData.Port[0] = (config.port[i] >> 8) & 0xFF;
|
||||||
|
W5500.W5500_Class[i].ConfigData.Port[1] = config.port[i] & 0xFF;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -48,7 +48,12 @@ static void proto_modbus_communication_data_send(u8 *p_data, u16 len)
|
|||||||
|
|
||||||
static void proto_modbus_init(void)
|
static void proto_modbus_init(void)
|
||||||
{
|
{
|
||||||
W5500.W5500_Class[0].Rx_DataAnalysis = proto_modbus_communication_data_analysis;
|
u16 i;
|
||||||
|
for(i=0;i<BSP_W5500_PORT_NUM;i++)
|
||||||
|
{
|
||||||
|
W5500.W5500_Class[i].Rx_DataAnalysis = proto_modbus_communication_data_analysis;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
static void proto_modbus_task(void)
|
static void proto_modbus_task(void)
|
||||||
{
|
{
|
||||||
@@ -134,8 +139,8 @@ static void proto_modbus_communication_data_analysis(u8 *pData, u16 len,void *ot
|
|||||||
|
|
||||||
case 0x06:
|
case 0x06:
|
||||||
{
|
{
|
||||||
modbus_analysis_data.write_data_addr[0] = pData[10];
|
modbus_analysis_data.write_data_addr = &pData[send_buff_index_offset + 4];
|
||||||
modbus_analysis_data.write_data_addr[1] = pData[11];
|
|
||||||
TempAddr = modbus_analysis_data.start_addr;
|
TempAddr = modbus_analysis_data.start_addr;
|
||||||
TempData = (modbus_analysis_data.write_data_addr[0] << 8) | modbus_analysis_data.write_data_addr[1];
|
TempData = (modbus_analysis_data.write_data_addr[0] << 8) | modbus_analysis_data.write_data_addr[1];
|
||||||
error_code = proto_modbus_data_write(TempAddr, TempData);
|
error_code = proto_modbus_data_write(TempAddr, TempData);
|
||||||
@@ -155,11 +160,8 @@ static void proto_modbus_communication_data_analysis(u8 *pData, u16 len,void *ot
|
|||||||
|
|
||||||
case 0x10:
|
case 0x10:
|
||||||
{
|
{
|
||||||
u8 byte_count = pData[12]; // <20>ֽ<EFBFBD><D6BD><EFBFBD>
|
modbus_analysis_data.write_data_addr = &pData[send_buff_index_offset + 7];
|
||||||
// <20><><EFBFBD><EFBFBD><EFBFBD>ݸ<EFBFBD><DDB8>Ƶ<EFBFBD> write_data_addr
|
|
||||||
for (u8 i = 0; i < byte_count; i++) {
|
|
||||||
modbus_analysis_data.write_data_addr[i] = pData[13 + i];
|
|
||||||
}
|
|
||||||
TempAddr = modbus_analysis_data.start_addr;
|
TempAddr = modbus_analysis_data.start_addr;
|
||||||
for (inx = 0; inx < modbus_analysis_data.reg_number; inx++)
|
for (inx = 0; inx < modbus_analysis_data.reg_number; inx++)
|
||||||
{
|
{
|
||||||
@@ -173,12 +175,12 @@ static void proto_modbus_communication_data_analysis(u8 *pData, u16 len,void *ot
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
send_struct.len = send_buff_index_offset + 6;
|
send_struct.len = send_buff_index_offset + 6;
|
||||||
send_struct.send_buffer[send_buff_index_offset + send_buff_index_offset + 0] = modbus_analysis_data.id;
|
send_struct.send_buffer[send_buff_index_offset + 0] = modbus_analysis_data.id;
|
||||||
send_struct.send_buffer[send_buff_index_offset + send_buff_index_offset + 1] = modbus_analysis_data.func;
|
send_struct.send_buffer[send_buff_index_offset + 1] = modbus_analysis_data.func;
|
||||||
send_struct.send_buffer[send_buff_index_offset + send_buff_index_offset + 2] = modbus_analysis_data.start_addr >> 8;
|
send_struct.send_buffer[send_buff_index_offset + 2] = modbus_analysis_data.start_addr >> 8;
|
||||||
send_struct.send_buffer[send_buff_index_offset + send_buff_index_offset + 3] = modbus_analysis_data.start_addr & 0xff;
|
send_struct.send_buffer[send_buff_index_offset + 3] = modbus_analysis_data.start_addr & 0xff;
|
||||||
send_struct.send_buffer[send_buff_index_offset + send_buff_index_offset + 4] = modbus_analysis_data.reg_number >> 8;
|
send_struct.send_buffer[send_buff_index_offset + 4] = modbus_analysis_data.reg_number >> 8;
|
||||||
send_struct.send_buffer[send_buff_index_offset + send_buff_index_offset + 5] = modbus_analysis_data.reg_number & 0xff;
|
send_struct.send_buffer[send_buff_index_offset + 5] = modbus_analysis_data.reg_number & 0xff;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
BIN
漏液主控界面2.HMI
BIN
漏液主控界面2.HMI
Binary file not shown.
Reference in New Issue
Block a user