Commit 9c6021f1 authored by Don Gagne's avatar Don Gagne

Merge pull request #1572 from DonLakeFlyer/SensorCalUsability

Sensor cal usability
parents e779c81c e2d80384
......@@ -548,7 +548,8 @@ SOURCES += \
#
INCLUDEPATH += \
src/VehicleSetup
src/VehicleSetup \
src/AutoPilotPlugins/PX4 \
FORMS += \
src/VehicleSetup/SetupView.ui \
......
......@@ -39,12 +39,8 @@ QGCView {
Component {
id: view
FactPanel {
QGCViewPanel {
id: panel
anchors.fill: parent
signal showDialog(Component component, string title, int charWidth, int buttons)
signal hideDialog
Connections {
target: rootQGCView
......
......@@ -38,14 +38,10 @@
bool AirframeComponentController::_typesRegistered = false;
AirframeComponentController::AirframeComponentController(void) :
_uas(NULL),
_currentVehicleIndex(0),
_autostartId(0),
_showCustomConfigPanel(false)
{
_uas = UASManager::instance()->getActiveUAS();
Q_ASSERT(_uas);
if (!_typesRegistered) {
_typesRegistered = true;
qmlRegisterUncreatableType<AirframeType>("QGroundControl.Controllers", 1, 0, "AiframeType", "Can only reference AirframeType");
......
......@@ -66,7 +66,6 @@ signals:
private:
static bool _typesRegistered;
UASInterface* _uas;
QVariantList _airframeTypes;
QString _currentAirframeType;
QString _currentVehicleName;
......
......@@ -75,9 +75,6 @@ PX4AutoPilotPlugin::PX4AutoPilotPlugin(UASInterface* uas, QObject* parent) :
{
Q_ASSERT(uas);
qmlRegisterType<FlightModesComponentController>("QGroundControl.Controllers", 1, 0, "FlightModesComponentController");
qmlRegisterType<AirframeComponentController>("QGroundControl.Controllers", 1, 0, "AirframeComponentController");
_parameterFacts = new PX4ParameterLoader(this, uas, this);
Q_CHECK_PTR(_parameterFacts);
......
......@@ -110,11 +110,7 @@ QWidget* SensorsComponent::setupWidget(void) const
QGCQmlWidgetHolder* holder = new QGCQmlWidgetHolder();
Q_CHECK_PTR(holder);
holder->setAutoPilot(_autopilot);
SensorsComponentController* controller = new SensorsComponentController(_autopilot, holder);
holder->setContextPropertyObject("controller", controller);
holder->setAutoPilot(_autopilot);
holder->setSource(QUrl::fromUserInput("qrc:/qml/SensorsComponent.qml"));
return holder;
......
......@@ -32,8 +32,7 @@
#include <QVariant>
#include <QQmlProperty>
SensorsComponentController::SensorsComponentController(AutoPilotPlugin* autopilot, QObject* parent) :
QObject(parent),
SensorsComponentController::SensorsComponentController(void) :
_statusLog(NULL),
_progressBar(NULL),
_compassButton(NULL),
......@@ -67,15 +66,8 @@ SensorsComponentController::SensorsComponentController(AutoPilotPlugin* autopilo
_orientationCalLeftSideRotate(false),
_orientationCalNoseDownSideRotate(false),
_unknownFirmwareVersion(false),
_waitingForCancel(false),
_autopilot(autopilot)
_waitingForCancel(false)
{
Q_ASSERT(_autopilot);
Q_ASSERT(_autopilot->pluginReady());
_uas = _autopilot->uas();
Q_ASSERT(_uas);
// Mag rotation parameters are optional
_showCompass0 = _autopilot->parameterExists("CAL_MAG0_ROT") &&
_autopilot->getParameterFact("CAL_MAG0_ROT")->value().toInt() >= 0;
......@@ -400,6 +392,15 @@ void SensorsComponentController::_handleUASTextMessage(int uasId, int compId, in
void SensorsComponentController::_refreshParams(void)
{
QStringList fastRefreshList;
// We ask for a refresh on these first so that the rotation combo show up as fast as possible
fastRefreshList << "CAL_MAG0_ID" << "CAL_MAG1_ID" << "CAL_MAG2_ID" << "CAL_MAG0_ROT" << "CAL_MAG1_ROT" << "CAL_MAG2_ROT";
foreach (QString paramName, fastRefreshList) {
_autopilot->refreshParameter(FactSystem::defaultComponentId, paramName);
}
// Now ask for all to refresh
_autopilot->refreshParametersPrefix(FactSystem::defaultComponentId, "CAL_");
_autopilot->refreshParametersPrefix(FactSystem::defaultComponentId, "SENS_");
}
......
......@@ -31,15 +31,15 @@
#include <QQuickItem>
#include "UASInterface.h"
#include "AutoPilotPlugin.h"
#include "FactPanelController.h"
/// Sensors Component MVC Controller for SensorsComponent.qml.
class SensorsComponentController : public QObject
class SensorsComponentController : public FactPanelController
{
Q_OBJECT
public:
SensorsComponentController(AutoPilotPlugin* autopilot, QObject* parent = NULL);
SensorsComponentController(void);
Q_PROPERTY(bool fixedWing READ fixedWing CONSTANT)
......@@ -167,9 +167,6 @@ private:
bool _unknownFirmwareVersion;
bool _waitingForCancel;
AutoPilotPlugin* _autopilot;
UASInterface* _uas;
};
#endif
......@@ -31,7 +31,11 @@ import QGroundControl.FactSystem 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
Item {
Rectangle {
color: __qgcPal.window
QGCPalette { id: __qgcPal; colorGroupEnabled: true }
property string __missingFacts: ""
function showMissingFactOverlay(missingFactName) {
......@@ -43,8 +47,6 @@ Item {
}
Rectangle {
QGCPalette { id: __qgcPal; colorGroupEnabled: true }
id: __missingFactOverlay
anchors.fill: parent
z: 9999
......
......@@ -33,10 +33,10 @@ FactPanelController::FactPanelController(void) :
_autopilot(NULL),
_factPanel(NULL)
{
UASInterface* uas = UASManager::instance()->getActiveUAS();
Q_ASSERT(uas);
_uas = UASManager::instance()->getActiveUAS();
Q_ASSERT(_uas);
_autopilot = AutoPilotPluginManager::instance()->getInstanceForAutoPilotPlugin(uas);
_autopilot = AutoPilotPluginManager::instance()->getInstanceForAutoPilotPlugin(_uas);
Q_ASSERT(_autopilot);
Q_ASSERT(_autopilot->pluginReady());
......
......@@ -56,6 +56,7 @@ protected:
/// Report a missing fact to the FactPanel Qml element
void _reportMissingFact(const QString& missingFact);
UASInterface* _uas;
AutoPilotPlugin* _autopilot;
private slots:
......
......@@ -62,6 +62,9 @@
#include "ViewWidgetController.h"
#include "ParameterEditorController.h"
#include "CustomCommandWidgetController.h"
#include "FlightModesComponentController.h"
#include "AirframeComponentController.h"
#include "SensorsComponentController.h"
#include "ScreenTools.h"
#include "MavManager.h"
......@@ -310,13 +313,20 @@ void QGCApplication::_initCommon(void)
// setFont(fontDatabase.font(fontFamilyName, "Roman", 12));
// Register our Qml objects
qmlRegisterType<QGCPalette>("QGroundControl.Palette", 1, 0, "QGCPalette");
qmlRegisterType<ViewWidgetController>("QGroundControl.Controllers", 1, 0, "ViewWidgetController");
qmlRegisterType<ParameterEditorController>("QGroundControl.Controllers", 1, 0, "ParameterEditorController");
qmlRegisterType<CustomCommandWidgetController>("QGroundControl.Controllers", 1, 0, "CustomCommandWidgetController");
qmlRegisterType<FlightModesComponentController>("QGroundControl.Controllers", 1, 0, "FlightModesComponentController");
qmlRegisterType<AirframeComponentController>("QGroundControl.Controllers", 1, 0, "AirframeComponentController");
qmlRegisterType<SensorsComponentController>("QGroundControl.Controllers", 1, 0, "SensorsComponentController");
//-- Create QML Singleton Interfaces
qmlRegisterSingletonType<ScreenTools>("QGroundControl.ScreenTools", 1, 0, "ScreenTools", screenToolsSingletonFactory);
qmlRegisterSingletonType<MavManager>("QGroundControl.MavManager", 1, 0, "MavManager", mavManagerSingletonFactory);
//-- Register Waypoint Interface
qmlRegisterInterface<Waypoint>("Waypoint");
}
......
......@@ -34,7 +34,7 @@ import QGroundControl.ScreenTools 1.0
import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0
Item {
FactPanel {
id: __rootItem
property Component viewComponent
......@@ -106,7 +106,7 @@ Item {
}
}
function __showDialog(component, title, charWidth, buttons) {
function showDialog(component, title, charWidth, buttons) {
__dialogCharWidth = charWidth
__dialogTitle = title
......@@ -117,7 +117,7 @@ Item {
__dialogOverlay.visible = true
}
function __showMessage(title, message, buttons) {
function showMessage(title, message, buttons) {
__dialogCharWidth = 50
__dialogTitle = title
__messageDialogText = message
......@@ -129,7 +129,7 @@ Item {
__dialogOverlay.visible = true
}
function __hideDialog() {
function hideDialog() {
__dialogComponent = null
__viewPanel.enabled = true
__dialogOverlay.visible = false
......@@ -156,15 +156,15 @@ Item {
Connections {
target: __viewPanel.item
onShowDialog: __showDialog(component, title, charWidth, buttons)
onShowMessage: __showMessage(title, message, buttons)
onHideDialog: __hideDialog()
onShowDialog: __rootItem.showDialog(component, title, charWidth, buttons)
onShowMessage: __rootItem.showMessage(title, message, buttons)
onHideDialog: __rootItem.hideDialog()
}
Connections {
target: __dialogComponentLoader.item
onHideDialog: __hideDialog()
onHideDialog: __rootItem.hideDialog()
}
Loader {
......
......@@ -30,8 +30,11 @@ import QtQuick.Controls 1.3
import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
Rectangle {
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0
FactPanel {
QGCPalette { id: __qgcPal; colorGroupEnabled: enabled }
signal hideDialog
......@@ -43,5 +46,5 @@ Rectangle {
hideDialog()
}
color: qgcPal.windowShadeDark
color: __qgcPal.windowShadeDark
}
......@@ -30,12 +30,15 @@ import QtQuick.Controls 1.3
import QGroundControl.Palette 1.0
import QGroundControl.Controls 1.0
Rectangle {
property QGCPalette qgcPal: QGCPalette { colorGroupEnabled: enabled }
import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0
FactPanel {
QGCPalette { id: __qgcPal; colorGroupEnabled: enabled }
signal showDialog(Component component, string title, int charWidth, int buttons)
signal hideDialog
signal showMessage(string title, string message, int buttons)
color: qgcPal.window
color: __qgcPal.window
}
......@@ -44,6 +44,8 @@ QGCView {
QGCViewPanel {
id: panel
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
FirmwareUpgradeController {
id: controller
upgradeButton: upgradeButton
......
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