增加雷达开启、关闭、临时关闭功能,本地电子围栏功能完善
This commit is contained in:
parent
924d3e9635
commit
501f096df6
|
|
@ -14,7 +14,7 @@
|
|||
#include "gps_config.h"
|
||||
#include "local_tts.h"
|
||||
|
||||
#if 1
|
||||
#if 0
|
||||
#include "app_uart.h"
|
||||
#define DEBUG(fmt, args...) app_printf("[GPS]" fmt, ##args)
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
#include "gps_config.h"
|
||||
#include "local_tts.h"
|
||||
|
||||
#if 1
|
||||
#if 0
|
||||
#include "app_uart.h"
|
||||
#define DEBUG(fmt, args...) app_printf("[Broadcast]" fmt, ##args)
|
||||
#else
|
||||
|
|
@ -320,8 +320,6 @@ static void play_attraction_info(AttractionNode* attraction, double distance) {
|
|||
static void attr_broadcast_task(void* arg) {
|
||||
(void)arg; // 避免未使用参数警告
|
||||
BOOL should_play; //是否播放最后判断量
|
||||
BOOL introduc=true; //是否播报景区介绍
|
||||
|
||||
|
||||
DEBUG("task begin\r\n");
|
||||
|
||||
|
|
@ -329,7 +327,6 @@ static void attr_broadcast_task(void* arg) {
|
|||
{
|
||||
safe_tts_play(park_desc,11);
|
||||
|
||||
introduc=false;
|
||||
|
||||
}
|
||||
while (1) {
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ typedef struct{
|
|||
uint8_t IO_TX_brake :1; // 1:正常 0:刹车
|
||||
uint8_t A_brake :1; // 1:自动刹车,0:手动刹车
|
||||
uint8_t A_Speed_Cut :1; // 1:自动减速,0:手动减速
|
||||
uint8_t P_Radar_EN :1; // 1:雷达使能,0:雷达禁止
|
||||
uint8_t P_Radar_EN :1; // 2:雷达暂时关闭,1:雷达使能,0:雷达禁止
|
||||
};
|
||||
uint8_t IO_STA;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ typedef enum {
|
|||
ID_GetLocInfoResp = 0x0201, // 位置信息查询应答
|
||||
ID_LocTrackingCtrl = 0x8202, // 临时位置跟踪控制
|
||||
ID_TxtMsgdelivery = 0x8300, // 文本信息下发
|
||||
ID_Paly_Introduction =0x8302, //播放景区介绍
|
||||
ID_Car_Ctrl = 0x8500, // 车辆控制
|
||||
ID_Car_CtrlResp = 0x0500, // 车辆控制应答
|
||||
ID_Set_Polygon_area = 0x8604, // 设置多边形区域
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ typedef enum {
|
|||
ID_BrakeLimit_B = 0xF006, //WORD 后退刹车距离
|
||||
ID_SpeedCutLimit_B = 0xF007, //WORD 后退自动减速刹车距离
|
||||
ID_Ban_Fence_Polygon_Delay_OFF = 0xF008, //BYTE 禁止围栏延时关闭时间, 单位秒
|
||||
ID_RadarEN = 0xF009, //BYTE 雷达使能位, 0 代表关闭, 1 代表开启
|
||||
ID_RadarEN = 0xF009, //BYTE 雷达使能位, 0 代表关闭, 1 代表开启 2代表临时关闭
|
||||
}set_TermParamID_t;
|
||||
typedef struct{
|
||||
uint32_t HeartBeatInterval;// DWORD, 终端心跳发送间隔(s)
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include "local_tts.h"
|
||||
#include "control_out.h"
|
||||
#include "radar.h"
|
||||
|
||||
|
||||
#define LOCAL_FENCE_COUNT (sizeof(local_fences) / sizeof(LocalFenceConfig_t))
|
||||
|
|
@ -148,7 +149,7 @@ void jt808_Set_CarStatus(uint8_t status){
|
|||
}
|
||||
sys_sta.O_door_lock = (status & 0x01)? 1 : 0; // 设置电门锁状态
|
||||
sys_sta.PLT_MODE = (status & 0x02)? 1 : 0; // 平台设置的模式 //1:游客模式,0:管理模式
|
||||
sys_sta.P_Radar_EN = (status & 0x04)? 1 : 0; // 1:雷达使能,0:雷达禁止
|
||||
// sys_sta.P_Radar_EN = (status & 0x04)? 1 : 0; // 1:雷达使能,0:雷达禁止
|
||||
}
|
||||
|
||||
// 获取车辆状态
|
||||
|
|
@ -361,7 +362,21 @@ int jt808_setTermParam(set_TermParamID_t param_id, void *param, uint8_t param_le
|
|||
break;
|
||||
}
|
||||
case ID_RadarEN:{// TODO: 雷达使能位
|
||||
jt808_term_param_item.set_term_param.RadarEN =param_val32 & 0xFF;
|
||||
uint8_t radar_en = param_val32 & 0xFF;
|
||||
JT808_DEBUG("RadarEN=%d", radar_en);
|
||||
|
||||
// 更新运行时状态(包括值2)
|
||||
osMutexAcquire(radar_mutex, osWaitForever);
|
||||
sys_sta.P_Radar_EN = radar_en;
|
||||
osMutexRelease(radar_mutex);
|
||||
|
||||
// 只保存0或1到持久化参数
|
||||
if(radar_en != 2) {
|
||||
jt808_term_param_item.set_term_param.RadarEN = radar_en;
|
||||
} else {
|
||||
// 值2不保存,但可以记录日志
|
||||
JT808_DEBUG("Skip saving temporary RadarEN=2 state");
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:{
|
||||
|
|
@ -517,7 +532,7 @@ void jt808_LocReport_param_update(void){
|
|||
jt808_term_param_item.big_loc_report.basic_info.status.IO_TX_brake =sys_sta.IO_TX_brake; // 1:正常 0:刹车
|
||||
jt808_term_param_item.big_loc_report.basic_info.status.A_brake =sys_sta.A_brake; // 1:自动刹车,0:手动刹车
|
||||
jt808_term_param_item.big_loc_report.basic_info.status.A_Speed_Cut =sys_sta.A_Speed_Cut; // 1:自动减速,0:手动减速
|
||||
jt808_term_param_item.big_loc_report.basic_info.status.P_Radar_EN =sys_sta.P_Radar_EN; // 1:雷达使能,0:雷达禁止
|
||||
jt808_term_param_item.big_loc_report.basic_info.status.P_Radar_EN =sys_sta.P_Radar_EN; //2:雷达暂时关闭 1:雷达使能,0:雷达禁止
|
||||
jt808_term_param_item.big_loc_report.basic_info.status.val32 = Swap32(jt808_term_param_item.big_loc_report.basic_info.status.val32); // 状态信息(转大端)
|
||||
|
||||
jt808_term_param_item.big_loc_report.basic_info.alarm_flag.val32 = 0; // 清除报警标志
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
static osThreadId_t os_RADAR_ThreadId;
|
||||
radar_data_t radar_data;
|
||||
osMutexId_t radar_mutex; // 互斥锁
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
|
|
@ -126,10 +127,15 @@ void radar_CheckData(uint8_t *data, uint16_t data_len){
|
|||
// 定时处理数和获取数据
|
||||
static void RADAR_TaskHandle(void *param){
|
||||
uint8_t temp_count =0;
|
||||
uint16_t time_count =0;
|
||||
while(1){
|
||||
|
||||
if(0==sys_sta.P_Radar_EN)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
osMutexAcquire(radar_mutex, osWaitForever);
|
||||
if (1==sys_sta.P_Radar_EN)
|
||||
{
|
||||
if(radar_CMDSend_cnt != radar_CMDReceive_cnt){ // 发送命令和接收命令计数不一致时,复位自动刹车和减速状态
|
||||
|
|
@ -155,6 +161,18 @@ static void RADAR_TaskHandle(void *param){
|
|||
|
||||
}
|
||||
|
||||
else if (2==sys_sta.P_Radar_EN)
|
||||
{
|
||||
time_count++;
|
||||
if(time_count>=143)
|
||||
{
|
||||
sys_sta.P_Radar_EN=1;
|
||||
time_count=0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
osMutexRelease(radar_mutex);
|
||||
osDelay(140/5); // 140ms
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue