添加信号质量采集功能
This commit is contained in:
parent
fc30018ee6
commit
b2ac01d0c4
@ -719,27 +719,24 @@ static void d_packLocMsg(void)
|
||||
* 获取信号信息,以时戳开头
|
||||
* @param dout
|
||||
*/
|
||||
RT_WEAK getSignals(uint8_t *dout, uint8_t len);
|
||||
static int packSignal(uint8_t *dout)
|
||||
RT_WEAK size_t getSignals(uint8_t *dout, uint8_t len);
|
||||
void packSignal(void)
|
||||
{
|
||||
LOG_I("FUNC = get signals");
|
||||
uint8_t signalMsg[200] =
|
||||
{ 0x5A, 0xA5, ADDR_ANJI, ADDR_TT, _INFO_SIGNAL >> 8, _INFO_SIGNAL & 0xFF, 0, 0 };
|
||||
|
||||
|
||||
int len = time2Byte(signalMsg+8);//添加时间戳
|
||||
len += getSignals(signalMsg + 8 + len, _LOC_CNT) + 1; //p指向第2个数据
|
||||
if (len == 0x08) {//无有效位置数据
|
||||
return 0;
|
||||
}
|
||||
uint8_t len = time2Byte(signalMsg+8);//添加时间戳
|
||||
len += getSignals(signalMsg + 8 + len, 100);
|
||||
|
||||
signalMsg[7] = len; //update len of raw data
|
||||
signalMsg[8 + len] = bccCRC(signalMsg + 2, 8 + len - 2); //update CRC
|
||||
signalMsg[8 + len + 1] = 0xED;
|
||||
|
||||
len = 8 + len + 2;
|
||||
// LOG_HEX("packLocMsg", 16, alertMsg, len); //bccCRC+Tail
|
||||
memcpy(dout, signalMsg, len);
|
||||
return len;
|
||||
LOG_HEX("signal",16,signalMsg,len);
|
||||
upSend(signalMsg,len);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -758,7 +755,7 @@ void reportBattInfo(void)
|
||||
battInfo[8 + len + 1] = 0xED;
|
||||
|
||||
len = 8 + len + 2;
|
||||
LOG_HEX("battInfo", 16, battInfo, len); //bccCRC+Tail
|
||||
// LOG_HEX("battInfo", 16, battInfo, len); //bccCRC+Tail
|
||||
|
||||
upSend(battInfo, len);
|
||||
|
||||
@ -1066,6 +1063,9 @@ void ttRunCMD_thread_entry(uint8_t *din, size_t len)
|
||||
case _CMD_SET_RTC:
|
||||
updateSysRTC(din+8, din[7]);
|
||||
break;
|
||||
case _INFO_SIGNAL:
|
||||
packSignal();
|
||||
break;
|
||||
default:
|
||||
LOG_W("0x%04X=未支持的指令。",cmd);
|
||||
break;
|
||||
|
@ -64,9 +64,11 @@ TT *TTinfo=&tmp;
|
||||
static rt_tick_t bootstamp=0;
|
||||
#define RST_LEN 100//存储info的数组的长度
|
||||
static uint8_t rstInfo[RST_LEN];//存储info的数组
|
||||
static uint8_t signalInfo[RST_LEN];
|
||||
void resetInfo()
|
||||
{
|
||||
rt_memset(rstInfo,0x3f,RST_LEN);//初始化
|
||||
rt_memset(signalInfo,0x3f,RST_LEN);//初始化
|
||||
}
|
||||
/**
|
||||
* @description: 将TT结构体转换为数组
|
||||
@ -153,7 +155,7 @@ extern SYS_CFG scfg;
|
||||
|
||||
void initcfg()
|
||||
{
|
||||
rt_memset(rstInfo,0x3f,RST_LEN);//初始化
|
||||
resetInfo();//初始化
|
||||
bootstamp = rt_tick_get_millisecond();
|
||||
}
|
||||
INIT_APP_EXPORT(initcfg);
|
||||
@ -467,11 +469,12 @@ void repGetTT_thread_entry(void* parameter)
|
||||
uint8_t buffer[10];
|
||||
int len = info2HEX(TTinfo, buffer);
|
||||
appendInfo(rstInfo, RST_LEN, buffer, len);
|
||||
appendInfo(signalInfo, RST_LEN, buffer, 1);
|
||||
}
|
||||
rulecheck();
|
||||
rt_thread_mdelay(5 * 1000);//间隔3s更新一次数据
|
||||
}
|
||||
rt_memset(rstInfo,0x3f,RST_LEN);//复位
|
||||
resetInfo();//复位
|
||||
strcpy(TTinfo->sim,"-");
|
||||
strcpy(TTinfo->xh,"-");
|
||||
strcpy(TTinfo->jh,"-");
|
||||
@ -487,7 +490,7 @@ void repGetTT(void)
|
||||
{
|
||||
while(!isTCPok())//第一次运行时未上电则等待
|
||||
{}
|
||||
rt_memset(rstInfo,0x3f,RST_LEN);//初始化
|
||||
resetInfo();//初始化
|
||||
/* 创建 serial 线程 */
|
||||
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);
|
||||
|
||||
/**
|
||||
* 获取信号状态
|
||||
* @param dout 存储结果的数组
|
||||
* @param len 指定获取状态的次数
|
||||
*/
|
||||
size_t getSignals(uint8_t *dout, uint8_t len){
|
||||
memcpy(dout,signalInfo,len);
|
||||
return len;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user