添加注码错误代码偏移
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user