Пример #1
0
pFace::pFace(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::pFace)
{
    ui->setupUi(this);

    QObject::connect(ui->LoadButton,SIGNAL(clicked()),this,SLOT(readScript()));
    QObject::connect(ui->RunButton,SIGNAL(clicked()),this,SLOT(tmpRunner()));
    //QObject::connect(ui->RunButton,SIGNAL(clicked()),this,SLOT(parseCommands()));
    QObject::connect(ui->ConnectButton,SIGNAL(clicked()),this,SLOT(connect2Port()));
    QObject::connect(ui->DisconnectButton,SIGNAL(clicked()),this,SLOT(closePort()));
    QObject::connect(ui->scanButton,SIGNAL(clicked()),this,SLOT(scanPorts()));

    QObject::connect(ui->homeX,SIGNAL(clicked()),this,SLOT(homeX()));
    QObject::connect(ui->homeY,SIGNAL(clicked()),this,SLOT(homeY()));
    QObject::connect(ui->homeZ,SIGNAL(clicked()),this,SLOT(homeZ()));
    QObject::connect(ui->homeAll,SIGNAL(clicked()),this,SLOT(homeAll()));

    scanPorts();
}
Пример #2
0
void arduinoThread::digitalPinChanged(const int & pinNum) {
    // note: this will throw tons of false positives on a bare mega, needs resistors
    if (curState == HOMING) {
        if (pinNum == X_LIMIT_PIN && ard.getDigital(X_LIMIT_PIN)) {
            stopX();
            homeY();
        }
        if (pinNum == Y_LIMIT_PIN && ard.getDigital(Y_LIMIT_PIN)) {
            stopY();
            homeZ();
        }
        if (pinNum == Z_LIMIT_PIN && ard.getDigital(Z_LIMIT_PIN)) {
            stopZ();
            curState = HOME;
        }
    }
    // if not homing or reseting and the switch is down, it's an error
    else if (curState != PREPRINT && curState != RESET && curState != HOME && curState != SHOOT_FACE) {
        if (ard.getDigital(pinNum) == ARD_HIGH){
            curState = ERROR;
        }
    }
}