Browse Source

Core plugin can determine Sensor pages to show

QGC4.4
DonLakeFlyer 8 years ago
parent
commit
b0273cae11
  1. 10
      src/AutoPilotPlugins/PX4/SensorsComponent.qml
  2. 23
      src/api/QGCOptions.h

10
src/AutoPilotPlugins/PX4/SensorsComponent.qml

@ -7,12 +7,12 @@ @@ -7,12 +7,12 @@
*
****************************************************************************/
import QtQuick 2.3
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.4
import QtQuick.Dialogs 1.2
import QGroundControl 1.0
import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0
import QGroundControl.Palette 1.0
@ -336,6 +336,7 @@ SetupPage { @@ -336,6 +336,7 @@ SetupPage {
width: parent.buttonWidth
text: qsTr("Compass")
indicatorGreen: cal_mag0_id.value != 0
visible: QGroundControl.corePlugin.options.showSensorCalibrationCompass
onClicked: {
preCalibrationDialogType = "compass"
@ -349,6 +350,7 @@ SetupPage { @@ -349,6 +350,7 @@ SetupPage {
width: parent.buttonWidth
text: qsTr("Gyroscope")
indicatorGreen: cal_gyro0_id.value != 0
visible: QGroundControl.corePlugin.options.showSensorCalibrationGyro
onClicked: {
preCalibrationDialogType = "gyro"
@ -362,6 +364,7 @@ SetupPage { @@ -362,6 +364,7 @@ SetupPage {
width: parent.buttonWidth
text: qsTr("Accelerometer")
indicatorGreen: cal_acc0_id.value != 0
visible: QGroundControl.corePlugin.options.showSensorCalibrationAccel
onClicked: {
preCalibrationDialogType = "accel"
@ -376,6 +379,7 @@ SetupPage { @@ -376,6 +379,7 @@ SetupPage {
text: qsTr("Level Horizon")
indicatorGreen: sens_board_x_off.value != 0 || sens_board_y_off != 0 | sens_board_z_off != 0
enabled: cal_acc0_id.value != 0 && cal_gyro0_id.value != 0
visible: QGroundControl.corePlugin.options.showSensorCalibrationLevel
onClicked: {
preCalibrationDialogType = "level"
@ -388,7 +392,7 @@ SetupPage { @@ -388,7 +392,7 @@ SetupPage {
id: airspeedButton
width: parent.buttonWidth
text: qsTr("Airspeed")
visible: (controller.vehicle.fixedWing || controller.vehicle.vtol) && controller.getParameterFact(-1, "CBRK_AIRSPD_CHK").value != 162128
visible: (controller.vehicle.fixedWing || controller.vehicle.vtol) && controller.getParameterFact(-1, "CBRK_AIRSPD_CHK").value != 162128 && QGroundControl.corePlugin.options.showSensorCalibrationAirspeed
indicatorGreen: sens_dpres_off.value != 0
onClicked: {
@ -410,6 +414,8 @@ SetupPage { @@ -410,6 +414,8 @@ SetupPage {
id: setOrientationsButton
width: parent.buttonWidth
text: qsTr("Set Orientations")
visible: QGroundControl.corePlugin.options.showSensorCalibrationOrient
onClicked: {
setOrientationsDialogShowBoardOrientation = true
showDialog(setOrientationsDialogComponent, qsTr("Set Orientations"), sensorsPage.showDialogDefaultWidth, StandardButton.Ok)

23
src/api/QGCOptions.h

@ -28,7 +28,12 @@ public: @@ -28,7 +28,12 @@ public:
Q_PROPERTY(double toolbarHeightMultiplier READ toolbarHeightMultiplier CONSTANT)
Q_PROPERTY(bool enablePlanViewSelector READ enablePlanViewSelector CONSTANT)
Q_PROPERTY(CustomInstrumentWidget* instrumentWidget READ instrumentWidget CONSTANT)
Q_PROPERTY(bool showSensorCalibrationCompass READ showSensorCalibrationCompass NOTIFY showSensorCalibrationCompassChanged)
Q_PROPERTY(bool showSensorCalibrationGyro READ showSensorCalibrationGyro NOTIFY showSensorCalibrationGyroChanged)
Q_PROPERTY(bool showSensorCalibrationAccel READ showSensorCalibrationAccel NOTIFY showSensorCalibrationAccelChanged)
Q_PROPERTY(bool showSensorCalibrationLevel READ showSensorCalibrationLevel NOTIFY showSensorCalibrationLevelChanged)
Q_PROPERTY(bool showSensorCalibrationAirspeed READ showSensorCalibrationAirspeed NOTIFY showSensorCalibrationAirspeedChanged)
Q_PROPERTY(bool showSensorCalibrationOrient READ showSensorCalibrationOrient NOTIFY showSensorCalibrationOrientChanged)
/// Should QGC hide its settings menu and colapse it into one single menu (Settings and Vehicle Setup)?
/// @return true if QGC should consolidate both menus into one.
@ -46,6 +51,22 @@ public: @@ -46,6 +51,22 @@ public:
/// @return An alternate widget (see QGCInstrumentWidget.qml, the default widget)
virtual CustomInstrumentWidget* instrumentWidget();
/// By returning false you can hide the following sensor calibration pages
bool showSensorCalibrationCompass () const { return true; }
bool showSensorCalibrationGyro () const { return true; }
bool showSensorCalibrationAccel () const { return true; }
bool showSensorCalibrationLevel () const { return true; }
bool showSensorCalibrationAirspeed () const { return true; }
bool showSensorCalibrationOrient () const { return true; }
signals:
void showSensorCalibrationCompassChanged (bool show);
void showSensorCalibrationGyroChanged (bool show);
void showSensorCalibrationAccelChanged (bool show);
void showSensorCalibrationLevelChanged (bool show);
void showSensorCalibrationAirspeedChanged (bool show);
void showSensorCalibrationOrientChanged (bool show);
private:
CustomInstrumentWidget* _defaultInstrumentWidget;
};

Loading…
Cancel
Save