修复当前固件类型指示错误问题 zsxfly20240919
This commit is contained in:
parent
6b38505012
commit
a584b681eb
|
@ -48,7 +48,7 @@
|
|||
<InvalidFlash>1</InvalidFlash>
|
||||
</TargetStatus>
|
||||
<OutputDirectory>.\output\</OutputDirectory>
|
||||
<OutputName>OTA_V2_3</OutputName>
|
||||
<OutputName>OTA_V2_1</OutputName>
|
||||
<CreateExecutable>1</CreateExecutable>
|
||||
<CreateLib>0</CreateLib>
|
||||
<CreateHexFile>1</CreateHexFile>
|
||||
|
|
|
@ -24,25 +24,6 @@ static uint8_t MODBUS_ReceCount =0;
|
|||
static uint8_t MODBUS_Rece_BUF[MODBUS_MAX_LEN];
|
||||
static uint8_t MODBUS_Sent_BUF[MODBUS_MAX_LEN];
|
||||
|
||||
// 需掉电不丢失数据12*2字节//40027-40030//40514-40520
|
||||
uint16_t MODBUS_FLASH_DAT[12] ={
|
||||
[0]=1,//MODBUS从机地址
|
||||
[1]=1,// 出厂模式状态 //写入 1,设备将重置进入出厂模式
|
||||
[2]=100,// 固件版本
|
||||
[3]=1,// 硬件版本
|
||||
|
||||
[4]=30,//30*100ms // 代码过期时间
|
||||
[5]=30,//30*100ms// 输出继电器的关闭时间
|
||||
[6]=100,//100*100ms// Led 激活时间
|
||||
[7]=10,//10*10ms// 蜂鸣器激活时间
|
||||
|
||||
[8]=0x001f,// Led 键盘颜色//RGB565 格式
|
||||
[9]=0xf800,// Led Mifare 读卡颜色//RGB565 格式
|
||||
[10]=0x07E0,// Led 状态灯0颜色//RGB565 格式
|
||||
[11]=0x07ff,// Led 状态灯1颜色//RGB565 格式
|
||||
};
|
||||
|
||||
|
||||
bool app_modbus_CheckData(uint8_t *dat , uint8_t len);
|
||||
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ static tmr_tk_t radar_timer_handler(tmr_id_t id){
|
|||
radar_CMDSend_cnt++;
|
||||
}
|
||||
|
||||
return _MS(160);//300ms
|
||||
return _MS(140);//300ms
|
||||
}
|
||||
|
||||
static uint8_t radar_buff[RADAR_BUFF_MAX];
|
||||
|
|
|
@ -61,15 +61,6 @@ uint8_t read_cfg(SYS_CONF_t *sys_config_info_t){
|
|||
#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 ");//读取配置文件失败//使用默认配置
|
||||
|
@ -85,6 +76,13 @@ void conf_init(void){
|
|||
DEBUG("write Default Config!!!");// 写入默认配置
|
||||
write_cfg(&sys_conf);
|
||||
}
|
||||
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 =0;
|
||||
}else if(curr_code_addr == BANK_B_BASE){
|
||||
sys_conf.VER_type =1;
|
||||
}
|
||||
DEBUG("\nsys_conf:lenght=%d",sizeof(sys_conf));
|
||||
DEBUG("VERSION:%#04X",sys_conf.VERSION);
|
||||
DEBUG("Modbus_addr:%#04X",sys_conf.Modbus_addr);
|
||||
|
|
|
@ -21,7 +21,7 @@ typedef struct SYS_CONF{
|
|||
struct{
|
||||
uint16_t SW_version:11; // 软件版本序号
|
||||
uint16_t HW_version:4; // 硬件版本序号
|
||||
uint16_t VER_type:1; // 版本类型:0:0x04000;1:0x20000
|
||||
uint16_t VER_type:1; // 当前固件类型0:0x04000;1:0x20000
|
||||
};
|
||||
};
|
||||
uint8_t Modbus_addr; // MODBUS地址
|
||||
|
@ -63,7 +63,7 @@ void conf_init(void);
|
|||
// 版本类型: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 SOFTWARE_ID (((SW_VERSION & 0x07FF) | ((HW_VERSION & 0x0F)<<11)) & 0x7fff)
|
||||
|
||||
#define D_Modbus_addr 0x37
|
||||
/************************油门(Unit:%)************************/
|
||||
|
|
Loading…
Reference in New Issue