1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-19 04:52:12 +01:00

OP-1458 Increase the update for the accessory channels

This commit is contained in:
Stefan Karlsson 2014-08-31 15:51:19 +02:00
parent 644d35fa41
commit cd5efd61d3
2 changed files with 29 additions and 11 deletions

View File

@ -395,6 +395,10 @@ void ConfigInputWidget::goToWizard()
flightModeSettingsData.Arming = FlightModeSettings::ARMING_ALWAYSDISARMED;
flightModeSettingsObj->setData(flightModeSettingsData);
accessoryDesiredObj0 = AccessoryDesired::GetInstance(getObjectManager(), 0);
accessoryDesiredObj1 = AccessoryDesired::GetInstance(getObjectManager(), 1);
accessoryDesiredObj2 = AccessoryDesired::GetInstance(getObjectManager(), 2);
// Use faster input update rate.
fastMdata();
@ -633,12 +637,9 @@ void ConfigInputWidget::wizardSetUpStep(enum wizardSteps step)
break;
case wizardIdentifyLimits:
{
accessoryDesiredObj0 = AccessoryDesired::GetInstance(getObjectManager(), 0);
accessoryDesiredObj1 = AccessoryDesired::GetInstance(getObjectManager(), 1);
accessoryDesiredObj2 = AccessoryDesired::GetInstance(getObjectManager(), 2);
setTxMovement(nothing);
ui->wzText->setText(QString(tr("Please move all controls to their maximum extents on both directions.\n\nPress Next when ready.")));
manualSettingsData = manualSettingsObj->getData();
manualSettingsData = manualSettingsObj->getData();
for (uint i = 0; i < ManualControlSettings::CHANNELMAX_NUMELEM; ++i) {
// Preserve the inverted status
if (manualSettingsData.ChannelMin[i] <= manualSettingsData.ChannelMax[i]) {
@ -766,16 +767,27 @@ void ConfigInputWidget::wizardTearDownStep(enum wizardSteps step)
}
}
static void fastMdataSingle(UAVDataObject *object, UAVObject::Metadata *savedMdata)
{
*savedMdata = object->getMetadata();
UAVObject::Metadata mdata = *savedMdata;
UAVObject::SetFlightTelemetryUpdateMode(mdata, UAVObject::UPDATEMODE_PERIODIC);
mdata.flightTelemetryUpdatePeriod = 150;
object->setMetadata(mdata);
}
static void restoreMdataSingle(UAVDataObject *object, UAVObject::Metadata *savedMdata)
{
object->setMetadata(*savedMdata);
}
/**
* Set manual control command to fast updates
*/
void ConfigInputWidget::fastMdata()
{
manualControlMdata = manualCommandObj->getMetadata();
UAVObject::Metadata mdata = manualControlMdata;
UAVObject::SetFlightTelemetryUpdateMode(mdata, UAVObject::UPDATEMODE_PERIODIC);
mdata.flightTelemetryUpdatePeriod = 150;
manualCommandObj->setMetadata(mdata);
fastMdataSingle(manualCommandObj, &manualControlMdata);
fastMdataSingle(accessoryDesiredObj0, &accessoryDesiredMdata0);
}
/**
@ -783,7 +795,8 @@ void ConfigInputWidget::fastMdata()
*/
void ConfigInputWidget::restoreMdata()
{
manualCommandObj->setMetadata(manualControlMdata);
restoreMdataSingle(manualCommandObj, &manualControlMdata);
restoreMdataSingle(accessoryDesiredObj0, &accessoryDesiredMdata0);
}
/**

View File

@ -96,20 +96,25 @@ private:
QList<int> heliChannelOrder;
QList<int> acroChannelOrder;
UAVObject::Metadata manualControlMdata;
ManualControlCommand *manualCommandObj;
ManualControlCommand::DataFields manualCommandData;
FlightStatus *flightStatusObj;
FlightStatus::DataFields flightStatusData;
UAVObject::Metadata accessoryDesiredMdata0;
AccessoryDesired *accessoryDesiredObj0;
AccessoryDesired *accessoryDesiredObj1;
AccessoryDesired *accessoryDesiredObj2;
AccessoryDesired::DataFields accessoryDesiredData0;
AccessoryDesired::DataFields accessoryDesiredData1;
AccessoryDesired::DataFields accessoryDesiredData2;
UAVObject::Metadata manualControlMdata;
ManualControlSettings *manualSettingsObj;
ManualControlSettings::DataFields manualSettingsData;
ManualControlSettings::DataFields previousManualSettingsData;
FlightModeSettings *flightModeSettingsObj;
FlightModeSettings::DataFields flightModeSettingsData;
FlightModeSettings::DataFields previousFlightModeSettingsData;