Browse Source

Add code to servoControler class

test
nasi 3 years ago
parent
commit
1139293c70
  1. 10
      Servo/include/ServoController.h
  2. 10
      Servo/src/ServoController.cpp

10
Servo/include/ServoController.h

@ -1,13 +1,12 @@
#ifndef SERVOCONTROLLER_H
#define SERVOCONTROLLER_H
#include <QTimer>
#include "ModbusWrapper.h"
#include "ModbusConfig.h"
class ServoController
{
public:
ServoController();
private:
ModbusWrapper _modbusWrapper;
const int SRV_START_ANGLE_INT_PART_REG = 2000;
@ -27,8 +26,6 @@ private:
const quint16 SRV_APPLY_SETTING_VAL = 1000;
const quint16 SRV_CALIBRATION_VAL = 13576;
private:
void apply();
void enableDrive();
void setStartStop(bool start);
@ -38,7 +35,6 @@ private:
void changeMode(double startAngle, double stopAngle, double speed);
ModbusConfig initiateConfig();
public:
void init();
void startMoving();
@ -53,8 +49,6 @@ public:
double getAngleOffset();
void setAngleOffset(double offset);
double getAzimuth();
};
#endif // SERVOCONTROLLER_H

10
Servo/src/ServoController.cpp

@ -1,10 +1,5 @@
#include "ServoController.h"
ServoController::ServoController()
{
}
/*************************************************************************************************/
ModbusConfig ServoController::initiateConfig()
{
ModbusConfig _config;
@ -32,10 +27,7 @@ void ServoController::enableDrive()
/*************************************************************************************************/
void ServoController::setStartStop(bool start)
{
if(start)
_modbusWrapper.setSingleRegister(SRV_START_STOP_REG, 3);
else
_modbusWrapper.setSingleRegister(SRV_START_STOP_REG, 0);
_modbusWrapper.setSingleRegister(SRV_START_STOP_REG, start ? 3 : 0);
apply();
}

Loading…
Cancel
Save