加了编译时间打印,以及将IP改为正式端,以及修复了传感器不输出故障不恢复的问题

This commit is contained in:
小马_666 2025-01-23 08:43:49 +08:00
parent aaaafad44a
commit bfbb5b55ee
6 changed files with 36 additions and 19 deletions

View File

@ -5,7 +5,7 @@
"type": "mrs-debugger",
"request": "launch",
"name": "JT-DT-YD4N02A_RTT_MRS-4G",
"cwd": "c:\\Users\\张喆1223\\Desktop\\NT26K\\JT-DT-YD4N02A_4G_RTT_MRS",
"cwd": "d:\\SXDT\\Project\\CH32\\JT-DT-YD4N02A_RTT_MRS-NT26K",
"openOCDCfg": {
"useLocalOpenOCD": true,
"executable": "c:/MounRiver/MounRiver_Studio2/resources/app/resources/win32/components/WCH/OpenOCD/OpenOCD/bin/openocd.exe",
@ -39,8 +39,8 @@
"additionalCommands": []
},
"loadedFiles": {
"executableFile": "c:\\Users\\张喆1223\\Desktop\\NT26K\\JT-DT-YD4N02A_4G_RTT_MRS\\obj\\JT-DT-YD4N02A_RTT_MRS-4G.elf",
"symbolFile": "c:\\Users\\张喆1223\\Desktop\\NT26K\\JT-DT-YD4N02A_4G_RTT_MRS\\obj\\JT-DT-YD4N02A_RTT_MRS-4G.elf",
"executableFile": "d:\\SXDT\\Project\\CH32\\JT-DT-YD4N02A_RTT_MRS-NT26K\\obj\\JT-DT-YD4N02A_RTT_MRS-4G.elf",
"symbolFile": "d:\\SXDT\\Project\\CH32\\JT-DT-YD4N02A_RTT_MRS-NT26K\\obj\\JT-DT-YD4N02A_RTT_MRS-4G.elf",
"executableFileOffset": 0,
"symbolFileOffset": 0
},

View File

@ -2,7 +2,7 @@
* @Author: mbw
* @Date: 2024-10-23 17:14:16
* @LastEditors: mbw && 1600520629@qq.com
* @LastEditTime: 2025-01-18 12:05:52
* @LastEditTime: 2025-01-23 08:42:56
* @FilePath: \JT-DT-YD4N02A_RTT_MRS-NT26K\applications\main.c
* @Descrt_thread_
*
@ -128,6 +128,7 @@ int _Self_Check_Mode(void)
return RT_EOK;
}
#if 0
void Preheat_Sensor(rt_uint32_t timeout_counter)
{
// 定义超时时间,单位为毫秒
@ -168,6 +169,7 @@ void Preheat_Sensor(rt_uint32_t timeout_counter)
Preheat_Sensor(timeout_counter);
}
}
#endif
void Work_Cnt_Timer_Callback(void *parameter)
{
@ -503,11 +505,15 @@ static void SYS_Set_RtcProductTime(int argc, char **argv)
MSH_CMD_EXPORT(SYS_Set_RtcProductTime, "SYS_Set_RtcProductTime");
static void SYS_SW_Version(void)
{
COMPILE_TIME;
rt_kprintf("JT-DT-YD4N02A Software version: V%02X\r\n", (uint8_t)Flash_Get_SysCfg(kSwVerId));
}
MSH_CMD_EXPORT(SYS_SW_Version, "软件版本");
MSH_CMD_EXPORT(SYS_SW_Version, "软件版本和编译时间");
#endif

View File

@ -18,7 +18,7 @@
#define MAX_EXPIRATION_DAYS (365 * MAX_EXPIRATION_YEARS + 30 * 3U)
#define SYS_HW_VERSION (0X22U)
#define SYS_SW_VERSION (0X14U)
#define SYS_SW_VERSION (0X15U)
#define SYS_IOT_UPLOAD_CYCLE_MIN (0X3C00U) // 高位在前,低位在后
#define SYS_IOT_RETRY (0X03U)
#define SYS_TEMP_ALARM_THRESHOLD (0X30U)
@ -27,8 +27,14 @@
#define SYS_RELAY_SWITCH (0X04U)
#define SYS_ALARM_VALVE_MAX (0X30U)
#define SYS_IOT_URL ("8.130.117.149")
#define SYS_IOT_PORT ("7137")
#define SYS_IOT_URL ("8.130.127.158")
#define SYS_IOT_PORT ("7101")
// 定义宏来打印编译时间和日期
#define COMPILE_TIME \
do { \
rt_kprintf("Compiled on: %s at %s\n", __DATE__, __TIME__); \
} while (0)
typedef enum
{

View File

@ -798,7 +798,7 @@ int BSP_Flash_Init (void)
LOG_D ("Flash_Set_Sever_Data error!");
}
Flash_SetProductTimeLimit (2025, 1, 19, 13, 50, 20, kFactoryTimeId);
Flash_SetProductTimeLimit (2025, 1, 23, 13, 50, 20, kFactoryTimeId);
Set_ExpirationTime (MAX_EXPIRATION_DAYS);
sci.hw_ver = SYS_HW_VERSION;

View File

@ -2,7 +2,7 @@
* @Author: mbw
* @Date: 2024-11-14 10:21:04
* @LastEditors: mbw && 1600520629@qq.com
* @LastEditTime: 2025-01-17 10:46:51
* @LastEditTime: 2025-01-22 22:54:08
* @FilePath: \JT-DT-YD4N02A_RTT_MRS-NT26K\bsp\src\bsp_h308.c
* @Description:
*
@ -38,6 +38,7 @@ static rt_sem_t uart4_rx_ok_sem;
static struct rt_timer uart4_rx_timer1;
uint8_t sensor_rx_count = 0; // 接收缓冲区中,已经收到的数据包数量
static rt_uint8_t alarm_flag = 0, fault_flag = 0;
TsH308 H308 = {0};
@ -197,9 +198,9 @@ static void H308_HandleFault(uint8_t count, uint8_t *flag, uint8_t threshold)
}
}
static uint8_t H308_CheckData(void)
static uint8_t H308_CheckData(rt_uint8_t alarm_flag, rt_uint8_t fault_flag)
{
static rt_uint8_t alarm_flag = 0, fault_flag = 0;
static rt_uint8_t alarm_count = 0, fault_count = 0;
static rt_uint8_t index = 0;
static rt_uint8_t alarm_status_buffer[H308_SAMPLING_TIMS] = {0};
@ -231,11 +232,15 @@ uint8_t IS_H308_EndOfLife(void)
{
H308.end_of_life = 1;
}
else
{
H308.end_of_life = 0;
}
}
else
{
H308.end_of_life = 0;
}
// else
// {
// H308.end_of_life = 0;
// }
return H308.end_of_life;
}
@ -307,7 +312,7 @@ static void h308_thread_entry(void *param)
LOG_I("str:[%s]", str);
if (ret == 0)
{
H308_CheckData();
H308_CheckData(alarm_flag, fault_flag);
}
else
{
@ -346,6 +351,7 @@ static void h308_thread_entry(void *param)
if (H308.detection_flag != kH308Fault)
{
H308.detection_flag = kH308Fault;
fault_flag = 1;
Send_Laser_Alarm_Event(kFaultEvent);
}
}

View File

@ -799,7 +799,6 @@ int Nt26k_Process_Events(Nt26kEvent nt26k_recv_event, struct at_device *device,
if (result != RT_EOK)
{
LOG_E("nt26k send failed\n");
rt_thread_mdelay(5000);
continue;
}
else
@ -850,7 +849,7 @@ int Nt26k_Process_Events(Nt26kEvent nt26k_recv_event, struct at_device *device,
}
LOG_D("断网,等待连接中......\n");
}
rt_thread_mdelay(5000);
rt_thread_mdelay(2000);
}
}
// 函数执行完毕返回0