diff --git a/Servo/include/ServoController.h b/Servo/include/ServoController.h index b0b712f..d2915ce 100644 --- a/Servo/include/ServoController.h +++ b/Servo/include/ServoController.h @@ -11,14 +11,14 @@ private: const int SRV_START_ANGLE_INT_PART_REG = 2000; const int SRV_STOP_ANGLE_INT_PART_REG = 2001; const int SRV_AZIMUTH_SPEED_REG = 2002; - const int SRV_APPLY_SETTING_REG = 2004; - const int SRV_START_STOP_REG = 2005; - const int SRV_ZERO_OFFSET_ANGLE = 2007; - const int SRV_START_ANGLE_FRAC_PART_REG = 2010; - const int SRV_STOP_ANGLE_FRAC_PART_REG = 2011; - const int SRV_CALIBRATE_REG = 2013; - const int SRV_ENABLE_DRIVE_REG = 2017; - const int SRV_AZIMUTH_REG = 2030; + const int SRV_APPLY_SETTING_REG = 2003;//2004; + const int SRV_START_STOP_REG = 2004 ;//2005; + const int SRV_ZERO_OFFSET_ANGLE =2005;// 2007; + const int SRV_START_ANGLE_FRAC_PART_REG = 2006 ;//2010; + const int SRV_STOP_ANGLE_FRAC_PART_REG = 2007; // 2011; + const int SRV_CALIBRATE_REG = 2008 ;//2013; + const int SRV_ENABLE_DRIVE_REG =2009;// 2017; + const int SRV_AZIMUTH_REG = 2010; //2030; const double SRV_ANGLE_FACTOR = 100.0; const double SRV_SPEED_FACTOR = 1000.0; diff --git a/Servo/src/ModbusMaster.cpp b/Servo/src/ModbusMaster.cpp index 5cffa40..9c7bb3c 100644 --- a/Servo/src/ModbusMaster.cpp +++ b/Servo/src/ModbusMaster.cpp @@ -20,7 +20,7 @@ void ModbusMaster::init(ExpConfig& expConfig) connect(_modbusDevice, &QModbusClient::errorOccurred, [this](QModbusDevice::Error) { _initialized = false; - throw ServoException(_modbusDevice->errorString()); + connectionStateChanged(QModbusDevice::UnconnectedState); }); connect(_modbusDevice, @@ -46,6 +46,7 @@ void ModbusMaster::init(ExpConfig& expConfig) /*************************************************************************************************/ void ModbusMaster::connectionStateChanged(QModbusDevice::State state) { + if(state == QModbusDevice::UnconnectedState) { _connected = false; diff --git a/Test/MainWindow.cpp b/Test/MainWindow.cpp index 68b519b..6e9c4c4 100644 --- a/Test/MainWindow.cpp +++ b/Test/MainWindow.cpp @@ -217,6 +217,7 @@ void MainWindow::handleGetRequestFromServo() ui->showStopAngle->setText(QString::number(_servoControler.getStopAngle())); ui->showAngleOffset->setText(QString::number(_servoControler.getAngleOffset())); ui->showAzimuth->setText(QString::number(_servoControler.getAzimuth())); + ui->showServoError->setText(""); QThread::sleep(2); } catch(ServoException exp)