添加自动测试命令 auto_test
V2.03 批检仪检测指令使用小板的错误码
This commit is contained in:
@@ -49,4 +49,7 @@
|
||||
V2.02 0x48,0x30指令的返回数据中添加流水号信息
|
||||
0x11 注码命令所有芯片都使用16位uid
|
||||
添加自动测试命令0x44
|
||||
2024.01.04
|
||||
添加自动测试命令 auto_test
|
||||
V2.03 批检仪检测指令使用小板的错误码
|
||||
|
||||
|
@@ -6,7 +6,7 @@
|
||||
|
||||
|
||||
|
||||
#define BUILD_DATE "2024-01-03 17:45:14"
|
||||
#define BUILD_DATE "2024-01-04 14:43:54"
|
||||
|
||||
|
||||
|
||||
|
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"build_date": "2024-01-03 17:45:14",
|
||||
"build_date": "2024-01-04 14:43:54",
|
||||
"hard_version": "MHPZ2_V1.00",
|
||||
"private": [
|
||||
"info.json",
|
||||
"json.lua",
|
||||
"prints.lua"
|
||||
],
|
||||
"soft_version": "V2.02"
|
||||
"soft_version": "V2.03"
|
||||
}
|
||||
|
@@ -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.);
|
||||
|
@@ -3,19 +3,33 @@
|
||||
|
||||
|
||||
#include "QObject"
|
||||
#include "QTimer"
|
||||
#include "base/base.h"
|
||||
|
||||
|
||||
//class cmd_line_slots:public QObject
|
||||
//{
|
||||
// Q_OBJECT
|
||||
//public:
|
||||
// cmd_line_slots(){}
|
||||
// ~cmd_line_slots(){}
|
||||
//public slots:
|
||||
class cmd_line_slots:public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
cmd_line_slots(){
|
||||
timer_=nullptr;
|
||||
run_flag=0;
|
||||
}
|
||||
~cmd_line_slots(){
|
||||
if(timer_!=nullptr){
|
||||
delete timer_;
|
||||
timer_=nullptr;
|
||||
}
|
||||
}
|
||||
public slots:
|
||||
// void rate_slot(int rate,mystring str);
|
||||
// void end_slot(int addr,int ack,myarray data);
|
||||
//};
|
||||
void auto_test();
|
||||
void auto_start();
|
||||
protected:
|
||||
QTimer *timer_;
|
||||
int run_flag;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
@@ -661,23 +661,29 @@ int cmd_checker_check::dolater(int cmd, myarray data)
|
||||
slave_acked.append(myarray());
|
||||
}
|
||||
slave_acked_num=0;
|
||||
if(key_press()!=0){
|
||||
}else{
|
||||
busy=0;
|
||||
qWarning("key not pressed,check will not start.");
|
||||
return 2;
|
||||
}
|
||||
myarray moter_cmd=moter_ctrl("down");
|
||||
if(moter_cmd.size()==0){
|
||||
busy=0;
|
||||
qWarning("moter failed.");
|
||||
return 1;
|
||||
}
|
||||
if(key_press()!=0){
|
||||
}else{
|
||||
m4->set_irq_fun(moter_down_cb_fun,"moter down");
|
||||
emit send_to_m4_signal(moter_cmd);
|
||||
}else{
|
||||
qWarning("key not pressed,check will not start.");
|
||||
return 2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
int cmd_checker_check::key_press(){
|
||||
return cmd_m4_key_pressed();
|
||||
if(syscfg()->auto_test==0){
|
||||
return cmd_m4_key_pressed();
|
||||
}else{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@@ -140,6 +140,7 @@ myarray tran_slave_to_selfdev_check(myarray &data)
|
||||
r.append((len_for_each-1),char(0xff));
|
||||
}else{
|
||||
// 去掉应答位
|
||||
uint8_t slave_err=data[0];
|
||||
data.remove(0,1);
|
||||
myarray paramerr=ccfg_->returns_to_paramerr(data.right(return_num*2));
|
||||
r=data.left(8)+paramerr+data.right(return_num*2);
|
||||
@@ -147,6 +148,9 @@ myarray tran_slave_to_selfdev_check(myarray &data)
|
||||
uint8_t *d=(uint8_t *)data.data();
|
||||
elec_judge(ccfg_->check_scheme(),ccfg_->get_check_task_num(),
|
||||
d,d+8,d+16,&marerr,&suberr);
|
||||
if(marerr==0){
|
||||
marerr=slave_err;
|
||||
}
|
||||
r.insert(0,uint8_t(marerr));
|
||||
}
|
||||
return r;
|
||||
|
@@ -1 +1 @@
|
||||
V2.02 添加自动测试命令0x44
|
||||
V2.03 批检仪检测命令本地错误码为0时使用小板的错误码
|
Reference in New Issue
Block a user