添加信号质量采集功能

This commit is contained in:
CSSC-WORK\murmur 2023-09-12 11:40:39 +08:00
parent fc30018ee6
commit b2ac01d0c4
2 changed files with 26 additions and 14 deletions

View File

@ -719,27 +719,24 @@ static void d_packLocMsg(void)
* *
* @param dout * @param dout
*/ */
RT_WEAK getSignals(uint8_t *dout, uint8_t len); RT_WEAK size_t getSignals(uint8_t *dout, uint8_t len);
static int packSignal(uint8_t *dout) void packSignal(void)
{ {
LOG_I("FUNC = get signals");
uint8_t signalMsg[200] = uint8_t signalMsg[200] =
{ 0x5A, 0xA5, ADDR_ANJI, ADDR_TT, _INFO_SIGNAL >> 8, _INFO_SIGNAL & 0xFF, 0, 0 }; { 0x5A, 0xA5, ADDR_ANJI, ADDR_TT, _INFO_SIGNAL >> 8, _INFO_SIGNAL & 0xFF, 0, 0 };
int len = time2Byte(signalMsg+8);//添加时间戳 uint8_t len = time2Byte(signalMsg+8);//添加时间戳
len += getSignals(signalMsg + 8 + len, _LOC_CNT) + 1; //p指向第2个数据 len += getSignals(signalMsg + 8 + len, 100);
if (len == 0x08) {//无有效位置数据
return 0;
}
signalMsg[7] = len; //update len of raw data signalMsg[7] = len; //update len of raw data
signalMsg[8 + len] = bccCRC(signalMsg + 2, 8 + len - 2); //update CRC signalMsg[8 + len] = bccCRC(signalMsg + 2, 8 + len - 2); //update CRC
signalMsg[8 + len + 1] = 0xED; signalMsg[8 + len + 1] = 0xED;
len = 8 + len + 2; len = 8 + len + 2;
// LOG_HEX("packLocMsg", 16, alertMsg, len); //bccCRC+Tail LOG_HEX("signal",16,signalMsg,len);
memcpy(dout, signalMsg, len); upSend(signalMsg,len);
return len;
} }
/** /**
@ -758,7 +755,7 @@ void reportBattInfo(void)
battInfo[8 + len + 1] = 0xED; battInfo[8 + len + 1] = 0xED;
len = 8 + len + 2; len = 8 + len + 2;
LOG_HEX("battInfo", 16, battInfo, len); //bccCRC+Tail // LOG_HEX("battInfo", 16, battInfo, len); //bccCRC+Tail
upSend(battInfo, len); upSend(battInfo, len);
@ -1066,6 +1063,9 @@ void ttRunCMD_thread_entry(uint8_t *din, size_t len)
case _CMD_SET_RTC: case _CMD_SET_RTC:
updateSysRTC(din+8, din[7]); updateSysRTC(din+8, din[7]);
break; break;
case _INFO_SIGNAL:
packSignal();
break;
default: default:
LOG_W("0x%04X=未支持的指令。",cmd); LOG_W("0x%04X=未支持的指令。",cmd);
break; break;

View File

@ -64,9 +64,11 @@ TT *TTinfo=&tmp;
static rt_tick_t bootstamp=0; static rt_tick_t bootstamp=0;
#define RST_LEN 100//存储info的数组的长度 #define RST_LEN 100//存储info的数组的长度
static uint8_t rstInfo[RST_LEN];//存储info的数组 static uint8_t rstInfo[RST_LEN];//存储info的数组
static uint8_t signalInfo[RST_LEN];
void resetInfo() void resetInfo()
{ {
rt_memset(rstInfo,0x3f,RST_LEN);//初始化 rt_memset(rstInfo,0x3f,RST_LEN);//初始化
rt_memset(signalInfo,0x3f,RST_LEN);//初始化
} }
/** /**
* @description: TT结构体转换为数组 * @description: TT结构体转换为数组
@ -153,7 +155,7 @@ extern SYS_CFG scfg;
void initcfg() void initcfg()
{ {
rt_memset(rstInfo,0x3f,RST_LEN);//初始化 resetInfo();//初始化
bootstamp = rt_tick_get_millisecond(); bootstamp = rt_tick_get_millisecond();
} }
INIT_APP_EXPORT(initcfg); INIT_APP_EXPORT(initcfg);
@ -467,11 +469,12 @@ void repGetTT_thread_entry(void* parameter)
uint8_t buffer[10]; uint8_t buffer[10];
int len = info2HEX(TTinfo, buffer); int len = info2HEX(TTinfo, buffer);
appendInfo(rstInfo, RST_LEN, buffer, len); appendInfo(rstInfo, RST_LEN, buffer, len);
appendInfo(signalInfo, RST_LEN, buffer, 1);
} }
rulecheck(); rulecheck();
rt_thread_mdelay(5 * 1000);//间隔3s更新一次数据 rt_thread_mdelay(5 * 1000);//间隔3s更新一次数据
} }
rt_memset(rstInfo,0x3f,RST_LEN);//复位 resetInfo();//复位
strcpy(TTinfo->sim,"-"); strcpy(TTinfo->sim,"-");
strcpy(TTinfo->xh,"-"); strcpy(TTinfo->xh,"-");
strcpy(TTinfo->jh,"-"); strcpy(TTinfo->jh,"-");
@ -487,7 +490,7 @@ void repGetTT(void)
{ {
while(!isTCPok())//第一次运行时未上电则等待 while(!isTCPok())//第一次运行时未上电则等待
{} {}
rt_memset(rstInfo,0x3f,RST_LEN);//初始化 resetInfo();//初始化
/* 创建 serial 线程 */ /* 创建 serial 线程 */
rt_thread_t thread = rt_thread_create("repGetTT", repGetTT_thread_entry, RT_NULL, 1024 * 30, 27+2, 10); rt_thread_t thread = rt_thread_create("repGetTT", repGetTT_thread_entry, RT_NULL, 1024 * 30, 27+2, 10);
/* 创建成功则启动线程 */ /* 创建成功则启动线程 */
@ -504,3 +507,12 @@ void repGetTT(void)
} }
//MSH_CMD_EXPORT(repGetTT,gett); //MSH_CMD_EXPORT(repGetTT,gett);
/**
*
* @param dout
* @param len
*/
size_t getSignals(uint8_t *dout, uint8_t len){
memcpy(dout,signalInfo,len);
return len;
}