Browse Source

Merge pull request #2535 from DonLakeFlyer/HIL

HIL fixes
QGC4.4
Don Gagne 9 years ago
parent
commit
5a48f92b36
  1. 2
      src/Vehicle/MultiVehicleManager.cc
  2. 2
      src/Vehicle/Vehicle.cc
  3. 31
      src/uas/UAS.cc
  4. 4
      src/uas/UAS.h
  5. 2
      src/ui/toolbar/MainToolBarIndicators.qml

2
src/Vehicle/MultiVehicleManager.cc

@ -109,7 +109,7 @@ void MultiVehicleManager::_deleteVehiclePhase1(Vehicle* vehicle)
} }
vehicle->setActive(false); vehicle->setActive(false);
vehicle->uas()->clearVehicle(); vehicle->uas()->shutdownVehicle();
// First we must signal that a vehicle is no longer available. // First we must signal that a vehicle is no longer available.
_activeVehicleAvailable = false; _activeVehicleAvailable = false;

2
src/Vehicle/Vehicle.cc

@ -1057,7 +1057,7 @@ void Vehicle::setFlightMode(const QString& flightMode)
mavlink_msg_set_mode_pack(_mavlink->getSystemId(), _mavlink->getComponentId(), &msg, id(), newBaseMode, custom_mode); mavlink_msg_set_mode_pack(_mavlink->getSystemId(), _mavlink->getComponentId(), &msg, id(), newBaseMode, custom_mode);
sendMessage(msg); sendMessage(msg);
} else { } else {
qCWarning(VehicleLog) << "FirmwarePlugin::setFlightMode failed, flightMode:" << flightMode; qWarning() << "FirmwarePlugin::setFlightMode failed, flightMode:" << flightMode;
} }
} }

31
src/uas/UAS.cc

@ -194,23 +194,6 @@ UAS::UAS(MAVLinkProtocol* protocol, Vehicle* vehicle, FirmwarePluginManager * fi
} }
/** /**
* Saves the settings of name, airframe, autopilot type and battery specifications
* by calling writeSettings.
*/
UAS::~UAS()
{
#ifndef __mobile__
stopHil();
if (simulation) {
// wait for the simulator to exit
simulation->wait();
simulation->disconnectSimulation();
simulation->deleteLater();
}
#endif
}
/**
* @ return the id of the uas * @ return the id of the uas
*/ */
int UAS::getUASID() const int UAS::getUASID() const
@ -2233,3 +2216,17 @@ void UAS::_say(const QString& text, int severity)
if (!qgcApp()->runningUnitTests()) if (!qgcApp()->runningUnitTests())
qgcApp()->toolbox()->audioOutput()->say(text, severity); qgcApp()->toolbox()->audioOutput()->say(text, severity);
} }
void UAS::shutdownVehicle(void)
{
#ifndef __mobile__
stopHil();
if (simulation) {
// wait for the simulator to exit
simulation->wait();
simulation->disconnectSimulation();
simulation->deleteLater();
}
#endif
_vehicle = NULL;
}

4
src/uas/UAS.h

@ -64,7 +64,6 @@ class UAS : public UASInterface
Q_OBJECT Q_OBJECT
public: public:
UAS(MAVLinkProtocol* protocol, Vehicle* vehicle, FirmwarePluginManager * firmwarePluginManager); UAS(MAVLinkProtocol* protocol, Vehicle* vehicle, FirmwarePluginManager * firmwarePluginManager);
~UAS();
float lipoFull; ///< 100% charged voltage float lipoFull; ///< 100% charged voltage
float lipoEmpty; ///< Discharged voltage float lipoEmpty; ///< Discharged voltage
@ -100,7 +99,8 @@ public:
Q_PROPERTY(double satRawVDOP READ getSatRawVDOP NOTIFY satRawVDOPChanged) Q_PROPERTY(double satRawVDOP READ getSatRawVDOP NOTIFY satRawVDOPChanged)
Q_PROPERTY(double satRawCOG READ getSatRawCOG NOTIFY satRawCOGChanged) Q_PROPERTY(double satRawCOG READ getSatRawCOG NOTIFY satRawCOGChanged)
void clearVehicle(void) { _vehicle = NULL; } /// Vehicle is about to go away
void shutdownVehicle(void);
void setGroundSpeed(double val) void setGroundSpeed(double val)
{ {

2
src/ui/toolbar/MainToolBarIndicators.qml

@ -397,8 +397,6 @@ Row {
id: flightModeMenuItemComponent id: flightModeMenuItemComponent
MenuItem { MenuItem {
checkable: true
checked: activeVehicle ? (activeVehicle.flightMode === text) : false
onTriggered: { onTriggered: {
if(activeVehicle) { if(activeVehicle) {
activeVehicle.flightMode = text activeVehicle.flightMode = text

Loading…
Cancel
Save