
document.write("<script type='text/javascript' src='../static/bootstrap/bootstrap/js/bootstrap.js'></script>");
document.write("<link rel='stylesheet' href='../static/bootstrap/bootstrap/css/bootstrap.css'  media='all'>");
document.write("<script type='text/javascript' src='../static/echarts/echarts.min.js'></script>");
document.write("<script type='text/javascript' src='../public/interface.js'></script>");
document.write("<script type='text/javascript' src='../ElectronicLoadTester/files/public.js'></script>");

document.write("<script type='text/javascript' src='../static/layui/layui.all.js'></script>");




$(function(){
    obj.cnt = 8;
    window.t1 = function () {//layer.msg(obj.cnt.toString())
        if(interface.getFreeTime(0) < 100){
        }
        else if(obj.cnt == 0){//查询控制方式
            interface.getSerialComm(0, "SYSTem:LOCal?", "system_local", TaktTimeDelay, OverTimeDelay);
            window.system_local = function (i, dat) {
                if(dat == "1"){
                    obj.cnt++;
                }else{
                    $('#Heading_ConnectionStatus_text').html("连接状态:未连接");
                }
            }
        }
        else if(obj.cnt == 1) {//查询开关状态
            interface.getSerialComm(0, "INPut?", "get_input", TaktTimeDelay, OverTimeDelay);
            window.get_input = function (i, dat) {
                OnFlag = dat;
                obj.cnt++;
            }
        }
        else if(obj.cnt == 2) {//查询电流
            interface.getSerialComm(0, "MEASure:CURRent?", "measure_current", TaktTimeDelay, OverTimeDelay);
            window.measure_current = function (i, dat) {
                chart_data_add(0, dat);obj.cnt++;
                $('#TextField_Current_input').val(dat);
            }
        }
        else if(obj.cnt == 3) {//查询电压
            interface.getSerialComm(0, "MEASure:VOLTage?", "measure_voltage", TaktTimeDelay, OverTimeDelay);
            window.measure_voltage = function (i, dat) {
                chart_data_add(1, dat);obj.cnt++;
                $('#TextField_Voltage_input').val(dat);
            }
        }
        else if(obj.cnt == 4) {//查询电池容量
            // var dat = comm.get_bat_CAPacity();
            // if(dat.sta == "ok"){
            //     $('#TextField_Capacity_input').val(dat.val);
            // }
            obj.cnt++;
        }
        else if(obj.cnt == 5) {//查询DP线上的实时电压值
            //serial_comm(0, "QCM:D+:VOLT?", TaktTimeDelay, WriteTimeDelay, 3); var dat = comm.get_qc_DpVolt();
            interface.getSerialComm(0, "QCM:D+:VOLT?", "get_qcm_d1_volt", TaktTimeDelay, OverTimeDelay);
            window.get_qcm_d1_volt = function (i, dat) {
                obj.cnt++;
                $('#Heading_DPDN_positive_text').text(dat + "V");
            }
        }
        else if(obj.cnt == 6) {//查询DN线上的实时电压值
            //serial_comm(0, "QCM:D-:VOLT?", TaktTimeDelay, WriteTimeDelay, 3); var dat = comm.get_qc_DnVolt();
            interface.getSerialComm(0, "QCM:D-:VOLT?", "get_qcm_d2_volt", TaktTimeDelay, OverTimeDelay);
            window.get_qcm_d2_volt = function (i, dat) {
                obj.cnt++;
                $('#Heading_DPDN_negative_text').text(dat + "V");
            }
        }
        else if(obj.cnt == 7) {//查询DN线上的实时电压值
            //serial_comm(0, "QCM:PDO:LIST?", TaktTimeDelay, WriteTimeDelay, 3); var dat = comm.get_qc_PdoList();
            interface.getSerialComm(0, "QCM:PDO:LIST?", "get_qcm_pdo_list", TaktTimeDelay, OverTimeDelay);
            var start = 0, stop = 0;
            // dat.val = "FPS:5.0V/3.0AFPS:9.0V/3.0AFPS:12.0V/3.0AFPS:15.0V/3.0AFPS:20.0V/2.2500APPS:16.0V-3.3000V/3.0A";
            window.get_qcm_pdo_list= function (i, dat) {
                var html = "";
                while (true){
                    stop = dat.indexOf("A", start);
                    if(stop >= 0){
                        var list = dat.substring(start, stop + 1);
                        start = stop + 1;
                        html += "<option class=\"Droplist_PDDotTestVolt_input_option\" value=\"" + list + "\">" + list + "</option>";
                    }else{
                        break;
                    }
                }
                if($("#Droplist_PDDotTestVolt_input").html() != html){
                    $("#Droplist_PDDotTestVolt_input").html(html);
                }
                obj.cnt++;
            }
        }
        else if(obj.cnt == 8){//查询版本
            interface.getSerialComm(0, "*IDN?", "get_idn", TaktTimeDelay, OverTimeDelay);
            window.get_idn = function (i, dat) {
                InstrumentModel = dat;
                $('#Heading_DeviceInformation_text').html("设备信息:" + dat);
                $('#Heading_ConnectionStatus_text').html("连接状态:已连接");
                if(get_InstrumentModel("UTL8511C") == false){
                    alert("该功能仅支持UTL8511C系列");
                    history.back(-1);
                }
                obj.cnt = 0;
            }
        }
        else{
            obj.cnt = 0;
        }
        // var tt = chart_qc.echart.getOption().series;
        // layer.msg(JSON.stringify(chart_qc.echart.getOption().series[0].color));
        $("#Line_Volt").css("background-color", chart_qc.echart.getOption().series[1].color);    $("#Line_Volt_img").css("display", "none");
        $("#Line_Current").css("background-color", chart_qc.echart.getOption().series[0].color); $("#Line_Current_img").css("display", "none");
    }


    //显示时间
    var TimeCnt = 0;
    var OnFlag = "0";
    window.t3 = function () {
        function formatSeconds(value) {
            let result = parseInt(value);
            let h = Math.floor(result / 3600) < 10 ? '0' + Math.floor(result / 3600) : Math.floor(result / 3600);
            let m = Math.floor((result / 60 % 60)) < 10 ? '0' + Math.floor((result / 60 % 60)) : Math.floor((result / 60 % 60));
            let s = Math.floor((result % 60)) < 10 ? '0' + Math.floor((result % 60)) : Math.floor((result % 60));
            result = `${h} : ${m} : ${s}`;
            return result
        }
        if(OnFlag == "1"){
            TimeCnt++;
        }else{
            TimeCnt = 0;
        }
        $('#TextField_Time_input').val(formatSeconds(TimeCnt));
    }



    function qc2_qc3_dotTest(mode, volt, curr){     //QC2.0 QC3.0
        let conn_cnt = 0;
        let loading = layer.load(2, {time: 10000});
        //serial_comm(0, "QCM:PROT " + val, TaktTimeDelay, WriteTimeDelay, 0); comm.set_qc_Prot(mode);                      // QCM:PROT QC2----设置快充协议
        interface.setSerialSend(0, "QCM:PROT " + mode, "qc2_qc3_qcm_prot", obj.delay1, obj.delay2, obj.overDelay);
        window.qc2_qc3_qcm_prot = function (a) {
            // QCM:CONN? ------检查握手状态，在返回值为1时，继续发送指令
            //serial_comm(0, "QCM:CONN?", TaktTimeDelay, WriteTimeDelay, 3); var dat = null; for(var i=0; i<10;i++){dat = comm.get_qc_Conn();if(dat.sta == "ok" && dat.val == "1"){break;}}
            interface.getSerialComm(0, "QCM:CONN?", "qc2_qc3_get_qcm_conn", TaktTimeDelay, OverTimeDelay);
            window.qc2_qc3_get_qcm_conn = function (i, dat) {
                if(dat == "1"){
                    //serial_comm(0, "QCM:QC:VOLT " + val, TaktTimeDelay, WriteTimeDelay, 0); comm.set_qc_Volt(volt);                  // QCM:QC:VOLT 9---设定输出电压
                    interface.setSerialSend(0, "QCM:QC:VOLT " + volt, "qc2_qc3_qcm_qc_volt", obj.delay1, obj.delay2, obj.overDelay);
                    window.qc2_qc3_qcm_qc_volt = function (a) {
                        //serial_comm(0, "QCM:FUNC " + val, TaktTimeDelay, WriteTimeDelay, 0); comm.set_qc_Func("QCFIX");              // QCM:FUNC QCFIX--选择定点模式并触发输出
                        interface.setSerialSend(0, "QCM:FUNC QCFIX", "qc2_qc3_qcm_func_qcfix", obj.delay1, obj.delay2, obj.overDelay);
                        window.qc2_qc3_qcm_func_qcfix = function (a) {
                            //serial_comm(0, "MODE " + mode, TaktTimeDelay, WriteTimeDelay, 0); comm.set_LimitMode("CURRent");         // MODE CURR-------选择恒流模式
                            interface.setSerialSend(0, "MODE CURRent", "qc2_qc3_set_mode_current", obj.delay1, obj.delay2, obj.overDelay);
                            window.qc2_qc3_set_mode_current = function (a) {
                                //serial_comm(0, cmd_str, TaktTimeDelay, WriteTimeDelay, 0); comm.set_LimitValue("CURR " + curr);    // CURR 1A---------恒流值为1A
                                interface.setSerialSend(0, "CURR " + curr, "qc2_qc3_set_curr", obj.delay1, obj.delay2, obj.overDelay);
                                window.qc2_qc3_set_curr = function (a) {
                                    //serial_comm(0, "INPut " + on, TaktTimeDelay, WriteTimeDelay, 0); comm.set_OnOff("ON");                   // INPUT ON--------启动带载
                                    interface.setSerialSend(0, "INPut ON", "qc2_qc3_set_input_on", obj.delay1, obj.delay2, obj.overDelay);
                                    window.qc2_qc3_set_input_on = function(a){
                                        // comm.set_OnOff("OFF");                  // INPUT OFF-------关闭带载
                                        // comm.set_qc_Prot("NULL");               // QCM:PROT NULL---退出快充协议
                                        layer.close(loading);
                                        layer.msg("<h1>设置完成</h1>"); //layer.msg("设置完成");
                                    }
                                }
                            }
                        }
                    }
                }else{
                    if(++conn_cnt < 100){qc2_qc3_qcm_prot();}else{layer.close(loading); layer.msg("<h1>应答超时</h1>");}
                }//握手返回异常
            }
        }
    }

    function qc3_qc4_StepTest(mode, start_volt, step_volt, stop_volt, step_time, curr){    //QC2.0 QC3.0
        let conn_cnt = 0;
        let loading = layer.load(2, {time: 10000});
        //serial_comm(0, "QCM:PROT " + val, TaktTimeDelay, WriteTimeDelay, 0); comm.set_qc_Prot(mode);                      // QCM:PROT QC3        设置快充协议
        interface.setSerialSend(0, "QCM:PROT " + mode, "qc3_qc4_qcm_prot", obj.delay1, obj.delay2, obj.overDelay);
        window.qc3_qc4_qcm_prot = function (a) {
            // QCM:CONN? ------检查握手状态，在返回值为1时，继续发送指令
            //serial_comm(0, "QCM:CONN?", TaktTimeDelay, WriteTimeDelay, 3); var dat = null; for(var i=0; i<10;i++){dat = comm.get_qc_Conn();if(dat.sta == "ok" && dat.val == "1"){break;}}
            interface.getSerialComm(0, "QCM:CONN?", "qc3_qc4_qcm_conn", TaktTimeDelay, OverTimeDelay);
            window.qc3_qc4_qcm_conn = function (i, dat) {
                if( dat == "1"){
                    //serial_comm(0, "QCM:QC: STAR " + val, TaktTimeDelay, WriteTimeDelay, 0); comm.set_qc_StartVolt(start_volt);      // QCM:QC:STAR 5       设定起始电压：5V
                    interface.setSerialSend(0, "QCM:QC: STAR " + start_volt, "qc3_qc4_qcm_qc_star", obj.delay1, obj.delay2, obj.overDelay);
                    window.qc3_qc4_qcm_qc_star = function (a) {
                        //serial_comm(0, "QCM:QC:STEP " + val, TaktTimeDelay, WriteTimeDelay, 0); comm.set_qc_StepVolt(step_volt);        // QCM:QC:STEP 0.2     设定步进电压：0.2V
                        interface.setSerialSend(0, "QCM:QC:STEP " + step_volt, "qc3_qc4_qcm_qc_step", obj.delay1, obj.delay2, obj.overDelay);
                        window.qc3_qc4_qcm_qc_step = function (a) {
                            //serial_comm(0, "QCM:QC:END " + val, TaktTimeDelay, WriteTimeDelay, 0); comm.set_qc_StopVolt(stop_volt);        // QCM:QC:END 12       设定结束电压：12V
                            interface.setSerialSend(0, "QCM:QC:END " + stop_volt, "qc3_qc4_qcm_qc_end", obj.delay1, obj.delay2, obj.overDelay);
                            window.qc3_qc4_qcm_qc_end = function (a) {
                                //serial_comm(0, "QCM:QC:DWELl " + val, TaktTimeDelay, WriteTimeDelay, 0); comm.set_qc_StepTime(step_time);        // QCM:QC:DWEL 0.1     设定步进时间：0.1s    步进时间 = 步进电压÷0.2×0.1 s
                                interface.setSerialSend(0, "QCM:QC:DWELl " + step_time, "qc3_qc4_qcm_qc_dwel1", obj.delay1, obj.delay2, obj.overDelay);
                                window.qc3_qc4_qcm_qc_dwel1 = function (a) {
                                    //serial_comm(0, "QCM:QC:TRIGger " + val, TaktTimeDelay, WriteTimeDelay, 0); comm.set_qc_Trig("1");                 // QCM:QC:TRIG 1       设定触发方式：自动触发
                                    interface.setSerialSend(0, "QCM:QC:TRIGger 1", "qc3_qc4_qcm_qc_trigger1", obj.delay1, obj.delay2, obj.overDelay);
                                    window.qc3_qc4_qcm_qc_trigger1 = function (a) {
                                        //serial_comm(0, "QCM:MODE " + val, TaktTimeDelay, WriteTimeDelay, 0); comm.set_qc_mode("QCSTEP");           // QCM:MODE QCSTEP     设定快充模式：步进模式
                                        interface.setSerialSend(0, "QCM:MODE QCSTEP", "qc3_qc4_qcm_mode_qcstep", obj.delay1, obj.delay2, obj.overDelay);
                                        window.qc3_qc4_qcm_mode_qcstep = function (a) {
                                            //serial_comm(0, "QCM:INP " + val, TaktTimeDelay, WriteTimeDelay, 0); comm.set_qc_OnOff("ON");              // QCM:INP ON          启动步进测试
                                            interface.setSerialSend(0, "QCM:INP ON", "qc3_qc4_qcm_inp_on", obj.delay1, obj.delay2, obj.overDelay);
                                            window.qc3_qc4_qcm_inp_on = function (a) {
                                                //serial_comm(0, "MODE " + mode, TaktTimeDelay, WriteTimeDelay, 0); comm.set_LimitMode("CURRent");       // MODE CURR           选择恒流模式
                                                interface.setSerialSend(0, "MODE CURRent", "qc3_qc4_mode_current", obj.delay1, obj.delay2, obj.overDelay);
                                                window.qc3_qc4_mode_current = function (a) {
                                                    //serial_comm(0, cmd_str, TaktTimeDelay, WriteTimeDelay, 0); comm.set_LimitValue("CURR " + curr); // CURR 1A             恒流值为1A
                                                    interface.setSerialSend(0, "CURR " + curr, "qc3_qc4_get_curr", obj.delay1, obj.delay2, obj.overDelay);
                                                    window.qc3_qc4_get_curr = function (a) {
                                                        //serial_comm(0, "INPut " + on, TaktTimeDelay, WriteTimeDelay, 0); comm.set_OnOff("ON");                // INPUT ON            启动带载
                                                        interface.setSerialSend(0, "INPut ON", "qc3_qc4_input_on", obj.delay1, obj.delay2, obj.overDelay);
                                                        window.qc3_qc4_input_on = function(a){
                                                            // comm.set_OnOff("OFF");               // INPUT OFF           关闭带载
                                                            // comm.set_qc_Prot("NULL");            // QCM:PROT NULL       退出快充协议
                                                            layer.close(loading);
                                                            layer.msg("<h1>设置完成</h1>");
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }else{
                    if(++conn_cnt < 100){qc3_qc4_qcm_prot();}else{layer.close(loading); layer.msg("<h1>应答超时</h1>");}
                }//握手返回异常
            }
        }
    }

    function qp2_dotTest(mode, volt, curr){     //QC2.0 QC3.0
        let conn_cnt = 0;
        let loading = layer.load(2, {time: 10000});
        //serial_comm(0, "QCM:PROT " + val, TaktTimeDelay, WriteTimeDelay, 0); comm.set_qc_Prot(mode);                      // QCM:PROT QC2----设置快充协议
        interface.setSerialSend(0, "QCM:PROT " + mode, "qp2_qcm_prot", obj.delay1, obj.delay2, obj.overDelay);
        window.qp2_qcm_prot = function (a) {
            // QCM:CONN? ------检查握手状态，在返回值为1时，继续发送指令
            //serial_comm(0, "QCM:CONN?", TaktTimeDelay, WriteTimeDelay, 3);  var dat = null; for(var i=0; i<100;i++){dat = comm.get_qc_Conn();if(dat.sta == "ok" && dat.val == "1"){break;}}
            interface.getSerialComm(0, "QCM:CONN?", "qp2_qcm_conn", TaktTimeDelay, OverTimeDelay);
            window.qp2_qcm_conn = function (i, dat) {
                if(dat == "1"){
                    //serial_comm(0, "QCM:PE:VOLTage " + val, TaktTimeDelay, WriteTimeDelay, 0); comm.set_qc_PeVolt(volt);                // QCM:PE:VOLTage 5--设定输出电压
                    interface.setSerialSend(0, "QCM:PE:VOLTage " + volt, "qp2_qcm_pe_voltage", obj.delay1, obj.delay2, obj.overDelay);
                    window.qp2_qcm_pe_voltage = function (a) {
                        //serial_comm(0, "QCM:FUNC " + val, TaktTimeDelay, WriteTimeDelay, 0); comm.set_qc_Func("PEFIX");              // QCM:FUNC PEFIX--选择定点模式并触发输出
                        interface.setSerialSend(0, "QCM:FUNC PEFIX", "qp2_qcm_func_pefix", obj.delay1, obj.delay2, obj.overDelay);
                        window.qp2_qcm_func_pefix = function (a) {
                            //serial_comm(0, "MODE " + mode, TaktTimeDelay, WriteTimeDelay, 0); comm.set_LimitMode("CURRent");         // MODE CURR-------选择恒流模式
                            interface.setSerialSend(0, "MODE CURRent", "qp2_mode_current", obj.delay1, obj.delay2, obj.overDelay);
                            window.qp2_mode_current = function (a) {
                                //serial_comm(0, cmd_str, TaktTimeDelay, WriteTimeDelay, 0); comm.set_LimitValue("CURR " + curr);    // CURR 1A---------恒流值为1A
                                interface.setSerialSend(0, "CURR " + curr, "qp2_get_curr", obj.delay1, obj.delay2, obj.overDelay);
                                window.qp2_get_curr = function (a) {
                                    //serial_comm(0, "INPut " + on, TaktTimeDelay, WriteTimeDelay, 0); comm.set_OnOff("ON");                   // INPUT ON--------启动带载
                                    interface.setSerialSend(0, "INPut ON", "qp2_set_input_on", obj.delay1, obj.delay2, obj.overDelay);
                                    window.qp2_set_input_on = function(a){
                                        // comm.set_OnOff("OFF");                  // INPUT OFF-------关闭带载
                                        // comm.set_qc_Prot("NULL");               // QCM:PROT NULL---退出快充协议
                                        layer.close(loading);
                                        layer.msg("<h1>设置完成</h1>");
                                    }
                                }
                            }
                        }
                    }
                }else{
                    if(++conn_cnt < 100){qp2_qcm_prot();}else{layer.close(loading); layer.msg("<h1>应答超时</h1>");}
                }//握手返回异常
            }
        }
    }

    function pd2_pd3DotTest(mode, volt_num, out_volt, out_curr, curr){
        let conn_cnt = 0;
        let loading = layer.load(2, {time: 10000});
        //serial_comm(0, "QCM:PROT " + val, TaktTimeDelay, WriteTimeDelay, 0); comm.set_qc_Prot(mode);                      // QCM:PROT PD3         设置快充协议
        interface.setSerialSend(0, "QCM:PROT " + mode, "pd2_pd3_qcm_prot", obj.delay1, obj.delay2, obj.overDelay);
        window.pd2_pd3_qcm_prot = function (a) {
            // QCM:CONN? ------检查握手状态，在返回值为1时，继续发送指令
            //serial_comm(0, "QCM:CONN?", TaktTimeDelay, WriteTimeDelay, 3);   var dat = null; for(var i=0; i<10;i++){dat = comm.get_qc_Conn();if(dat.sta == "ok" && dat.val == "1"){break;}}
            interface.getSerialComm(0, "QCM:CONN?", "pd2_pd3_qcm_conn", TaktTimeDelay, OverTimeDelay);
            window.pd2_pd3_qcm_conn = function (i, dat) {
                if(dat == "1"){
                    //serial_comm(0, "QCM:PDO:COUN?", TaktTimeDelay, WriteTimeDelay, 3); var dat = comm.get_qc_PdoCoun();        // QCM:PDO:COUN?        查询PD电源电压对象的数量(该指令非必需)
                    interface.getSerialComm(0, "QCM:PDO:COUN?", "pd2_pd3_pdo_coun", TaktTimeDelay, OverTimeDelay);
                    window.pd2_pd3_pdo_coun = function (i, dat) {
                        //serial_comm(0, "QCM:PDO:LIST?", TaktTimeDelay, WriteTimeDelay, 3); var dat = comm.get_qc_PdoList();        // QCM:PDO:LIST?        查询PD电源电压列表(该指令非必需)
                        interface.getSerialComm(0, "QCM:PDO:LIST?", "pd2_pd3_pdo_list", TaktTimeDelay, OverTimeDelay);
                        window.pd2_pd3_pdo_list = function (i, dat) {
                            //serial_comm(0, "QCM:PD:PDON " + val, TaktTimeDelay, WriteTimeDelay, 0); comm.set_qc_UpdPdon(volt_num);          // QCM:PD:PDON 2        设定电压对象序号：1
                            interface.setSerialSend(0, "QCM:PD:PDON " + volt_num, "pd2_pd3_pd_pdon", obj.delay1, obj.delay2, obj.overDelay);
                            window.pd2_pd3_pd_pdon = function (a) {
                                //serial_comm(0, "QCM:PD:VOLTage " + val, TaktTimeDelay, WriteTimeDelay, 0); comm.set_qc_UpdVolt(out_volt);          // QCM:PD:VOLT 9        设定输出电压：9V
                                interface.setSerialSend(0, "QCM:PD:VOLTage " + out_volt, "pd2_pd3_pd_voltage", obj.delay1, obj.delay2, obj.overDelay);
                                window.pd2_pd3_pd_voltage = function (a) {
                                    //serial_comm(0, "QCM:PD:CURRent " + val, TaktTimeDelay, WriteTimeDelay, 0); comm.set_qc_UpdCurr(out_curr);          // QCM:PD:CURR 2        设定输出电流：2A
                                    interface.setSerialSend(0, "QCM:PD:CURRent " + out_curr, "pd2_pd3_pd_current", obj.delay1, obj.delay2, obj.overDelay);
                                    window.pd2_pd3_pd_current = function (a) {
                                        //serial_comm(0, "QCM:MODE " + val, TaktTimeDelay, WriteTimeDelay, 0); comm.set_qc_mode("PDFIX");             // QCM:MODE PDFIX       选择定点模式并触发输出
                                        interface.setSerialSend(0, "QCM:MODE PDFIX", "pd2_pd3_mode_pdfix", obj.delay1, obj.delay2, obj.overDelay);
                                        window.pd2_pd3_mode_pdfix = function (a) {
                                            //serial_comm(0, "MODE " + mode, TaktTimeDelay, WriteTimeDelay, 0); comm.set_LimitMode("CURRent");        // MODE CURR            选择恒流模式
                                            interface.setSerialSend(0, "MODE CURRent", "pd2_pd3_mode_current", obj.delay1, obj.delay2, obj.overDelay);
                                            window.pd2_pd3_mode_current = function (a) {
                                                //serial_comm(0, cmd_str, TaktTimeDelay, WriteTimeDelay, 0); comm.set_LimitValue("CURR " + curr);  // CURR 1A              恒流值为1A
                                                interface.setSerialSend(0, "CURR " + curr, "pd2_pd3_set_curr", obj.delay1, obj.delay2, obj.overDelay);
                                                window.pd2_pd3_set_curr = function (a) {
                                                    //serial_comm(0, "INPut " + on, TaktTimeDelay, WriteTimeDelay, 0); comm.set_OnOff("ON");                 // INPUT ON             启动带载
                                                    interface.setSerialSend(0, "INPut ON", "pd2_pd3_input_on", obj.delay1, obj.delay2, obj.overDelay);
                                                    window.pd2_pd3_input_on = function(a){
                                                        // comm.set_OnOff("OFF");                // INPUT OFF            关闭带载
                                                        // comm.set_qc_Prot("NULL");             // QCM:PROT NULL        退出快充协议
                                                        layer.close(loading);
                                                        layer.msg("<h1>设置完成</h1>");
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }else{
                    if(++conn_cnt < 100){pd2_pd3_qcm_prot();}else{layer.close(loading); layer.msg("<h1>应答超时</h1>");}
                }//握手返回异常
            }
        }
    }

    function dpdn_Test(mode, dpdn, curr){           //
        let conn_cnt = 0;
        let loading = layer.load(2, {time: 10000});
        //serial_comm(0, "QCM:PROT " + val, TaktTimeDelay, WriteTimeDelay, 0); comm.set_qc_Prot(mode);                      //
        interface.setSerialSend(0, "QCM:PROT " + mode, "dpdn_qcm_prot", obj.delay1, obj.delay2, obj.overDelay);
        window.dpdn_qcm_prot = function (a) {
            // QCM:CONN? ------检查握手状态，在返回值为1时，继续发送指令
            //serial_comm(0, "QCM:CONN?", TaktTimeDelay, WriteTimeDelay, 3);   var dat = null; for(var i=0; i<10;i++){dat = comm.get_qc_Conn();if(dat.sta == "ok" && dat.val == "1"){break;}}
            interface.getSerialComm(0, "QCM:CONN?", "dpdn_qcm_conn", TaktTimeDelay, OverTimeDelay);
            window.dpdn_qcm_conn = function (i, dat) {
                if(dat == "1"){
                    //serial_comm(0, "QCM:FUNC " + val, TaktTimeDelay, WriteTimeDelay, 0);comm.set_qc_Func("DPDN");              //
                    interface.setSerialSend(0, "QCM:FUNC DPDN", "dpdn_func_dpdn", obj.delay1, obj.delay2, obj.overDelay);
                    window.dpdn_func_dpdn = function (a) {
                        if(dpdn == "1"){
                            //serial_comm(0, "QCM:D+:SHORt " + val, TaktTimeDelay, WriteTimeDelay, 0); comm.set_qc_BcShort1("ON");                  //在BC1.2协议下对D+施加3.3V电压（对电源短路测试）QCM:D+:SHORt ON
                            interface.setSerialSend(0, "QCM:D+:SHORt ON", "dpdn_qcm_d_short_on", obj.delay1, obj.delay2, obj.overDelay);
                        }else if(dpdn == "2"){
                            //serial_comm(0, "QCM:D-:SHORt " + val, TaktTimeDelay, WriteTimeDelay, 0); comm.set_qc_BcShort2("ON");                  //BC1.2协议下对D-施加3.3V电压（对电源短路测试）QCM:D-:SHORt ON
                            interface.setSerialSend(0, "QCM:D-:SHORt ON", "dpdn_qcm_d_short_on", obj.delay1, obj.delay2, obj.overDelay);
                        }
                        window.dpdn_qcm_d_short_on = function (a) {
                            //serial_comm(0, "MODE " + mode, TaktTimeDelay, WriteTimeDelay, 0); comm.set_LimitMode("CURRent");         //
                            interface.setSerialSend(0, "MODE CURRent", "dpdn_mode_current", obj.delay1, obj.delay2, obj.overDelay);
                            window.dpdn_mode_current = function (a) {
                                //serial_comm(0, cmd_str, TaktTimeDelay, WriteTimeDelay, 0); comm.set_LimitValue("CURR " + curr);    //
                                interface.setSerialSend(0, "CURR " + curr, "dpdn_set_curr", obj.delay1, obj.delay2, obj.overDelay);
                                window.dpdn_set_curr = function (a) {
                                    //serial_comm(0, "INPut " + on, TaktTimeDelay, WriteTimeDelay, 0); comm.set_OnOff("ON");                   // INPUT ON--------启动带载
                                    interface.setSerialSend(0, "INPut ON", "dpdn_set_inpput_on", obj.delay1, obj.delay2, obj.overDelay);
                                    window.dpdn_set_inpput_on = function(a){
                                        layer.close(loading);
                                        layer.msg("<h1>设置完成</h1>");
                                    }
                                }
                            }
                        }
                    }
                }else{
                    if(++conn_cnt < 100){dpdn_qcm_prot();}else{layer.close(loading); layer.msg("<h1>应答超时</h1>");}
                }//握手返回异常
            }
        }
    }

    $("#FlowShape_Start").click(function () {
        if(select_is("#RadioButton_Select_QC2_img") == true){
            var clas = $("#Droplist_QC2_Class_input").val();
            var volt = $("#Droplist_QC2Volt_input").val().slice(0,-1);
            var curr = $("#TextField_QC2Current_input").val();
            if(clas == "CLASS A" && volt == "20V"){return layer.msg("<h1>CLASS A 不允许选20V</h1>");}
            qc2_qc3_dotTest("QC2", volt, curr);
        }
        else if(select_is("#RadioButton_Select_QC3_img") == true){//QC3.0
            if(select_is("#RadioButton_QC3_OFF_img") == true){
                var volt = $("#Droplist_QC3DotTestVolt_input").val().slice(0,-1);
                var curr = $("#TextField_QC3Current_input").val();
                var clas = $("#Droplist_QC3_Class_input").val();
                if(clas == "CLASS A" && volt == "20V"){return layer.msg("<h1>CLASS A 不允许选20V</h1>");}
                qc2_qc3_dotTest("QC3", volt , curr);
            }else if(select_is("#RadioButton_QC3_ON_img") == true){
                var start_volt = $("#TextField_QC3StartVolt_input").val();
                var step_volt  = $("#TextField_QC3StepVolt_input").val();
                var stop_volt  = $("#TextField_QC3StopVolt_input").val();
                var step_time  = $("#TextField_QC3StepTime_input").val();
                var curr       = $("#TextField_QC3Current_input").val();
                qc3_qc4_StepTest("QC3", start_volt, step_volt, stop_volt, step_time, curr);
            }
        }
        else if(select_is("#RadioButton_Select_QC4_img") == true){//QC4.0
            if(select_is("#RadioButton_QC4_OFF_img") == true){
                var volt = $("#Droplist_QC4DotTestVolt_input").val().slice(0,-1);
                var curr = $("#TextField_QC4Current_input").val();
                qc2_qc3_dotTest("QC4", volt, curr);
            }else if(select_is("#RadioButton_QC4_ON_img") == true){
                var start_volt = $("#TextField_QC4StartVolt_input").val();
                var step_volt  = $("#TextField_QC4StepVolt_input").val();
                var stop_volt  = $("#TextField_QC4StopVolt_input").val();
                var step_time  = $("#TextField_QC4StepTime_input").val();
                var curr       = $("#TextField_QC4Current_input").val();
                qc3_qc4_StepTest("QC4", start_volt, step_volt, stop_volt, step_time, curr);
            }
        }
        else if(select_is("#RadioButton_Select_PE2_img") == true){//PE2.0
            if(select_is("#RadioButton_PE2_OFF_img") == true){
                var volt = $("#Droplist_PEDotTestVolt_input").val().slice(0,-1);
                var curr = $("#TextField_PECurrent_input").val();
                qp2_dotTest("PE2", volt, curr);
            }else if(select_is("#RadioButton_PE2_ON_img") == true){
                var volt = $("#Droplist_PEStepVolt_input").val().slice(0,-1);
                var curr = $("#TextField_PECurrent_input").val();
                qp2_dotTest("PE2", volt, curr);
            }
        }
        else if(select_is("#RadioButton_Select_DPDN_img") == true){//DPDN
            var curr = $("#TextField_PDDNCurrent_input").val();
            var type = $("#Droplist_PDSupplyType_input").val();
            if(type == "D+短路测试"){
                dpdn_Test("BC12", "1", curr);
            }else if(type == "D-短路测试"){
                dpdn_Test("BC12", "2", curr);
            }else{
                dpdn_Test("BC12", "0", curr);
            }
        }
        else if(select_is("#RadioButton_Select_PD2_img") == true){//PD2.0
            var curr = $("#TextField_PDCurrent_input").val();
            var type = $("#Droplist_PDDotTestVolt_input").val();
            var out_volt = type.substring(type.indexOf(":") + 1, type.indexOf("V"));
            var out_curr = type.substring(type.indexOf("/") + 1, type.indexOf("A"));
            pd2_pd3DotTest("PD2", "1", out_volt, out_curr, curr);
        }
    });
    $("#FlowShape_Stop").click(function () {
        let loading = layer.load(2, {time: 10000});
        //serial_comm(0, "INPut " + on, TaktTimeDelay, WriteTimeDelay, 0); comm.set_OnOff("OFF");               // INPUT OFF           关闭带载
        //serial_comm(0, "QCM:PROT " + val, TaktTimeDelay, WriteTimeDelay, 0); comm.set_qc_Prot("NULL");            // QCM:PROT NULL       退出快充协议
        interface.setSerialSend(0, "INPut OFF", "FlowShape_Stop_Off", obj.delay1, obj.delay2, obj.overDelay);
        window.FlowShape_Stop_Off = function (a) {
            interface.setSerialSend(0, "QCM:PROT NULL", "FlowShape_Stop_Prot_Null", obj.delay1, obj.delay2, obj.overDelay);
            window.FlowShape_Stop_Prot_Null = function (a) {
                layer.close(loading);
                layer.msg("<h1>完成停止</h1>");
            }
        }
    });
    // $("#RadioButton_Select_PD2_img").click(function () {
    //     comm.set_qc_Prot("PD2");
    // });




    //如下为图表显示
    {
        var chart_qc = new eEhart("#FlowShape_QC_Chart",        "电流/电压", [{name: '电流'},{name: '电压'}], 1);

        function chart_data_add(num, data) {
            var select_ch = $("#Droplist_Channel_input").val();
            if(select_ch == "CH2"){
                chart_qc.add_data(1, num, data);
            }
            else{
                chart_qc.add_data(0, num, data);
            }
        }

        //导出表中所有输入数据
        $("#FlowShape_Export").click(function () {
            var str = JSON.stringify(chart_qc.option_data[0]);
            interface.saveFile(str, "QcTest");
        });

        //导入数据到表中
        $("#FlowShape_Import").click(function () {
            var json = JSON.parse(interface.readFile());
            if(json != false){
                chart_qc.option_data[0] = json;
                chart_qc.echart.setOption(chart_qc.option_data[0]);
            }
        });

        //水平滚动条联动
        function dataZoom(params){
            if(params.dataZoomId.indexOf("1") < 0){
                var end = 100,start = 0;
                if(params.start == undefined){
                    end = params.batch[0].end;
                    start = params.batch[0].start;
                }else{
                    end = params.end;
                    start = params.start;
                }
                chart_qc.option_data[chart_qc.chart_select].dataZoom[0].end = end;
                chart_qc.option_data[chart_qc.chart_select].dataZoom[0].start = start;
                chart_qc.echart.setOption(chart_qc.option_data[chart_qc.chart_select]);
            }
        }
        chart_qc.echart.on('dataZoom', function (params) {
            dataZoom(params);
        });

        var seriesIndex = 0;
        $("#FlowShape_QC_Chart").append('<div id="div_colpick_show" style="padding-left: 0px; padding-top: 0px"></div>');
        chart_qc.echart.on('click', function (params) {
            seriesIndex = params.seriesIndex;
            const box = document.querySelector("#div_colpick_show");
            $(box).colpick({
                onSubmit: (hsb, hex, rgb, el, bySetColor) => {
                    // layer.msg(hex);
                    chart_qc.option_data[chart_qc.chart_select].series[seriesIndex].color = "#" + hex;
                    chart_qc.echart.setOption(chart_qc.option_data[chart_qc.chart_select]);
                    $(box).colpickHide();
                }
            }); // 初始化
            $(box).colpickShow(); // 显示
        });
    }


    //input值恢复与定时备份
    {
        var userAgent = myBrowser().indexOf("WOW64");
        function stringToBool(str) {
            if(str == "True" || str == "true" || str == "TRUE"){
                return true;
            }
            return false;
        }
        if(userAgent >= 0){
            var id = "RadioButton_Select_QC2_img";     set_img_select("#" + id, stringToBool(interface.getIni("QcTest", id,  "False")));
            var id = "Droplist_QC2_Class_input";       $("#" + id).val(interface.getIni("QcTest", id,  "CLASS A"));      $("#" + id).attr("maxlength",5);
            var id = "Droplist_QC2Volt_input";          $("#" + id).val(interface.getIni("QcTest", id,  "5V"));     $("#" + id).attr("maxlength",5);
            var id = "TextField_QC2Current_input";     $("#" + id).val(interface.getIni("QcTest", id,  "1.00"));      $("#" + id).attr("maxlength",5);

            var id = "RadioButton_Select_QC3_img";     set_img_select("#" + id, stringToBool(interface.getIni("QcTest", id,  "False")));
            var id = "Droplist_QC3_Class_input";       $("#" + id).val(interface.getIni("QcTest", id,  "CLASS A"));      $("#" + id).attr("maxlength",5);
            var id = "TextField_QC3Current_input";     $("#" + id).val(interface.getIni("QcTest", id,  "1.000"));      $("#" + id).attr("maxlength",5);
            var id = "TextField_QC3StartVolt_input";   $("#" + id).val(interface.getIni("QcTest", id,  "5.000"));      $("#" + id).attr("maxlength",5);
            var id = "TextField_QC3StopVolt_input";    $("#" + id).val(interface.getIni("QcTest", id,  "9.000"));      $("#" + id).attr("maxlength",5);
            var id = "TextField_QC3StepVolt_input";    $("#" + id).val(interface.getIni("QcTest", id,  "0.500"));      $("#" + id).attr("maxlength",5);
            var id = "TextField_QC3StepTime_input";    $("#" + id).val(interface.getIni("QcTest", id,  "1.000"));      $("#" + id).attr("maxlength",5);
            var id = "Droplist_QC3DotTestVolt_input";  $("#" + id).val(interface.getIni("QcTest", id,  "9V"));      $("#" + id).attr("maxlength",5);
            var id = "RadioButton_QC3_ON_img";          set_img_select("#" + id, stringToBool(interface.getIni("QcTest", id,  "False")));
            var id = "RadioButton_QC3_OFF_img";         set_img_select("#" + id, stringToBool(interface.getIni("QcTest", id,  "False")));

            var id = "RadioButton_Select_QC4_img";     set_img_select("#" + id, stringToBool(interface.getIni("QcTest", id,  "False")));
            var id = "TextField_QC4Current_input";     $("#" + id).val(interface.getIni("QcTest", id,  "1.000"));      $("#" + id).attr("maxlength",5);
            var id = "TextField_QC4StartVolt_input";   $("#" + id).val(interface.getIni("QcTest", id,  "5.000 "));      $("#" + id).attr("maxlength",5);
            var id = "TextField_QC4StopVolt_input";    $("#" + id).val(interface.getIni("QcTest", id,  "9.000"));      $("#" + id).attr("maxlength",5);
            var id = "TextField_QC4StepVolt_input";    $("#" + id).val(interface.getIni("QcTest", id,  "0.500"));      $("#" + id).attr("maxlength",5);
            var id = "TextField_QC4StepTime_input";    $("#" + id).val(interface.getIni("QcTest", id,  "1.000"));      $("#" + id).attr("maxlength",5);
            var id = "Droplist_QC4DotTestVolt_input";  $("#" + id).val(interface.getIni("QcTest", id,  "9V"));      $("#" + id).attr("maxlength",5);
            var id = "RadioButton_QC4_ON_img";          set_img_select("#" + id, stringToBool(interface.getIni("QcTest", id,  "False")));
            var id = "RadioButton_QC4_OFF_img";         set_img_select("#" + id, stringToBool(interface.getIni("QcTest", id,  "False")));

            var id = "RadioButton_Select_PE2_img";     set_img_select("#" + id, stringToBool(interface.getIni("QcTest", id,  "False")));
            var id = "TextField_PECurrent_input";      $("#" + id).val(interface.getIni("QcTest", id,  "1.000"));      $("#" + id).attr("maxlength",5);
            var id = "Droplist_PEDotTestVolt_input";  $("#" + id).val(interface.getIni("QcTest", id,  "5.0V"));      $("#" + id).attr("maxlength",5);
            var id = "Droplist_PEStepVolt_input";     $("#" + id).val(interface.getIni("QcTest", id,  "5.0V"));      $("#" + id).attr("maxlength",5);
            var id = "RadioButton_PE2_ON_img";         set_img_select("#" + id, stringToBool(interface.getIni("QcTest", id,  "False")));
            var id = "RadioButton_PE2_OFF_img";        set_img_select("#" + id, stringToBool(interface.getIni("QcTest", id,  "False")));

            var id = "RadioButton_Select_DPDN_img";   set_img_select("#" + id, stringToBool(interface.getIni("QcTest", id,  "False")));
            var id = "TextField_PDDNCurrent_input";   $("#" + id).val(interface.getIni("QcTest", id,  "1.000"));      $("#" + id).attr("maxlength",5);
            var id = "Droplist_PDSupplyType_input";   $("#" + id).val(interface.getIni("QcTest", id,  "D+短路测试"));      $("#" + id).attr("maxlength",5);

            var id = "RadioButton_Select_PD2_img";     set_img_select("#" + id, stringToBool(interface.getIni("QcTest", id,  "False")));
            var id = "TextField_PDCurrent_input";      $("#" + id).val(interface.getIni("QcTest", id,  "1.000"));      $("#" + id).attr("maxlength",5);
            //var id = "Droplist_PDDotTestVolt_input";  $("#" + id).val(interface.getIni("QcTest", id,  "5.0V"));      $("#" + id).attr("maxlength",5);


            chart_qc.option_data[0].legend.selected = JSON.parse(interface.getIni("QcTest", "FlowShape_chart_qc_legend_selected",  "{}"));   chart_qc.echart.setOption(chart_qc.option_data[0]);

            for(var i=0; i<chart_qc.option_data[0].series.length; i++){
                chart_qc.option_data[0].series[i].color = interface.getIni("QcTest", "FlowShape_chart_qc_series" + i,  "#0000ff");
            }
            chart_qc.echart.setOption(chart_qc.option_data[0]);
        }
        // var tini = window.setInterval(function() {
        window.tini = function () {
            if(userAgent >= 0){
                var id = "RadioButton_Select_QC2_img";     interface.setIni("QcTest", id,       select_is("#" + id));
                var id = "Droplist_QC2_Class_input";        interface.setIni("QcTest", id,       $("#" + id).val());
                var id = "Droplist_QC2Volt_input";          interface.setIni("QcTest", id,       $("#" + id).val());
                var id = "TextField_QC2Current_input";     interface.setIni("QcTest", id,       $("#" + id).val());

                var id = "RadioButton_Select_QC3_img";      interface.setIni("QcTest", id,       select_is("#" + id));
                var id = "Droplist_QC3_Class_input";        interface.setIni("QcTest", id,       $("#" + id).val());
                var id = "TextField_QC3Current_input";      interface.setIni("QcTest", id,       $("#" + id).val());
                var id = "TextField_QC3StartVolt_input";   interface.setIni("QcTest", id,       $("#" + id).val());
                var id = "TextField_QC3StopVolt_input";     interface.setIni("QcTest", id,       $("#" + id).val());
                var id = "TextField_QC3StepVolt_input";     interface.setIni("QcTest", id,       $("#" + id).val());
                var id = "TextField_QC3StepTime_input";     interface.setIni("QcTest", id,       $("#" + id).val());
                var id = "Droplist_QC3DotTestVolt_input";   interface.setIni("QcTest", id,       $("#" + id).val());
                var id = "RadioButton_QC3_ON_img";            interface.setIni("QcTest", id,      select_is("#" + id));
                var id = "RadioButton_QC3_OFF_img";          interface.setIni("QcTest", id,       select_is("#" + id));

                var id = "RadioButton_Select_QC4_img";     interface.setIni("QcTest", id,       select_is("#" + id));
                var id = "TextField_QC4Current_input";     interface.setIni("QcTest", id,       $("#" + id).val());
                var id = "TextField_QC4StartVolt_input";   interface.setIni("QcTest", id,       $("#" + id).val());
                var id = "TextField_QC4StopVolt_input";    interface.setIni("QcTest", id,       $("#" + id).val());
                var id = "TextField_QC4StepVolt_input";    interface.setIni("QcTest", id,       $("#" + id).val());
                var id = "TextField_QC4StepTime_input";    interface.setIni("QcTest", id,       $("#" + id).val());
                var id = "Droplist_QC4DotTestVolt_input";  interface.setIni("QcTest", id,       $("#" + id).val());
                var id = "RadioButton_QC4_ON_img";          interface.setIni("QcTest", id,       select_is("#" + id));
                var id = "RadioButton_QC4_OFF_img";         interface.setIni("QcTest", id,       select_is("#" + id));

                var id = "RadioButton_Select_PE2_img";     interface.setIni("QcTest", id,       select_is("#" + id));
                var id = "TextField_PECurrent_input";      interface.setIni("QcTest", id,       $("#" + id).val());
                var id = "Droplist_PEDotTestVolt_input";  interface.setIni("QcTest", id,       $("#" + id).val());
                var id = "Droplist_PEStepVolt_input";     interface.setIni("QcTest", id,       $("#" + id).val());
                var id = "RadioButton_PE2_ON_img";         interface.setIni("QcTest", id,       select_is("#" + id));
                var id = "RadioButton_PE2_OFF_img";        interface.setIni("QcTest", id,       select_is("#" + id));

                var id = "RadioButton_Select_DPDN_img";   interface.setIni("QcTest", id,       select_is("#" + id));
                var id = "TextField_PDDNCurrent_input";   interface.setIni("QcTest", id,       $("#" + id).val());
                var id = "Droplist_PDSupplyType_input";   interface.setIni("QcTest", id,       $("#" + id).val());

                var id = "RadioButton_Select_PD2_img";    interface.setIni("QcTest", id,       select_is("#" + id));
                var id = "TextField_PDCurrent_input";     interface.setIni("QcTest", id,       $("#" + id).val());
                var id = "Droplist_PDDotTestVolt_input";  interface.setIni("QcTest", id,       $("#" + id).val());

                interface.setIni("QcTest", "FlowShape_chart_qc_legend_selected",  JSON.stringify(chart_qc.echart.getOption().legend[0].selected));

                var opt = chart_qc.echart.getOption().series;
                for(var i=0; i<opt.length; i++){
                    interface.setIni("QcTest", "FlowShape_chart_qc_series" + i,  opt[i].color);
                }
            }
        }
    }

    //input值恢复与定时备份
    // {
    //     var userAgent = myBrowser().indexOf("WOW64");
    //     function stringToBool(str) {
    //         if(str == "True" || str == "true" || str == "TRUE"){
    //             return true;
    //         }
    //         return false;
    //     }
    //
    //     var id_list = [
    //         "RadioButton_Select_QC2_img",
    //         "Droplist_QC2_Class_input",
    //         "Droplist_QC2Volt_input",
    //         "TextField_QC2Current_input",
    //         "RadioButton_Select_QC3_img",
    //         "Droplist_QC3_Class_input",
    //         "TextField_QC3Current_input",
    //         "TextField_QC3StartVolt_input",
    //         "TextField_QC3StopVolt_input",
    //         "TextField_QC3StepVolt_input",
    //         "TextField_QC3StepTime_input",
    //         "Droplist_QC3DotTestVolt_input",
    //         "RadioButton_QC3_ON_img",
    //         "RadioButton_QC3_OFF_img",
    //         "RadioButton_Select_QC4_img",
    //         "TextField_QC4Current_input",
    //         "TextField_QC4StartVolt_input",
    //         "TextField_QC4StopVolt_input",
    //         "TextField_QC4StepVolt_input",
    //         "TextField_QC4StepTime_input",
    //         "Droplist_QC4DotTestVolt_input",
    //         "RadioButton_QC4_ON_img",
    //         "RadioButton_QC4_OFF_img",
    //         "RadioButton_Select_PE2_img",
    //         "TextField_PECurrent_input",
    //         "Droplist_PEDotTestVolt_input",
    //         "Droplist_PEStepVolt_input",
    //         "RadioButton_PE2_ON_img",
    //         "RadioButton_PE2_OFF_img",
    //         "RadioButton_Select_DPDN_img",
    //         "TextField_PDDNCurrent_input",
    //         "Droplist_PDSupplyType_input",
    //         "RadioButton_Select_PD2_img",
    //         "TextField_PDCurrent_input",
    //         "Droplist_PDDotTestVolt_input"
    //     ];
    //
    //
    //     if(userAgent >= 0){
    //         set_img_select("#" + id_list[0], stringToBool(interface.getIni("QcTest", id_list[0],  "False")));
    //         $("#" + id_list[1]).val(interface.getIni("QcTest", id_list[1],  "CLASS A"));        $("#" + id_list[1]).attr("maxlength",5);
    //         $("#" + id_list[2]).val(interface.getIni("QcTest", id_list[2],  "5V"));              $("#" + id_list[2]).attr("maxlength",5);
    //         $("#" + id_list[3]).val(interface.getIni("QcTest", id_list[3],  "1.00"));            $("#" + id_list[3]).attr("maxlength",5);
    //         set_img_select("#" + id_list[4], stringToBool(interface.getIni("QcTest", id_list[4],  "False")));
    //         $("#" + id_list[5]).val(interface.getIni("QcTest", id_list[5],  "CLASS A"));        $("#" + id_list[5]).attr("maxlength",5);
    //         $("#" + id_list[6]).val(interface.getIni("QcTest", id_list[6],  "1.000"));          $("#" + id_list[6]).attr("maxlength",5);
    //         $("#" + id_list[7]).val(interface.getIni("QcTest", id_list[7],  "5.000"));          $("#" + id_list[7]).attr("maxlength",5);
    //         $("#" + id_list[8]).val(interface.getIni("QcTest", id_list[8],  "9.000"));          $("#" + id_list[8]).attr("maxlength",5);
    //         $("#" + id_list[9]).val(interface.getIni("QcTest", id_list[9],  "0.500"));          $("#" + id_list[9]).attr("maxlength",5);
    //         $("#" + id_list[10]).val(interface.getIni("QcTest", id_list[10],  "1.000"));        $("#" + id_list[10]).attr("maxlength",5);
    //         $("#" + id_list[11]).val(interface.getIni("QcTest", id_list[11],  "9V"));            $("#" + id_list[11]).attr("maxlength",5);
    //         set_img_select("#" + id_list[12], stringToBool(interface.getIni("QcTest", id_list[12],  "False")));
    //         set_img_select("#" + id_list[13], stringToBool(interface.getIni("QcTest", id_list[13],  "False")));
    //         set_img_select("#" + id_list[14], stringToBool(interface.getIni("QcTest", id_list[14],  "False")));
    //         $("#" + id_list[15]).val(interface.getIni("QcTest", id_list[15],  "1.000"));         $("#" + id_list[15]).attr("maxlength",5);
    //         $("#" + id_list[16]).val(interface.getIni("QcTest", id_list[16],   "5.000"));        $("#" + id_list[16]).attr("maxlength",5);
    //         $("#" + id_list[17]).val(interface.getIni("QcTest", id_list[17],  "9.000"));         $("#" + id_list[17]).attr("maxlength",5);
    //         $("#" + id_list[18]).val(interface.getIni("QcTest", id_list[18],  "0.500"));         $("#" + id_list[18]).attr("maxlength",5);
    //         $("#" + id_list[19]).val(interface.getIni("QcTest", id_list[19],  "1.000"));         $("#" + id_list[19]).attr("maxlength",5);
    //         $("#" + id_list[20]).val(interface.getIni("QcTest", id_list[20],  "9V"));             $("#" + id_list[20]).attr("maxlength",5);
    //         set_img_select("#" + id_list[21], stringToBool(interface.getIni("QcTest", id_list[21],  "False")));
    //         set_img_select("#" + id_list[22], stringToBool(interface.getIni("QcTest", id_list[22],  "False")));
    //         set_img_select("#" + id_list[23], stringToBool(interface.getIni("QcTest", id_list[23],  "False")));
    //         $("#" + id_list[24]).val(interface.getIni("QcTest", id_list[24],  "1.000"));          $("#" + id_list[24]).attr("maxlength",5);
    //         $("#" + id_list[25]).val(interface.getIni("QcTest", id_list[25],  "5.0V"));           $("#" + id_list[25]).attr("maxlength",5);
    //         $("#" + id_list[26]).val(interface.getIni("QcTest", id_list[26],  "5.0V"));           $("#" + id_list[26]).attr("maxlength",5);
    //         set_img_select("#" + id_list[27], stringToBool(interface.getIni("QcTest", id_list[27],  "False")));
    //         set_img_select("#" + id_list[28], stringToBool(interface.getIni("QcTest", id_list[28],  "False")));
    //         set_img_select("#" + id_list[29], stringToBool(interface.getIni("QcTest", id_list[29],  "False")));
    //         $("#" + id_list[30]).val(interface.getIni("QcTest", id_list[30],  "1.000"));          $("#" + id_list[30]).attr("maxlength",5);
    //         $("#" + id_list[31]).val(interface.getIni("QcTest", id_list[31],  "D+短路测试"));     $("#" + id_list[31]).attr("maxlength",5);
    //         set_img_select("#" + id_list[32], stringToBool(interface.getIni("QcTest", id_list[32],  "False")));
    //         $("#" + id_list[33]).val(interface.getIni("QcTest", id_list[33],  "1.000"));          $("#" + id_list[33]).attr("maxlength",5);
    //         $("#" + id_list[34]).val(interface.getIni("QcTest", id_list[34],  "5.0V"));           $("#" + id_list[34]).attr("maxlength",5);
    //
    //         $("#" + id_list[0]).change(function () { interface.setIni("QcTest", id_list[0],       select_is("#" + id_list[0])) });
    //         $("#" + id_list[1]).change(function () { interface.setIni("QcTest", id_list[1],       $("#" + id_list[1]).val()); });
    //         $("#" + id_list[2]).change(function () { interface.setIni("QcTest", id_list[2],       $("#" + id_list[2]).val()); });
    //         $("#" + id_list[3]).change(function () { interface.setIni("QcTest", id_list[3],       $("#" + id_list[3]).val()); });
    //         $("#" + id_list[4]).change(function () { interface.setIni("QcTest", id_list[4],       select_is("#" + id_list[4])) });
    //         $("#" + id_list[5]).change(function () { interface.setIni("QcTest", id_list[5],       $("#" + id_list[5]).val()); });
    //         $("#" + id_list[6]).change(function () { interface.setIni("QcTest", id_list[6],       $("#" + id_list[6]).val()); });
    //         $("#" + id_list[7]).change(function () { interface.setIni("QcTest", id_list[7],       $("#" + id_list[7]).val()); });
    //         $("#" + id_list[8]).change(function () { interface.setIni("QcTest", id_list[8],       $("#" + id_list[8]).val()); });
    //         $("#" + id_list[9]).change(function () { interface.setIni("QcTest", id_list[9],       $("#" + id_list[9]).val()); });
    //         $("#" + id_list[10]).change(function () { interface.setIni("QcTest", id_list[10],     $("#" + id_list[10]).val());});
    //         $("#" + id_list[11]).change(function () { interface.setIni("QcTest", id_list[11],     $("#" + id_list[11]).val());});
    //         $("#" + id_list[12]).change(function () { interface.setIni("QcTest", id_list[12],     select_is("#" + id_list[12]))});
    //         $("#" + id_list[13]).change(function () { interface.setIni("QcTest", id_list[13],     select_is("#" + id_list[13]))});
    //         $("#" + id_list[14]).change(function () { interface.setIni("QcTest", id_list[14],     select_is("#" + id_list[14]))});
    //         $("#" + id_list[15]).change(function () { interface.setIni("QcTest", id_list[15],     $("#" + id_list[15]).val());});
    //         $("#" + id_list[16]).change(function () { interface.setIni("QcTest", id_list[16],     $("#" + id_list[16]).val());});
    //         $("#" + id_list[17]).change(function () { interface.setIni("QcTest", id_list[17],     $("#" + id_list[17]).val());});
    //         $("#" + id_list[18]).change(function () { interface.setIni("QcTest", id_list[18],     $("#" + id_list[18]).val());});
    //         $("#" + id_list[19]).change(function () { interface.setIni("QcTest", id_list[19],     $("#" + id_list[19]).val());});
    //         $("#" + id_list[20]).change(function () { interface.setIni("QcTest", id_list[20],     $("#" + id_list[20]).val());});
    //         $("#" + id_list[21]).change(function () { interface.setIni("QcTest", id_list[21],     select_is("#" + id_list[21]))});
    //         $("#" + id_list[22]).change(function () { interface.setIni("QcTest", id_list[22],     select_is("#" + id_list[22]))});
    //         $("#" + id_list[23]).change(function () { interface.setIni("QcTest", id_list[23],     select_is("#" + id_list[23]))});
    //         $("#" + id_list[24]).change(function () { interface.setIni("QcTest", id_list[24],     $("#" + id_list[24]).val());});
    //         $("#" + id_list[25]).change(function () { interface.setIni("QcTest", id_list[25],     $("#" + id_list[25]).val());});
    //         $("#" + id_list[26]).change(function () { interface.setIni("QcTest", id_list[26],     $("#" + id_list[26]).val());});
    //         $("#" + id_list[27]).change(function () { interface.setIni("QcTest", id_list[27],     select_is("#" + id_list[27]))});
    //         $("#" + id_list[28]).change(function () { interface.setIni("QcTest", id_list[28],     select_is("#" + id_list[28]))});
    //         $("#" + id_list[29]).change(function () { interface.setIni("QcTest", id_list[29],     select_is("#" + id_list[29]))});
    //         $("#" + id_list[30]).change(function () { interface.setIni("QcTest", id_list[30],     $("#" + id_list[30]).val());});
    //         $("#" + id_list[31]).change(function () { interface.setIni("QcTest", id_list[31],     $("#" + id_list[31]).val());});
    //         $("#" + id_list[32]).change(function () { interface.setIni("QcTest", id_list[32],     select_is("#" + id_list[32]))});
    //         $("#" + id_list[33]).change(function () { interface.setIni("QcTest", id_list[33],     $("#" + id_list[33]).val());});
    //         $("#" + id_list[34]).change(function () { interface.setIni("QcTest", id_list[34],     $("#" + id_list[34]).val());});
    //
    //     }
    // }

    interface.setTime([["t1", 30], ["t3", 1000], ["tini", 10000]]);

});




