添加读取电机步数命令
添加新赋码仪检测命令,赋码仪注码命令 添加检测并写入流水号命令
This commit is contained in:
@@ -277,19 +277,32 @@ int selfdev_moter::dolater(int cmd, myarray data)
|
||||
prot_m4 *m4 = protM4();
|
||||
mycfg *cfg_=syscfg();
|
||||
connect(this, &selfdev_moter::send_to_m4_signal, m4, &prot_m4::send_data_slot);
|
||||
if(data[0]==0x02){
|
||||
emit send_to_m4_signal(moter_ctrl("up"));
|
||||
}else if(data[0]==0x03){
|
||||
emit send_to_m4_signal(moter_ctrl("down"));
|
||||
}else if(data[0]==0x01){
|
||||
if(data.size()>=3){
|
||||
int count=(data[1])|(data[2]<<8);
|
||||
cfg_->moter_count=20000+count;
|
||||
qDebug("moter count=%d",cfg_->moter_count);
|
||||
cfg_->save();
|
||||
if(cmd==0x40)
|
||||
{
|
||||
if(data[0]==0x02){
|
||||
emit send_to_m4_signal(moter_ctrl("up"));
|
||||
}else if(data[0]==0x03){
|
||||
emit send_to_m4_signal(moter_ctrl("down"));
|
||||
}else if(data[0]==0x01){
|
||||
if(data.size()>=3){
|
||||
int count=(data[1])|(data[2]<<8);
|
||||
cfg_->moter_count=20000+count;
|
||||
qDebug("moter count=%d",cfg_->moter_count);
|
||||
cfg_->save();
|
||||
}
|
||||
}
|
||||
emit send_data_signal(cmd,myarray(1,char(0)));
|
||||
return 0;
|
||||
}else if(cmd==0x47){
|
||||
myarray r;
|
||||
r.append(uint8_t(0));
|
||||
int count=cfg_->moter_count-20000;
|
||||
if(count<0) count=0;
|
||||
r.append(uint8_t(count&0xff));
|
||||
r.append(uint8_t((count>>8)&0xff));
|
||||
emit send_data_signal(cmd,r);
|
||||
return 0;
|
||||
}
|
||||
emit send_data_signal(0x40,myarray(1,char(0)));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -302,6 +315,15 @@ static HandlePc *get_selfdev_moter(){
|
||||
}
|
||||
|
||||
protpc_export(0x40, get_selfdev_moter);
|
||||
protpc_export(0x47, get_selfdev_moter);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -853,8 +875,13 @@ void selfdev_runtask::slave_end_slot(int addr,int ack, slave_data data)
|
||||
{
|
||||
qDebug("selfdev runtask end.");
|
||||
for(int i=0;i<data.size();i++){
|
||||
qDebug("index=%d",i);
|
||||
slave_ret slave=data.at(i);
|
||||
slave_acked.replace(slave.addr-1,slave.data);
|
||||
qDebug("index=%d end",i);
|
||||
// 数据的第一位是来源的地址
|
||||
slave.data.insert(0,slave.addr);
|
||||
slave_acked.replace(i,slave.data);
|
||||
// qDebug("index=%d end 2",i);
|
||||
slave_acked_num++;
|
||||
}
|
||||
if(cmd_pc_ret()!=0){
|
||||
|
Reference in New Issue
Block a user