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

24
src/Joystick/Joystick.h

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

Loading…
Cancel
Save