V2.06
CAN总线发送数据源地址强制改为本机地址,目标地址强制改为0 EW模块升级添加运行在app判断
This commit is contained in:
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@@ -6,6 +6,7 @@
|
|||||||
"opt.h": "c",
|
"opt.h": "c",
|
||||||
"if_can.h": "c",
|
"if_can.h": "c",
|
||||||
"board.h": "c",
|
"board.h": "c",
|
||||||
"prot_uc.h": "c"
|
"prot_uc.h": "c",
|
||||||
|
"tran_for_slave.h": "c"
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -1507,7 +1507,7 @@
|
|||||||
|
|
||||||
<Group>
|
<Group>
|
||||||
<GroupName>rt_thread</GroupName>
|
<GroupName>rt_thread</GroupName>
|
||||||
<tvExp>1</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<cbSel>0</cbSel>
|
<cbSel>0</cbSel>
|
||||||
<RteFlg>0</RteFlg>
|
<RteFlg>0</RteFlg>
|
||||||
|
@@ -251,4 +251,8 @@
|
|||||||
V2.05
|
V2.05
|
||||||
重写延时等待函数,解决与模块之间通信间隔有可能过短的问题
|
重写延时等待函数,解决与模块之间通信间隔有可能过短的问题
|
||||||
修改硬件版本号时自动修改can波特率
|
修改硬件版本号时自动修改can波特率
|
||||||
|
2023.11.14
|
||||||
|
V2.06
|
||||||
|
CAN总线发送数据源地址强制改为本机地址,目标地址强制改为0
|
||||||
|
EW模块升级添加运行在app判断
|
||||||
|
|
||||||
|
@@ -252,10 +252,47 @@ void EW_Updata(void)
|
|||||||
uint8_t pack_len=UPDATA_PACK_LEN;
|
uint8_t pack_len=UPDATA_PACK_LEN;
|
||||||
uint32_t crc=0;
|
uint32_t crc=0;
|
||||||
uint32_t crc_module=0;
|
uint32_t crc_module=0;
|
||||||
|
|
||||||
|
// 充电时间 6000
|
||||||
|
int time_charg=checker_runcfg.params[0];
|
||||||
|
// 加载app时间 6000
|
||||||
|
int time_loadapp=checker_runcfg.params[1];
|
||||||
|
// 总线关断时间 1000
|
||||||
|
int time_poweroff=checker_runcfg.params[2];
|
||||||
|
// 升级模式,0,无app时升级;1,无条件升级
|
||||||
|
int updata_mode=checker_runcfg.params[3];
|
||||||
|
|
||||||
|
retry:
|
||||||
delay_ms(100);
|
delay_ms(100);
|
||||||
ret=EW_bootCharg();
|
ret=EW_bootCharg();
|
||||||
|
if(ret){
|
||||||
|
// 有可能在app中
|
||||||
|
delay_ms(time_loadapp);
|
||||||
|
if(EW_appCommTest()==0){
|
||||||
|
if(updata_mode==1){
|
||||||
|
delay_ms(50);
|
||||||
|
EW_RunBootLoader(0,1);
|
||||||
|
updata_mode=2;
|
||||||
|
DBG_LOG("turn to bootloader,retry.");
|
||||||
|
goto retry;
|
||||||
|
}else if(updata_mode==2){
|
||||||
|
// 已经重试过一次了,bootloader还是不能通信
|
||||||
|
DBG_WARN("boot commit failed.");
|
||||||
|
ret=12;
|
||||||
|
goto err;
|
||||||
|
}else if(updata_mode==0){
|
||||||
|
// 有app的时候不需要升级
|
||||||
|
DBG_WARN("no need updata.");
|
||||||
|
ret=0;
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
// bootloader 和 app 都不能通信
|
||||||
|
DBG_WARN("commit failed");
|
||||||
|
}
|
||||||
|
}
|
||||||
if(ret) {ret=1;goto err;}
|
if(ret) {ret=1;goto err;}
|
||||||
delay_ms(6000);
|
delay_ms(time_charg);
|
||||||
ret=EW_bootErease();
|
ret=EW_bootErease();
|
||||||
if(ret) {ret=2;goto err;}
|
if(ret) {ret=2;goto err;}
|
||||||
delay_ms(600);
|
delay_ms(600);
|
||||||
@@ -279,7 +316,7 @@ void EW_Updata(void)
|
|||||||
delay_ms(50);
|
delay_ms(50);
|
||||||
ret=EW_bootJump();
|
ret=EW_bootJump();
|
||||||
if(ret) {ret=6;goto err;}
|
if(ret) {ret=6;goto err;}
|
||||||
delay_ms(6000);
|
delay_ms(time_loadapp);
|
||||||
ret=EW_EnWriteMTP(0,1);
|
ret=EW_EnWriteMTP(0,1);
|
||||||
if(ret) {ret=7;goto err;}
|
if(ret) {ret=7;goto err;}
|
||||||
DBG_LOG("EW_EnWriteMTP success.");
|
DBG_LOG("EW_EnWriteMTP success.");
|
||||||
@@ -298,9 +335,9 @@ void EW_Updata(void)
|
|||||||
DBG_LOG("EW_ReadMTP check success.");
|
DBG_LOG("EW_ReadMTP check success.");
|
||||||
delay_ms(1);
|
delay_ms(1);
|
||||||
XTBUS_OFF;
|
XTBUS_OFF;
|
||||||
delay_ms(1000);
|
delay_ms(time_poweroff);
|
||||||
XTBUS_ON;
|
XTBUS_ON;
|
||||||
delay_ms(6000);
|
delay_ms(time_loadapp);
|
||||||
ret=EW_appCommTest();
|
ret=EW_appCommTest();
|
||||||
if(ret) {ret=11;goto err;}
|
if(ret) {ret=11;goto err;}
|
||||||
DBG_LOG("EW_appCommTest success.");
|
DBG_LOG("EW_appCommTest success.");
|
||||||
@@ -1007,7 +1044,7 @@ void EW_Test_Boom()
|
|||||||
|
|
||||||
Power_SetSampleRange_Seep(EWChecker_ChgEnger_Sample_R,ADC_SPEED_HIGH);
|
Power_SetSampleRange_Seep(EWChecker_ChgEnger_Sample_R,ADC_SPEED_HIGH);
|
||||||
ADC_GetCurADCFast();
|
ADC_GetCurADCFast();
|
||||||
delay_ms(checker_runcfg.params[3]);
|
delay_ms(checker_runcfg.params[2]);
|
||||||
if(checker_runcfg.params[0] > 0 || checker_runcfg.params[1] > 0)
|
if(checker_runcfg.params[0] > 0 || checker_runcfg.params[1] > 0)
|
||||||
{
|
{
|
||||||
us_temp = AD_GetBusCurUp(checker_runcfg.params[1],checker_runcfg.params[0]);
|
us_temp = AD_GetBusCurUp(checker_runcfg.params[1],checker_runcfg.params[0]);
|
||||||
@@ -1139,7 +1176,7 @@ EW_Test_WriteThreedCode, //11 模拟注码
|
|||||||
EW_Test_VerifyThreedCode, //12
|
EW_Test_VerifyThreedCode, //12
|
||||||
EW_Test_CheckSelf, //13 芯片自检
|
EW_Test_CheckSelf, //13 芯片自检
|
||||||
EW_Test_CheckeState, //14状态检测
|
EW_Test_CheckeState, //14状态检测
|
||||||
EW_Test_Charge, //15 充能统计
|
EW_Test_Charge, //15 充电
|
||||||
EW_Test_DisChg, //16 放电
|
EW_Test_DisChg, //16 放电
|
||||||
EW_Test_SetDelay, //17写延时
|
EW_Test_SetDelay, //17写延时
|
||||||
EW_Test_ReadDelay, //18读延时
|
EW_Test_ReadDelay, //18读延时
|
||||||
@@ -1152,6 +1189,7 @@ EW_Test_WriteFacBuff, //24缓存数据写入MTP
|
|||||||
EW_Test_VerifyFacBuff, //25验证缓存数据
|
EW_Test_VerifyFacBuff, //25验证缓存数据
|
||||||
EW_Test_PowerOFF, //26 关总线
|
EW_Test_PowerOFF, //26 关总线
|
||||||
EW_Updata, //27 升级
|
EW_Updata, //27 升级
|
||||||
|
EW_Test_ChgEnergy, //28 充能统计
|
||||||
(void*)0 //数组结束
|
(void*)0 //数组结束
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -347,8 +347,8 @@ static int read(uart_def *u,uint8_t *b,int len)
|
|||||||
}
|
}
|
||||||
static int write(uart_def *u,const uint8_t *b,int len)
|
static int write(uart_def *u,const uint8_t *b,int len)
|
||||||
{
|
{
|
||||||
uint8_t src=b[4];
|
uint8_t src=elec_local_addr();
|
||||||
uint8_t dst=b[5];
|
uint8_t dst=0;
|
||||||
uint8_t ret;
|
uint8_t ret;
|
||||||
ret=YeCan_SendFrame(src,dst,b,len);
|
ret=YeCan_SendFrame(src,dst,b,len);
|
||||||
if(ret==0) return len;
|
if(ret==0) return len;
|
||||||
|
@@ -6,8 +6,8 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define BUILD_DATE "2023-11-13 17:12:52"
|
#define BUILD_DATE "2023-11-14 18:09:40"
|
||||||
#define SOFT_VERSION "2.05"
|
#define SOFT_VERSION "2.06"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -7,7 +7,7 @@ import mycopy
|
|||||||
|
|
||||||
|
|
||||||
# 定义软件版本号
|
# 定义软件版本号
|
||||||
SOFT_VERION = "2.05"
|
SOFT_VERION = "2.06"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user