2024-05-11 00:04:28 +08:00
|
|
|
|
#ifndef _SYS_CONFIG_H_
|
|
|
|
|
#define _SYS_CONFIG_H_
|
|
|
|
|
#include "app_control_out.h"
|
|
|
|
|
#include "app_uart.h"
|
|
|
|
|
#include "stdio.h"
|
|
|
|
|
#include "app_radar.h"
|
|
|
|
|
#include "app_ws2812.h"
|
2024-08-19 01:14:21 +08:00
|
|
|
|
#include "app_Time_Event.h"
|
2024-05-11 00:04:28 +08:00
|
|
|
|
#include "app_bat.h"
|
2024-08-19 01:14:21 +08:00
|
|
|
|
#include "app_PAD.h"
|
2024-08-19 12:09:05 +08:00
|
|
|
|
#include "app_ota.h"
|
2024-05-11 00:04:28 +08:00
|
|
|
|
|
2024-08-19 01:14:21 +08:00
|
|
|
|
// 存储在第1扇区第0页
|
|
|
|
|
#define CONF_OFFSET_BASE (0x18001000) // 配置信息存储地址(以页为单位:0x100)
|
|
|
|
|
#define CONF_OFFSET_ADDR (CONF_OFFSET_BASE - FLASH_BASE)
|
|
|
|
|
|
|
|
|
|
// 必须4字节对齐
|
|
|
|
|
typedef struct SYS_CONF{
|
2024-09-19 18:02:53 +08:00
|
|
|
|
union{
|
|
|
|
|
uint16_t VERSION; // 软件版本号
|
|
|
|
|
struct{
|
|
|
|
|
uint16_t SW_version:11; // 软件版本序号
|
|
|
|
|
uint16_t HW_version:4; // 硬件版本序号
|
2024-09-19 23:26:19 +08:00
|
|
|
|
uint16_t VER_type:1; // 当前固件类型0:0x04000;1:0x20000
|
2024-09-19 18:02:53 +08:00
|
|
|
|
};
|
|
|
|
|
};
|
2024-08-20 11:02:49 +08:00
|
|
|
|
uint8_t Modbus_addr; // MODBUS地址
|
2024-08-19 01:14:21 +08:00
|
|
|
|
uint8_t Manager_sLim; // 管理员模式油门极限(Unit:%)
|
|
|
|
|
uint8_t Tourist_sLim; // 游客模式油门极限
|
|
|
|
|
uint8_t Speed_Cut_sLim; // 减速油门极限(Unit:%)(自动减速时油门极限)
|
|
|
|
|
uint16_t Brake_DLimit; // 刹车距离极限(前进)(Unit:mm)
|
|
|
|
|
uint16_t Speed_Cut_DLimit; // 减速距离极限
|
|
|
|
|
uint16_t Brake_DLimit_B; // 刹车距离极限(后退)
|
|
|
|
|
uint16_t Speed_Cut_DLimit_B;// 减速距离极限
|
|
|
|
|
uint16_t CRC16; // 配置信息CRC16校验码
|
2024-05-11 00:04:28 +08:00
|
|
|
|
}SYS_CONF_t;
|
|
|
|
|
|
2024-08-19 01:14:21 +08:00
|
|
|
|
extern SYS_CONF_t sys_conf;
|
2024-05-11 00:04:28 +08:00
|
|
|
|
extern BAT_Message_t BAT_Message;
|
|
|
|
|
|
|
|
|
|
// 写配置
|
|
|
|
|
void write_cfg(SYS_CONF_t *sys_config_info_t);
|
2024-08-19 01:14:21 +08:00
|
|
|
|
// 读配置
|
|
|
|
|
uint8_t read_cfg(SYS_CONF_t *sys_config_info_t);
|
2024-08-20 11:02:49 +08:00
|
|
|
|
// 初始化配置
|
|
|
|
|
void conf_init(void);
|
2024-05-11 00:04:28 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 油门ADC
|
|
|
|
|
#define ACC_UP_Res 5.1 //上分压电阻(unit:KΩ)
|
|
|
|
|
#define ACC_DOWN_Res 5.1 //下分压电阻
|
|
|
|
|
|
|
|
|
|
// 电池ADC
|
2024-08-19 01:14:21 +08:00
|
|
|
|
#define BAT_UP_Res 197.0 //上分压电阻(unit:KΩ)
|
|
|
|
|
#define BAT_DOWN_Res 4.7 //下分压电阻
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**************************系统版本**************************/
|
|
|
|
|
// 软件本号
|
2025-01-16 19:29:02 +08:00
|
|
|
|
#define SW_VERSION (7)
|
2024-09-19 18:02:53 +08:00
|
|
|
|
// 硬件本号
|
|
|
|
|
#define HW_VERSION (2)
|
|
|
|
|
// 版本类型:0:0x04000;1:0x20000//不可修改
|
2024-12-26 15:37:11 +08:00
|
|
|
|
#define VER_TYPE ((0x18004000 ==RD_32(0x18000008))?0x0000:0x8000)
|
2024-09-19 18:02:53 +08:00
|
|
|
|
|
2024-09-19 23:26:19 +08:00
|
|
|
|
#define SOFTWARE_ID (((SW_VERSION & 0x07FF) | ((HW_VERSION & 0x0F)<<11)) & 0x7fff)
|
2024-09-19 18:02:53 +08:00
|
|
|
|
|
2024-08-20 23:33:30 +08:00
|
|
|
|
#define D_Modbus_addr 0x37
|
2024-08-19 01:14:21 +08:00
|
|
|
|
/************************油门(Unit:%)************************/
|
|
|
|
|
// 管理员模式默认油门极限(0-100%)
|
|
|
|
|
#define D_Manager_sLim 100
|
|
|
|
|
// 游客模式默认油门极限(0-100%)
|
|
|
|
|
#define D_Tourist_sLim 50
|
|
|
|
|
// 减速油门极限(0-100%)(自动减速时油门极限)
|
|
|
|
|
#define D_Speed_Cut_sLim 50
|
|
|
|
|
/*****************刹车减速距离(前进)(Unit:mm)*****************/
|
|
|
|
|
// 默认自动刹车距离35~4500mm(毫米)
|
|
|
|
|
#define D_Brake_DLimit 1000
|
|
|
|
|
// 默认自动减速距离35~4500mm
|
|
|
|
|
#define D_Speed_Cut_DLimit 1600
|
|
|
|
|
/*****************刹车减速距离(后退)(Unit:mm)*****************/
|
|
|
|
|
// 默认自动刹车距离35~4500mm(毫米)
|
|
|
|
|
#define D_Brake_DLimit_B 1000
|
|
|
|
|
// 默认自动减速距离35~4500mm
|
|
|
|
|
#define D_Speed_Cut_DLimit_B 1600
|
2024-05-11 00:04:28 +08:00
|
|
|
|
|
|
|
|
|
|
2024-06-29 17:07:18 +08:00
|
|
|
|
/*****************************BLE************************/
|
|
|
|
|
#define BLE_ENABLE 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************雷达************************/
|
|
|
|
|
#define RADAR_MODE 0 // 0:电应普 1:FD07-3
|
|
|
|
|
|
|
|
|
|
|
2024-05-11 00:04:28 +08:00
|
|
|
|
#endif
|
|
|
|
|
|