P417_host/dlg/diagnostic.aardio

225 lines
8.7 KiB
Plaintext

import win.ui;
/*DSG{{*/
var winform = win.form(text="aardio form";right=984;bottom=599;bgcolor=16777215)
winform.add(
btn1001={cls="button";text="默认会话";left=28;top=58;right=115;bottom=88;ah=1;aw=1;z=4};
btn1003={cls="button";text="扩展会话";left=126;top=58;right=213;bottom=88;ah=1;aw=1;z=5};
btnReadF187={cls="button";text="ECU零件号";left=234;top=183;right=321;bottom=213;ah=1;aw=1;z=18};
btnReadF18A={cls="button";text="供应商ID";left=37;top=183;right=124;bottom=213;ah=1;aw=1;z=19};
btnReadF190={cls="button";text="VIN码";left=135;top=183;right=222;bottom=213;ah=1;aw=1;z=20};
btnReadF193={cls="button";text="硬件版本";left=37;top=226;right=124;bottom=256;ah=1;aw=1;z=22};
btnReadF195={cls="button";text="软件版本";left=135;top=226;right=224;bottom=256;ah=1;aw=1;z=23};
btnReadF198={cls="button";text="维修店代码";left=135;top=141;right=222;bottom=171;ah=1;aw=1;z=21};
btnReadF199={cls="button";text="刷写日期";left=37;top=141;right=124;bottom=171;ah=1;aw=1;z=17};
btnReadPressTh={cls="button";text="读取";left=420;top=418;right=507;bottom=448;ah=1;aw=1;z=10};
btnWrite9001={cls="button";text="触发震动";left=45;top=332;right=284;bottom=362;ah=1;aw=1;z=24};
btnWrite9002={cls="button";text="写入参考电压";left=184;top=370;right=284;bottom=400;ah=1;aw=1;z=27};
btnWrite9003={cls="button";text="写入增益";left=183;top=408;right=284;bottom=438;ah=1;aw=1;z=28};
btnWritePressTh={cls="button";text="写入";left=524;top=418;right=611;bottom=448;ah=1;aw=1;z=11};
cb3E={cls="checkbox";text="3E保持";left=232;top=64;right=306;bottom=86;ah=1;aw=1;bgcolor=16777215;z=6};
cbbDacRef={cls="combobox";left=45;top=370;right=175;bottom=396;ah=1;aw=1;edge=1;font=LOGFONT(h=-18);items={};mode="dropdown";z=25};
cbbMotorGain={cls="combobox";left=45;top=408;right=175;bottom=434;ah=1;aw=1;edge=1;font=LOGFONT(h=-18);items={};mode="dropdown";z=26};
edLog={cls="edit";left=649;top=12;right=970;bottom=578;ah=1;aw=1;edge=1;font=LOGFONT(h=-18);multiline=1;z=12};
edPressTh1={cls="edit";text="500";left=531;top=97;right=605;bottom=124;ah=1;align="center";aw=1;edge=1;font=LOGFONT(h=-18);multiline=1;num=1;z=9};
edPressTh2={cls="edit";text="500";left=531;top=136;right=605;bottom=163;ah=1;align="center";aw=1;edge=1;font=LOGFONT(h=-18);multiline=1;num=1;z=37};
edPressTh3={cls="edit";text="500";left=531;top=175;right=605;bottom=202;ah=1;align="center";aw=1;edge=1;font=LOGFONT(h=-18);multiline=1;num=1;z=38};
edPressTh4={cls="edit";text="500";left=531;top=215;right=605;bottom=242;ah=1;align="center";aw=1;edge=1;font=LOGFONT(h=-18);multiline=1;num=1;z=39};
edPressTh5={cls="edit";text="500";left=531;top=254;right=605;bottom=281;ah=1;align="center";aw=1;edge=1;font=LOGFONT(h=-18);multiline=1;num=1;z=40};
edPressTh6={cls="edit";text="500";left=531;top=294;right=605;bottom=321;ah=1;align="center";aw=1;edge=1;font=LOGFONT(h=-18);multiline=1;num=1;z=41};
edPressTh7={cls="edit";text="500";left=531;top=333;right=605;bottom=360;ah=1;align="center";aw=1;edge=1;font=LOGFONT(h=-18);multiline=1;num=1;z=42};
edPressTh8={cls="edit";text="500";left=531;top=373;right=605;bottom=400;ah=1;align="center";aw=1;edge=1;font=LOGFONT(h=-18);multiline=1;num=1;z=43};
groupbox={cls="groupbox";text="标定";left=398;top=13;right=638;bottom=459;ah=1;aw=1;edge=1;z=1};
groupbox2={cls="groupbox";text="读取DID";left=22;top=109;right=331;bottom=275;ah=1;aw=1;edge=1;z=3};
groupbox3={cls="groupbox";text="震动";left=22;top=293;right=331;bottom=459;ah=1;aw=1;edge=1;z=2};
rbLeft={cls="radiobutton";text="左侧";left=61;top=15;right=115;bottom=35;ah=1;aw=1;bgcolor=16777215;checked=1;group=1;z=7};
rbPressTh={cls="radiobutton";text="压力";left=440;top=35;right=506;bottom=61;ah=1;aw=1;bgcolor=16777215;checked=1;group=1;z=15};
rbRight={cls="radiobutton";text="右侧";left=141;top=15;right=195;bottom=35;ah=1;aw=1;bgcolor=16777215;z=8};
rbTouchTh={cls="radiobutton";text="触摸";left=529;top=35;right=595;bottom=61;ah=1;aw=1;bgcolor=16777215;z=16};
static={cls="static";text="按键";left=445;top=67;right=500;bottom=96;ah=1;aw=1;font=LOGFONT(h=-18);transparent=1;z=13};
static10={cls="static";text="OK";left=420;top=371;right=521;bottom=398;center=1;font=LOGFONT(h=-18);transparent=1;z=36};
static2={cls="static";text="阈值";left=543;top=68;right=598;bottom=97;ah=1;aw=1;font=LOGFONT(h=-18);notify=1;transparent=1;z=14};
static3={cls="static";text="恢复/语音";left=420;top=97;right=521;bottom=124;center=1;font=LOGFONT(h=-18);transparent=1;z=29};
static4={cls="static";text="巡航/菜单";left=420;top=136;right=521;bottom=163;center=1;font=LOGFONT(h=-18);transparent=1;z=30};
static5={cls="static";text="取消/返回";left=420;top=175;right=521;bottom=202;center=1;font=LOGFONT(h=-18);transparent=1;z=31};
static6={cls="static";text="上";left=420;top=214;right=521;bottom=238;center=1;font=LOGFONT(h=-18);transparent=1;z=32};
static7={cls="static";text="下";left=420;top=254;right=521;bottom=281;center=1;font=LOGFONT(h=-18);transparent=1;z=33};
static8={cls="static";text="左";left=420;top=293;right=521;bottom=320;center=1;font=LOGFONT(h=-18);transparent=1;z=34};
static9={cls="static";text="右";left=420;top=332;right=521;bottom=359;center=1;font=LOGFONT(h=-18);transparent=1;z=35}
)
/*}}*/
LSW_KeyArr = {"恢复","巡航","取消","上","下","左","右","OK"};
RSW_KeyArr = {"语音","菜单","返回","上","下","左","右","OK"};
Motor_refArr = {"0x0 1V0","0x1 1V1","0x2 1V2","0x3 1V25","0x4 2V0","0x5 2V2","0x6 2V4","0x7 2V5"};
Motor_gainArr = {"Level0","Level1","Level2","Level3"}
winform.cbbDacRef.clear();
for(k,v in Motor_refArr){
winform.cbbDacRef.add(v);
}
winform.cbbDacRef.selIndex = 1;
winform.cbbMotorGain.clear();
for(k,v in Motor_gainArr){
winform.cbbMotorGain.add(v);
}
winform.cbbMotorGain.selIndex = 1;
import win.timer;
Diag3E_Timer = win.timer(winform,4000);
Diag3E_Timer.onTimer = function(){
CT_Diag3E();
}
Display = function(str){
var nowtime = time();
nowtime.format="%H:%M:%S";
winform.edLog.print(tostring(nowtime) + " " + str);
}
winform.rbLeft.oncommand = function(id,event){
CT_SetDiagID(0x720,0x620);
}
winform.rbRight.oncommand = function(id,event){
CT_SetDiagID(0x710,0x610);
}
winform.btn1001.oncommand = function(id,event){
CT_Diag10(0x01);
}
winform.btn1003.oncommand = function(id,event){
CT_Diag10(0x03);
}
winform.cb3E.oncommand = function(id,event){
if(winform.cb3E.checked == true){
Diag3E_Timer.enable();
}
else {
Diag3E_Timer.disable();
}
}
GetReadThResp = function(did){
var ret = CT_GetLastDiagResp();
if(ret == null){
return 0;
}
if(ret.sid == 0x62 && (#ret.data >= 4)){
var getdid = (ret.data[1]<<8) + ret.data[2];
if(getdid == did){
var val = (ret.data[3]<<8) + ret.data[4];
return val;
}
}
return 0;
}
winform.btnReadPressTh.oncommand = function(id,event){
CT_Diag10(0x01);
win.delay(20,1);
var didbase = winform.rbPressTh.checked?0x9020:0x9010;
for(name,ctrl in winform.eachControl("edit","edPressTh\d") ){
ctrl.text = 0//string.right(name,1);
var did = didbase + tonumber(string.right(name,1)) - 1;
CT_Diag22(did);
win.delay(20,1);
var ret = GetReadThResp(did);
if(ret != 0){
ctrl.text = ret;
}
}
}
winform.btnWritePressTh.oncommand = function(id,event){
CT_Diag10(0x03);
win.delay(20,1);
var didbase = winform.rbPressTh.checked?0x9020:0x9010;
for(name,ctrl in winform.eachControl("edit","edPressTh\d") ){
//ctrl.text = 0//string.right(name,1);
var did = didbase + tonumber(string.right(name,1)) - 1;
var val = tonumber(ctrl.text);
CT_Diag2EVal2B(did,val);
win.delay(20,1);
var ret = GetReadThResp(did);
if(ret != 0){
ctrl.text = ret;
}
}
}
winform.btnWrite9001.oncommand = function(id,event){
CT_Diag10(0x03);
win.delay(20,1);
CT_Diag2EVal1B(0x9001,0x01);
}
winform.btnWrite9002.oncommand = function(id,event){
CT_Diag10(0x03);
win.delay(20,1);
var val = winform.cbbDacRef.selIndex - 1;
CT_Diag2EVal1B(0x9002,val);
}
winform.btnWrite9003.oncommand = function(id,event){
CT_Diag10(0x03);
win.delay(20,1);
var val = winform.cbbMotorGain.selIndex - 1;
CT_Diag2EVal1B(0x9003,val);
}
winform.btnReadF199.oncommand = function(id,event){
CT_Diag10(0x01);
win.delay(20,1);
CT_Diag22(0xF199);
}
winform.btnReadF198.oncommand = function(id,event){
CT_Diag10(0x01);
win.delay(20,1);
CT_Diag22(0xF198);
}
winform.btnReadF18A.oncommand = function(id,event){
CT_Diag10(0x01);
win.delay(20,1);
CT_Diag22(0xF18A);
}
winform.btnReadF190.oncommand = function(id,event){
CT_Diag10(0x01);
win.delay(20,1);
CT_Diag22(0xF190);
}
winform.btnReadF187.oncommand = function(id,event){
CT_Diag10(0x01);
win.delay(20,1);
CT_Diag22(0xF187);
}
winform.btnReadF193.oncommand = function(id,event){
CT_Diag10(0x01);
win.delay(20,1);
CT_Diag22(0xF193);
}
winform.btnReadF195.oncommand = function(id,event){
CT_Diag10(0x01);
win.delay(20,1);
CT_Diag22(0xF195);
}
winform.group();
winform.show();
win.loopMessage();
return winform;