OpticalFlowConfig.cc 867 Bytes
Newer Older
1
#include "OpticalFlowConfig.h"
2
#include <QMessageBox>
3

4
OpticalFlowConfig::OpticalFlowConfig(QWidget *parent) : AP2ConfigWidget(parent)
5 6
{
    ui.setupUi(this);
7
    connect(ui.enableCheckBox,SIGNAL(clicked(bool)),this,SLOT(enableCheckBoxClicked(bool)));
8 9 10 11 12
}

OpticalFlowConfig::~OpticalFlowConfig()
{
}
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
void OpticalFlowConfig::parameterChanged(int uas, int component, QString parameterName, QVariant value)
{
    if (parameterName == "FLOW_ENABLE")
    {
        if (value.toInt() == 0)
        {
            ui.enableCheckBox->setChecked(false);
        }
        else
        {
            ui.enableCheckBox->setChecked(true);
        }
    }
}

void OpticalFlowConfig::enableCheckBoxClicked(bool checked)
{
    if (!m_uas)
    {
32
        showNullMAVErrorMessageBox();
33 34
        return;
    }
35
    m_uas->getParamManager()->setParameter(1,"FLOW_ENABLE",checked ? 1 : 0);
36
}