Browse Source

Removal of some comments, and fix for JoystickInput not exiting cleanly

QGC4.4
Michael Carpenter 12 years ago
parent
commit
0596954767
  1. 11
      src/input/JoystickInput.cc
  2. 1
      src/input/JoystickInput.h
  3. 2
      src/ui/MainWindow.cc
  4. 4
      src/ui/QGCVehicleConfig.cc

11
src/input/JoystickInput.cc

@ -130,7 +130,7 @@ void JoystickInput::init()
int numJoysticks = SDL_NumJoysticks(); int numJoysticks = SDL_NumJoysticks();
// Wait for joysticks if none is connected // Wait for joysticks if none is connected
while (numJoysticks == 0) while (numJoysticks == 0 && !done)
{ {
QGC::SLEEP::msleep(400); QGC::SLEEP::msleep(400);
// INITIALIZE SDL Joystick support // INITIALIZE SDL Joystick support
@ -140,6 +140,10 @@ void JoystickInput::init()
} }
numJoysticks = SDL_NumJoysticks(); numJoysticks = SDL_NumJoysticks();
} }
if (done)
{
return;
}
printf("%d Input devices found:\n", numJoysticks); printf("%d Input devices found:\n", numJoysticks);
for(int i=0; i < SDL_NumJoysticks(); i++ ) for(int i=0; i < SDL_NumJoysticks(); i++ )
@ -157,6 +161,10 @@ void JoystickInput::init()
// Make sure active UAS is set // Make sure active UAS is set
setActiveUAS(UASManager::instance()->getActiveUAS()); setActiveUAS(UASManager::instance()->getActiveUAS());
} }
void JoystickInput::shutdown()
{
done = true;
}
/** /**
* @brief Execute the Joystick process * @brief Execute the Joystick process
@ -171,6 +179,7 @@ void JoystickInput::run()
{ {
done = false; done = false;
exit(); exit();
return;
} }
while(SDL_PollEvent(&event)) while(SDL_PollEvent(&event))
{ {

1
src/input/JoystickInput.h

@ -55,6 +55,7 @@ public:
JoystickInput(); JoystickInput();
~JoystickInput(); ~JoystickInput();
void run(); void run();
void shutdown();
const QString& getName(); const QString& getName();

2
src/ui/MainWindow.cc

@ -276,6 +276,8 @@ MainWindow::~MainWindow()
// } // }
if (joystick) if (joystick)
{ {
joystick->shutdown();
joystick->wait(5000);
delete joystick; delete joystick;
joystick = NULL; joystick = NULL;
} }

4
src/ui/QGCVehicleConfig.cc

@ -843,13 +843,13 @@ void QGCVehicleConfig::parameterChanged(int uas, int component, QString paramete
else else
{ {
bool found = false; bool found = false;
qDebug() << "Param with no widget:" << parameterName; // qDebug() << "Param with no widget:" << parameterName;
for (int i=0;i<toolWidgets.size();i++) for (int i=0;i<toolWidgets.size();i++)
{ {
if (parameterName.startsWith(toolWidgets[i]->objectName())) if (parameterName.startsWith(toolWidgets[i]->objectName()))
{ {
//It should be grouped with this one. //It should be grouped with this one.
qDebug() << parameterName << toolWidgets[i]->objectName(); //qDebug() << parameterName << toolWidgets[i]->objectName();
toolWidgets[i]->addParam(uas,component,parameterName,value); toolWidgets[i]->addParam(uas,component,parameterName,value);
libParamToWidgetMap->insert(parameterName,toolWidgets[i]); libParamToWidgetMap->insert(parameterName,toolWidgets[i]);
found = true; found = true;

Loading…
Cancel
Save