Browse Source

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

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

15
src/input/JoystickInput.cc

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

1
src/input/JoystickInput.h

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

2
src/ui/MainWindow.cc

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

4
src/ui/QGCVehicleConfig.cc

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

Loading…
Cancel
Save