广播执行任务
This commit is contained in:
@@ -809,3 +809,57 @@ protpc_export(0x41, get_selfdev_set_rescv);
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 执行任务
|
||||||
|
int selfdev_runtask::dolater(int cmd, myarray data)
|
||||||
|
{
|
||||||
|
prot_slave *slave=protSlave();
|
||||||
|
mycfg *cfg_=syscfg();
|
||||||
|
busy=1;
|
||||||
|
// 这里开始检测
|
||||||
|
qDebug("set_rescv.");
|
||||||
|
emit send_data_signal(cmd,myarray(1,0));
|
||||||
|
HandleBoardCast *b=new slave_cmd();
|
||||||
|
bool ack=slave->set_boardcast_handle(cfg_->calc_slave_addrs(),b);
|
||||||
|
if(ack==false){
|
||||||
|
qWarning("handle is busy.");
|
||||||
|
busy=0;
|
||||||
|
}else{
|
||||||
|
connect(b,&HandleBoardCast::end_signal,this,&selfdev_runtask::slave_end_slot);
|
||||||
|
// 广播设置校准值,需使用新增命令
|
||||||
|
b->cmd=0x13;
|
||||||
|
b->start(data);
|
||||||
|
}
|
||||||
|
slave_acked.clear();
|
||||||
|
for(int i=0;i<cfg_->slave_num;i++){
|
||||||
|
slave_acked.append(myarray());
|
||||||
|
}
|
||||||
|
slave_acked_num=0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void selfdev_runtask::timeout()
|
||||||
|
{
|
||||||
|
busy=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void selfdev_runtask::slave_end_slot(int addr,int ack, slave_data data)
|
||||||
|
{
|
||||||
|
qDebug("selfdev set_rescv end.");
|
||||||
|
myarray r;
|
||||||
|
r.append(char(0));
|
||||||
|
emit send_data_signal(0x50,r);
|
||||||
|
busy=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HandlePc *get_selfdev_runtask(){
|
||||||
|
return new selfdev_runtask();
|
||||||
|
}
|
||||||
|
protpc_export(0x50, get_selfdev_runtask);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -251,4 +251,32 @@ signals:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 执行任务
|
||||||
|
class selfdev_runtask : public HandlePc
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
selfdev_runtask() : HandlePc() {
|
||||||
|
slave_acked_num=0;
|
||||||
|
}
|
||||||
|
~selfdev_runtask() {
|
||||||
|
}
|
||||||
|
int dolater(int cmd, myarray data);
|
||||||
|
void timeout();
|
||||||
|
public slots:
|
||||||
|
void slave_end_slot(int addr,int ack, slave_data data);
|
||||||
|
protected:
|
||||||
|
QList<myarray> slave_acked;
|
||||||
|
int slave_acked_num;
|
||||||
|
signals:
|
||||||
|
void send_to_m4_signal(myarray data);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user