回滚修改,详见ReadMe
This commit is contained in:
@@ -60,6 +60,7 @@ class save:
|
||||
num=0
|
||||
for i in self.json_obj["TaskArray"]:
|
||||
num=num+i["ReturnCount"]
|
||||
# print("checkret_num=",num)
|
||||
return num
|
||||
# 计算超限错误字节个数
|
||||
def calc_parerrnum(self):
|
||||
@@ -71,7 +72,7 @@ class save:
|
||||
ret_num=self.calc_retnum()*2+8+self.calc_parerrnum()
|
||||
slave_num=len(d)//ret_num
|
||||
for i in range(slave_num):
|
||||
print("slave:",i+1)
|
||||
# print("slave:",i+1)
|
||||
self.save_item(i+1,d[i*ret_num:i*ret_num+ret_num])
|
||||
|
||||
# 保存一个条目
|
||||
@@ -85,7 +86,7 @@ class save:
|
||||
# print(d[8:8+errnum].hex(' '))
|
||||
a,b=lua_test(self.script,self.scheme,d)
|
||||
s=s+a+','+str(b)
|
||||
print(s)
|
||||
# print(s)
|
||||
with open(self.save_file,"+a") as f:
|
||||
f.write(s+'\n')
|
||||
|
||||
@@ -128,7 +129,7 @@ if __name__ == "__main__":
|
||||
# sa=save()
|
||||
# print(sa.hex2bit(bytes([0xab,0xcd])))
|
||||
# js_test()
|
||||
check_data=bytearray([0xB5,0x96,0xEC,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x01,0x00,0x00,0x00,0x00,0x21,0x00,0x12,0x01,0x00,0x00,0x00,0x00,0xB5,0x00,0xB1,0x00,0x6B,0x00,0x00,0x00,0xA5,0x02,0xA4,0x02,0x00,0x00,0xA4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00])
|
||||
lua_test("file/judge-xt.lua","file/EX_Coder_Test_2023-07-4.json".encode("gbk").decode("utf-8"),check_data)
|
||||
check_data=bytearray([0x00,0x08,0x00,0x02,0x50,0x01,0x00,0x00,0x40,0x00,0x46,0xe3,0x4f,0x03,0x58,0x00,0xb5,0x00,0x00,0x01,0x09,0x01,0x10,0x00,0x00,0x00,0x4b,0x00,0x78,0x00,0x57,0x0a,0x21,0x01,0x6a,0x00,0xec,0x00,0x04,0x01,0x4a,0x01,0x1b,0x01,0x23,0x01,0x40,0x9c,0x7e,0x06,0x90,0x00,0x43,0x00,0x77,0x00,0x00,0x00,0x03,0x00,0x40,0x9c,0x80,0x06,0x1f,0x00,0x54,0x07,0x21,0x01,0xd0,0x07,0xff,0xff])
|
||||
lua_test("file/judge-xt-checker.lua","file/7.15.json".encode("gbk").decode("utf-8"),check_data)
|
||||
# lua_test("file/judge-xt.lua","file/checker_ye_cfg.json",check_data)
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@@ -190,11 +190,11 @@ class port:
|
||||
# 接收请求检测命令
|
||||
data=self.recv()
|
||||
if(self.cmd==0x37):
|
||||
self.send(0x30,bytearray([0]))
|
||||
self.send(0x40,bytearray([3]))
|
||||
# 接收指令应答
|
||||
self.recv()
|
||||
# 延时2秒等电机下压
|
||||
time.sleep(2)
|
||||
time.sleep(3)
|
||||
# 开始检测
|
||||
self.send_code(bytearray([0xB0, 0x00, 0x02, 0x00, 0x60]))
|
||||
# 接收指令应答
|
||||
@@ -212,11 +212,8 @@ class port:
|
||||
# 接收指令应答
|
||||
self.recv_code(5)
|
||||
|
||||
# 接收检测结果
|
||||
data=self.recv()
|
||||
if(self.cmd==0x31):
|
||||
self.send(0x31,bytearray([0]))
|
||||
# save.save(data)
|
||||
# 电机上升
|
||||
self.send(0x40,bytearray([2]))
|
||||
end = time.perf_counter()
|
||||
print("检测耗时:",end-start)
|
||||
|
||||
|
1491
python/file/7-15.json
Normal file
1491
python/file/7-15.json
Normal file
File diff suppressed because it is too large
Load Diff
1491
python/file/7.15.json
Normal file
1491
python/file/7.15.json
Normal file
File diff suppressed because it is too large
Load Diff
1491
python/file/XT_Foundry_Test-7-15.json
Normal file
1491
python/file/XT_Foundry_Test-7-15.json
Normal file
File diff suppressed because it is too large
Load Diff
BIN
python/file/XT_Foundry_Test-7-15.xlsx
Normal file
BIN
python/file/XT_Foundry_Test-7-15.xlsx
Normal file
Binary file not shown.
@@ -29,7 +29,8 @@
|
||||
-- 2023.7.14
|
||||
-- 根据任务id找到下一个任务,只要判定相关任务顺序不变脚本就不受影响
|
||||
-- 添加根据子错误找到对应的主错误功能
|
||||
|
||||
-- 2023.7.20
|
||||
-- 充能流程异常改为电容异常
|
||||
|
||||
|
||||
|
||||
@@ -370,8 +371,8 @@ end
|
||||
function JQ_Test_ChgEnergy(task,err_code)
|
||||
if(find_ack(task["TaskIndex"]+1,mid(check_data,1,8))==false)then
|
||||
-- 充能错误只能是检测器异常,检测结束
|
||||
print("task failed.task_index=",task["TaskIndex"])
|
||||
only(err_code,1)
|
||||
print("task capacitance Energy failed.task_index=",task["TaskIndex"])
|
||||
only(err_code,2)
|
||||
return nil
|
||||
else
|
||||
ret_value=find_return(task["TaskIndex"]+1)
|
||||
|
@@ -458,7 +458,7 @@ if __name__ == "__main__":
|
||||
|
||||
# 设置电阻 矫正值
|
||||
# u.cmd=0x41
|
||||
# data=bytearray([1,50,0x00,2,51,0x00,3,52,0x00,4,53,0x00,5,54,0x00,6,55,0x00,7,56,0x00,8,57,0x00,9,58,0x00,10,59,0x00,11,60,0x00,12,61,0x00,13,62,0x00,14,63,0x00,15,64,0x00,16,65,0x00,17,66,0x00,18,67,0x00,19,68,0x00,20,69,0x00])
|
||||
# data=bytearray([1,50,0x00,2,0,0x00,3,0,0x00,4,0,0x00,5,0,0x00,6,0,0x00,7,0,0x00,8,0,0x00,9,0,0x00,10,0,0x00,11,0,0x00,12,0,0x00,13,0,0x00,14,0,0x00,15,0,0x00,16,0,0x00,17,0,0x00,18,0,0x00,19,0,0x00,20,0,0x00])
|
||||
# 测量电阻
|
||||
# u.cmd=0x42
|
||||
# data=bytearray([0])
|
||||
@@ -466,12 +466,12 @@ if __name__ == "__main__":
|
||||
# u.cmd=0x43
|
||||
# data=bytearray([1,50,0x00,2,51,0x00,3,52,0x00,4,53,0x00,5,54,0x00,6,55,0x00,7,56,0x00,8,57,0x00,9,58,0x00,10,59,0x00,11,60,0x00,12,61,0x00,13,62,0x00,14,63,0x00,15,64,0x00,16,65,0x00,17,66,0x00,18,67,0x00,19,68,0x00,20,69,0x00])
|
||||
# 设置电机校正值
|
||||
u.cmd=0x40
|
||||
# u.cmd=0x40
|
||||
# data=bytearray([0x01,100,0])
|
||||
# data=bytearray([0x02]) # 上升
|
||||
data=bytearray([0x03]) # 下降
|
||||
# data=bytearray([0x03]) # 下降
|
||||
|
||||
print(u.encode(data).hex(' '))
|
||||
# print(u.encode(data).hex(' '))
|
||||
# with open("file/EX_Coder_Test_2023-07-6.json","rb") as f:
|
||||
# json_obj=json.loads(f.read())
|
||||
# d=scheme_to_byte(json_obj)
|
||||
@@ -482,6 +482,11 @@ if __name__ == "__main__":
|
||||
# s="{d:03d}".format(d=2)
|
||||
# print(s)
|
||||
|
||||
with open("file/7-15.json","rb") as f:
|
||||
u.cmd=0x22
|
||||
p=u.encode(f.read())
|
||||
print(p.hex(' '))
|
||||
|
||||
|
||||
# 开始检测
|
||||
# 59 6d 03 00 30 00 00 60 0f
|
||||
|
@@ -141,3 +141,7 @@
|
||||
2023.7.7
|
||||
boot没有同步app编译,升级app会导致之后添加的配置参数丢失
|
||||
添加管壳码全'0'判断
|
||||
2023.7.20
|
||||
检测和赋码结束时解除忙状态
|
||||
上报指令流水号自增
|
||||
不进行流水号重复判断
|
@@ -68,12 +68,12 @@ array_def *protu_decode(protu_def *p,array_def *data)
|
||||
str_set(p->str_err,"recv data check error.");
|
||||
}
|
||||
int cmd_no=arr_get(data,5)|(arr_get(data,6)<<8);
|
||||
if(p->cmd_no==cmd_no)
|
||||
{
|
||||
// 重复的cmd_no
|
||||
DBG_WARN("duplicate sequence number.");
|
||||
str_set(p->str_err,"duplicate sequence number.");
|
||||
}
|
||||
// if(p->cmd_no==cmd_no)
|
||||
// {
|
||||
// // 重复的cmd_no
|
||||
// DBG_WARN("duplicate sequence number.");
|
||||
// str_set(p->str_err,"duplicate sequence number.");
|
||||
// }
|
||||
p->cmd=arr_get(data,4);
|
||||
// 数据负载
|
||||
arr_delete(r);
|
||||
|
@@ -6,7 +6,7 @@
|
||||
|
||||
|
||||
|
||||
#define BUILD_DATE "2023-07-14 16:23:08"
|
||||
#define BUILD_DATE "2023-07-20 17:41:21"
|
||||
#define SOFT_VERSION "0.10"
|
||||
|
||||
|
||||
|
@@ -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)
|
||||
|
@@ -77,6 +77,7 @@ static void write_uid_upmit(write_uid_def *w)
|
||||
emit tran_send_signal(w->u.p,0x82,arr_temp(a));
|
||||
g_self.step=0;
|
||||
// 把命令字改为0x82用于接收主机应答
|
||||
tran_set_busy(w->u.p,0);
|
||||
w->u.cmd=0x82;
|
||||
}
|
||||
|
||||
@@ -375,7 +376,7 @@ static void check_end(ucport_def *u,port_mcu *src,void *data,int ack,char *err_s
|
||||
arr_append(a,w->type);
|
||||
arr_appends(a,w->ack,(6)*10);
|
||||
emit tran_send_signal(w->u.p,0x81,arr_temp(a));
|
||||
//tran_set_busy(w->u.p,0);
|
||||
tran_set_busy(w->u.p,0);
|
||||
// 把命令字改为0x81用于接收主机应答
|
||||
w->u.cmd=0x81;
|
||||
g_self.step=1;
|
||||
|
Reference in New Issue
Block a user