Commit 7a2bec3e authored by Don Gagne's avatar Don Gagne

Merge pull request #1775 from DonLakeFlyer/RadioCal

Remove MIN/MAX/TRIM as cal trigger
parents 628d3aa1 825187e5
......@@ -58,7 +58,8 @@ bool RadioComponent::requiresSetup(void) const
bool RadioComponent::setupComplete(void) const
{
// Check for mapped attitude controls
// The best we can do to detect the need for a radio calibration is look for attitude
// controls to be mapped.
QStringList attitudeMappings;
attitudeMappings << "RC_MAP_ROLL" << "RC_MAP_PITCH" << "RC_MAP_YAW" << "RC_MAP_THROTTLE";
foreach(QString mapParam, attitudeMappings) {
......@@ -67,32 +68,6 @@ bool RadioComponent::setupComplete(void) const
}
}
// Check for min/max/trim defaults for channel 1-4
static const int rcMinDefault = 1000;
static const int rcMaxDefault = 2000;
static const int rcTrimDefault = 1500;
for (int i=1; i<5; i++) {
QVariant value;
int rcMin, rcMax, rcTrim;
QString param;
param = QString("RC%1_MIN").arg(i);
rcMin = _autopilot->getParameterFact(FactSystem::defaultComponentId, param)->value().toInt();
param = QString("RC%1_MAX").arg(i);
rcMax = _autopilot->getParameterFact(FactSystem::defaultComponentId, param)->value().toInt();
param = QString("RC%1_TRIM").arg(i);
rcTrim = _autopilot->getParameterFact(FactSystem::defaultComponentId, param)->value().toInt();
if (rcMin == rcMinDefault && rcMax == rcMaxDefault && rcTrim == rcTrimDefault) {
return false;
}
}
return true;
}
......@@ -112,20 +87,8 @@ QStringList RadioComponent::setupCompleteChangedTriggerList(void) const
{
QStringList triggers;
// The best we can do to detect the need for a radio calibration is look for trim/min/max still being
// at defaults. We also look for attitude controls to be mapped. But since they default to channels
// they are not a very reliable source.
// Attitude control mapping is always a trigger
triggers << "RC_MAP_ROLL" << "RC_MAP_PITCH" << "RC_MAP_YAW" << "RC_MAP_THROTTLE";
// We also trigger on min/max/trim for channels 1-4 which would normally be the attitude
// control channels. This may not always be the case, but it's the best we can
triggers << "RC1_MIN" << "RC1_MAX" << "RC1_TRIM";
triggers << "RC2_MIN" << "RC2_MAX" << "RC2_TRIM";
triggers << "RC3_MIN" << "RC3_MAX" << "RC3_TRIM";
triggers << "RC4_MIN" << "RC4_MAX" << "RC4_TRIM";
return triggers;
}
......
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