重定义软件版本定义 zsxfly20240919
This commit is contained in:
parent
28f347c13f
commit
6b38505012
|
@ -58,7 +58,18 @@ uint8_t read_cfg(SYS_CONF_t *sys_config_info_t){
|
|||
return ((sys_config_info_t->CRC16 == crc16) ? 0 : 1);
|
||||
}
|
||||
|
||||
#define BANK_A_BASE (0x18004000)
|
||||
#define BANK_B_BASE (0x18020000)
|
||||
void conf_init(void){
|
||||
|
||||
uint32_t curr_code_addr = RD_32(0x18000008);
|
||||
DEBUG("Curr Addr:0x%x", curr_code_addr);
|
||||
if(curr_code_addr == BANK_A_BASE){
|
||||
sys_conf.VER_type =1;
|
||||
}else if(curr_code_addr == BANK_B_BASE){
|
||||
sys_conf.VER_type =0;
|
||||
}
|
||||
|
||||
// read config
|
||||
if( read_cfg(&sys_conf) || (sys_conf.VERSION != SOFTWARE_ID)){
|
||||
DEBUG("Read Config :CRC_ERROR ");//读取配置文件失败//使用默认配置
|
||||
|
|
|
@ -16,7 +16,14 @@
|
|||
|
||||
// 必须4字节对齐
|
||||
typedef struct SYS_CONF{
|
||||
uint16_t VERSION; // 软件版本号
|
||||
union{
|
||||
uint16_t VERSION; // 软件版本号
|
||||
struct{
|
||||
uint16_t SW_version:11; // 软件版本序号
|
||||
uint16_t HW_version:4; // 硬件版本序号
|
||||
uint16_t VER_type:1; // 版本类型:0:0x04000;1:0x20000
|
||||
};
|
||||
};
|
||||
uint8_t Modbus_addr; // MODBUS地址
|
||||
uint8_t Manager_sLim; // 管理员模式油门极限(Unit:%)
|
||||
uint8_t Tourist_sLim; // 游客模式油门极限
|
||||
|
@ -50,7 +57,14 @@ void conf_init(void);
|
|||
|
||||
/**************************系统版本**************************/
|
||||
// 软件本号
|
||||
#define SOFTWARE_ID 0x0101
|
||||
#define SW_VERSION (1)
|
||||
// 硬件本号
|
||||
#define HW_VERSION (2)
|
||||
// 版本类型:0:0x04000;1:0x20000//不可修改
|
||||
#define VER_TYPE (sys_conf.VER_type)
|
||||
|
||||
#define SOFTWARE_ID ((SW_VERSION & 0x07FF)|((HW_VERSION & 0x0F)<<11)|((VER_TYPE & 0x01)<<15))
|
||||
|
||||
#define D_Modbus_addr 0x37
|
||||
/************************油门(Unit:%)************************/
|
||||
// 管理员模式默认油门极限(0-100%)
|
||||
|
|
Loading…
Reference in New Issue