OpticalFlowConfig.cc 890 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
    initConnections();
9 10 11 12 13
}

OpticalFlowConfig::~OpticalFlowConfig()
{
}
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
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)
    {
33
        showNullMAVErrorMessageBox();
34 35
        return;
    }
36
    m_uas->getParamManager()->setParameter(1,"FLOW_ENABLE",checked ? 1 : 0);
37
}