上报位置附带电池信息,据此更新解析
添加jd wd 电压 电量绘图
This commit is contained in:
parent
5097641baf
commit
bf5b2f9691
51
解析TT数据.lua
51
解析TT数据.lua
@ -37,6 +37,32 @@ function getCFG( str )
|
||||
return rst
|
||||
end
|
||||
|
||||
function getBattInfo(str)
|
||||
local a1,a2,a3,a4,a5,a6,a7,a8,a9,b1,b2,b3,b4,b5,b6,b7,b8= string.unpack(">hhhhhhhhhhhhhhhhh",str)
|
||||
local rst = ""
|
||||
.."实际电压 "..(a1/100).."V\r\n"
|
||||
.."电芯数量 "..a2.."\r\n"
|
||||
.."电量 "..a3.."%\r\n"
|
||||
.."容量 "..(a4/100).."AH\r\n"
|
||||
.."输出电流 "..(a5/100).."A\r\n"
|
||||
.."充电电流 "..(a6/100).."A\r\n"
|
||||
.."温度1 "..a7.."℃\r\n"
|
||||
.."温度2 "..a8.."℃\r\n"
|
||||
.."温度3 "..a9.."℃\r\n"
|
||||
.."电芯1电压 "..(b1/1000).."V\r\n"
|
||||
.."电芯2电压 "..(b2/1000).."V\r\n"
|
||||
.."电芯3电压 "..(b3/1000).."V\r\n"
|
||||
.."电芯4电压 "..(b4/1000).."V\r\n"
|
||||
.."电芯5电压 "..(b5/1000).."V\r\n"
|
||||
.."电芯6电压 "..(b6/1000).."V\r\n"
|
||||
.."电芯7电压 "..(b7/1000).."V\r\n"
|
||||
.."电芯8电压 "..(b8/1000).."V\r\n"
|
||||
|
||||
apiAddPoint((a1/100),8)
|
||||
apiAddPoint(a3,9)
|
||||
return rst
|
||||
end
|
||||
|
||||
--解析
|
||||
function parseInfo(data)
|
||||
local selfTest = 0x7001
|
||||
@ -92,35 +118,20 @@ function parseInfo(data)
|
||||
local islocok = string.unpack("B",data:sub(8+1))
|
||||
rst.info = rst.info.."位置状态 "..(islocok == 0 and "正常" or "异常").."\r\n"
|
||||
rst.info = rst.info.. "信号, 经度, 纬度, 高度\r\n"
|
||||
for i = 1, 100, 10 do
|
||||
for i = 1, 80, 10 do
|
||||
local xh, jd, wd, gd = string.unpack("<Bffb", data:sub(8+7 + 1 + i, -1)) -- only 1 pair
|
||||
rst.info = rst.info.."["..string.format("%02d",(xh-0xE0))..", " .. string.format("%.6f",jd) .. ", " .. string.format("%.6f",wd) .. ", " .. string.format("%03d",gd) .. "] \r\n"
|
||||
apiAddPoint(jd,0)
|
||||
apiAddPoint(wd,1)
|
||||
end
|
||||
rst.info = rst.info..getBattInfo(data:sub(8+8+80+1,-1))
|
||||
end
|
||||
|
||||
if cmd == battInfo then
|
||||
rst.cmd = info.battInfo
|
||||
--print(data:toHex())
|
||||
rst.info = getID(data:sub(8+1,-1))
|
||||
local y,m,d,h,min,s,rand,a1,a2,a3,a4,a5,a6,a7,a8,a9= string.unpack(">BBBBBBBhhhhhhhhh",data:sub(9,-1))
|
||||
rst.info = rst.info
|
||||
.."实际电压 "..(a1/100).."V\r\n"
|
||||
-- .."电芯数量 "..a2.."\r\n"
|
||||
.."电量 "..a3.."%\r\n"
|
||||
-- .."容量 "..a4.."\r\n"
|
||||
-- .."输出电流 "..a5.."\r\n"
|
||||
-- .."充电电流 "..
|
||||
.."温度1 "..a7.."℃\r\n"
|
||||
.."温度2 "..a8.."℃\r\n"
|
||||
.."温度3 "..a9.."℃\r\n"
|
||||
-- .."电芯 1电压 "..
|
||||
-- .."电芯 2电压 "..
|
||||
-- .."电芯 3电压 "..
|
||||
-- .."电芯 4电压 "..
|
||||
-- .."电芯 5电压 "..
|
||||
-- .."电芯 6电压 "..
|
||||
-- .."电芯 7电压 "..
|
||||
-- .."电芯 8电压 "..
|
||||
rst.info = rst.info..getBattInfo(data:sub(8+1+7,-1))
|
||||
end
|
||||
|
||||
if cmd == signalInfo then
|
||||
|
Loading…
Reference in New Issue
Block a user