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

OP-308 Make actuators read-only and set them to zero when running calibration, so that engines cannot be started by accident.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2779 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
edouard 2011-02-13 19:10:29 +00:00 committed by edouard
parent 52f09e5d55
commit d0d5d2db4e

View File

@ -888,6 +888,19 @@ void ConfigServoWidget::updateChannels(UAVObject* controlCommand)
mccDataRate = mdata.flightTelemetryUpdatePeriod;
mdata.flightTelemetryUpdatePeriod = 150;
controlCommand->setMetadata(mdata);
// Also protect the user by setting all values to zero
// and making the ActuatorCommand object readonly
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("ActuatorCommand")));
mdata = obj->getMetadata();
mdata.flightAccess = UAVObject::ACCESS_READONLY;
obj->setMetadata(mdata);
UAVObjectField *field = obj->getField("Channel");
for (int i=0; i< field->getNumElements(); i++) {
field->setValue(0,i);
}
obj->updated();
}
fieldName = QString("Channel");
field = controlCommand->getField(fieldName);
@ -932,6 +945,12 @@ void ConfigServoWidget::updateChannels(UAVObject* controlCommand)
mdata.flightTelemetryUpdateMode = UAVObject::UPDATEMODE_PERIODIC;
mdata.flightTelemetryUpdatePeriod = mccDataRate;
controlCommand->setMetadata(mdata);
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("ActuatorCommand")));
mdata = obj->getMetadata();
mdata.flightAccess = UAVObject::ACCESS_READWRITE;
obj->setMetadata(mdata);
}
firstUpdate = true;
}