@@ -572,7 +572,7 @@ ToolTemplate *HarmonicCalibration::createAcquisitionWidget()
572572 displayLengthLayout->addWidget (displayLengthLabel);
573573 displayLengthLayout->addWidget (displayLengthLineEdit);
574574
575- QPushButton *resetYAxisButton = new QPushButton (" Reset Y-Axis Scale" , generalSection);
575+ QPushButton *resetYAxisButton = new QPushButton (" Reset Graph Scale" , generalSection);
576576 StyleHelper::BasicButton (resetYAxisButton);
577577 connect (resetYAxisButton, &QPushButton::clicked, this , &HarmonicCalibration::resetAcquisitionYAxisScale);
578578
@@ -2348,8 +2348,9 @@ void HarmonicCalibration::initializeADMT()
23482348 bool disabledECC = disableECC (true );
23492349 bool resetDIGIOSuccess = resetDIGIO ();
23502350 bool resetGENERALSuccess = resetGENERAL ();
2351+ bool resetHarmonicSuccess = clearHarmonicRegisters ();
23512352
2352- if (!disabledECC || !resetDIGIOSuccess || !resetGENERALSuccess) {
2353+ if (!disabledECC || !resetDIGIOSuccess || !resetGENERALSuccess || resetHarmonicSuccess ) {
23532354 StatusBarManager::pushMessage (" Failed initialize ADMT" );
23542355 }
23552356}
@@ -3197,7 +3198,7 @@ void HarmonicCalibration::getCalibrationSamples()
31973198{
31983199 if (resetCurrentPositionToZero ()) {
31993200 int step = floor (motorMicrostepPerRevolution / samplesPerCycle);
3200- if (! isMotorRotationClockwise)
3201+ if (isMotorRotationClockwise)
32013202 step = -step;
32023203 if (isPostCalibration) {
32033204 int currentSamplesCount = graphPostDataList.size ();
@@ -3307,6 +3308,7 @@ void HarmonicCalibration::resetMotorToZero()
33073308{
33083309 if (readMotorAttributeValue (ADMTController::MotorAttribute::CURRENT_POS, current_pos) == 0 ) {
33093310 if (current_pos != 0 ) {
3311+ setRampMode (true ); // Write to ramp mode in case of motor disable
33103312 writeMotorAttributeValue (ADMTController::MotorAttribute::ROTATE_VMAX,
33113313 convertRPStoVMAX (convertRPMtoRPS (fast_motor_rpm)));
33123314 writeMotorAttributeValue (ADMTController::MotorAttribute::TARGET_POS, 0 );
@@ -4172,6 +4174,7 @@ bool HarmonicCalibration::moveMotorToPosition(double &position, bool validate)
41724174
41734175void HarmonicCalibration::moveMotorContinuous ()
41744176{
4177+ stopResetMotorToZero ();
41754178 writeMotorAttributeValue (ADMTController::MotorAttribute::ROTATE_VMAX, rotate_vmax);
41764179 setRampMode (isMotorRotationClockwise);
41774180}
@@ -4200,7 +4203,11 @@ bool HarmonicCalibration::resetCurrentPositionToZero()
42004203 return success;
42014204}
42024205
4203- void HarmonicCalibration::stopMotor () { writeMotorAttributeValue (ADMTController::MotorAttribute::DISABLE, 1 ); }
4206+ void HarmonicCalibration::stopMotor ()
4207+ {
4208+ stopResetMotorToZero ();
4209+ writeMotorAttributeValue (ADMTController::MotorAttribute::DISABLE, 1 );
4210+ }
42044211
42054212int HarmonicCalibration::readMotorAttributeValue (ADMTController::MotorAttribute attribute, double &value)
42064213{
@@ -4234,9 +4241,9 @@ int HarmonicCalibration::readMotorRegisterValue(uint32_t address, uint32_t *valu
42344241
42354242void HarmonicCalibration::setRampMode (bool motorRotationClockwise)
42364243{
4237- // Ramp Mode 1: Clockwise, Ramp Mode 2: Counter- Clockwise
4244+ // Ramp Mode 1: Counter- Clockwise, Ramp Mode 2: Clockwise
42384245 isMotorRotationClockwise = motorRotationClockwise;
4239- int mode = isMotorRotationClockwise ? 1 : 2 ;
4246+ int mode = ! isMotorRotationClockwise ? 1 : 2 ;
42404247 writeMotorAttributeValue (ADMTController::MotorAttribute::RAMP_MODE, mode);
42414248}
42424249
@@ -4947,7 +4954,7 @@ void HarmonicCalibration::connectLineEditToMotorTurnCount(QLineEdit *lineEdit, i
49474954 if (ok && value >= min && value <= max && value != 0 ) {
49484955 readMotorAttributeValue (ADMTController::MotorAttribute::CURRENT_POS, current_pos);
49494956 int target_pos = value * motorMicrostepPerRevolution;
4950- if (! isMotorRotationClockwise)
4957+ if (isMotorRotationClockwise)
49514958 target_pos *= -1 ;
49524959
49534960 int final_pos = current_pos + target_pos;
0 commit comments