添加获取电池RAW信息功能
This commit is contained in:
parent
98a895fb3e
commit
b6ed49f437
@ -163,7 +163,16 @@ uint8_t getBattInfo(uint8_t *dout)
|
||||
p += 2;
|
||||
return p;
|
||||
}
|
||||
/*
|
||||
* 获取电池RAW信息
|
||||
*/
|
||||
uint8_t getBattRAWInfo(uint8_t *dout)
|
||||
{
|
||||
uint8_t len = sizeof(batt);
|
||||
memcpy(dout,&batt,len);
|
||||
|
||||
return len;
|
||||
}
|
||||
static void T485_thread_entry(void *parameter)
|
||||
{
|
||||
while (1)
|
||||
|
@ -737,6 +737,29 @@ static int packSignal(uint8_t *dout)
|
||||
return len;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取电池信息,带时戳
|
||||
*/
|
||||
void reportBattInfo(void)
|
||||
{
|
||||
uint8_t battInfo[200] = { 0x5A, 0xA5, ADDR_ANJI, ADDR_TT, _INFO_BATT >> 8, _INFO_BATT & 0xFF, 0, 0 };
|
||||
|
||||
uint8_t binfo[63];
|
||||
uint8_t len = time2Byte(battInfo + 8); //添加时间戳
|
||||
uint8_t blen = getBattRAWInfo(binfo + 8 + len);
|
||||
len += blen;
|
||||
|
||||
battInfo[7] = len; //update len of raw data
|
||||
battInfo[8 + len] = bccCRC(battInfo + 2, 8 + len - 2); //update CRC
|
||||
battInfo[8 + len + 1] = 0xED;
|
||||
|
||||
len = 8 + len + 2;
|
||||
LOG_HEX("battInfo", 16, battInfo, len); //bccCRC+Tail
|
||||
|
||||
upSend(battInfo, len);
|
||||
|
||||
}
|
||||
|
||||
///**
|
||||
// * 加密位置信息。对位置信息的更改需在加密前操作
|
||||
// * @param din 存储待加密位置信息的数组
|
||||
@ -1019,7 +1042,7 @@ void ttRunCMD_thread_entry(uint8_t *din, size_t len)
|
||||
break;
|
||||
|
||||
case _INFO_BATT:
|
||||
parseBattInfo(din+8, din[7]);
|
||||
reportBattInfo();
|
||||
break;
|
||||
case _CMD_SET_RTC:
|
||||
updateSysRTC(din+8, din[7]);
|
||||
|
Loading…
Reference in New Issue
Block a user