void VESPERSMotorView::hideAndDisconnect()
{
	// If no control has been set yet, then don't touch connections that don't exist.
	if (control_){

		disconnect(stop_, SIGNAL(clicked()), control_, SLOT(stop()));
		disconnect(control_, SIGNAL(connected(bool)), this, SLOT(setEnabled(bool)));
		disconnect(control_, SIGNAL(unitsChanged(QString)), units_, SLOT(setText(QString)));
		disconnect(control_, SIGNAL(unitsChanged(QString)), jogUnits_, SLOT(setText(QString)));
		disconnect(control_, SIGNAL(setpointChanged(double)), this, SLOT(updateSetpoint(double)));
		disconnect(((AMPVwStatusControl *)control_)->movingPV(), SIGNAL(valueChanged(int)), this, SLOT(updateStatus(int)));

		if (type_ == Full){

			disconnect(setpoint_, SIGNAL(returnPressed()), this, SLOT(move()));
			disconnect(jogLeft_, SIGNAL(clicked()), this, SLOT(jogLeft()));
			disconnect(jogRight_, SIGNAL(clicked()), this, SLOT(jogRight()));
			setpoint_->hide();
			setpointLabel_->hide();
			jogLabel_->hide();
			jog_->hide();
			jogLeft_->hide();
			jogRight_->hide();
			units_->hide();
			jogUnits_->hide();
		}
		else if (type_ == Simple){

			disconnect(firstSetpointButton_, SIGNAL(clicked()), this, SLOT(moveToFirstSetpoint()));
			disconnect(secondSetpointButton_, SIGNAL(clicked()), this, SLOT(moveToSecondSetpoint()));
			firstSetpointButton_->hide();
			secondSetpointButton_->hide();
		}
	}
}
Exemple #2
0
void VESPERSMotorView::setControl(AMControl *control)
{
	// Disconnect everything first before starting over.
	hideAndDisconnect();

	control_ = control;
	type_ = Full;
	lowLimit_ = 0;
	highLimit_ = 0;
	if (QString::compare(control_->units(), "") == 0){

		units_->setText("mm");
		jogUnits_->setText("mm");
	}
	else{

		units_->setText(control_->units());
		jogUnits_->setText(control_->units());
	}
	title_->setText(control_->name());
	setpoint_->setText(QString::number(control_->value(), 'f', 3));
	jog_->setText(QString::number(0, 'f', 3));

	connect(stop_, SIGNAL(clicked()), control_, SLOT(stop()));
	connect(control_, SIGNAL(connected(bool)), this, SLOT(setEnabled(bool)));
	connect(control_, SIGNAL(unitsChanged(QString)), units_, SLOT(setText(QString)));
	connect(control_, SIGNAL(unitsChanged(QString)), jogUnits_, SLOT(setText(QString)));
	connect(control_, SIGNAL(setpointChanged(double)), this, SLOT(updateSetpoint(double)));
	connect(((AMPVwStatusControl *)control_)->movingPV(), SIGNAL(valueChanged(int)), this, SLOT(updateStatus(int)));

	connect(setpoint_, SIGNAL(returnPressed()), this, SLOT(move()));
	connect(jogLeft_, SIGNAL(clicked()), this, SLOT(jogLeft()));
	connect(jogRight_, SIGNAL(clicked()), this, SLOT(jogRight()));

	delete this->layout();

	QGridLayout *layout = new QGridLayout;
	layout->addWidget(title_, 0, 0, 1, 6);
	layout->addWidget(stop_, 1, 0);
	layout->addWidget(status_, 1, 1, 1, 5, Qt::AlignCenter);
	layout->addWidget(setpointLabel_, 2, 0, Qt::AlignRight);
	layout->addWidget(setpoint_, 2, 1, 1, 5);
	layout->addWidget(units_, 2, 5);
	layout->addWidget(jogLabel_, 3, 0, Qt::AlignRight);
	layout->addWidget(jogLeft_, 3, 1);
	layout->addWidget(jog_, 3, 2, 1, 3);
	layout->addWidget(jogUnits_, 3, 4);
	layout->addWidget(jogRight_, 3, 5);

	setpoint_->show();
	setpointLabel_->show();
	jogLabel_->show();
	jogLeft_->show();
	jog_->show();
	jogRight_->show();
	units_->show();
	jogUnits_->show();

	setLayout(layout);
}
void arduinoThread::reset(){
    // moves X, Y, and Z away one jog from the switches
    // does not move Syringe to avoid air bubbles
    curState = RESET;
    jogLeft();
    ofSleepMillis(20);
    jogUp();
    ofSleepMillis(20);
    jogForward();
//    ofSleepMillis(20);
//    plungerUp();
}