OpticalFlowConfig.cc 939 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
void OpticalFlowConfig::parameterChanged(int uas, int component, QString parameterName, QVariant value)
{
16 17 18
    Q_UNUSED(uas);
    Q_UNUSED(component);
    
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
    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)
    {
36
        showNullMAVErrorMessageBox();
37 38
        return;
    }
39
    m_uas->getParamManager()->setParameter(1,"FLOW_ENABLE",checked ? 1 : 0);
40
}