Commit 92422bd5 authored by Gregory Dymarek's avatar Gregory Dymarek

Improving coding style

parent 6e33df1a
......@@ -221,14 +221,14 @@ float Joystick::_adjustRange(int value, Calibration_t calibration)
void Joystick::run(void)
{
open();
_open();
while (!_exitThread) {
update();
_update();
// Update axes
for (int axisIndex=0; axisIndex<_axisCount; axisIndex++) {
int newAxisValue = getAxis(axisIndex);
int newAxisValue = _getAxis(axisIndex);
// Calibration code requires signal to be emitted even if value hasn't changed
_rgAxisValues[axisIndex] = newAxisValue;
emit rawAxisValueChanged(axisIndex, newAxisValue);
......@@ -236,7 +236,7 @@ void Joystick::run(void)
// Update buttons
for (int buttonIndex=0; buttonIndex<_buttonCount; buttonIndex++) {
bool newButtonValue = getButton(buttonIndex);
bool newButtonValue = _getButton(buttonIndex);
if (newButtonValue != _rgButtonValues[buttonIndex]) {
_rgButtonValues[buttonIndex] = newButtonValue;
emit rawButtonPressedChanged(buttonIndex, newButtonValue);
......@@ -321,7 +321,7 @@ void Joystick::run(void)
QGC::SLEEP::msleep(40);
}
close();
_close();
}
void Joystick::startPolling(Vehicle* vehicle)
......
......@@ -132,12 +132,12 @@ protected:
bool _validButton(int button);
private:
virtual bool open() = 0;
virtual void close() = 0;
virtual bool update() = 0;
virtual bool _open() = 0;
virtual void _close() = 0;
virtual bool _update() = 0;
virtual bool getButton(int i) = 0;
virtual int getAxis(int i) = 0;
virtual bool _getButton(int i) = 0;
virtual int _getAxis(int i) = 0;
// Override from QThread
virtual void run(void);
......
......@@ -42,7 +42,7 @@ QMap<QString, Joystick*> JoystickSDL::discover(MultiVehicleManager* _multiVehicl
return ret;
}
bool JoystickSDL::open(void) {
bool JoystickSDL::_open(void) {
sdlJoystick = SDL_JoystickOpen(_index);
if (!sdlJoystick) {
......@@ -53,21 +53,21 @@ bool JoystickSDL::open(void) {
return true;
}
void JoystickSDL::close(void) {
void JoystickSDL::_close(void) {
SDL_JoystickClose(sdlJoystick);
}
bool JoystickSDL::update(void)
bool JoystickSDL::_update(void)
{
SDL_JoystickUpdate();
return true;
}
bool JoystickSDL::getButton(int i) {
bool JoystickSDL::_getButton(int i) {
return !!SDL_JoystickGetButton(sdlJoystick, i);
}
int JoystickSDL::getAxis(int i) {
int JoystickSDL::_getAxis(int i) {
return SDL_JoystickGetAxis(sdlJoystick, i);
}
......@@ -20,12 +20,12 @@ public:
static QMap<QString, Joystick*> discover(MultiVehicleManager* _multiVehicleManager);
private:
virtual bool open();
virtual void close();
virtual bool update();
bool _open() final;
void _close() final;
bool _update() final;
virtual bool getButton(int i);
virtual int getAxis(int i);
bool _getButton(int i) final;
int _getAxis(int i) final;
SDL_Joystick *sdlJoystick;
int _index; ///< Index for SDL_JoystickOpen
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment