From 8e3d2e1c0f0a1c3d74e4edd14812e5e6ee7334ad Mon Sep 17 00:00:00 2001 From: sunbeam Date: Tue, 11 Apr 2023 17:06:18 +0800 Subject: [PATCH] v2.3 --- dlg/about.aardio | 1 + dlg/diagnostic.aardio | 70 ++++++++++++++++++++++++++++++++++++------- dlg/setting.aardio | 2 +- 配置文件.ini | 60 +++++++++++++++++++++++++++++++++++++ 4 files changed, 121 insertions(+), 12 deletions(-) create mode 100644 配置文件.ini diff --git a/dlg/about.aardio b/dlg/about.aardio index d5ed814..681dba4 100644 --- a/dlg/about.aardio +++ b/dlg/about.aardio @@ -11,6 +11,7 @@ static={cls="static";text="Static";left=21;top=17;right=458;bottom=340;transpare V2.0: 采用新界面 V2.1: 加入诊断,修复信号界面闪烁问题 V2.2: 加入全屏,修改标定/诊断逻辑 +V2.3: 标定增加预设配置 */ winform.button.oncommand = function(id,event){ diff --git a/dlg/diagnostic.aardio b/dlg/diagnostic.aardio index 6595b3c..dda66f6 100644 --- a/dlg/diagnostic.aardio +++ b/dlg/diagnostic.aardio @@ -4,6 +4,8 @@ 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}; +btnConvert={cls="button";text="转换";left=541;top=463;right=619;bottom=493;ah=1;aw=1;z=46}; +btnReadConfig={cls="button";text="读取配置";left=531;top=545;right=625;bottom=578;z=48}; 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}; @@ -15,20 +17,23 @@ btnReadPressTh={cls="button";text="读取";left=420;top=418;right=507;bottom=448 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}; +btnWriteConfig={cls="button";text="写入配置";left=415;top=545;right=510;bottom=570;hide=1;z=49}; 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}; +combobox={cls="combobox";left=408;top=508;right=629;bottom=534;edge=1;font=LOGFONT(h=-18);items={};mode="dropdown";z=47}; +edFactor={cls="edit";text="1.0";left=457;top=464;right=531;bottom=491;ah=1;align="center";aw=1;edge=1;font=LOGFONT(h=-18);z=44}; +edLog={cls="edit";left=649;top=12;right=970;bottom=586;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);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);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);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);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);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);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);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);num=1;z=43}; +groupbox={cls="groupbox";text="标定";left=398;top=13;right=638;bottom=586;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}; @@ -37,6 +42,7 @@ rbRight={cls="radiobutton";text="右侧";left=141;top=15;right=195;bottom=35;ah= 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}; +static11={cls="static";text="系数";left=411;top=463;right=449;bottom=490;center=1;font=LOGFONT(h=-18);transparent=1;z=45}; 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}; @@ -131,7 +137,7 @@ winform.btnReadPressTh.oncommand = function(id,event){ ctrl.text = 0//string.right(name,1); var did = didbase + tonumber(string.right(name,1)) - 1; CT_Diag22(did); - win.delay(20,1); + win.delay(30,1); var ret = GetReadThResp(did); if(ret != 0){ ctrl.text = ret; @@ -218,6 +224,48 @@ winform.btnReadF195.oncommand = function(id,event){ CT_Diag22(0xF195); } +winform.btnConvert.oncommand = function(id,event){ + for(name,ctrl in winform.eachControl("edit","edPressTh\d") ){ + var val = tonumber(ctrl.text); + var x = tonumber(winform.edFactor.text); + if(math.isFinite(x) && math.isFinite(val)){ + ctrl.text = math.round(x * val); + } + + } +} +import fsys.ini; +var ini_file = fsys.ini("\配置文件.ini"); +var allconfig = ini_file.readSectionNames(); +for(k,v in allconfig){ + winform.combobox.add(v); +} +winform.combobox.selIndex = 1; +winform.btnReadConfig.oncommand = function(id,event){ + var sec = ini_file.getSection(winform.combobox.selText); + winform.edPressTh1.text = sec.key1; + winform.edPressTh2.text = sec.key2; + winform.edPressTh3.text = sec.key3; + winform.edPressTh4.text = sec.上; + winform.edPressTh5.text = sec.下; + winform.edPressTh6.text = sec.左; + winform.edPressTh7.text = sec.右; + winform.edPressTh8.text = sec.OK; +} + +winform.btnWriteConfig.oncommand = function(id,event){ + var sec = ini_file.getSection("小节名称"); + sec.key1 = 500; + sec.key2 = 500; + sec.key3 = 500; + sec.上 = 500; + sec.下 = 500; + sec.左 = 500; + sec.右 = 500; + sec.OK = 500; + sec.save(); +} + winform.group(); winform.show(); diff --git a/dlg/setting.aardio b/dlg/setting.aardio index 48a5ec8..a4564c9 100644 --- a/dlg/setting.aardio +++ b/dlg/setting.aardio @@ -9,7 +9,7 @@ cbbDev={cls="combobox";left=127;top=123;right=376;bottom=149;dl=1;dt=1;edge=1;it plus={cls="plus";text="全屏";left=133;top=316;right=216;bottom=347;align="left";dl=1;dt=1;font=LOGFONT(h=-15);iconStyle={align="left";font=LOGFONT(h=-15;name='FontAwesome')};iconText='\uF0C8 ';notify=1;textPadding={left=24};z=7}; plus5={cls="plus";text="English";left=130;top=264;right=248;bottom=295;align="left";dl=1;dt=1;font=LOGFONT(h=-20;name='FontAwesome');iconStyle={align="left";font=LOGFONT(h=-16;name='FontAwesome');padding={left=5}};iconText='\uF0C8';notify=1;textPadding={left=30};z=1}; static={cls="static";left=128;top=65;right=441;bottom=81;transparent=1;z=6}; -static4={cls="static";text="V2.2 20230325";left=745;top=4;right=981;bottom=35;align="right";font=LOGFONT(h=-22);notify=1;transparent=1;z=4} +static4={cls="static";text="V2.3 20230411";left=745;top=4;right=981;bottom=35;align="right";font=LOGFONT(h=-22);notify=1;transparent=1;z=4} ) /*}}*/ diff --git a/配置文件.ini b/配置文件.ini new file mode 100644 index 0000000..55e638c --- /dev/null +++ b/配置文件.ini @@ -0,0 +1,60 @@ +[-ѹ2N] +key1=274 +key2=351 +key3=592 +=164 +=384 +=203 +=268 +OK=237 + +[-ѹ3N] +key1=499 +key2=559 +key3=906 +=272 +=620 +=335 +=422 +OK=351 + +[-ѹ4N] +key1=699 +key2=765 +key3=1121 +=416 +=831 +=478 +=584 +OK=510 + +[Ҳ-ѹ2N] +key1=333 +key2=315 +key3=518 +=203 +=339 +=248 +=205 +OK=221 + +[Ҳ-ѹ3N] +key1=567 +key2=510 +key3=821 +=350 +=546 +=382 +=328 +OK=348 + +[Ҳ-ѹ4N] +key1=740 +key2=743 +key3=1040 +=541 +=747 +=542 +=458 +OK=472 +