|
|
@ -30,12 +30,18 @@ public: |
|
|
|
|
|
|
|
|
|
|
|
~Joystick(); |
|
|
|
~Joystick(); |
|
|
|
|
|
|
|
|
|
|
|
typedef struct { |
|
|
|
typedef struct Calibration_t { |
|
|
|
int min; |
|
|
|
int min; |
|
|
|
int max; |
|
|
|
int max; |
|
|
|
int center; |
|
|
|
int center; |
|
|
|
int deadband; |
|
|
|
int deadband; |
|
|
|
bool reversed; |
|
|
|
bool reversed; |
|
|
|
|
|
|
|
Calibration_t() |
|
|
|
|
|
|
|
: min(-32767) |
|
|
|
|
|
|
|
, max(32767) |
|
|
|
|
|
|
|
, center(0) |
|
|
|
|
|
|
|
, deadband(0) |
|
|
|
|
|
|
|
, reversed(false) {} |
|
|
|
} Calibration_t; |
|
|
|
} Calibration_t; |
|
|
|
|
|
|
|
|
|
|
|
typedef enum { |
|
|
|
typedef enum { |
|
|
@ -68,7 +74,8 @@ public: |
|
|
|
Q_PROPERTY(int throttleMode READ throttleMode WRITE setThrottleMode NOTIFY throttleModeChanged) |
|
|
|
Q_PROPERTY(int throttleMode READ throttleMode WRITE setThrottleMode NOTIFY throttleModeChanged) |
|
|
|
Q_PROPERTY(bool exponential READ exponential WRITE setExponential NOTIFY exponentialChanged) |
|
|
|
Q_PROPERTY(bool exponential READ exponential WRITE setExponential NOTIFY exponentialChanged) |
|
|
|
Q_PROPERTY(bool accumulator READ accumulator WRITE setAccumulator NOTIFY accumulatorChanged) |
|
|
|
Q_PROPERTY(bool accumulator READ accumulator WRITE setAccumulator NOTIFY accumulatorChanged) |
|
|
|
|
|
|
|
Q_PROPERTY(bool requiresCalibration READ requiresCalibration CONSTANT) |
|
|
|
|
|
|
|
|
|
|
|
// Property accessors
|
|
|
|
// Property accessors
|
|
|
|
|
|
|
|
|
|
|
|
int axisCount(void) { return _axisCount; } |
|
|
|
int axisCount(void) { return _axisCount; } |
|
|
@ -89,6 +96,8 @@ public: |
|
|
|
|
|
|
|
|
|
|
|
QString name(void) { return _name; } |
|
|
|
QString name(void) { return _name; } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
virtual bool requiresCalibration(void) { return true; } |
|
|
|
|
|
|
|
|
|
|
|
int throttleMode(void); |
|
|
|
int throttleMode(void); |
|
|
|
void setThrottleMode(int mode); |
|
|
|
void setThrottleMode(int mode); |
|
|
|
|
|
|
|
|
|
|
@ -144,12 +153,13 @@ signals: |
|
|
|
void buttonActionTriggered(int action); |
|
|
|
void buttonActionTriggered(int action); |
|
|
|
|
|
|
|
|
|
|
|
protected: |
|
|
|
protected: |
|
|
|
void _saveSettings(void); |
|
|
|
void _setDefaultCalibration(void); |
|
|
|
void _loadSettings(void); |
|
|
|
void _saveSettings(void); |
|
|
|
float _adjustRange(int value, Calibration_t calibration, bool withDeadbands); |
|
|
|
void _loadSettings(void); |
|
|
|
void _buttonAction(const QString& action); |
|
|
|
float _adjustRange(int value, Calibration_t calibration, bool withDeadbands); |
|
|
|
bool _validAxis(int axis); |
|
|
|
void _buttonAction(const QString& action); |
|
|
|
bool _validButton(int button); |
|
|
|
bool _validAxis(int axis); |
|
|
|
|
|
|
|
bool _validButton(int button); |
|
|
|
|
|
|
|
|
|
|
|
private: |
|
|
|
private: |
|
|
|
virtual bool _open() = 0; |
|
|
|
virtual bool _open() = 0; |
|
|
|