检测错误码

This commit is contained in:
ranchuan
2023-07-03 18:27:10 +08:00
parent 156d1ceeb4
commit 41c1e97ba5
9 changed files with 489 additions and 16 deletions

View File

@@ -129,4 +129,7 @@
解决不插网线会导致程序重启的bug
2023.6.28
要实现重复注相同码不报错的功能,重复检测不报错,要使用两套方案
2023.7.3
检测错误码
解决tcp下升级方案死机的问题原因是内存没有回收导致的内存不足

View File

@@ -6,8 +6,8 @@
#define BUILD_DATE "2023-06-28 18:04:06"
#define SOFT_VERSION "0.01"
#define BUILD_DATE "2023-07-03 18:20:09"
#define SOFT_VERSION "0.10"

View File

@@ -4,6 +4,13 @@ import datetime
from datetime import datetime, timedelta
# 定义软件版本号
SOFT_VERION = "0.10"
# 定义mod文件的名称和路径
MOD_FILE="mod_signals.c"
MOD_PATH="./source/task/"
@@ -126,7 +133,7 @@ def creat_compile_info(dst:str):
f.write("#ifndef compiler_info__\n")
f.write("#define compiler_info__\n\n\n\n\n\n\n")
f.write("#define BUILD_DATE \""+utc_time+"\"\n")
f.write("#define SOFT_VERSION \"0.01\"\n")
f.write("#define SOFT_VERSION \""+SOFT_VERION+"\"\n")
f.write("\n\n\n\n\n\n\n#endif\n")

View File

@@ -144,12 +144,17 @@ void *malloc(uint32_t size)
{
mallco_dev *self=&g_self;
uint32_t offset;
int used=0;
void *ret_addr=NULL;
offset=mem_malloc(size);
if (offset!=0XFFFFFFFF)
{
ret_addr=(void*)((uint32_t)self->membase+offset);
}
else{
used=mem_perused();
param_check(used);
}
return ret_addr;
}

View File

@@ -319,13 +319,19 @@ static void check_end(ucport_def *u,port_mcu *src,void *data,int ack,char *err_s
uint32_t errcode=0;
uint8_t *ack_d=&w->ack[(addr)*6];
ack_d[0]=addr+slave_addr_off();
ack_d[1]=ack;
if(ack==-1) ack_d[1]=208; // 208表示通信超时
else ack_d[1]=ack==0?0:209;// 209表示小板返回了命令失败
// TODO: 还有4字节数据
errcode=in_range_err(arr_data(data)+8+8,arr_data(data));
ack_d[2]=errcode&0xff;
ack_d[3]=(errcode>>8)&0xff;
ack_d[4]=(errcode>>16)&0xff;
ack_d[5]=(errcode>>24)&0xff;
if(data)
{
errcode=in_range_err(arr_data(data)+8+8,arr_data(data));
ack_d[2]=errcode&0xff;
ack_d[3]=(errcode>>8)&0xff;
ack_d[4]=(errcode>>16)&0xff;
ack_d[5]=(errcode>>24)&0xff;
if(ack_d[1]==0) ack_d[1]=ack_d[2];
}else{
}
w->ack_num++;
if(w->ack_num>=10)

View File

@@ -371,6 +371,9 @@ static void when_scheme_done(ucport_def *u)
DBG_WARN("can not fond variable \"tran\"");
return;
}
DBG_LOG("memused:%d",mem_perused());
rt_thread_mdelay(100);
DBG_LOG("memused:%d",mem_perused());
for(int i=0;i<PORT_NUM;i++)
{
// 只给在线设备升级方案