1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-27 16:54:15 +01:00

OP-1455 Send the current slider values when enabling Test outputs

This commit is contained in:
Stefan Karlsson 2014-08-23 15:45:16 +02:00
parent 449653f01e
commit f81effa7ea
2 changed files with 20 additions and 0 deletions

View File

@ -126,6 +126,17 @@ void ConfigOutputWidget::enableControls(bool enable)
ui->channelOutTest->setEnabled(enable);
}
/**
Force update all channels with the values in the OutputChannelForms.
*/
void ConfigOutputWidget::sendAllChannelTests()
{
for (unsigned int i = 0; i < ActuatorCommand::CHANNEL_NUMELEM; i++) {
OutputChannelForm *form = getOutputChannelForm(i);
sendChannelTest(i, form->neutral());
}
}
/**
Toggles the channel testing mode by making the GCS take over
the ActuatorCommand objects
@ -178,6 +189,11 @@ void ConfigOutputWidget::runChannelTests(bool state)
}
obj->setMetadata(mdata);
obj->updated();
// Setup the correct initial channel values when the channel testing mode is turned on.
if (state) {
sendAllChannelTests();
}
}
OutputChannelForm *ConfigOutputWidget::getOutputChannelForm(const int index) const

View File

@ -58,7 +58,11 @@ private:
void updateChannelInSlider(QSlider *slider, QLabel *min, QLabel *max, QCheckBox *rev, int value);
void assignOutputChannel(UAVDataObject *obj, QString &str);
OutputChannelForm *getOutputChannelForm(const int index) const;
void sendAllChannelTests();
int mccDataRate;
UAVObject::Metadata accInitialData;