实现方案导入导出,根据选项自动生成文件名
This commit is contained in:
@@ -3,7 +3,7 @@ var fac_bind_run = 0;
|
||||
async function EWRunFire()
|
||||
{
|
||||
|
||||
ShowCommMes("注码脚本加载",MesgType.MESG_TYPE_INFO);
|
||||
ShowCommMes("起爆脚本本加载",MesgType.MESG_TYPE_INFO);
|
||||
fac_bind_init_flag =1;
|
||||
var content_str = '<div class="layui-row" style="line-height: 1.8rem; padding-top: 2px;">';
|
||||
|
||||
@@ -12,9 +12,22 @@ async function EWRunFire()
|
||||
content_str += '</div>'
|
||||
|
||||
content_str += '<div class="layui-col-xs2">'
|
||||
content_str += '<button type="button" class="layui-btn layui-btn-normal plugin_fire_test" style="height: 1.8rem; line-height: 1.8rem;width: 90%;" onclick="Ew_AutoFire()">起爆</button>';
|
||||
content_str += '<button type="button" class="layui-btn layui-btn-normal plugin_fire_test" style="height: 1.8rem; line-height: 1.8rem;width: 90%;" onclick="Ew_AutoFire()">单发起爆</button>';
|
||||
content_str += '</div>'
|
||||
|
||||
content_str += '<div class="layui-col-xs2">'
|
||||
content_str += '<button type="button" class="layui-btn layui-btn-normal plugin_fire_test" style="height: 1.8rem; line-height: 1.8rem;width: 90%;" onclick="Ew_AutoFirePrapare()">组网</button>';
|
||||
content_str += '</div>'
|
||||
|
||||
content_str += '<div class="layui-col-xs2">'
|
||||
content_str += '<button type="button" class="layui-btn layui-btn-normal plugin_fire_test" style="height: 1.8rem; line-height: 1.8rem;width: 90%;" onclick="Ew_MutilFire()">起爆</button>';
|
||||
content_str += '</div>'
|
||||
|
||||
content_str += '<div class="layui-col-xs2">'
|
||||
content_str += '<button type="button" class="layui-btn layui-btn-normal plugin_fire_test" style="height: 1.8rem; line-height: 1.8rem;width: 90%;" onclick="Ew_PowerOnTest()">上电测试</button>';
|
||||
content_str += '</div>'
|
||||
|
||||
|
||||
content_str += '</div>'
|
||||
$("#Oper_View").append(content_str);
|
||||
}
|
||||
@@ -22,7 +35,7 @@ async function EWRunFire()
|
||||
async function Ew_Autobind()
|
||||
{
|
||||
var rtv = 0;
|
||||
epro2_oper.ep2_heartbeat_sw = 0;
|
||||
|
||||
ep2_getInput();
|
||||
epro2_oper.cmd = 13;
|
||||
await Ep2_HeartBeat_SW();
|
||||
@@ -103,5 +116,151 @@ async function Ew_AutoFire()
|
||||
await TransSleep(200);
|
||||
epro2_oper.cmd = 18;
|
||||
await Ep2_Blast();
|
||||
ShowCommMes("起爆成功",MesgType.MESG_TYPE_INFO);
|
||||
ShowCommMes("起爆成功",MesgType.MESG_TYPE_INFO);
|
||||
ShowCommMes("起爆成功",MesgType.MESG_TYPE_INFO);
|
||||
ShowCommMes("起爆成功",MesgType.MESG_TYPE_INFO);
|
||||
ShowCommMes("起爆成功",MesgType.MESG_TYPE_INFO);
|
||||
ShowCommMes("起爆成功",MesgType.MESG_TYPE_INFO);
|
||||
ShowCommMes("起爆成功",MesgType.MESG_TYPE_INFO);
|
||||
ShowCommMes("起爆成功",MesgType.MESG_TYPE_INFO);
|
||||
ShowCommMes("起爆成功",MesgType.MESG_TYPE_INFO);
|
||||
ShowCommMes("起爆成功",MesgType.MESG_TYPE_INFO);
|
||||
ShowCommMes("起爆成功",MesgType.MESG_TYPE_INFO);
|
||||
ShowCommMes("起爆成功",MesgType.MESG_TYPE_INFO);
|
||||
ShowCommMes("起爆成功",MesgType.MESG_TYPE_INFO);
|
||||
|
||||
await Ep2_BusSwitch(0);
|
||||
}
|
||||
|
||||
var Ew_AutoFire_Flag = 0;
|
||||
async function Ew_AutoFirePrapare()
|
||||
{
|
||||
// var run_counter = 0;
|
||||
// if(Ew_AutoFire_Flag == 0)
|
||||
// {
|
||||
// Ew_AutoFire_Flag = 1;
|
||||
// }else{
|
||||
// Ew_AutoFire_Flag = 0;
|
||||
// return;
|
||||
// }
|
||||
// while(Ew_AutoFire_Flag > 0)
|
||||
// {
|
||||
ep2_getInput();
|
||||
epro2_oper.ep2_high_voltage = 85;
|
||||
epro2_oper.ep2_middle_voltage = 50;
|
||||
await Ep2_BusSwitch(1);
|
||||
await TransSleep(2000);
|
||||
ShowCommMes("快速配置",MesgType.MESG_TYPE_INFO);
|
||||
epro2_oper.cmd = 25;
|
||||
epro2_oper.cycle_test = 1;
|
||||
await Ep2_ExcueOperCmd();
|
||||
|
||||
epro2_oper.ep2_high_voltage = 200;
|
||||
await Ep2_BusSwitch(1);
|
||||
await TransSleep(2000);
|
||||
|
||||
ShowCommMes("充电",MesgType.MESG_TYPE_INFO);
|
||||
epro2_oper.cmd = 17;
|
||||
epro2_oper.cycle_test = 0;
|
||||
await Ep2_ExcueOperCmd();
|
||||
await TransSleep(8000);
|
||||
|
||||
ShowCommMes("使能MTP",MesgType.MESG_TYPE_INFO);
|
||||
epro2_oper.cmd = 29;
|
||||
await Ep2_ExcueOperCmd();
|
||||
await TransSleep(200);
|
||||
|
||||
|
||||
ShowCommMes("校准",MesgType.MESG_TYPE_INFO);
|
||||
epro2_oper.cmd = 7;
|
||||
await Ep2_ExcueOperCmd();
|
||||
await TransSleep(1500);
|
||||
|
||||
ShowCommMes("保持配置",MesgType.MESG_TYPE_INFO);
|
||||
epro2_oper.cmd = 3;
|
||||
await Ep2_ExcueOperCmd();
|
||||
await TransSleep(1000);
|
||||
|
||||
epro2_oper.cmd = 4;
|
||||
await Ep2_ExcueOperCmd();
|
||||
await TransSleep(1000);
|
||||
|
||||
if( typeof(ep2_qthandle) != "undefined" && ep2_qthandle != null )
|
||||
{
|
||||
ep2_qthandle.Ep2_Beep(2);
|
||||
}
|
||||
epro2_oper.cmd = 18;
|
||||
await Ep2_ExcueOperCmd();
|
||||
await Ep2_BusSwitch(0);
|
||||
// await TransSleep(2000);
|
||||
// run_counter++;
|
||||
// ShowCommMes("运行次数 "+run_counter,MesgType.MESG_TYPE_INFO);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
async function Ew_MutilFire()
|
||||
{
|
||||
epro2_oper.cmd = 18;
|
||||
await Ep2_ExcueOperCmd();
|
||||
await Ep2_BusSwitch(0);
|
||||
}
|
||||
var EW_PorwerOnTest_Flag = 0;
|
||||
async function Ew_PowerOnTest()
|
||||
{
|
||||
if(EW_PorwerOnTest_Flag == 0)
|
||||
{
|
||||
EW_PorwerOnTest_Flag = 1;
|
||||
}else{
|
||||
EW_PorwerOnTest_Flag = 0;
|
||||
return;
|
||||
}
|
||||
ep2_getInput();
|
||||
//开心跳
|
||||
|
||||
epro2_oper.ep2_heartbeat_sw = 0;
|
||||
epro2_oper.cmd = 13;
|
||||
await Ep2_HeartBeat_SW();
|
||||
var count = 0;
|
||||
var delay_count = 0;
|
||||
while(count < 1000 && EW_PorwerOnTest_Flag > 0)
|
||||
{
|
||||
count++;
|
||||
//关总线
|
||||
delay_count = 0;
|
||||
epro2_oper.cmd = 16;
|
||||
await Ep2_BusSwitch(0);
|
||||
while(delay_count < 120 && EW_PorwerOnTest_Flag > 0)
|
||||
{
|
||||
await TransSleep(1000);
|
||||
delay_count++;
|
||||
}
|
||||
if(EW_PorwerOnTest_Flag == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
epro2_oper.cmd = 15;
|
||||
await Ep2_BusSwitch(1);//上电
|
||||
delay_count = 0;
|
||||
while(delay_count < 5 && EW_PorwerOnTest_Flag > 0)
|
||||
{
|
||||
await TransSleep(1000);
|
||||
delay_count++;
|
||||
}
|
||||
if(EW_PorwerOnTest_Flag == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if(ep2_bus_cur > 12)
|
||||
{
|
||||
ShowCommMes("上电测试失败 "+ count,MesgType.MESG_TYPE_ERROR,1);
|
||||
BTErrorCount(1);
|
||||
break;
|
||||
}else{
|
||||
|
||||
ShowCommMes("上电测试通过 "+ count,MesgType.MESG_TYPE_INFO,1);
|
||||
}
|
||||
}
|
||||
ShowCommMes("上电测试结束 ",MesgType.MESG_TYPE_INFO,1);
|
||||
}
|
76
web/layui/plugin/EWScanUID.js
Normal file
76
web/layui/plugin/EWScanUID.js
Normal file
@@ -0,0 +1,76 @@
|
||||
async function EWScanUID()
|
||||
{
|
||||
ShowCommMes("自动扫描脚本本加载",MesgType.MESG_TYPE_INFO);
|
||||
fac_bind_init_flag =1;
|
||||
var content_str = '<div class="layui-row" style="line-height: 1.8rem; padding-top: 2px;">';
|
||||
|
||||
content_str += '<div class="layui-col-xs2">'
|
||||
content_str += '<button type="button" class="layui-btn layui-btn-normal plugin_bind_test" style="height: 1.8rem; line-height: 1.8rem;width: 90%;" onclick="Ew_StartScanUid()">扫描</button>';
|
||||
content_str += '</div>'
|
||||
content_str += '<div class="layui-col-xs2 ">';
|
||||
content_str += '<div class="grid-demo grid-demo-bg1" style="margin-left: 3px;text-align: center;border-radius: 2px; background-color: #eee;" >分配因子</div> </div>';
|
||||
|
||||
content_str += '<div class="layui-col-xs2">';
|
||||
content_str += '<div class="grid-demo grid-demo-bg1" style="margin:0 4px ;text-align: center;border-radius: 2px;" >';
|
||||
content_str += '<input type="text" value="" class="layui-input ewscan_auto_fac" style="height: 1.8rem; line-height: 1.8rem; padding-left:0px; text-align:left;">';
|
||||
content_str += '</div></div>';
|
||||
|
||||
content_str += '<div class="layui-col-xs2 ">';
|
||||
content_str += '<div class="grid-demo grid-demo-bg1" style="margin-left: 3px;text-align: center;border-radius: 2px; background-color: #eee;" >最大地址</div> </div>';
|
||||
|
||||
content_str += '<div class="layui-col-xs2">';
|
||||
content_str += '<div class="grid-demo grid-demo-bg1" style="margin:0 4px ;text-align: center;border-radius: 2px;" >';
|
||||
content_str += '<input type="text" value="" class="layui-input ewscan_auto_maxaddr" style="height: 1.8rem; line-height: 1.8rem; padding-left:0px; text-align:left;">';
|
||||
content_str += '</div></div>';
|
||||
|
||||
content_str += '</div>'
|
||||
$("#Oper_View").append(content_str);
|
||||
}
|
||||
|
||||
async function Ew_StartScanUid()
|
||||
{
|
||||
var scan_uid_rtv = [];
|
||||
var max_addr = parseInt($(".ewscan_auto_maxaddr").val(),10);
|
||||
var auto_fac = parseInt($(".ewscan_auto_fac").val(),10);
|
||||
ShowCommMes("启动搜索 最大个数 "+max_addr +" 随机值 "+ auto_fac ,MesgType.MESG_TYPE_INFO);
|
||||
epro2_oper.cmd = 35;
|
||||
await Ep2_autoSetAddr(max_addr,auto_fac);
|
||||
await TransSleep(200);
|
||||
epro2_oper.cmd = 9;
|
||||
epro2_oper.cycle_bgaddr = 21;
|
||||
epro2_oper.cycle_endaddr = max_addr+21;
|
||||
epro2_oper.cycle_group_count = 100;
|
||||
epro2_oper.sys_states ="80 00";
|
||||
Ep2_Inspect_OK = [];
|
||||
await Ep2_Inspect_Task(0);
|
||||
if(Ep2_Inspect_OK.length == 0)
|
||||
{
|
||||
ShowCommMes("搜索结束。。。。。。。。",MesgType.MESG_TYPE_INFO);
|
||||
return ;
|
||||
}
|
||||
await TransSleep(2000);
|
||||
var rtv = 0;
|
||||
for(var i = 0; i < Ep2_Inspect_OK.length; i++)
|
||||
{
|
||||
epro2_oper.cmd = 19;
|
||||
epro2_oper.commaddr = Ep2_Inspect_OK[i];
|
||||
rtv = await Ep2_ReadUID();
|
||||
if(rtv != 0)
|
||||
{
|
||||
await TransSleep(50);
|
||||
continue;
|
||||
|
||||
}
|
||||
scan_uid_rtv[scan_uid_rtv.length] = epro2_oper.uid;
|
||||
epro2_oper.cmd = 100;
|
||||
await Ep2_UpdateAddr(max_addr+50);
|
||||
await TransSleep(50);
|
||||
}
|
||||
for(var i = 0; i < scan_uid_rtv.length; i++)
|
||||
{
|
||||
ShowCommMes("UID: "+ scan_uid_rtv[i],MesgType.MESG_TYPE_INFO);
|
||||
}
|
||||
ShowCommMes("成功搜索 "+scan_uid_rtv.length+" 个UID",MesgType.MESG_TYPE_INFO);
|
||||
}
|
||||
|
||||
|
@@ -32,7 +32,7 @@ async function fac_bind()
|
||||
epro2_oper.cmd = 13;
|
||||
await Ep2_HeartBeat_SW();
|
||||
ShowCommMes("注码脚本运行启动 fac_bind_run = "+fac_bind_run,MesgType.MESG_TYPE_INFO);
|
||||
var flow_str = epro2_oper.uid.slice(11,15);
|
||||
var flow_str = epro2_oper.uid.slice(12,16);
|
||||
var flow_num = parseInt(flow_str,10);
|
||||
var rtv = 0;
|
||||
while(fac_bind_run > 0)
|
||||
@@ -54,7 +54,7 @@ async function fac_bind()
|
||||
await Ep2_EnMTPWrite(1);
|
||||
await TransSleep(300);
|
||||
var last_uid = epro2_oper.uid;
|
||||
var uidhead = epro2_oper.uid.slice(0,11);
|
||||
var uidhead = epro2_oper.uid.slice(0,12);
|
||||
epro2_oper.uid = uidhead + IntFormat(4,flow_num);
|
||||
epro2_oper.cmd = 20;
|
||||
await Ep2_WriteUID();
|
||||
|
Reference in New Issue
Block a user