添加web

This commit is contained in:
andy
2024-01-14 22:38:04 +08:00
parent e44d5716cb
commit 5b3786dd36
154 changed files with 28778 additions and 0 deletions

View File

@@ -0,0 +1,107 @@
var fac_bind_run = 0;
async function EWRunFire()
{
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_Autobind()">注码</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_AutoFire()">起爆</button>';
content_str += '</div>'
content_str += '</div>'
$("#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);
}

View File

@@ -0,0 +1,343 @@
var Energy_View_ID = -1;
var Energy_EChart = null;
function Energy_Echar()
{
var test_data = [
[0.067732, 3.176513],
[0.42781, 3.816464],
[0.995731, 4.550095],
[0.738336, 4.256571],
[0.981083, 4.560815],
[0.526171, 3.929515],
[0.378887, 3.52617],
[0.033859, 3.156393],
[0.132791, 3.110301],
[0.138306, 3.149813],
[0.247809, 3.476346],
[0.64827, 4.119688],
[0.731209, 4.282233],
[0.236833, 3.486582],
[0.969788, 4.655492],
[0.607492, 3.965162],
[0.358622, 3.5149],
[0.147846, 3.125947],
[0.63782, 4.094115],
[0.230372, 3.476039],
[0.070237, 3.21061],
[0.067154, 3.190612],
[0.925577, 4.631504],
[0.717733, 4.29589],
[0.015371, 3.085028],
[0.33507, 3.44808],
[0.040486, 3.16744],
[0.212575, 3.364266],
[0.617218, 3.993482],
[0.541196, 3.891471],
[0.045353, 3.143259],
[0.126762, 3.114204],
[0.556486, 3.851484],
[0.901144, 4.621899],
[0.958476, 4.580768],
[0.274561, 3.620992],
[0.394396, 3.580501],
[0.87248, 4.618706],
[0.409932, 3.676867],
[0.908969, 4.641845],
[0.166819, 3.175939],
[0.665016, 4.26498],
[0.263727, 3.558448],
[0.231214, 3.436632],
[0.552928, 3.831052],
[0.047744, 3.182853],
[0.365746, 3.498906],
[0.495002, 3.946833],
[0.493466, 3.900583],
[0.792101, 4.238522],
[0.76966, 4.23308],
[0.251821, 3.521557],
[0.181951, 3.203344],
[0.808177, 4.278105],
[0.334116, 3.555705],
[0.33863, 3.502661],
[0.452584, 3.859776],
[0.69477, 4.275956],
[0.590902, 3.916191],
[0.307928, 3.587961],
[0.148364, 3.183004],
[0.70218, 4.225236],
[0.721544, 4.231083],
[0.666886, 4.240544],
[0.124931, 3.222372],
[0.618286, 4.021445],
[0.381086, 3.567479],
[0.385643, 3.56258],
[0.777175, 4.262059],
[0.116089, 3.208813],
[0.115487, 3.169825],
[0.66351, 4.193949],
[0.254884, 3.491678],
[0.993888, 4.533306],
[0.295434, 3.550108],
[0.952523, 4.636427],
[0.307047, 3.557078],
[0.277261, 3.552874],
[0.279101, 3.494159],
[0.175724, 3.206828],
[0.156383, 3.195266],
[0.733165, 4.221292],
[0.848142, 4.413372],
[0.771184, 4.184347],
[0.429492, 3.742878],
[0.162176, 3.201878],
[0.917064, 4.648964],
[0.315044, 3.510117],
[0.201473, 3.274434],
[0.297038, 3.579622],
[0.336647, 3.489244],
[0.666109, 4.237386],
[0.583888, 3.913749],
[0.085031, 3.22899],
[0.687006, 4.286286],
[0.949655, 4.628614],
[0.189912, 3.239536],
[0.844027, 4.457997],
[0.333288, 3.513384],
[0.427035, 3.729674],
[0.466369, 3.834274],
[0.550659, 3.811155],
[0.278213, 3.598316],
[0.918769, 4.692514],
[0.886555, 4.604859],
[0.569488, 3.864912],
[0.066379, 3.184236],
[0.335751, 3.500796],
[0.426863, 3.743365],
[0.395746, 3.622905],
[0.694221, 4.310796],
[0.27276, 3.583357],
[0.503495, 3.901852],
[0.067119, 3.233521],
[0.038326, 3.105266],
[0.599122, 3.865544],
[0.947054, 4.628625],
[0.671279, 4.231213],
[0.434811, 3.791149],
[0.509381, 3.968271],
[0.749442, 4.25391],
[0.058014, 3.19471],
[0.482978, 3.996503],
[0.466776, 3.904358],
[0.357767, 3.503976],
[0.949123, 4.557545],
[0.41732, 3.699876],
[0.920461, 4.613614],
[0.156433, 3.140401],
[0.656662, 4.206717],
[0.616418, 3.969524],
[0.853428, 4.476096],
[0.133295, 3.136528],
[0.693007, 4.279071],
[0.178449, 3.200603],
[0.199526, 3.299012],
[0.073224, 3.209873],
[0.286515, 3.632942],
[0.182026, 3.248361],
[0.621523, 3.995783],
[0.344584, 3.563262],
[0.398556, 3.649712],
[0.480369, 3.951845],
[0.15335, 3.145031],
[0.171846, 3.181577],
[0.867082, 4.637087],
[0.223855, 3.404964],
[0.528301, 3.873188],
[0.890192, 4.633648],
[0.106352, 3.154768],
[0.917886, 4.623637],
[0.014855, 3.078132],
[0.567682, 3.913596],
[0.068854, 3.221817],
[0.603535, 3.938071],
[0.53205, 3.880822],
[0.651362, 4.176436],
[0.901225, 4.648161],
[0.204337, 3.332312],
[0.696081, 4.240614],
[0.963924, 4.532224],
[0.98139, 4.557105],
[0.987911, 4.610072],
[0.990947, 4.636569],
[0.736021, 4.229813],
[0.253574, 3.50086],
[0.674722, 4.245514],
[0.939368, 4.605182],
[0.235419, 3.45434],
[0.110521, 3.180775],
[0.218023, 3.38082],
[0.869778, 4.56502],
[0.19683, 3.279973],
[0.958178, 4.554241],
[0.972673, 4.63352],
[0.745797, 4.281037],
[0.445674, 3.844426],
[0.470557, 3.891601],
[0.549236, 3.849728],
[0.335691, 3.492215],
[0.884739, 4.592374],
[0.918916, 4.632025],
[0.441815, 3.75675],
[0.116598, 3.133555],
[0.359274, 3.567919],
[0.814811, 4.363382],
[0.387125, 3.560165],
[0.982243, 4.564305],
[0.78088, 4.215055],
[0.652565, 4.174999],
[0.87003, 4.58664],
[0.604755, 3.960008],
[0.255212, 3.529963],
[0.730546, 4.213412],
[0.493829, 3.908685],
[0.257017, 3.585821],
[0.833735, 4.374394],
[0.070095, 3.213817],
[0.52707, 3.952681],
[0.116163, 3.129283]
];
var echart_option = {
dataset: [
{
source: test_data
},
{
transform: {
type: 'ecStat:regression'
// 'linear' by default.
// config: { method: 'linear', formulaOn: 'end'}
}
}
],
title: {
text: 'Linear Regression',
left: 'center'
},
legend: {
bottom: 5
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross'
}
},
xAxis: {
splitLine: {
lineStyle: {
type: 'dashed'
}
}
},
yAxis: {
splitLine: {
lineStyle: {
type: 'dashed'
}
}
},
series: [
{
name: 'scatter',
type: 'scatter'
},
{
name: 'line',
type: 'line',
datasetIndex: 1,
symbolSize: 0.1,
symbol: 'circle',
label: { show: true, fontSize: 16 },
labelLayout: { dx: -20 },
encode: { label: 2, tooltip: 1 }
}
]
};
var index = 0;
var content = '<div style="padding: 5px; line-height: 25px; background-color: #eee; color:#0f1010;height:98%; ">';
content += '<div id = "Energy_Echar_dom" style= "min-width:550px; min-height:550px;width:90%;height:90%; margin:0 auto;" > </div>'
content += '<div class="layui-row">';
content += '<div class="layui-col-xs3" > <button type="button" class="layui-btn" onclick = "Energy_Base_Cur()">基本电流</button> </div> ';
content += '<div class="layui-col-xs3" > <button type="button" class="layui-btn" onclick = "Energy_Chg_Cur()">充电电流</button> </div> ';
content += '<div class="layui-col-xs3" > <button type="button" class="layui-btn" onclick = "Energy_Boom_Cur()">起爆后电流</button></div>';
content += '<div class="layui-col-xs3" > <button type="button" class="layui-btn" onclick = "Energy_Cur_Close()">退出</button></div>';
content += '</div>';
content += '</div>';
if(Energy_View_ID > 0)
{
layer.close(Energy_View_ID);
}
Energy_View_ID = layer.open({
type: 1,
content:content,
title: "走势图",
shade:0.6,
moveType: 1,
btnAlign: 'c',
minHeight:550,
minWidth:650,
resize : true,
success: function(layero, index){
var dom = document.getElementById('Energy_Echar_dom');
if(dom == null || dom == typeof('undefine'))
{
return ;
}
Energy_EChart = echarts.init(dom, null, {
renderer: 'canvas',
useDirtyRect: false
});
echarts.registerTransform(ecStat.transform.regression);
if (echart_option && typeof echart_option === 'object') {
Energy_EChart.setOption(echart_option);
}
},
resizing: function(layero){
if(Energy_EChart == null || Energy_EChart == typeof('undefine'))
return;
Energy_EChart.resize();
},
cancel:function(index, layero){
console.log("Close Energy_Echar");
epj_rec_plugin = null;
return true;
},
});
epj_rec_plugin = 'Energy_Cur_RecFunc';
console.log("Run Energy_Echar");
}
function Energy_Cur_Close()
{
layer.close(Energy_View_ID);
}
var echar_src_data = [];
function Energy_Cur_RecFunc(frame)
{
if(frame[4] != 0xFE);
{
return;
}
for(var i = 8; i < frame.length;i++)
{
}
}

View File

@@ -0,0 +1,180 @@
var ew_code_update_init_flag = 0;
var EWB_CMD_CTR = 6;
function EwCodeUpdate()
{
if(ew_code_update_init_flag == 0)
{
ShowCommMes("程序更新脚本加载成功",MesgType.MESG_TYPE_INFO);
ew_code_update_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="EwCodeUpdateExcue()">升级程序</button>';
content_str += '</div> ';
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="EWB_Chg(1)">充电</button>';
content_str += '</div> ';
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="EWB_EraseCode()">擦除代码</button>';
content_str += '</div> ';
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="EWB_UpdateCode()">升级代码</button>';
content_str += '</div> ';
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="EWB_RunApp()">运行App</button>';
content_str += '</div> ';
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="EWB_AppSleep()">休眠App</button>';
content_str += '</div> ';
content_str +='</div>';
$("#Oper_View").append(content_str);
return;
}
}
async function EWB_AppSleep()
{
var param = [];
var cmd_buf = Ep2_CmdData(1,60,param,0,0,EP2_CMM_RATE);
ep2_excuedcmd = 0;
epro2_oper.cmd = 0xFF;
Ep2_SendCmd(cmd_buf);
var rtv = await Ep2_WaitCmdExcu(epro2_oper.cmd,1000);
if(rtv == 0){
ShowCommMes("执行休眠成功",MesgType.MESG_TYPE_INFO);
}
}
async function Ep2_ChipRunBoot()
{
var param = [];
param[0] =0x99;
param[1] = 0x66;
param[2] = 0xAA;
param[3] = 0x55;
var cmd_buf = Ep2_CmdData(0,61,param,0,0,EP2_CMM_RATE);
ep2_excuedcmd = 0;
epro2_oper.cmd = 0xFF;
Ep2_SendCmd(cmd_buf);
var rtv = await Ep2_WaitCmdExcu(epro2_oper.cmd,1000);
if(rtv == 0){
ShowCommMes("芯片复位执行成功",MesgType.MESG_TYPE_INFO);
}
}
async function EWB_Chg(sw)
{
var cmd_buf = [];
cmd_buf[0] = sw;
epro2_oper.ctr_cmd = EWB_CMD_CTR;
epro2_oper.cmd = 0x01;
Ep2_SendCmd(cmd_buf);
await TransSleep(200);
}
async function EWB_EraseCode()
{
var cmd_buf = [];
epro2_oper.ctr_cmd = EWB_CMD_CTR;
epro2_oper.cmd = 0x02;
Ep2_SendCmd(cmd_buf);
await TransSleep(200);
}
async function EWB_UpdateCode()
{
var cmd_buf = [];
var code_addr = 0x1000;
var code_size = 11*1024;
var err_close = 0;//1 写入出现错误终止 0 错误继续执行
var w_size = 0;
cmd_buf[0] = code_addr & 0x0FF;
cmd_buf[1] = (code_addr >> 8) & 0x0FF;
cmd_buf[2] = code_size & 0x0FF;
cmd_buf[3] = (code_size >> 8) & 0x0FF;
cmd_buf[4] = err_close;
//05334577249
epro2_oper.ctr_cmd = EWB_CMD_CTR;
epro2_oper.cmd = 0x06;
Ep2_SendCmd(cmd_buf);
var time_out = 0;
ep2_excued_rtv = 0;
ep2_excuedcmd = 0;
while(time_out < 100)
{
if(ep2_excuedcmd == 0x06)
{
time_out = 0;
if(ep2_excued_rtv == 0)
{
w_size = ep2_recive_buf[11]*256+ep2_recive_buf[10];
ShowCommMes("已经下载程序 "+w_size+" 字节",MesgType.MESG_TYPE_INFO);
}else{
ShowCommMes("已经下载程序 "+w_size+" 字节 下载异常",MesgType.MESG_TYPE_ERROR);
break;
}
ep2_excuedcmd = 0;
ep2_excued_rtv = 0;
}
if(w_size >= code_size)
{
break;
}
await TransSleep(10);
time_out++;
}
}
async function EWB_RunApp()
{
var cmd_buf = [];
epro2_oper.ctr_cmd = EWB_CMD_CTR;
epro2_oper.cmd = 0x05;
Ep2_SendCmd(cmd_buf);
await TransSleep(200);
}
async function EwCodeUpdateExcue()
{
//使能MTP
epro2_oper.commaddr = 1;
epro2_oper.cmd = 29;
await Ep2_EnMTPWrite(1);
await TransSleep(300);
//用户程序跳转到bootloader
await Ep2_ChipRunBoot();
//关闭总线
await Ep2_BusSwitch(0);
await TransSleep(5000);
//开总线
epro2_oper.ep2_heartbeat_sw = 0;
await Ep2_HeartBeat_SW();
await TransSleep(100);
await Ep2_BusSwitch(1);
await TransSleep(300);
//执行充电命令
EWB_Chg(1);
//等待充电
await TransSleep(5000);
EWB_Chg(1);
await TransSleep(5000);
//擦除用户Code区
EWB_EraseCode();
await TransSleep(1000);
//升级程序
await EWB_UpdateCode();
//跳转用户命令
await TransSleep(1000);
await EWB_RunApp();
}

View File

@@ -0,0 +1,79 @@
var fac_bind_init_flag = 0;
var fac_bind_run = 0;
async function fac_bind()
{
if(fac_bind_init_flag == 0)
{
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="fac_bind()">启动测试</button>';
content_str += '</div></div>'
$("#Oper_View").append(content_str);
return;
}
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;
}
epro2_oper.ep2_heartbeat_sw = 0;
ep2_getInput();
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_num = parseInt(flow_str,10);
var rtv = 0;
while(fac_bind_run > 0)
{
ShowCommMes("等待模块接入。。flow_num "+flow_num,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);
var last_uid = epro2_oper.uid;
var uidhead = epro2_oper.uid.slice(0,11);
epro2_oper.uid = uidhead + IntFormat(4,flow_num);
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++;
}
while(ep2_bus_cur > 0.01 && fac_bind_run > 0)
{
await TransSleep(300);
}
}
ShowCommMes("注码脚本运行结束",MesgType.MESG_TYPE_INFO);
}

View File

@@ -0,0 +1,38 @@
function jw3524test()
{
var obj = $('#Oper_View');
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 " style="height: 1.8rem; line-height: 1.8rem;width: 90%; padding: 0 3px;" onclick="JW3425Test_Run()">测试</button>'
content_str += '</div></div>';
obj.append(content_str);
ShowCommMes("插件加载成功", MesgType.MESG_TYPE_INFO);
}
async function JW3425Test_Run()
{
epro2_oper.cmd = 1;
await Ep2_Charge();
ShowCommMes("充电等待 20S", MesgType.MESG_TYPE_INFO);
for(var i= 0 ; i < 20; i++)
{
await TransSleep(1000);
}
epro2_oper.commaddr = 1;
epro2_oper.pwd = "20191029";
epro2_oper.cmd = 19;
await Ep2_VerifiPwdCmd(epro2_oper.commaddr,epro2_oper.pwd);
await TransSleep(100);
epro2_oper.cmd = 32;
epro2_oper.delayfire = 0;
epro2_oper.commaddr = 1;
await Ep2_WriteDelay();
await TransSleep(100);
epro2_oper.cmd = 7;
await Ep2_ClkAmend(1,500);
await TransSleep(100);
epro2_oper.cmd = 12;
await Ep2_Blast();
}

View File

@@ -0,0 +1,555 @@
/*var Local_More_View_ID = 0;
async function Local_More()
{
ShowBtAddr(1);
BtOper_Json.waittimeout = 1000;
BtOper_Json.waitack = true;
ShowCommMes("抗震检测",MesgType.MESG_TYPE_INFO);
ShowCommMes("循环延时用来控制充电时间",MesgType.MESG_TYPE_INFO);
//获取输入框数据
BtGetInputInfo();
await TransSleep(1000);
//开总线
BtOper_Json.busmode = 2;
BtOper_Json.cycletest = 0;
BtOper_Json.opercmd = EProCmdV.SET_BUS_MODE_;
await SendCmd(true);
await TransSleep(1000);
BtOper_Json.opercmd = EProCmdV.WRITE_UID_;
await SendCmd(true);
await TransSleep(20);
BtOper_Json.opercmd = EProCmdV.WRITE_PWD_;
await SendCmd(true);
await TransSleep(20);
BtOper_Json.opercmd = EProCmdV.BC_WRITE_ADDR_;
await SendCmd(true);
await TransSleep(20);
BtOper_Json.opercmd = EProCmdV.SET_DELAY_;
await SendCmd(true);
await TransSleep(20);
BtOper_Json.opercmd = EProCmdV.CHARGE_;
await SendCmd(true);
await TransSleep(BtOper_Json.rundelay);
await TimerAmend_( 1, 500, true, true, 1200);
await TransSleep(20);
BtOper_Json.opercmd = EProCmdV.SET_PSWD_FLAG;
await SendCmd(true);
await TransSleep(20);
BtOper_Json.opercmd = EProCmdV.BASE_CHECK_;
BtOper_Json.setparam[0] = 0;
await SendCmd(true);
await TransSleep(1000);
BtOper_Json.opercmd = EProCmdV.READ_STATE_;
await SendCmd(true);
await TransSleep(20);
BtOper_Json.opercmd = EProCmdV.BOOM_;
await SendCmd(true);
await TransSleep(20);
//关总线
BtOper_Json.opercmd = EProCmdV.SET_BUS_MODE_;
BtOper_Json.busmode = 1;
await SendCmd(true);
}*/
/*
* 时钟精度测试
* */
/*
async function Local_More()
{
var count = 0;
var rtv = 0;
GetEp1_InputInfo();
epro1_oper.commaddr = 1;
ShowCommMes("Local_More ",MesgType.MESG_TYPE_INFO);
while(count < epro1_oper.cycle_runcount)
{
epro1_oper.cmd = 11;
ep1_bus_switch = 0;
await Ep1_SwitchBus();
Ep1_Beep(1);
count++;
await TransSleep(1500);
ShowCommMes("启动时钟精度自动检测 "+ epro1_oper.delayfire +"ms",MesgType.MESG_TYPE_INFO);
if(count == 1)
{
epro1_oper.cmd = 23;
rtv = await Ep1_SetPWDFlag();
if(rtv > 0)
{
ShowCommMes("密码验证失败 ",MesgType.MESG_TYPE_ERROR);
return ;
}
}
await TransSleep(100);
epro1_oper.cmd = 33;
rtv = await Ep1_ReadSysStatesCmd();
if(rtv > 0)
{
ShowCommMes("通讯失败 ",MesgType.MESG_TYPE_ERROR);
return ;
}
await TransSleep(100);
epro1_oper.cmd = 1;
await Ep1_Charge();
await TransSleep(5000);
epro1_oper.cmd = 25;
rtv = await Ep1_WriteDelay();
if(rtv > 0)
{
ShowCommMes("延时设置失败 ",MesgType.MESG_TYPE_ERROR);
return ;
}
await TransSleep(100);
epro1_oper.cmd = 5;
await Ep1_ClkAmend(1,500);
await TransSleep(100);
epro1_oper.cmd = 35;
await Ep1_ReadAmend();
await TransSleep(100);
epro1_oper.cmd = 4 ;
await Ep1_Blast();
epro1_oper.cmd = 11;
ep1_bus_switch = 1;
await Ep1_SwitchBus();
ShowCommMes("等待起爆完成 ",MesgType.MESG_TYPE_INFO);
await TransSleep(3000+epro1_oper.delayfire);
ShowCommMes("测试完成 ");
}
}*/
/*
* @param 定时器翻转发送
*/
/*
async function Local_More()
{
var rtv = 0;
var param = [];
GetEp1_InputInfo();
epro1_oper.commaddr = 1;
ShowCommMes("Local_More ",MesgType.MESG_TYPE_INFO);
epro1_oper.cmd = 100;
param[0] = epro1_oper.delayfire;
cmd_buf = Ep1_CmdData(0,8,20,param,0);
ep1_excuedcmd = 0;
Ep1_SendCmd(cmd_buf);
rtv = await Ep1_WaitCmdExcu(epro1_oper.cmd,1000);
await TransSleep(1000);
}*/
/*
在线搜索
* */
/*
async function Local_More()
{
var count = 0;
var rtv = 0;
var uid_head = '581900230A0'
GetEp1_InputInfo();
var flow_num = epro1_oper.cycle_bgaddr;
epro1_oper.commaddr = 1;
ShowCommMes("Local_More ",MesgType.MESG_TYPE_INFO);
while((flow_num < epro1_oper.cycle_endaddr) && (epro1_oper.cycle_test > 0))
{
epro1_oper.commaddr = 1;
epro1_oper.uid = uid_head + IntFormat(4,flow_num);
await TransSleep(1000);
Ep1_Beep(1);
epro1_oper.cmd = 33;
rtv = await Ep1_ReadSysStatesCmd();
if(rtv > 0)
{
ShowCommMes("通讯失败 ",MesgType.MESG_TYPE_ERROR);
continue
}
await TransSleep(50);
epro1_oper.cmd = 18;
rtv = await Ep1_WriteUID();
if(rtv > 0)
{
ShowCommMes("通讯失败 ",MesgType.MESG_TYPE_ERROR);
continue
}
await TransSleep(50);
epro1_oper.cmd = 21;
rtv = await Ep1_WritePWD();
if(rtv > 0)
{
ShowCommMes("通讯失败 ",MesgType.MESG_TYPE_ERROR);
continue
}
await TransSleep(50);
epro1_oper.cmd = 28;
epro1_oper.commaddr = 500;
rtv = await Ep1_WriteAddr();
if(rtv > 0)
{
ShowCommMes("通讯失败 ",MesgType.MESG_TYPE_ERROR);
continue
}
await TransSleep(50);
epro1_oper.cmd = 10;
rtv = await Ep1_Sleep();
if(rtv > 0)
{
ShowCommMes("通讯失败 ",MesgType.MESG_TYPE_ERROR);
continue
}
Ep1_Beep(2);
flow_num++;
ShowCommMes("注入UID: "+epro1_oper.uid+" 成功",MesgType.MESG_TYPE_INFO);
await TransSleep(1000);
}
}*/
/*
在线巡检,搜索未注册雷管
* */
/*
async function Local_More()
{
var array_result = [];
var result_count = 0;
var ok_addr = [];
var rtv;
var count = 400;
while(1){
epro1_oper.cmd = 31;
epro1_oper.auset_addr_fac = count;
await Ep1_SearchTask();
await TransSleep(200);
var bgaddr = 21;
var ok_index = 0;
ok_addr = [];
count+=20;
while(bgaddr < count)
{
epro1_oper.cmd = 13;
var rtd = await Ep1_Inspect(bgaddr,bgaddr+50,1);
for(var index = 0; index <rtd.ok_addr.length;index++ )
{
ok_addr[ok_index++] = rtd.ok_addr[index];
}
await TransSleep(1000);
bgaddr += 50;
}
if(ok_index == 0)
{
ShowCommMes("搜索完成 数量:"+result_count ,MesgType.MESG_TYPE_INFO);
break;
}else{
ShowCommMes("次轮搜索到 "+ok_index ,MesgType.MESG_TYPE_INFO);
}
count -= 70;
for(var index = 0; index < ok_index; index++)
{
epro1_oper.cmd = 17;
epro1_oper.commaddr = ok_addr[index];
rtv = await Ep1_ReadUID();
await TransSleep(20);
if(rtv != 0)
{
continue;
}
var search_result = {
uid:"",
delay:0,
};
search_result.uid = epro1_oper.uid;
epro1_oper.cmd = 24;
rtv = await Ep1_ReadDelay();
await TransSleep(20);
if(rtv != 0)
{
continue;
}
search_result.delay = epro1_oper.delayfire;
ShowCommMes("uid "+search_result.uid+" 延时:"+ search_result.delay ,MesgType.MESG_TYPE_INFO);
array_result[result_count++] = search_result;
epro1_oper.cmd = 19;
epro1_oper.commaddr = 1000;
await Ep1_VerifiUidFeature();
await TransSleep(10);
epro1_oper.cmd = 10;
await Ep1_Sleep();
await TransSleep(20);
}
}
for(var index = 0; index < result_count; index++)
{
var result = array_result[index];
if(result.delay >= 5)
{
result.delay -= 5;
}else{
result.delay = "未设置";
}
ShowCommMes("UID"+result.uid+" 延时:" + result.delay,MesgType.MESG_TYPE_INFO);
}
}*/
/*
* 时钟精度测试
* */
/*
async function Local_More()
{
var count = 0;
var rtv = 0;
GetEp1_InputInfo();
epro1_oper.commaddr = 1;
ShowCommMes("Local_More ",MesgType.MESG_TYPE_INFO);
epro1_oper.cmd = 11;
ep1_bus_switch = 0;
await Ep1_SwitchBus();
Ep1_Beep(1);
await TransSleep(1500);
ShowCommMes("启动测试 延时 "+ epro1_oper.delayfire +"ms",MesgType.MESG_TYPE_INFO);
epro1_oper.cmd = 23;
rtv = await Ep1_SetPWDFlag();
if(rtv > 0)
{
ShowCommMes("密码验证失败 ",MesgType.MESG_TYPE_ERROR);
return ;
}
await TransSleep(100);
epro1_oper.cmd = 33;
rtv = await Ep1_ReadSysStatesCmd();
if(rtv > 0)
{
ShowCommMes("通讯失败 ",MesgType.MESG_TYPE_ERROR);
return ;
}
await TransSleep(100);
epro1_oper.cmd = 1;
await Ep1_Charge();
await TransSleep(8000);
epro1_oper.cmd = 25;
rtv = await Ep1_WriteDelay();
if(rtv > 0)
{
ShowCommMes("延时设置失败 ",MesgType.MESG_TYPE_ERROR);
return ;
}
await TransSleep(100);
epro1_oper.cmd = 5;
await Ep1_ClkAmend(1,500);
await TransSleep(100);
epro1_oper.cmd = 35;
await Ep1_ReadAmend();
await TransSleep(100);
epro1_oper.cmd = 4 ;
await Ep1_Blast();
epro1_oper.cmd = 11;
ep1_bus_switch = 1;
await Ep1_SwitchBus();
Ep1_Beep(2);
await TransSleep(1500);
ShowCommMes("等待起爆完成 ",MesgType.MESG_TYPE_INFO);
await TransSleep(1500+epro1_oper.delayfire);
ShowCommMes("测试完成 ",MesgType.MESG_TYPE_INFO);
epro1_oper.cmd = 11;
ep1_bus_switch = 0;
await Ep1_SwitchBus();
await TransSleep(1500);
epro1_oper.cmd = 37;
epro1_oper.flash_r_bgaddr = 0x3E84;
epro1_oper.flash_r_len = 4;
var readbuf = await Ep1_ReadFlashCmd();
if(readbuf.length > 0)
{
var temp_v = 0;
temp_v = (readbuf[1] << 8) | readbuf[0];
temp_v = temp_v / 4096*3.3/0.43*3.43;
temp_v = temp_v.toFixed(1);
ShowCommMes("起爆电压 "+ temp_v,MesgType.MESG_TYPE_OK);
}else{
ShowCommMes("起爆电压读取失败 ",MesgType.MESG_TYPE_ERROR);
}
epro1_oper.flash_r_bgaddr = 0x3E60;
epro1_oper.flash_r_len = 4;
readbuf = await Ep1_ReadFlashCmd();
if(readbuf.length > 0)
{
var temp_buf = [];
temp_buf[0] = readbuf[0];
var boom_flg = Bytes2Str(temp_buf);
temp_buf[0] = readbuf[1];
var reset_flag = Bytes2Str(temp_buf);
ShowCommMes("起爆标志 "+ boom_flg + "复位标志 "+ reset_flag,MesgType.MESG_TYPE_OK);
}else{
ShowCommMes("读起爆标志失败 ",MesgType.MESG_TYPE_ERROR);
}
epro1_oper.flash_r_bgaddr = 0x3EF0;
epro1_oper.flash_r_len = 10;
readbuf = await Ep1_ReadFlashCmd();
var timer_count = 0;
var timer_remain = 0;
var awu_count = 0;
var max_dot = 0;
var lpt_reload = 0;
if(readbuf.length > 0)
{
timer_count = (readbuf[1] << 8) | readbuf[0];
timer_remain = (readbuf[3] << 8) | readbuf[2];
awu_count = (readbuf[5] << 8) | readbuf[4];
max_dot = (readbuf[7] << 8) | readbuf[6];
lpt_reload= (readbuf[9] << 8) | readbuf[8];
ShowCommMes("定时器打点数 "+ timer_count + "定时器余数 "+ timer_remain +" LPT打点数 "+ awu_count +" 最大标记点数 "+max_dot + " LPT周期值 "+lpt_reload,MesgType.MESG_TYPE_OK);
}else{
ShowCommMes("读取延时记录失败 ",MesgType.MESG_TYPE_ERROR);
}
var mask_count = 0;
var temp_count = 0;
epro1_oper.flash_r_bgaddr = 0x3C00;
epro1_oper.flash_r_len = 8;
while((epro1_oper.flash_r_len > 0) && (epro1_oper.flash_r_bgaddr <= 0x3DF8))
{
readbuf = await Ep1_ReadFlashCmd();
epro1_oper.flash_r_bgaddr += 8;
if(readbuf.length < 1)
{
ShowCommMes("标记点读取失败 ",MesgType.MESG_TYPE_ERROR);
return;
}
for(var index = 0; index < readbuf.length ;index++)
{
if(readbuf[index] == 0x00)
{
mask_count += 8;
continue;
}
temp_count = (~readbuf[index]) & 0x0FF;
while(temp_count > 0)
{
mask_count++;
temp_count >>= 1;
}
epro1_oper.flash_r_len = 0;
break;
}
}
ShowCommMes("记录打点数 " + mask_count,MesgType.MESG_TYPE_OK);
}*/
/*
工厂芯片测试
* */
/*
async function Local_More()
{
GetEp1_InputInfo();
epro1_oper.commaddr = 1;
ShowCommMes("Local_More ",MesgType.MESG_TYPE_INFO);
var param = [];
param[0] = epro1_oper.delayfire & 0xFF;
var cmd_buf = Ep1_CmdData(1,8,0xFB,param,0);
ep1_excuedcmd = 0;
Ep1_SendCmd(cmd_buf);
var rtv = await Ep1_WaitCmdExcu(epro1_oper.cmd,1000);
}*/
/*
通讯测试
* */
async function Local_More()
{
GetEp1_InputInfo();
ShowCommMes("Local_More ",MesgType.MESG_TYPE_INFO);
epro1_oper.cmd = 11;
ep1_bus_switch = 0;
await Ep1_SwitchBus();
Ep1_Beep(1);
await TransSleep(1500);
ShowCommMes("启动通讯测试 ",MesgType.MESG_TYPE_INFO);
var count = 0;
while( (epro1_oper.cycle_test > 0)&&(epro1_oper.cycle_runcount > 0))
{
count = 0;
while((count < epro1_oper.cycle_group_count) && (epro1_oper.cycle_test > 0)&&(epro1_oper.cycle_runcount > 0))
{
epro1_oper.cycle_runcount --;
epro1_oper.commaddr = epro1_oper.cycle_bgaddr +count;
epro1_oper.cmd = 24;
await Ep1_ReadDelay();
await TransSleep(Math.round(Math.random()*180+20));
epro1_oper.cmd = 34;
await Ep1_ReadFirmwareCmd();
await TransSleep(Math.round(Math.random()*180+20));
epro1_oper.cmd = 33;
await Ep1_ReadSysStatesCmd();
await TransSleep(Math.round(Math.random()*180+20));
epro1_oper.cmd = 17;
await Ep1_ReadUID();
await TransSleep(Math.round(Math.random()*180+20));
epro1_oper.cmd = 19;
await Ep1_VerifiUidFeature();
await TransSleep(Math.round(Math.random()*180+20));
epro1_oper.cmd = 28;
await Ep1_WriteAddr();
await TransSleep(Math.round(Math.random()*180+20));
epro1_oper.cmd = 23;
await Ep1_SetPWDFlag();
await TransSleep(Math.round(Math.random()*180+20));
epro1_oper.cmd = 22;
await Ep1_VerifiPwdCmd();
await TransSleep(Math.round(Math.random()*180+20));
count++;
}
epro1_oper.cycle_runcount --;
}
}
function local_more_fun()
{
ShowCommMes("local_more_fun 555",MesgType.MESG_TYPE_INFO);
}

1
web/layui/plugin/pwd.js Normal file
View File

@@ -0,0 +1 @@
var CheckPlan_Export_PWD = "tttT4IicFhThQ6Iqpb3JsAaC";