feat:无锡usb设备调试

This commit is contained in:
Surenjun 2024-06-20 10:49:51 +08:00
parent 94e060187e
commit e355f3d283

View File

@ -301,6 +301,42 @@ export const plcStrToWXJson = async (plc:string) =>{
return wuXiDataStr
}
export const senorToWXDataStr= async (tempData) => {
const {sensor,gps} = tempData;
const timeStr = await getTimeStr()
const {mkg,aqd,dh1,dh2, zfxd, yfxd, jgd, ygd,ssc , jsc, lhq, fsc, lb, ygq,wd} = sensor
const judgeSignal = [
//车门 安全带 熄火 发动机启动 左转向 右转向 前照灯近灯 前照灯远灯
mkg, aqd, dh1, dh2, zfxd, yfxd, jgd, ygd,
// 注车制动 行车制动 离合器 副制动 喇叭 雨刷 危险报警灯 示廓灯 系统未涉及的传感器信号
ssc , jsc, lhq, fsc, lb, ygq, 0, 0, 0
]
const judgeAnotherSignal = [
// 低三挡位 左侧单边桥1 左侧单边桥2 右侧单边桥1 右侧单边桥2 雾灯
'000', '0', '0', '0', '0', wd,,'0',
// 桩杆全无信号 左后绕车 右后绕车 右前绕车 左前绕车
'000', '0', '0', '0', '0', '0','0'
]
//@ts-ignore
const str1 = (judgeSignal.join('')*1).toString(16);
//@ts-ignore
const str2 = (judgeAnotherSignal.join('')*1).toString(16);
const wuXiData = [
// 卫星时间 精度 纬度 高度 方位角 俯仰角 速度角 速度 横滚 卫星定位状态
'$KSXT', timeStr, gps.jd, gps.wd, gps.hbg, gps.hxj, gps.fyj, '' , gps.sd, '', gps.dwzt,
//前天线可用星数 后天线可用星数 东向坐标位置 北向位置坐标 天向位置坐标 东向速度 北向速度 天向速度
'', '', '', '', '', '', '', '','',
//@ts-ignore 评判信号1 评判信号2 发动机转速
(judgeSignal.join('')*1).toString(16), (judgeAnotherSignal.join('')*1).toString(16) , sensor.fdjzs,
'0xFFFFFFF'
]
return wuXiData.map(d => (d + '')).join(',');
// console.log('wuXiData',wuXiData.join(','));
}
//蓝灯
export function sendBlue(){
const arrBlue = [0x55, 0xaa, 0x01, 0x00, 0x02, 0x01, 0x03, 0x00];