添加错误代码
This commit is contained in:
@@ -147,13 +147,23 @@ def arr_from_int(num:int):
|
||||
def scheme_get_task_range(j:json):
|
||||
t=bytearray()
|
||||
return_count=j["ReturnCount"]
|
||||
t+=arr_from_int(return_count)
|
||||
t+=arr_from_int(j["ExecuteErrCode"])
|
||||
index=0
|
||||
for i in j["TestStandard"]:
|
||||
t+=arr_from_int(i["Max"])
|
||||
t+=arr_from_int(i["Min"])
|
||||
n=return_count-len(j["TestStandard"])
|
||||
if (index<len(j["ResultErrCode"])):
|
||||
t+=arr_from_int(j["ResultErrCode"][index])
|
||||
else:
|
||||
t+=arr_from_int(0)
|
||||
index+=1
|
||||
# 不足16的部分填充为16
|
||||
n=16-len(j["TestStandard"])
|
||||
for i in range(n):
|
||||
t+=arr_from_int(65535)
|
||||
t+=arr_from_int(0)
|
||||
t+=arr_from_int(0)
|
||||
return t
|
||||
|
||||
# 根据方案生成主板用的字节数据
|
||||
@@ -161,11 +171,9 @@ def scheme_to_host(j:json):
|
||||
t=bytearray()
|
||||
t+=arr_from_int(j["PlanID"])
|
||||
t+=arr_from_int(j["TimeOutM"])
|
||||
b=bytearray()
|
||||
t+=arr_from_int(len(j["TaskArray"]))
|
||||
for i in j["TaskArray"]:
|
||||
b+=scheme_get_task_range(i)
|
||||
t+=arr_from_int(len(b)//8)
|
||||
t+=b
|
||||
t+=scheme_get_task_range(i)
|
||||
return t
|
||||
|
||||
|
||||
@@ -433,8 +441,13 @@ if __name__ == "__main__":
|
||||
# u.init("utcp:7777")
|
||||
# u.send_file(0xee,"file/JQ_JCXB_V54.bin")
|
||||
# u.send_file(0xed,"../Objects/checker_gen1_app_20230602.bin")
|
||||
u.cmd=0x31
|
||||
print(u.encode(bytearray()).hex(' '))
|
||||
u.cmd=0x01
|
||||
print(u.encode(bytearray([0x0a,0x00])).hex(' '))
|
||||
# with open("file/EX三码绑定测试2023-06-26.json","rb") as f:
|
||||
# json_obj=json.loads(f.read())
|
||||
# d=scheme_to_byte(json_obj)
|
||||
# # print("len=",len(d),d.hex(","))
|
||||
# d+=scheme_to_host(json_obj)
|
||||
|
||||
|
||||
# 开始检测
|
||||
|
Reference in New Issue
Block a user