添加注码错误代码偏移
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -13,3 +13,5 @@ __pycache__/
|
||||
*.csv
|
||||
python/build/
|
||||
python/dist/
|
||||
*.xlsx
|
||||
*.json
|
@@ -37,6 +37,8 @@
|
||||
-- 读取芯片uid之后再次检测电流
|
||||
-- 2023.7.25
|
||||
-- 上电电压超限时报检测器异常
|
||||
-- 2023.7.27
|
||||
-- 改为位运算
|
||||
|
||||
|
||||
|
||||
@@ -111,7 +113,8 @@ function clac_cfg_errbytenum()
|
||||
for i=1,len(tasks),1 do
|
||||
num=num+tasks[i]["ReturnCount"]
|
||||
end
|
||||
return math.floor((num+7)/8)
|
||||
-- return math.floor((num+7)/8)
|
||||
return (num+7)//8
|
||||
end
|
||||
|
||||
|
||||
@@ -122,9 +125,10 @@ function find_ack(index,acks)
|
||||
print("index out of range.index=",index)
|
||||
return false
|
||||
end
|
||||
local temp=acks[math.floor((index-1)/8)+1]
|
||||
local i=(index-1)%8
|
||||
if ((math.floor((temp % exp2(i+1))/exp2(i)))~=0) then
|
||||
-- local temp=acks[math.floor((index-1)/8)+1]
|
||||
-- local i=(index-1)%8
|
||||
-- if ((math.floor((temp % exp2(i+1))/exp2(i)))~=0) then
|
||||
if ((acks[(index-1)//8+1] & (1<<((index-1)%8)))~=0) then
|
||||
return false
|
||||
else
|
||||
return true
|
||||
@@ -176,9 +180,12 @@ function find_return(index)
|
||||
if(temp==nil) then return ret end
|
||||
-- print("find_return,temp=")
|
||||
-- prints:print_a(temp)
|
||||
local len_t=math.floor(len/2)
|
||||
for i=1,len_t,1 do
|
||||
ret[i]=temp[i*2-1]+(temp[i*2]*exp2(8))
|
||||
-- local len_t=math.floor(len/2)
|
||||
-- for i=1,len_t,1 do
|
||||
-- ret[i]=temp[i*2-1]+(temp[i*2]*exp2(8))
|
||||
-- end
|
||||
for i=1,len//2,1 do
|
||||
ret[i]=temp[i*2-1]|(temp[i*2]<<8)
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
@@ -459,8 +459,8 @@ if __name__ == "__main__":
|
||||
# u.send_file(0xed,"../Objects/checker_gen1_app_20230602.bin")
|
||||
|
||||
# 设置电阻 矫正值
|
||||
# u.cmd=0x41
|
||||
# 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=0x41
|
||||
data=bytearray([1,0,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])
|
||||
@@ -473,7 +473,7 @@ if __name__ == "__main__":
|
||||
# data=bytearray([0x02]) # 上升
|
||||
# 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)
|
||||
@@ -484,10 +484,10 @@ 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(' '))
|
||||
# with open("file/7-15.json","rb") as f:
|
||||
# u.cmd=0x22
|
||||
# p=u.encode(f.read())
|
||||
# print(p.hex(' '))
|
||||
|
||||
|
||||
# 开始检测
|
||||
|
@@ -145,3 +145,5 @@
|
||||
检测和赋码结束时解除忙状态
|
||||
上报指令流水号自增
|
||||
不进行流水号重复判断
|
||||
2023.8.4
|
||||
添加注码错误偏移
|
@@ -6,7 +6,7 @@
|
||||
|
||||
|
||||
|
||||
#define BUILD_DATE "2023-07-20 17:41:21"
|
||||
#define BUILD_DATE "2023-08-04 10:50:52"
|
||||
#define SOFT_VERSION "0.10"
|
||||
|
||||
|
||||
|
@@ -90,7 +90,7 @@ static void write_uid_fillret(write_uid_def *w,int addr,int ack)
|
||||
uint8_t *d=&w->ack[(addr)*39];
|
||||
w->ack_num++;
|
||||
d[0]=addr+slave_addr_off();
|
||||
d[1]=ack;
|
||||
d[1]=(ack==0xff)?0xff:(ack+0xc0);
|
||||
memcpy(&d[2],w->item[addr].shell_code,13);
|
||||
memcpy(&d[2+13],w->item[addr].uid_code,16);
|
||||
memcpy(&d[2+13+16],w->item[addr].password,8);
|
||||
|
Reference in New Issue
Block a user