添加自动测试命令 auto_test
V2.03 批检仪检测指令使用小板的错误码
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#include "cmd_cmdline.h"
|
||||
#include "interface/if_can.h"
|
||||
#include "elec/mystring.h"
|
||||
#include "prot/prot_pc.h"
|
||||
|
||||
|
||||
|
||||
@@ -175,11 +176,11 @@ static void mcu_cmdlines(QList<myarray> args)
|
||||
rate_slot(rate,str);
|
||||
});
|
||||
myarray data;
|
||||
if(cfg_->slave_scheme_ext==0){
|
||||
data=myarray((const char *)ccfg_->check_scheme()->slave_data,2048);
|
||||
}else{
|
||||
// if(cfg_->slave_scheme_ext==0){
|
||||
// data=myarray((const char *)ccfg_->check_scheme()->slave_data,2048);
|
||||
// }else{
|
||||
data=myarray((const char *)ccfg_->check_scheme(),ccfg_->check_scheme_size());
|
||||
}
|
||||
// }
|
||||
b->start(data);
|
||||
}
|
||||
}
|
||||
@@ -289,6 +290,33 @@ cmdline_export(cfginfo, cfginfo, get cfg info.);
|
||||
|
||||
|
||||
|
||||
void cmd_line_slots::auto_test(){
|
||||
if(syscfg()->auto_test>0){
|
||||
ProtPc *pc=protPc();
|
||||
pc->send_data_slot(0x37,myarray(1,char(0)));
|
||||
}
|
||||
}
|
||||
|
||||
void cmd_line_slots::auto_start()
|
||||
{
|
||||
command *c=command_start();
|
||||
if(timer_==nullptr){
|
||||
timer_=new QTimer();
|
||||
connect(timer_,&QTimer::timeout, this, &cmd_line_slots::auto_test);
|
||||
}
|
||||
if(syscfg()->auto_test>0){
|
||||
c->send("auto test start.");
|
||||
timer_->start(syscfg()->auto_test*1000);
|
||||
}else{
|
||||
c->send("auto test stop.");
|
||||
timer_->stop();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static cmd_line_slots *g_slot_=nullptr;
|
||||
|
||||
static void cfgset(QList<myarray> args){
|
||||
command *c=command_start();
|
||||
prot_slave *slave=protSlave();
|
||||
@@ -341,6 +369,15 @@ static void cfgset(QList<myarray> args){
|
||||
}else if(args[1]=="slave_scheme_ext"){
|
||||
cfg_->slave_scheme_ext=args[2].toInt();
|
||||
print_item("slave_scheme_ext",mystring::number(cfg_->slave_scheme_ext).toLocal8Bit())
|
||||
}else if(args[1]=="auto_test"){
|
||||
cfg_->auto_test=args[2].toInt();
|
||||
print_item("auto_test",mystring::number(cfg_->auto_test).toLocal8Bit())
|
||||
if(g_slot_==nullptr){
|
||||
g_slot_=new cmd_line_slots();
|
||||
}
|
||||
if(g_slot_!=nullptr){
|
||||
QTimer::singleShot(0, g_slot_, &cmd_line_slots::auto_start);
|
||||
}
|
||||
}
|
||||
}
|
||||
cmdline_export(cfgset, cfgset, set cfg info.);
|
||||
|
Reference in New Issue
Block a user