var fac_bind_run = 0;
async function EWRunFire()
{
ShowCommMes("注码脚本加载",MesgType.MESG_TYPE_INFO);
fac_bind_init_flag =1;
var content_str = '
';
content_str += '
'
content_str += '';
content_str += '
'
content_str += '
'
content_str += '';
content_str += '
'
content_str += '
'
$("#Oper_View").append(content_str);
}
async function Ew_Autobind()
{
var rtv = 0;
epro2_oper.ep2_heartbeat_sw = 0;
ep2_getInput();
epro2_oper.cmd = 13;
await Ep2_HeartBeat_SW();
if(fac_bind_run == 0)
{
fac_bind_run = 1;
var obj = $(".plugin_bind_test")[0];
obj.innerText = "停止注码";
}else{
ShowCommMes("注码脚本运行结束",MesgType.MESG_TYPE_INFO);
fac_bind_run = 0;
var obj = $(".plugin_bind_test")[0];
obj.innerText = "启动注码";
return;
}
await Ep2_BusSwitch(1);
while(fac_bind_run > 0)
{
ShowCommMes("等待模块接入。。 ",MesgType.MESG_TYPE_INFO);
while(ep2_bus_cur < 0.01 && fac_bind_run > 0 && ep2_bus_cur < 0.025)
{
await TransSleep(300);
}
await TransSleep(2000);
epro2_oper.commaddr = 1;
//读状态
rtv = await Ep2_ReadSysStatesCmd(epro2_oper.commaddr);
if(rtv > 0)
{
continue;
}
epro2_oper.cmd = 29;
await Ep2_EnMTPWrite(1);
await TransSleep(300);
epro2_oper.cmd = 20;
await Ep2_WriteUID();
epro2_oper.cmd = 22;
await Ep2_WritePWD();
epro2_oper.cmd = 19;
rtv = await Ep2_ReadUID();
if(rtv != 0)
{
epro2_oper.uid = last_uid;
ShowCommMes("赋码失败 rtv " + rtv,MesgType.MESG_TYPE_ERROR);
}else{
ShowCommMes("赋码成功",MesgType.MESG_TYPE_INFO);
flow_num++;
}
epro2_oper.cmd = 1;
await Ep2_ChipReset();
break;
}
}
async function Ew_AutoFire()
{
ep2_getInput();
//开总线
epro2_oper.cmd = 25;
await Ep2_FastCfgCmd(epro2_oper.uid,epro2_oper.commaddr,epro2_oper.delayfire);
epro2_oper.cmd = 17;
await Ep2_Charge();
await TransSleep(8000);
epro2_oper.cmd = 29;
await Ep2_EnMTPWrite(1);
epro2_oper.cmd = 7 ;
await Ep2_ClkAmend();
await TransSleep(500);
epro2_oper.cmd = 3 ;
await Ep2_SaveFirInfo();
await TransSleep(1000);
epro2_oper.cmd = 32;
await Ep2_ReadSysStatesCmd(epro2_oper.commaddr);
await TransSleep(200);
epro2_oper.cmd = 18;
await Ep2_Blast();
await Ep2_BusSwitch(0);
}