升级小板添加结果返回,升级脚本可以修改波特率

This commit is contained in:
ranchuan
2023-08-18 18:53:09 +08:00
parent 337b970b93
commit 8d779a68f3
9 changed files with 116 additions and 31 deletions

View File

@@ -148,4 +148,9 @@
2023.8.4
添加注码错误偏移
2023.8.9
解决注码成功返回0xc0的问题
解决注码成功返回0xc0的问题
2023.8.17
修改一些通信逻辑,上报数据不自增流水号,使用上位机下发的流水号
与20230817V3.28X以前的程序不兼容
2023.8.18
升级小板增加命令行返回

View File

@@ -74,6 +74,7 @@ array_def *protu_decode(protu_def *p,array_def *data)
// DBG_WARN("duplicate sequence number.");
// str_set(p->str_err,"duplicate sequence number.");
// }
p->cmd_no=cmd_no;
p->cmd=arr_get(data,4);
// 数据负载
arr_delete(r);

View File

@@ -6,7 +6,7 @@
#define BUILD_DATE "2023-08-09 13:54:50"
#define BUILD_DATE "2023-08-18 10:34:08"
#define SOFT_VERSION "0.10"

View File

@@ -129,7 +129,10 @@ commend_export(scheme,scheme_info,"print scheme info")
typedef struct{
int updata_run;
}updata_def;
static updata_def g_updata;
static int updata_slave(list_def *argv)
{
void *ptr=flash_get_slave();
@@ -150,13 +153,44 @@ static int updata_slave(list_def *argv)
{
int addr=list_get_int(addrs,i);
port_mcu *mcu=tran_get_portm(tran,addr-1);
if(mcu)
if(mcu){
port_start(mcu,updata_creat(data,file->file_size));
g_updata.updata_run++;
}
}
cmd_print("start updata,addr=%s",str_temp(list_string(addrs)));
return 0;
}
static void cmd_end_slot(void *obj,port_mcu *src,void *data,int ack,char *err_str)
{
updata_def *self=obj;
if(self->updata_run>0)
{
cmd_print("addr:%d %s",port_get_addr(src),err_str);
self->updata_run--;
}
}
// 挂载命令行槽函数
static int cmd_slot_init(void)
{
void *tr=app_variable("tran",0,0);
if(tr){
for(int i=0;i<20;i++){
port_mcu *mcu=tran_get_portm(tr,i);
// 连接操作结束信号
if(mcu)
connect(mcu,port_end_signal,0,&g_updata,cmd_end_slot);
}
}
else{
app_valid_call("tran",(void (*)(void *))cmd_slot_init,0);
}
return 0;
}
app_init_export(cmd_slot_init);
commend_export(updatas,updata_slave,"updata slave")

View File

@@ -281,7 +281,7 @@ void protu_send_call(protu_def *p,uint8_t cmd,array_def *data)
if(cmd!=0){
p->cmd=cmd;
// 上报数据不增加流水号 2023.7.14
p->cmd_no++;
//p->cmd_no++;
if(p->codec)
t=p->codec->encode(p,data);
}else if(p->cmd==0)

View File

@@ -199,6 +199,8 @@ static ucport_def *write_uid(tran_def *t, uint8_t cmd,array_def *data)
port_start(mcu,code_creat(8,4,u->item[i].uid_pw_hex));
}else{
// 管壳码无效,不注码,此时默认已ack
// 管壳码无效不视为失败
ret=0;
write_uid_fillret(u,i+1,0xff);
}
}
@@ -210,14 +212,14 @@ static ucport_def *write_uid(tran_def *t, uint8_t cmd,array_def *data)
array_def *a=arr_creat();
arr_append(a,u->addrs_num);
if(g_self.step==1){
// if(g_self.step==1){
if(ret==0)
arr_append(a,TRAN_ERR_NONE);
else
arr_append(a,TRAN_ERR_PARAM);
}else{
arr_append(a,TRAN_ERR_STEP);
}
// }else{
// arr_append(a,TRAN_ERR_STEP);
// }
emit tran_reply_signal(u->u.p,arr_temp(a));
// test:稍后返回成功