Browse Source

Joystick: Add missing const in member functions

Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
QGC4.4
Patrick José Pereira 4 years ago committed by Don Gagne
parent
commit
224dfd92d5
  1. 14
      src/Joystick/Joystick.cc
  2. 24
      src/Joystick/Joystick.h

14
src/Joystick/Joystick.cc

@ -871,7 +871,7 @@ void Joystick::setThrottleMode(int mode)
emit throttleModeChanged(_throttleMode); emit throttleModeChanged(_throttleMode);
} }
bool Joystick::negativeThrust() bool Joystick::negativeThrust() const
{ {
return _negativeThrust; return _negativeThrust;
} }
@ -886,7 +886,7 @@ void Joystick::setNegativeThrust(bool allowNegative)
emit negativeThrustChanged(_negativeThrust); emit negativeThrustChanged(_negativeThrust);
} }
float Joystick::exponential() float Joystick::exponential() const
{ {
return _exponential; return _exponential;
} }
@ -898,7 +898,7 @@ void Joystick::setExponential(float expo)
emit exponentialChanged(_exponential); emit exponentialChanged(_exponential);
} }
bool Joystick::accumulator() bool Joystick::accumulator() const
{ {
return _accumulator; return _accumulator;
} }
@ -910,7 +910,7 @@ void Joystick::setAccumulator(bool accu)
emit accumulatorChanged(_accumulator); emit accumulatorChanged(_accumulator);
} }
bool Joystick::deadband() bool Joystick::deadband() const
{ {
return _deadband; return _deadband;
} }
@ -921,7 +921,7 @@ void Joystick::setDeadband(bool deadband)
_saveSettings(); _saveSettings();
} }
bool Joystick::circleCorrection() bool Joystick::circleCorrection() const
{ {
return _circleCorrection; return _circleCorrection;
} }
@ -1041,7 +1041,7 @@ void Joystick::_yawStep(int direction)
emit gimbalControlValue(_localPitch, _localYaw); emit gimbalControlValue(_localPitch, _localYaw);
} }
bool Joystick::_validAxis(int axis) bool Joystick::_validAxis(int axis) const
{ {
if(axis >= 0 && axis < _axisCount) { if(axis >= 0 && axis < _axisCount) {
return true; return true;
@ -1050,7 +1050,7 @@ bool Joystick::_validAxis(int axis)
return false; return false;
} }
bool Joystick::_validButton(int button) bool Joystick::_validButton(int button) const
{ {
if(button >= 0 && button < _totalButtonCount) if(button >= 0 && button < _totalButtonCount)
return true; return true;

24
src/Joystick/Joystick.h

@ -41,7 +41,7 @@ public:
Q_PROPERTY(QString action READ action CONSTANT) Q_PROPERTY(QString action READ action CONSTANT)
Q_PROPERTY(bool canRepeat READ canRepeat CONSTANT) Q_PROPERTY(bool canRepeat READ canRepeat CONSTANT)
QString action () { return _action; } QString action () { return _action; }
bool canRepeat () { return _repeat; } bool canRepeat () const{ return _repeat; }
private: private:
QString _action; QString _action;
bool _repeat = false; bool _repeat = false;
@ -120,8 +120,8 @@ public:
// Property accessors // Property accessors
QString name () { return _name; } QString name () { return _name; }
int totalButtonCount () { return _totalButtonCount; } int totalButtonCount () const{ return _totalButtonCount; }
int axisCount () { return _axisCount; } int axisCount () const{ return _axisCount; }
QStringList buttonActions (); QStringList buttonActions ();
QmlObjectListModel* assignableActions () { return &_assignableButtonActions; } QmlObjectListModel* assignableActions () { return &_assignableButtonActions; }
@ -151,19 +151,19 @@ public:
int throttleMode (); int throttleMode ();
void setThrottleMode (int mode); void setThrottleMode (int mode);
bool negativeThrust (); bool negativeThrust () const;
void setNegativeThrust (bool allowNegative); void setNegativeThrust (bool allowNegative);
float exponential (); float exponential () const;
void setExponential (float expo); void setExponential (float expo);
bool accumulator (); bool accumulator () const;
void setAccumulator (bool accu); void setAccumulator (bool accu);
bool deadband (); bool deadband () const;
void setDeadband (bool accu); void setDeadband (bool accu);
bool circleCorrection (); bool circleCorrection () const;
void setCircleCorrection(bool circleCorrection); void setCircleCorrection(bool circleCorrection);
void setTXMode (int mode); void setTXMode (int mode);
@ -173,12 +173,12 @@ public:
void setCalibrationMode (bool calibrating); void setCalibrationMode (bool calibrating);
/// Get joystick message rate (in Hz) /// Get joystick message rate (in Hz)
float axisFrequencyHz () { return _axisFrequencyHz; } float axisFrequencyHz () const{ return _axisFrequencyHz; }
/// Set joystick message rate (in Hz) /// Set joystick message rate (in Hz)
void setAxisFrequency (float val); void setAxisFrequency (float val);
/// Get joystick button repeat rate (in Hz) /// Get joystick button repeat rate (in Hz)
float buttonFrequencyHz () { return _buttonFrequencyHz; } float buttonFrequencyHz () const{ return _buttonFrequencyHz; }
/// Set joystick button repeat rate (in Hz) /// Set joystick button repeat rate (in Hz)
void setButtonFrequency(float val); void setButtonFrequency(float val);
@ -225,8 +225,8 @@ protected:
float _adjustRange (int value, Calibration_t calibration, bool withDeadbands); float _adjustRange (int value, Calibration_t calibration, bool withDeadbands);
void _executeButtonAction (const QString& action, bool buttonDown); void _executeButtonAction (const QString& action, bool buttonDown);
int _findAssignableButtonAction(const QString& action); int _findAssignableButtonAction(const QString& action);
bool _validAxis (int axis); bool _validAxis (int axis) const;
bool _validButton (int button); bool _validButton (int button) const;
void _handleAxis (); void _handleAxis ();
void _handleButtons (); void _handleButtons ();
void _buildActionList (Vehicle* activeVehicle); void _buildActionList (Vehicle* activeVehicle);

Loading…
Cancel
Save