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

View File

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