Commit 96f44416 authored by Don Gagne's avatar Don Gagne

Merge pull request #1362 from DonLakeFlyer/Preflight

Preflight check
parents 65e79da4 a03e816a
......@@ -479,7 +479,6 @@ HEADERS += \
src/uas/QGCUASFileManager.h \
src/ui/QGCUASFileView.h \
src/CmdLineOptParser.h \
src/uas/QGXPX4UAS.h \
src/QGCFileDialog.h \
src/QGCMessageBox.h \
src/QGCComboBox.h \
......@@ -623,7 +622,6 @@ SOURCES += \
src/uas/QGCUASFileManager.cc \
src/ui/QGCUASFileView.cc \
src/CmdLineOptParser.cc \
src/uas/QGXPX4UAS.cc \
src/QGCFileDialog.cc \
src/QGCComboBox.cc \
src/QGCTemporaryFile.cc \
......
......@@ -69,7 +69,11 @@ void FlightModesComponentController::_validateConfiguration(void)
{
_validConfiguration = true;
_channelCount = _autoPilotPlugin->factExists("RC_CHAN_CNT") ? _autoPilotPlugin->getFact("RC_CHAN_CNT")->value().toInt() : 18;
_channelCount = _autoPilotPlugin->factExists("RC_CHAN_CNT") ? _autoPilotPlugin->getFact("RC_CHAN_CNT")->value().toInt() : _chanMax;
if (_channelCount <= 0 || _channelCount > _chanMax) {
// Parameter exists, but has not yet been set or is invalid. Use default
_channelCount = _chanMax;
}
// Make sure switches are valid and within channel range
......
......@@ -80,7 +80,7 @@ PX4AutoPilotPlugin::PX4AutoPilotPlugin(UASInterface* uas, QObject* parent) :
_parameterFacts = new PX4ParameterFacts(uas, this);
Q_CHECK_PTR(_parameterFacts);
connect(_parameterFacts, &PX4ParameterFacts::factsReady, this, &PX4AutoPilotPlugin::_checkForIncorrectParameterVersion);
connect(_parameterFacts, &PX4ParameterFacts::factsReady, this, &PX4AutoPilotPlugin::_pluginReadyPreChecks);
PX4ParameterFacts::loadParameterFactMetaData();
}
......@@ -237,12 +237,29 @@ QUrl PX4AutoPilotPlugin::setupBackgroundImage(void)
return QUrl::fromUserInput("qrc:/qml/px4fmu_2.x.png");
}
void PX4AutoPilotPlugin::_checkForIncorrectParameterVersion(void)
/// This will perform various checks prior to signalling that the plug in ready
void PX4AutoPilotPlugin::_pluginReadyPreChecks(void)
{
// Check for older parameter version set
// FIXME: Firmware is moving to version stamp parameter set. Once that is complete the version stamp
// should be used instead.
if (parameters().contains("SENS_GYRO_XOFF")) {
_incorrectParameterVersion = true;
QGCMessageBox::warning(tr("Setup"), tr("This version of GroundControl can only perform vehicle setup on a newer version of firmware. "
"Please perform a Firmware Upgrade if you wish to use Vehicle Setup."));
} else {
// Check for missing setup complete
foreach(const QVariant componentVariant, components()) {
VehicleComponent* component = qobject_cast<VehicleComponent*>(qvariant_cast<QObject *>(componentVariant));
Q_ASSERT(component);
if (!component->setupComplete()) {
QGCMessageBox::warning(tr("Setup"), tr("One or more vehicle components require setup prior to flight. "
"Please correct these by going to the Setup view."));
break;
}
}
}
emit pluginReady();
}
......@@ -68,7 +68,7 @@ public:
PowerComponent* powerComponent(void) { return _powerComponent; }
private slots:
void _checkForIncorrectParameterVersion(void);
void _pluginReadyPreChecks(void);
private:
PX4ParameterFacts* _parameterFacts;
......
......@@ -21,20 +21,20 @@
1 50 BD_OBJ_SURFACE 0.00311725 9
1 50 BD_PRECISION 30 9
1 50 BD_TURNRADIUS 120 9
1 50 CAL_ACC0_ID 0 6
1 50 CAL_ACC0_XOFF 0 9
1 50 CAL_ACC0_XSCALE 1 9
1 50 CAL_ACC0_YOFF 0 9
1 50 CAL_ACC0_YSCALE 1 9
1 50 CAL_ACC0_ZOFF 0 9
1 50 CAL_ACC0_ZSCALE 1 9
1 50 CAL_ACC1_ID 0 6
1 50 CAL_ACC1_XOFF 0 9
1 50 CAL_ACC1_XSCALE 1 9
1 50 CAL_ACC1_YOFF 0 9
1 50 CAL_ACC1_YSCALE 1 9
1 50 CAL_ACC1_ZOFF 0 9
1 50 CAL_ACC1_ZSCALE 1 9
1 50 CAL_ACC0_ID 1246218 6
1 50 CAL_ACC0_XOFF 0.0657825 9
1 50 CAL_ACC0_XSCALE 0.99657 9
1 50 CAL_ACC0_YOFF -0.0470138 9
1 50 CAL_ACC0_YSCALE 1.00066 9
1 50 CAL_ACC0_ZOFF 0.2244 9
1 50 CAL_ACC0_ZSCALE 0.985475 9
1 50 CAL_ACC1_ID 1114634 6
1 50 CAL_ACC1_XOFF 0.976983 9
1 50 CAL_ACC1_XSCALE 0.978487 9
1 50 CAL_ACC1_YOFF 0.92215 9
1 50 CAL_ACC1_YSCALE 1.01181 9
1 50 CAL_ACC1_ZOFF 1.07291 9
1 50 CAL_ACC1_ZSCALE 1.00673 9
1 50 CAL_ACC2_ID 0 6
1 50 CAL_ACC2_XOFF 0 9
1 50 CAL_ACC2_XSCALE 1 9
......@@ -42,20 +42,20 @@
1 50 CAL_ACC2_YSCALE 1 9
1 50 CAL_ACC2_ZOFF 0 9
1 50 CAL_ACC2_ZSCALE 1 9
1 50 CAL_BOARD_ID 0 6
1 50 CAL_GYRO0_ID 0 6
1 50 CAL_GYRO0_XOFF 0 9
1 50 CAL_BOARD_ID 825374003 6
1 50 CAL_GYRO0_ID 2163722 6
1 50 CAL_GYRO0_XOFF 0.0102227 9
1 50 CAL_GYRO0_XSCALE 1 9
1 50 CAL_GYRO0_YOFF 0 9
1 50 CAL_GYRO0_YOFF 0.0485427 9
1 50 CAL_GYRO0_YSCALE 1 9
1 50 CAL_GYRO0_ZOFF 0 9
1 50 CAL_GYRO0_ZOFF -0.00950837 9
1 50 CAL_GYRO0_ZSCALE 1 9
1 50 CAL_GYRO1_ID 0 6
1 50 CAL_GYRO1_XOFF 0 9
1 50 CAL_GYRO1_ID 2228490 6
1 50 CAL_GYRO1_XOFF 0.012822 9
1 50 CAL_GYRO1_XSCALE 1 9
1 50 CAL_GYRO1_YOFF 0 9
1 50 CAL_GYRO1_YOFF 0.00126972 9
1 50 CAL_GYRO1_YSCALE 1 9
1 50 CAL_GYRO1_ZOFF 0 9
1 50 CAL_GYRO1_ZOFF -0.0285923 9
1 50 CAL_GYRO1_ZSCALE 1 9
1 50 CAL_GYRO2_ID 0 6
1 50 CAL_GYRO2_XOFF 0 9
......@@ -64,21 +64,21 @@
1 50 CAL_GYRO2_YSCALE 1 9
1 50 CAL_GYRO2_ZOFF 0 9
1 50 CAL_GYRO2_ZSCALE 1 9
1 50 CAL_MAG0_ID 0 6
1 50 CAL_MAG0_ROT -1 6
1 50 CAL_MAG0_XOFF 0 9
1 50 CAL_MAG0_XSCALE 1 9
1 50 CAL_MAG0_YOFF 0 9
1 50 CAL_MAG0_YSCALE 1 9
1 50 CAL_MAG0_ZOFF 0 9
1 50 CAL_MAG0_ZSCALE 1 9
1 50 CAL_MAG1_ID 0 6
1 50 CAL_MAG0_ID 73225 6
1 50 CAL_MAG0_ROT 0 6
1 50 CAL_MAG0_XOFF 0.0546612 9
1 50 CAL_MAG0_XSCALE 1.03474 9
1 50 CAL_MAG0_YOFF -0.0299049 9
1 50 CAL_MAG0_YSCALE 0.934338 9
1 50 CAL_MAG0_ZOFF -0.100793 9
1 50 CAL_MAG0_ZSCALE 0.981021 9
1 50 CAL_MAG1_ID 131594 6
1 50 CAL_MAG1_ROT -1 6
1 50 CAL_MAG1_XOFF 0 9
1 50 CAL_MAG1_XOFF -0.0239289 9
1 50 CAL_MAG1_XSCALE 1 9
1 50 CAL_MAG1_YOFF 0 9
1 50 CAL_MAG1_YOFF 0.0811809 9
1 50 CAL_MAG1_YSCALE 1 9
1 50 CAL_MAG1_ZOFF 0 9
1 50 CAL_MAG1_ZOFF 0.0455695 9
1 50 CAL_MAG1_ZSCALE 1 9
1 50 CAL_MAG2_ID 0 6
1 50 CAL_MAG2_ROT -1 6
......@@ -180,6 +180,7 @@
1 50 GF_ON 1 6
1 50 GF_SOURCE 0 6
1 50 INAV_DELAY_GPS 0.2 9
1 50 INAV_ENABLED 0 6
1 50 INAV_FLOW_K 0.15 9
1 50 INAV_FLOW_Q_MIN 0.5 9
1 50 INAV_LAND_DISP 0.7 9
......@@ -433,6 +434,7 @@
1 50 RC_ACRO_TH 0.5 9
1 50 RC_ASSIST_TH 0.25 9
1 50 RC_AUTO_TH 0.75 9
1 50 RC_CHAN_CNT 0 6
1 50 RC_DSM_BIND -1 6
1 50 RC_FAILS_THR 0 6
1 50 RC_LOITER_TH 0.5 9
......@@ -443,7 +445,7 @@
1 50 RC_MAP_FAILSAFE 0 6
1 50 RC_MAP_FLAPS 0 6
1 50 RC_MAP_LOITER_SW 0 6
1 50 RC_MAP_MODE_SW 0 6
1 50 RC_MAP_MODE_SW 6 6
1 50 RC_MAP_OFFB_SW 0 6
1 50 RC_MAP_PARAM1 0 6
1 50 RC_MAP_PARAM2 0 6
......@@ -457,6 +459,7 @@
1 50 RC_OFFB_TH 0.5 9
1 50 RC_POSCTL_TH 0.5 9
1 50 RC_RETURN_TH 0.5 9
1 50 RC_TH_USER 1 6
1 50 RTL_DESCEND_ALT 10 9
1 50 RTL_LAND_DELAY -1 9
1 50 RTL_LOITER_RAD 50 9
......
This diff is collapsed.
......@@ -29,12 +29,15 @@
#include "MockUAS.h"
#include "MultiSignalSpy.h"
#include "px4_configuration/PX4RCCalibration.h"
#include "QGCLoggingCategory.h"
/// @file
/// @brief PX4RCCalibration Widget unit test
///
/// @author Don Gagne <don@thegagnes.com>
Q_DECLARE_LOGGING_CATEGORY(PX4RCCalibrationTestLog)
/// @brief PX4RCCalibration Widget unit test
class PX4RCCalibrationTest : public UnitTest
{
......@@ -44,7 +47,6 @@ public:
PX4RCCalibrationTest(void);
private slots:
void initTestCase(void);
void init(void);
void cleanup(void);
......@@ -125,7 +127,7 @@ private:
static const struct ChannelSettings _rgChannelSettings[_availableChannels];
static const struct ChannelSettings _rgChannelSettingsValidate[PX4RCCalibration::_chanMax];
static const int _rgFunctionChannelMap[PX4RCCalibration::rcCalFunctionMax];
int _rgFunctionChannelMap[PX4RCCalibration::rcCalFunctionMax];
};
#endif
#include "QGCMAVLinkUASFactory.h"
#include "UASManager.h"
#include "QGXPX4UAS.h"
QGCMAVLinkUASFactory::QGCMAVLinkUASFactory(QObject *parent) :
QObject(parent)
......@@ -20,62 +19,31 @@ UASInterface* QGCMAVLinkUASFactory::createUAS(MAVLinkProtocol* mavlink, LinkInte
p = mavlink;
}
UASInterface* uas;
UASInterface* uasInterface;
switch (heartbeat->autopilot)
{
case MAV_AUTOPILOT_GENERIC:
{
UAS* mav = new UAS(mavlink, sysid);
// Set the system type
mav->setSystemType((int)heartbeat->type);
// Connect this robot to the UAS object
connect(mavlink, SIGNAL(messageReceived(LinkInterface*, mavlink_message_t)), mav, SLOT(receiveMessage(LinkInterface*, mavlink_message_t)));
connect(mavlink, SIGNAL(messageReceived(LinkInterface*,mavlink_message_t)), mav->getFileManager(), SLOT(receiveMessage(LinkInterface*, mavlink_message_t)));
uas = mav;
}
break;
case MAV_AUTOPILOT_PX4:
{
QGXPX4UAS* px4 = new QGXPX4UAS(mavlink, sysid);
// Set the system type
px4->setSystemType((int)heartbeat->type);
// Connect this robot to the UAS object
// it is IMPORTANT here to use the right object type,
// else the slot of the parent object is called (and thus the special
// packets never reach their goal)
connect(mavlink, SIGNAL(messageReceived(LinkInterface*, mavlink_message_t)), px4, SLOT(receiveMessage(LinkInterface*, mavlink_message_t)));
uas = px4;
}
break;
default:
{
UAS* mav = new UAS(mavlink, sysid);
mav->setSystemType((int)heartbeat->type);
UAS* uasObject = new UAS(mavlink, sysid);
Q_CHECK_PTR(uasObject);
uasInterface = uasObject;
uasObject->setSystemType((int)heartbeat->type);
// Connect this robot to the UAS object
// it is IMPORTANT here to use the right object type,
// else the slot of the parent object is called (and thus the special
// packets never reach their goal)
connect(mavlink, SIGNAL(messageReceived(LinkInterface*, mavlink_message_t)), mav, SLOT(receiveMessage(LinkInterface*, mavlink_message_t)));
uas = mav;
}
break;
}
// Connect this robot to the UAS object
// It is IMPORTANT here to use the right object type,
// else the slot of the parent object is called (and thus the special
// packets never reach their goal)
connect(mavlink, &MAVLinkProtocol::messageReceived, uasObject, &UAS::receiveMessage);
// Set the autopilot type
uas->setAutopilotType((int)heartbeat->autopilot);
uasInterface->setAutopilotType((int)heartbeat->autopilot);
// Make UAS aware that this link can be used to communicate with the actual robot
uas->addLink(link);
uasInterface->addLink(link);
// First thing we do with a new UAS is get the parameters
uas->getParamManager()->requestParameterList();
uasInterface->getParamManager()->requestParameterList();
// Now add UAS to "official" list, which makes the whole application aware of it
UASManager::instance()->addUAS(uas);
UASManager::instance()->addUAS(uasInterface);
return uas;
return uasInterface;
}
#include "QGXPX4UAS.h"
QGXPX4UAS::QGXPX4UAS(MAVLinkProtocol* mavlink, int id) :
UAS(mavlink, id)
{
}
/**
* This function is called by MAVLink once a complete, uncorrupted (CRC check valid)
* mavlink packet is received.
*
* @param link Hardware link the message came from (e.g. /dev/ttyUSB0 or UDP port).
* messages can be sent back to the system via this link
* @param message MAVLink message, as received from the MAVLink protocol stack
*/
void QGXPX4UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
{
UAS::receiveMessage(link, message);
}
void QGXPX4UAS::processParamValueMsgHook(mavlink_message_t& msg, const QString& paramName,const mavlink_param_value_t& rawValue, mavlink_param_union_t& paramValue)
{
Q_UNUSED(rawValue);
Q_UNUSED(paramValue);
int compId = msg.compid;
if (paramName == "SYS_AUTOSTART") {
bool ok;
int val = parameters.value(compId)->value(paramName).toInt(&ok);
if (ok && val == 0) {
emit misconfigurationDetected(this);
qDebug() << "HINTING MISCONFIGURATION";
}
qDebug() << "SYS_AUTOSTART FOUND WITH VAL: " << val;
}
}
#ifndef QGXPX4UAS_H
#define QGXPX4UAS_H
#include "UAS.h"
class QGXPX4UAS : public UAS
{
Q_OBJECT
Q_INTERFACES(UASInterface)
public:
QGXPX4UAS(MAVLinkProtocol* mavlink, int id);
public slots:
/** @brief Receive a MAVLink message from this MAV */
void receiveMessage(LinkInterface* link, mavlink_message_t message);
virtual void processParamValueMsgHook(mavlink_message_t& msg, const QString& paramName,const mavlink_param_value_t& rawValue, mavlink_param_union_t& paramValue);
};
#endif // QGXPX4UAS_H
......@@ -1029,8 +1029,6 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
paramVal.type = rawValue.param_type;
processParamValueMsg(message, parameterName,rawValue,paramVal);
processParamValueMsgHook(message, parameterName,rawValue,paramVal);
}
break;
case MAVLINK_MSG_ID_COMMAND_ACK:
......
......@@ -930,7 +930,6 @@ protected:
quint64 getUnixReferenceTime(quint64 time);
virtual void processParamValueMsg(mavlink_message_t& msg, const QString& paramName,const mavlink_param_value_t& rawValue, mavlink_param_union_t& paramValue);
virtual void processParamValueMsgHook(mavlink_message_t& msg, const QString& paramName,const mavlink_param_value_t& rawValue, mavlink_param_union_t& paramValue) { Q_UNUSED(msg); Q_UNUSED(paramName); Q_UNUSED(rawValue); Q_UNUSED(paramValue); };
int componentID[256];
bool componentMulti[256];
......
......@@ -31,6 +31,8 @@
#include "UASManager.h"
#include "QGCMessageBox.h"
QGC_LOGGING_CATEGORY(PX4RCCalibrationLog, "PX4RCCalibrationLog")
const int PX4RCCalibration::_updateInterval = 150; ///< Interval for timer which updates radio channel widgets
const int PX4RCCalibration::_rcCalPWMCenterPoint = ((PX4RCCalibration::_rcCalPWMValidMaxValue - PX4RCCalibration::_rcCalPWMValidMinValue) / 2.0f) + PX4RCCalibration::_rcCalPWMValidMinValue;
// FIXME: Double check these mins againt 150% throws
......@@ -262,7 +264,7 @@ void PX4RCCalibration::_remoteControlChannelRawChanged(int chan, float fval)
// We always update raw values
_rcRawValue[chan] = fval;
//qDebug() << "Raw value" << chan << fval;
qCDebug(PX4RCCalibrationLog) << "Raw value" << chan << fval;
if (_currentStep == -1) {
// Track the receiver channel count by keeping track of how many channels we see
......@@ -330,7 +332,7 @@ void PX4RCCalibration::_saveAllTrims(void)
// trims reset to correct values.
for (int i=0; i<_chanCount; i++) {
//qDebug() << "_saveAllTrims trim" << _rcRawValue[i];
qCDebug(PX4RCCalibrationLog) << "_saveAllTrims trim" << _rcRawValue[i];
_rgChannelInfo[i].rcTrim = _rcRawValue[i];
}
_nextStep();
......@@ -355,7 +357,7 @@ bool PX4RCCalibration::_stickSettleComplete(int value)
if (abs(_stickDetectValue - value) > _rcCalSettleDelta) {
// Stick is moving too much to consider stopped
//qDebug() << "_stickSettleComplete still moving, _stickDetectValue:value" << _stickDetectValue << value;
qCDebug(PX4RCCalibrationLog) << "_stickSettleComplete still moving, _stickDetectValue:value" << _stickDetectValue << value;
_stickDetectValue = value;
_stickDetectSettleStarted = false;
......@@ -372,7 +374,7 @@ bool PX4RCCalibration::_stickSettleComplete(int value)
} else {
// Start waiting for the stick to stay settled for _stickDetectSettleWaitMSecs msecs
//qDebug() << "_stickSettleComplete starting settle timer, _stickDetectValue:value" << _stickDetectValue << value;
qCDebug(PX4RCCalibrationLog) << "_stickSettleComplete starting settle timer, _stickDetectValue:value" << _stickDetectValue << value;
_stickDetectSettleStarted = true;
_stickDetectSettleElapsed.start();
......@@ -384,7 +386,7 @@ bool PX4RCCalibration::_stickSettleComplete(int value)
void PX4RCCalibration::_inputStickDetect(enum rcCalFunctions function, int channel, int value)
{
//qDebug() << "_inputStickDetect function:channel:value" << function << channel << value;
qCDebug(PX4RCCalibrationLog) << "_inputStickDetect function:channel:value" << _rgFunctionInfo[function].parameterName << channel << value;
// If this channel is already used in a mapping we can't use it again
if (_rgChannelInfo[channel].function != rcCalFunctionMax) {
......@@ -397,7 +399,7 @@ void PX4RCCalibration::_inputStickDetect(enum rcCalFunctions function, int chann
if (abs(_rcValueSave[channel] - value) > _rcCalMoveDelta) {
// Stick has moved far enough to consider it as being selected for the function
//qDebug() << "_inputStickDetect starting settle wait, function:channel:value" << function << channel << value;
qCDebug(PX4RCCalibrationLog) << "_inputStickDetect starting settle wait, function:channel:value" << function << channel << value;
// Setup up to detect stick being pegged to min or max value
_stickDetectChannel = channel;
......@@ -408,7 +410,7 @@ void PX4RCCalibration::_inputStickDetect(enum rcCalFunctions function, int chann
if (_stickSettleComplete(value)) {
ChannelInfo* info = &_rgChannelInfo[channel];
//qDebug() << "_inputStickDetect settle complete, function:channel:value" << function << channel << value;
qCDebug(PX4RCCalibrationLog) << "_inputStickDetect settle complete, function:channel:value" << function << channel << value;
// Stick detection is complete. Stick should be at max position.
// Map the channel to the function
......@@ -515,7 +517,7 @@ void PX4RCCalibration::_inputSwitchMinMax(enum rcCalFunctions function, int chan
if (value < _rcCalPWMCenterPoint) {
int minValue = qMin(_rgChannelInfo[channel].rcMin, value);
//qDebug() << "_inputSwitchMinMax setting min channel:min" << channel << minValue;
qCDebug(PX4RCCalibrationLog) << "_inputSwitchMinMax setting min channel:min" << channel << minValue;
_rgChannelInfo[channel].rcMin = minValue;
_rgRCValueMonitorWidget[channel]->setMin(minValue);
......@@ -523,7 +525,7 @@ void PX4RCCalibration::_inputSwitchMinMax(enum rcCalFunctions function, int chan
} else {
int maxValue = qMax(_rgChannelInfo[channel].rcMax, value);
//qDebug() << "_inputSwitchMinMax setting max channel:max" << channel << maxValue;
qCDebug(PX4RCCalibrationLog) << "_inputSwitchMinMax setting max channel:max" << channel << maxValue;
_rgChannelInfo[channel].rcMax = maxValue;
_rgRCValueMonitorWidget[channel]->setMax(maxValue);
......@@ -651,7 +653,7 @@ void PX4RCCalibration::_switchDetect(enum rcCalFunctions function, int channel,
_rgFunctionChannelMapping[function] = channel;
info->function = function;
//qDebug() << "Function:" << function << "mapped to:" << channel;
qCDebug(PX4RCCalibrationLog) << "Function:" << function << "mapped to:" << channel;
if (moveToNextStep) {
_nextStep();
......@@ -682,7 +684,7 @@ void PX4RCCalibration::_resetInternalCalibrationValues(void)
info->rcTrim = PX4RCCalibration::_rcCalPWMCenterPoint;
}
// Initialize function mapping to function channel not set
// Initialize attitude function mapping to function channel not set
for (size_t i=0; i<rcCalFunctionMax; i++) {
_rgFunctionChannelMapping[i] = _chanMax;
}
......@@ -709,16 +711,17 @@ void PX4RCCalibration::_resetInternalCalibrationValues(void)
Q_UNUSED(paramFound);
bool ok;
int channel = value.toInt(&ok);
int switchChannel = value.toInt(&ok);
Q_ASSERT(ok);
Q_UNUSED(ok);
// Parameter: 1-based channel, 0=not mapped
// _rgFunctionChannelMapping: 0-based channel, _chanMax=not mapped
_rgFunctionChannelMapping[curFunction] = (channel == 0) ? _chanMax : channel;
if (channel != 0) {
_rgChannelInfo[channel - 1].function = curFunction;
if (switchChannel != 0) {
qCDebug(PX4RCCalibrationLog) << "Reserving 0-based switch channel" << switchChannel - 1;
_rgFunctionChannelMapping[curFunction] = switchChannel - 1;
_rgChannelInfo[switchChannel - 1].function = curFunction;
}
}
}
......@@ -848,7 +851,7 @@ void PX4RCCalibration::_validateCalibration(void)
// Validate Min/Max values. Although the channel appears as available we still may
// not have good min/max/trim values for it. Set to defaults if needed.
if (info->rcMin > _rcCalPWMValidMinValue || info->rcMax < _rcCalPWMValidMaxValue) {
//qDebug() << "_validateCalibration resetting channel" << chan;
qCDebug(PX4RCCalibrationLog) << "_validateCalibration resetting channel" << chan;
info->rcMin = _rcCalPWMDefaultMinValue;
info->rcMax = _rcCalPWMDefaultMaxValue;
info->rcTrim = info->rcMin + ((info->rcMax - info->rcMin) / 2);
......@@ -874,7 +877,7 @@ void PX4RCCalibration::_validateCalibration(void)
}
} else {
// Unavailable channels are set to defaults
//qDebug() << "_validateCalibration resetting unavailable channel" << chan;
qCDebug(PX4RCCalibrationLog) << "_validateCalibration resetting unavailable channel" << chan;
info->rcMin = _rcCalPWMDefaultMinValue;
info->rcMax = _rcCalPWMDefaultMaxValue;
info->rcTrim = info->rcMin + ((info->rcMax - info->rcMin) / 2);
......@@ -943,7 +946,7 @@ void PX4RCCalibration::_updateView()
valueWidget->setVisible(true);
_rgRCValueMonitorLabel[chan]->setVisible(true);
//qDebug() << "Visible" << valueWidget->objectName() << chan;
//qCDebug(PX4RCCalibrationLog) << "Visible" << valueWidget->objectName() << chan;
struct ChannelInfo* info = &_rgChannelInfo[chan];
valueWidget->setValueAndMinMax(_rcRawValue[chan], info->rcMin, info->rcMax);
......@@ -970,7 +973,7 @@ void PX4RCCalibration::_updateView()
for (int chan=_chanCount; chan<_chanMax; chan++) {
_rgRCValueMonitorWidget[chan]->setVisible(false);
_rgRCValueMonitorLabel[chan]->setVisible(false);
//qDebug() << "Off" << _rgRCValueMonitorWidget[chan]->objectName() << chan;
qCDebug(PX4RCCalibrationLog) << "Hiding channel" << _rgRCValueMonitorWidget[chan]->objectName() << chan;
}
}
......@@ -1016,7 +1019,7 @@ void PX4RCCalibration::_stopCalibration(void)
/// @brief Saves the current channel values, so that we can detect when the use moves an input.
void PX4RCCalibration::_rcCalSaveCurrentValues(void)
{
//qDebug() << "_rcCalSaveCurrentValues";
qCDebug(PX4RCCalibrationLog) << "_rcCalSaveCurrentValues";
for (unsigned i = 0; i < _chanMax; i++) {
_rcValueSave[i] = _rcRawValue[i];
}
......@@ -1136,7 +1139,7 @@ void PX4RCCalibration::_setHelpImage(const char* imageFile)
}
file += imageFile;
//qDebug() << "_setHelpImage" << file;
qCDebug(PX4RCCalibrationLog) << "_setHelpImage" << file;
_ui->radioIcon->setPixmap(QPixmap(file));
}
......@@ -34,9 +34,12 @@
#include "UASInterface.h"
#include "RCValueWidget.h"
#include "QGCLoggingCategory.h"
#include "ui_PX4RCCalibration.h"
Q_DECLARE_LOGGING_CATEGORY(PX4RCCalibrationLog)
class PX4RCCalibrationTest;
namespace Ui {
......
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