Browse Source

Exception Whose occur stop socat is solved

AddStatus
nasicurious 3 years ago
parent
commit
4a58ffe9a8
  1. 16
      Servo/include/ServoController.h
  2. 3
      Servo/src/ModbusMaster.cpp
  3. 1
      Test/MainWindow.cpp

16
Servo/include/ServoController.h

@ -11,14 +11,14 @@ private:
const int SRV_START_ANGLE_INT_PART_REG = 2000; const int SRV_START_ANGLE_INT_PART_REG = 2000;
const int SRV_STOP_ANGLE_INT_PART_REG = 2001; const int SRV_STOP_ANGLE_INT_PART_REG = 2001;
const int SRV_AZIMUTH_SPEED_REG = 2002; const int SRV_AZIMUTH_SPEED_REG = 2002;
const int SRV_APPLY_SETTING_REG = 2004; const int SRV_APPLY_SETTING_REG = 2003;//2004;
const int SRV_START_STOP_REG = 2005; const int SRV_START_STOP_REG = 2004 ;//2005;
const int SRV_ZERO_OFFSET_ANGLE = 2007; const int SRV_ZERO_OFFSET_ANGLE =2005;// 2007;
const int SRV_START_ANGLE_FRAC_PART_REG = 2010; const int SRV_START_ANGLE_FRAC_PART_REG = 2006 ;//2010;
const int SRV_STOP_ANGLE_FRAC_PART_REG = 2011; const int SRV_STOP_ANGLE_FRAC_PART_REG = 2007; // 2011;
const int SRV_CALIBRATE_REG = 2013; const int SRV_CALIBRATE_REG = 2008 ;//2013;
const int SRV_ENABLE_DRIVE_REG = 2017; const int SRV_ENABLE_DRIVE_REG =2009;// 2017;
const int SRV_AZIMUTH_REG = 2030; const int SRV_AZIMUTH_REG = 2010; //2030;
const double SRV_ANGLE_FACTOR = 100.0; const double SRV_ANGLE_FACTOR = 100.0;
const double SRV_SPEED_FACTOR = 1000.0; const double SRV_SPEED_FACTOR = 1000.0;

3
Servo/src/ModbusMaster.cpp

@ -20,7 +20,7 @@ void ModbusMaster::init(ExpConfig& expConfig)
connect(_modbusDevice, &QModbusClient::errorOccurred, [this](QModbusDevice::Error) connect(_modbusDevice, &QModbusClient::errorOccurred, [this](QModbusDevice::Error)
{ {
_initialized = false; _initialized = false;
throw ServoException(_modbusDevice->errorString()); connectionStateChanged(QModbusDevice::UnconnectedState);
}); });
connect(_modbusDevice, connect(_modbusDevice,
@ -46,6 +46,7 @@ void ModbusMaster::init(ExpConfig& expConfig)
/*************************************************************************************************/ /*************************************************************************************************/
void ModbusMaster::connectionStateChanged(QModbusDevice::State state) void ModbusMaster::connectionStateChanged(QModbusDevice::State state)
{ {
if(state == QModbusDevice::UnconnectedState) if(state == QModbusDevice::UnconnectedState)
{ {
_connected = false; _connected = false;

1
Test/MainWindow.cpp

@ -217,6 +217,7 @@ void MainWindow::handleGetRequestFromServo()
ui->showStopAngle->setText(QString::number(_servoControler.getStopAngle())); ui->showStopAngle->setText(QString::number(_servoControler.getStopAngle()));
ui->showAngleOffset->setText(QString::number(_servoControler.getAngleOffset())); ui->showAngleOffset->setText(QString::number(_servoControler.getAngleOffset()));
ui->showAzimuth->setText(QString::number(_servoControler.getAzimuth())); ui->showAzimuth->setText(QString::number(_servoControler.getAzimuth()));
ui->showServoError->setText("");
QThread::sleep(2); QThread::sleep(2);
} }
catch(ServoException exp) catch(ServoException exp)

Loading…
Cancel
Save