赋码仪错误判断
This commit is contained in:
@@ -22,13 +22,10 @@
|
||||
|
||||
|
||||
|
||||
-- 读取方案配置信息
|
||||
-- print(cfg_name)
|
||||
check_cfg_file=io.open(cfg_name,"r")
|
||||
check_cfg_str=check_cfg_file:read("*a")
|
||||
check_cfg_file:close()
|
||||
json_table = json:decode(check_cfg_str)
|
||||
|
||||
-- 2023.7.5
|
||||
-- 调用者可以设置 check_cfg_str 变量,此时脚本不会使用io函数而直接使用
|
||||
-- 如果 check_cfg_str 为 nil 时自动读取 cfg_name 文件
|
||||
-- 改为调用main函数来运行脚本
|
||||
|
||||
|
||||
|
||||
@@ -273,7 +270,7 @@ function XT_Test_PowerOn(task,err_code)
|
||||
else
|
||||
-- 充能流程正常,返回第一个值是电压,第二个值是充能时间
|
||||
ret_value=find_return(task["TaskIndex"]+1)
|
||||
prints:print_a(ret_value)
|
||||
prints:print_a(ret_value,2)
|
||||
-- 电压无法上升,检测器异常
|
||||
if(ret_value[1]<task["TestStandard"][1]["Min"]) then
|
||||
print("voltage too low",ret_value[1])
|
||||
@@ -463,6 +460,8 @@ function judge_task(task,data)
|
||||
if range~=nil then
|
||||
-- print("judge task")
|
||||
for i=1,len(range),1 do
|
||||
-- prints:print_t(range[i])
|
||||
-- print("data=",data[i])
|
||||
if(data[i]<range[i]["Min"]) or (data[i]>range[i]["Max"]) then
|
||||
-- print("task=",task["TaskBrief"],"out of range:")
|
||||
-- print("err code=",task["ResultErrCode"][i])
|
||||
@@ -481,12 +480,15 @@ function judge_list()
|
||||
local ack=find_ack(i,acks)
|
||||
local task_p=json_table["TaskArray"][i]
|
||||
local ret_value=find_return(i)
|
||||
-- print("taskindex:",task_p["TaskIndex"])
|
||||
local err_code=judge_task(task_p,ret_value)
|
||||
-- print("err_code:")
|
||||
-- prints:print_a(err_code)
|
||||
if ack==false then
|
||||
table.insert(err_code,task_p["ExecuteErrCode"])
|
||||
end
|
||||
if len(err_code)>0 then
|
||||
print("task:",task_p["TaskBrief"],"err_code:")
|
||||
-- print("task:",task_p["TaskBrief"],"err_code:")
|
||||
prints:print_a(err_code)
|
||||
return get_err_code(err_code)
|
||||
end
|
||||
@@ -519,6 +521,14 @@ end
|
||||
|
||||
|
||||
function main()
|
||||
-- 读取方案配置信息
|
||||
-- print(cfg_name)
|
||||
if(check_cfg_str==nil)then
|
||||
check_cfg_file=io.open(cfg_name,"r")
|
||||
check_cfg_str=check_cfg_file:read("*a")
|
||||
check_cfg_file:close()
|
||||
end
|
||||
json_table = json:decode(check_cfg_str)
|
||||
check_erryternum=clac_cfg_errbytenum()
|
||||
local err_str_table={"检测器异常","主电容异常","接触异常","桥丝阻值异常","芯片异常"}
|
||||
local ch_err,ch_code=check_env()
|
||||
@@ -554,7 +564,7 @@ end
|
||||
|
||||
|
||||
-- 先返回错误描述,再返回错误码
|
||||
return main()
|
||||
-- return main()
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user