重新构建的批检仪主板程序

This commit is contained in:
andy
2023-11-26 23:05:35 +08:00
parent b1b69d307f
commit 4a70f64693
29 changed files with 2565 additions and 64 deletions

70
prot_cmd/cmd_pc.cpp Normal file
View File

@@ -0,0 +1,70 @@
#include "cmd_pc.h"
#include "prot/prot_m4.h"
#include "prot/prot_pc.h"
#include "prot/prot_slave.h"
#include "base/mycfg.h"
#include "QDebug"
typedef struct{
int moter_count;
int moter_run;
}moter_def;
static moter_def g_moter;
myarray moter_ctrl(myarray op)
{
mycfg *cfg_=syscfg();
moter_def *moter=&g_moter;
myarray r;
if(op=="up"){
int count=0;
if(moter->moter_count>0){
moter->moter_run=1;
count=-moter->moter_count-100;
moter->moter_count=0;
QString s=QString("moter %1").arg(count);
r=s.toLocal8Bit();
}else{
qWarning()<<"moter count out of range."<<endl;
return r;
}
}else if(op=="down"){
int count=0;
if(moter->moter_count<cfg_->moter_count){
moter->moter_run=1;
count=cfg_->moter_count-moter->moter_count;
moter->moter_count+=count;
QString s=QString("moter %1").arg(count);
r=s.toLocal8Bit();
}else{
qWarning()<<"moter count out of range."<<endl;
return r;
}
}
return 0;
}
int selfdev_check::dolater(int cmd, myarray data)
{
prot_m4 *m4=protM4();
connect(this,send_to_m4_signal,m4,&prot_m4::send_data_slot);
m4->set_irq_fun([=](myarray data){
m4->del_irq_fun(nullptr,"moter ");
if(data=="down"){
// 这里开始检测
}
},"moter ");
emit send_to_m4_signal(moter_ctrl("up"));
return 0;
}

28
prot_cmd/cmd_pc.h Normal file
View File

@@ -0,0 +1,28 @@
#ifndef cmd_pc_h__
#define cmd_pc_h__
#include "prot/prot_pc.h"
// 检测 自研批检仪
class selfdev_check:public HandlePc {
Q_OBJECT
public:
selfdev_check():HandlePc(){}
~selfdev_check(){}
int dolater(int cmd, myarray data);
signals:
void send_to_m4_signal(myarray data);
};
#endif

12
prot_cmd/cmd_slave.cpp Normal file
View File

@@ -0,0 +1,12 @@
#include "cmd_slave.h"
int slave_check::start(myarray data)
{
return 0;
}

14
prot_cmd/cmd_slave.h Normal file
View File

@@ -0,0 +1,14 @@
#ifndef CMD_SLAVE_H
#define CMD_SLAVE_H
#include "prot/prot_slave.h"
class slave_check:public HandleSlave
{
public:
slave_check():HandleSlave(){}
int start(myarray data);
};
#endif // CMD_SLAVE_H