升级小板添加结果返回,升级脚本可以修改波特率
This commit is contained in:
@@ -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"
|
||||
|
||||
|
||||
|
@@ -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")
|
||||
|
||||
|
Reference in New Issue
Block a user