CameraGimbalConfig.cc 28 KB
Newer Older
1 2
#include <QMessageBox>
#include <QDebug>
3 4 5

#include "CameraGimbalConfig.h"

6 7 8
CameraGimbalConfig::CameraGimbalConfig(QWidget *parent) : AP2ConfigWidget(parent)
{
    ui.setupUi(this);
9
    ui.tiltChannelComboBox->addItem(tr("Disable"));
10 11 12 13 14 15 16
    ui.tiltChannelComboBox->addItem("RC5");
    ui.tiltChannelComboBox->addItem("RC6");
    ui.tiltChannelComboBox->addItem("RC7");
    ui.tiltChannelComboBox->addItem("RC8");
    ui.tiltChannelComboBox->addItem("RC10");
    ui.tiltChannelComboBox->addItem("RC11");

17
    ui.tiltInputChannelComboBox->addItem(tr("Disable"));
18 19 20 21 22
    ui.tiltInputChannelComboBox->addItem("RC5");
    ui.tiltInputChannelComboBox->addItem("RC6");
    ui.tiltInputChannelComboBox->addItem("RC7");
    ui.tiltInputChannelComboBox->addItem("RC8");

23
    ui.rollChannelComboBox->addItem(tr("Disable"));
24 25 26 27 28 29 30
    ui.rollChannelComboBox->addItem("RC5");
    ui.rollChannelComboBox->addItem("RC6");
    ui.rollChannelComboBox->addItem("RC7");
    ui.rollChannelComboBox->addItem("RC8");
    ui.rollChannelComboBox->addItem("RC10");
    ui.rollChannelComboBox->addItem("RC11");

31
    ui.rollInputChannelComboBox->addItem(tr("Disable"));
32 33 34 35 36 37
    ui.rollInputChannelComboBox->addItem("RC5");
    ui.rollInputChannelComboBox->addItem("RC6");
    ui.rollInputChannelComboBox->addItem("RC7");
    ui.rollInputChannelComboBox->addItem("RC8");


38
    ui.panChannelComboBox->addItem(tr("Disable"));
39 40 41 42 43 44 45
    ui.panChannelComboBox->addItem("RC5");
    ui.panChannelComboBox->addItem("RC6");
    ui.panChannelComboBox->addItem("RC7");
    ui.panChannelComboBox->addItem("RC8");
    ui.panChannelComboBox->addItem("RC10");
    ui.panChannelComboBox->addItem("RC11");

46
    ui.panInputChannelComboBox->addItem(tr("Disable"));
47 48 49 50 51 52
    ui.panInputChannelComboBox->addItem("RC5");
    ui.panInputChannelComboBox->addItem("RC6");
    ui.panInputChannelComboBox->addItem("RC7");
    ui.panInputChannelComboBox->addItem("RC8");


53 54 55
    ui.shutterChannelComboBox->addItem(tr("Disable"));
    ui.shutterChannelComboBox->addItem(tr("Relay"));
    ui.shutterChannelComboBox->addItem(tr("Transistor"));
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
    ui.shutterChannelComboBox->addItem("RC5");
    ui.shutterChannelComboBox->addItem("RC6");
    ui.shutterChannelComboBox->addItem("RC7");
    ui.shutterChannelComboBox->addItem("RC8");
    ui.shutterChannelComboBox->addItem("RC10");
    ui.shutterChannelComboBox->addItem("RC11");

    connect(ui.tiltServoMinSpinBox,SIGNAL(editingFinished()),this,SLOT(updateTilt()));
    connect(ui.tiltServoMaxSpinBox,SIGNAL(editingFinished()),this,SLOT(updateTilt()));
    connect(ui.tiltAngleMinSpinBox,SIGNAL(editingFinished()),this,SLOT(updateTilt()));
    connect(ui.tiltAngleMaxSpinBox,SIGNAL(editingFinished()),this,SLOT(updateTilt()));
    connect(ui.tiltChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateTilt()));
    connect(ui.tiltInputChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateTilt()));
    connect(ui.tiltReverseCheckBox,SIGNAL(clicked(bool)),this,SLOT(updateTilt()));
    connect(ui.tiltStabilizeCheckBox,SIGNAL(clicked(bool)),this,SLOT(updateTilt()));

72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
    connect(ui.rollServoMinSpinBox,SIGNAL(editingFinished()),this,SLOT(updateRoll()));
    connect(ui.rollServoMaxSpinBox,SIGNAL(editingFinished()),this,SLOT(updateRoll()));
    connect(ui.rollAngleMinSpinBox,SIGNAL(editingFinished()),this,SLOT(updateRoll()));
    connect(ui.rollAngleMaxSpinBox,SIGNAL(editingFinished()),this,SLOT(updateRoll()));
    connect(ui.rollChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateRoll()));
    connect(ui.rollInputChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateRoll()));
    connect(ui.rollReverseCheckBox,SIGNAL(clicked(bool)),this,SLOT(updateRoll()));
    connect(ui.rollStabilizeCheckBox,SIGNAL(clicked(bool)),this,SLOT(updateRoll()));

    connect(ui.panServoMinSpinBox,SIGNAL(editingFinished()),this,SLOT(updatePan()));
    connect(ui.panServoMaxSpinBox,SIGNAL(editingFinished()),this,SLOT(updatePan()));
    connect(ui.panAngleMinSpinBox,SIGNAL(editingFinished()),this,SLOT(updatePan()));
    connect(ui.panAngleMaxSpinBox,SIGNAL(editingFinished()),this,SLOT(updatePan()));
    connect(ui.panChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updatePan()));
    connect(ui.panInputChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updatePan()));
    connect(ui.panReverseCheckBox,SIGNAL(clicked(bool)),this,SLOT(updatePan()));
    connect(ui.panStabilizeCheckBox,SIGNAL(clicked(bool)),this,SLOT(updatePan()));
89 90 91 92 93 94 95 96 97


    connect(ui.shutterServoMinSpinBox,SIGNAL(editingFinished()),this,SLOT(updateShutter()));
    connect(ui.shutterServoMaxSpinBox,SIGNAL(editingFinished()),this,SLOT(updateShutter()));
    connect(ui.shutterPushedSpinBox,SIGNAL(editingFinished()),this,SLOT(updateShutter()));
    connect(ui.shutterNotPushedSpinBox,SIGNAL(editingFinished()),this,SLOT(updateShutter()));
    connect(ui.shutterDurationSpinBox,SIGNAL(editingFinished()),this,SLOT(updateShutter()));
    connect(ui.shutterChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateShutter()));

98 99 100
    connect(ui.retractXSpinBox,SIGNAL(editingFinished()),this,SLOT(updateRetractAngles()));
    connect(ui.retractYSpinBox,SIGNAL(editingFinished()),this,SLOT(updateRetractAngles()));
    connect(ui.retractZSpinBox,SIGNAL(editingFinished()),this,SLOT(updateRetractAngles()));
101

102 103 104 105 106 107 108
    connect(ui.controlXSpinBox,SIGNAL(editingFinished()),this,SLOT(updateControlAngles()));
    connect(ui.controlYSpinBox,SIGNAL(editingFinished()),this,SLOT(updateControlAngles()));
    connect(ui.controlZSpinBox,SIGNAL(editingFinished()),this,SLOT(updateControlAngles()));

    connect(ui.neutralXSpinBox,SIGNAL(editingFinished()),this,SLOT(updateNeutralAngles()));
    connect(ui.neutralYSpinBox,SIGNAL(editingFinished()),this,SLOT(updateNeutralAngles()));
    connect(ui.neutralZSpinBox,SIGNAL(editingFinished()),this,SLOT(updateNeutralAngles()));
109
    initConnections();
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145

}
void CameraGimbalConfig::updateRetractAngles()
{
    if (!m_uas)
    {
        showNullMAVErrorMessageBox();
        return;
    }
    m_uas->getParamManager()->setParameter(1,"MNT_RETRACT_X",ui.retractXSpinBox->value());
    m_uas->getParamManager()->setParameter(1,"MNT_RETRACT_Y",ui.retractYSpinBox->value());
    m_uas->getParamManager()->setParameter(1,"MNT_RETRACT_Z",ui.retractZSpinBox->value());
}

void CameraGimbalConfig::updateNeutralAngles()
{
    if (!m_uas)
    {
        showNullMAVErrorMessageBox();
        return;
    }
    m_uas->getParamManager()->setParameter(1,"MNT_NEUTRAL_X",ui.neutralXSpinBox->value());
    m_uas->getParamManager()->setParameter(1,"MNT_NEUTRAL_Y",ui.neutralYSpinBox->value());
    m_uas->getParamManager()->setParameter(1,"MNT_NEUTRAL_Z",ui.neutralZSpinBox->value());
}

void CameraGimbalConfig::updateControlAngles()
{
    if (!m_uas)
    {
        showNullMAVErrorMessageBox();
        return;
    }
    m_uas->getParamManager()->setParameter(1,"MNT_CONTROL_X",ui.controlXSpinBox->value());
    m_uas->getParamManager()->setParameter(1,"MNT_CONTROL_Y",ui.controlYSpinBox->value());
    m_uas->getParamManager()->setParameter(1,"MNT_CONTROL_Z",ui.controlZSpinBox->value());
146
}
147

148 149 150 151
void CameraGimbalConfig::updateTilt()
{
    if (!m_uas)
    {
152
        showNullMAVErrorMessageBox();
153 154
        return;
    }
155
    if (!m_tiltPrefix.isEmpty())
156 157
    {
        //We need to set this to 0 for disabled.
158
        m_uas->getParamManager()->setParameter(1,m_tiltPrefix + "FUNCTION",0);
159
    }
160 161 162 163 164
    if (ui.tiltChannelComboBox->currentIndex() == 0)
    {
        //Disabled
        return;
    }
165

166 167 168
    m_uas->getParamManager()->setParameter(1,ui.tiltChannelComboBox->currentText() + "_FUNCTION",7);
    m_uas->getParamManager()->setParameter(1,ui.tiltChannelComboBox->currentText() + "_MIN",ui.tiltServoMinSpinBox->value());
    m_uas->getParamManager()->setParameter(1,ui.tiltChannelComboBox->currentText() + "_MAX",ui.tiltServoMaxSpinBox->value());
169 170
    m_uas->getParamManager()->setParameter(1,"MNT_ANGMIN_TIL",ui.tiltAngleMinSpinBox->value() * 100);
    m_uas->getParamManager()->setParameter(1,"MNT_ANGMAX_TIL",ui.tiltAngleMaxSpinBox->value() * 100);
171 172 173 174 175 176 177 178 179 180
    m_uas->getParamManager()->setParameter(1,ui.tiltChannelComboBox->currentText() + "_REV",(ui.tiltReverseCheckBox->isChecked() ? 1 : 0));
    if (ui.tiltInputChannelComboBox->currentIndex() == 0)
    {
        m_uas->getParamManager()->setParameter(1,"MNT_RC_IN_TILT",0);
    }
    else
    {
        m_uas->getParamManager()->setParameter(1,"MNT_RC_IN_TILT",ui.tiltInputChannelComboBox->currentIndex()+4);
    }
}
181

182
void CameraGimbalConfig::updateRoll()
183
{
184 185
    if (!m_uas)
    {
186
        showNullMAVErrorMessageBox();
187 188 189 190 191
        return;
    }
    m_uas->getParamManager()->setParameter(1,ui.rollChannelComboBox->currentText() + "_FUNCTION",8);
    m_uas->getParamManager()->setParameter(1,ui.rollChannelComboBox->currentText() + "_MIN",ui.rollServoMinSpinBox->value());
    m_uas->getParamManager()->setParameter(1,ui.rollChannelComboBox->currentText() + "_MAX",ui.rollServoMaxSpinBox->value());
192 193
    m_uas->getParamManager()->setParameter(1,"MNT_ANGMIN_ROL",ui.rollAngleMinSpinBox->value() * 100);
    m_uas->getParamManager()->setParameter(1,"MNT_ANGMAX_ROL",ui.rollAngleMaxSpinBox->value() * 100);
194 195 196 197 198 199 200 201 202
    m_uas->getParamManager()->setParameter(1,ui.rollChannelComboBox->currentText() + "_REV",(ui.rollReverseCheckBox->isChecked() ? 1 : 0));
    if (ui.rollInputChannelComboBox->currentIndex() == 0)
    {
        m_uas->getParamManager()->setParameter(1,"MNT_RC_IN_ROLL",0);
    }
    else
    {
        m_uas->getParamManager()->setParameter(1,"MNT_RC_IN_ROLL",ui.rollInputChannelComboBox->currentIndex()+4);
    }
203 204
}

205 206 207 208
void CameraGimbalConfig::updatePan()
{
    if (!m_uas)
    {
209
        showNullMAVErrorMessageBox();
210 211 212 213 214
        return;
    }
    m_uas->getParamManager()->setParameter(1,ui.panChannelComboBox->currentText() + "_FUNCTION",6);
    m_uas->getParamManager()->setParameter(1,ui.panChannelComboBox->currentText() + "_MIN",ui.panServoMinSpinBox->value());
    m_uas->getParamManager()->setParameter(1,ui.panChannelComboBox->currentText() + "_MAX",ui.panServoMaxSpinBox->value());
215 216
    m_uas->getParamManager()->setParameter(1,"MNT_ANGMIN_PAN",ui.panAngleMinSpinBox->value() * 100);
    m_uas->getParamManager()->setParameter(1,"MNT_ANGMAX_PAN",ui.panAngleMaxSpinBox->value() * 100);
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231
    m_uas->getParamManager()->setParameter(1,ui.panChannelComboBox->currentText() + "_REV",(ui.panReverseCheckBox->isChecked() ? 1 : 0));
    if (ui.panInputChannelComboBox->currentIndex() == 0)
    {
        m_uas->getParamManager()->setParameter(1,"MNT_RC_IN_PAN",0);
    }
    else
    {
        m_uas->getParamManager()->setParameter(1,"MNT_RC_IN_PAN",ui.panInputChannelComboBox->currentIndex()+4);
    }
}

void CameraGimbalConfig::updateShutter()
{
    if (!m_uas)
    {
232
        showNullMAVErrorMessageBox();
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261
        return;
    }
    if (ui.shutterChannelComboBox->currentIndex() == 0) //Disabled
    {
        m_uas->getParamManager()->setParameter(1,"CAM_TRIGG_TYPE",0);
    }
    else if (ui.shutterChannelComboBox->currentIndex() == 1) //Relay
    {
        m_uas->getParamManager()->setParameter(1,"CAM_TRIGG_TYPE",1);
    }
    else if (ui.shutterChannelComboBox->currentIndex() == 2) //Transistor
    {
        m_uas->getParamManager()->setParameter(1,"CAM_TRIGG_TYPE",4);
    }
    else
    {
        m_uas->getParamManager()->setParameter(1,ui.shutterChannelComboBox->currentText() + "_FUNCTION",10);
        m_uas->getParamManager()->setParameter(1,"CAM_TRIGG_TYPE",0);
    }
    m_uas->getParamManager()->setParameter(1,ui.shutterChannelComboBox->currentText() + "_MIN",ui.shutterServoMinSpinBox->value());
    m_uas->getParamManager()->setParameter(1,ui.shutterChannelComboBox->currentText() + "_MAX",ui.shutterServoMaxSpinBox->value());
    m_uas->getParamManager()->setParameter(1,"CAM_SERVO_ON",ui.shutterPushedSpinBox->value());
    m_uas->getParamManager()->setParameter(1,"CAM_SERVO_OFF",ui.shutterNotPushedSpinBox->value());
    m_uas->getParamManager()->setParameter(1,"CAM_DURATION",ui.shutterDurationSpinBox->value());


}


262 263 264
CameraGimbalConfig::~CameraGimbalConfig()
{
}
265 266 267

void CameraGimbalConfig::parameterChanged(int uas, int component, QString parameterName, QVariant value)
{
268 269 270
    Q_UNUSED(uas);
    Q_UNUSED(component);
    
271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363
    if (parameterName == "MNT_ANGMIN_TIL") //TILT
    {
        ui.tiltAngleMinSpinBox->setValue(value.toInt() / 100.0);
    }
    else if (parameterName == "MNT_ANGMAX_TIL")
    {
        ui.tiltAngleMaxSpinBox->setValue(value.toInt() / 100.0);
    }
    else if (parameterName == "MNT_RC_IN_TILT")
    {
        disconnect(ui.tiltInputChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateTilt()));
        if (value.toInt() == 0)
        {
            ui.tiltInputChannelComboBox->setCurrentIndex(0);
        }
        else
        {
            ui.tiltInputChannelComboBox->setCurrentIndex(value.toInt()-4);
        }
        connect(ui.tiltInputChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateTilt()));
    }
    else if (parameterName == "MNT_ANGMIN_ROL") //ROLL
    {
        ui.rollAngleMinSpinBox->setValue(value.toInt() / 100.0);
    }
    else if (parameterName == "MNT_ANGMAX_ROL")
    {
        ui.rollAngleMaxSpinBox->setValue(value.toInt() / 100.0);
    }
    else if (parameterName == "MNT_RC_IN_ROLL")
    {
        disconnect(ui.rollInputChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateRoll()));
        if (value.toInt() == 0)
        {
            ui.rollInputChannelComboBox->setCurrentIndex(0);
        }
        else
        {
            ui.rollInputChannelComboBox->setCurrentIndex(value.toInt()-4);
        }
        connect(ui.rollInputChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateRoll()));
    }
    else if (parameterName == "MNT_ANGMIN_PAN") //PAN
    {
        ui.panAngleMinSpinBox->setValue(value.toInt() / 100.0);
    }
    else if (parameterName == "MNT_ANGMAX_PAN")
    {
        ui.panAngleMaxSpinBox->setValue(value.toInt() / 100.0);
    }
    else if (parameterName == "MNT_RC_IN_PAN")
    {
        disconnect(ui.panInputChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updatePan()));
        if (value.toInt() == 0)
        {
            ui.panInputChannelComboBox->setCurrentIndex(0);
        }
        else
        {
            ui.panInputChannelComboBox->setCurrentIndex(value.toInt()-4);
        }
        connect(ui.panInputChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updatePan()));
    }
    if (parameterName == "CAM_DURATION")
    {
        ui.shutterDurationSpinBox->setValue(value.toInt());
    }
    else if (parameterName == "CAM_SERVO_OFF")
    {
        ui.shutterNotPushedSpinBox->setValue(value.toInt());
    }
    else if (parameterName == "CAM_SERVO_ON")
    {
        ui.shutterPushedSpinBox->setValue(value.toInt());
    }
    else if (parameterName == "CAM_TRIGG_TYPE")
    {
        disconnect(ui.shutterChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateShutter()));
        if (value.toInt() == 0) //Disabled
        {
            ui.shutterChannelComboBox->setCurrentIndex(0);
            ///TODO: Request all _FUNCTIONs here to find out if shutter is actually disabled.
        }
        else if (value.toInt() == 1) // Relay
        {
            ui.shutterChannelComboBox->setCurrentIndex(1);
        }
        else if (value.toInt() == 4) //Transistor
        {
            ui.shutterChannelComboBox->setCurrentIndex(2);
        }
        connect(ui.shutterChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateShutter()));
    }
364
    if (parameterName.startsWith(m_shutterPrefix) && !m_shutterPrefix.isEmpty())
365 366 367 368 369 370 371 372 373 374
    {
        if (parameterName.endsWith("MIN"))
        {
            ui.shutterServoMinSpinBox->setValue(value.toInt());
        }
        else if (parameterName.endsWith("MAX"))
        {
            ui.shutterServoMaxSpinBox->setValue(value.toInt());
        }
    }
375
    else if (parameterName.startsWith(m_tiltPrefix) && !m_tiltPrefix.isEmpty())
376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396
    {
        if (parameterName.endsWith("MIN"))
        {
            ui.tiltServoMinSpinBox->setValue(value.toInt());
        }
        else if (parameterName.endsWith("MAX"))
        {
            ui.tiltServoMaxSpinBox->setValue(value.toInt());
        }
        else if (parameterName.endsWith("REV"))
        {
            if (value.toInt() == 0)
            {
                ui.tiltReverseCheckBox->setChecked(false);
            }
            else
            {
                ui.tiltReverseCheckBox->setChecked(true);
            }
        }
    }
397
    else if (parameterName.startsWith(m_rollPrefix) && !m_rollPrefix.isEmpty())
398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418
    {
        if (parameterName.endsWith("MIN"))
        {
            ui.rollServoMinSpinBox->setValue(value.toInt());
        }
        else if (parameterName.endsWith("MAX"))
        {
            ui.rollServoMaxSpinBox->setValue(value.toInt());
        }
        else if (parameterName.endsWith("REV"))
        {
            if (value.toInt() == 0)
            {
                ui.rollReverseCheckBox->setChecked(false);
            }
            else
            {
                ui.rollReverseCheckBox->setChecked(true);
            }
        }
    }
419
    else if (parameterName.startsWith(m_panPrefix) && !m_panPrefix.isEmpty())
420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448
    {
        if (parameterName.endsWith("MIN"))
        {
            ui.panServoMinSpinBox->setValue(value.toInt());
        }
        else if (parameterName.endsWith("MAX"))
        {
            ui.panServoMaxSpinBox->setValue(value.toInt());
        }
        else if (parameterName.endsWith("REV"))
        {
            if (value.toInt() == 0)
            {
                ui.panReverseCheckBox->setChecked(false);
            }
            else
            {
                ui.panReverseCheckBox->setChecked(true);
            }
        }
    }
    else if (parameterName == "RC5_FUNCTION")
    {
        if (value.toInt() == 10)
        {
            //RC5 is shutter.
            disconnect(ui.shutterChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateShutter()));
            ui.shutterChannelComboBox->setCurrentIndex(3);
            connect(ui.shutterChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateShutter()));
449
            m_shutterPrefix = "RC5_";
450 451 452 453 454 455 456
        }
        else if (value.toInt() == 8)
        {
            //RC5 is roll
            disconnect(ui.rollChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateRoll()));
            ui.rollChannelComboBox->setCurrentIndex(1);
            connect(ui.rollChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateRoll()));
457
            m_rollPrefix = "RC5_";
458 459 460 461 462 463 464
        }
        else if (value.toInt() == 7)
        {
            //RC5 is tilt
            disconnect(ui.tiltChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateTilt()));
            ui.tiltChannelComboBox->setCurrentIndex(1);
            connect(ui.tiltChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateTilt()));
465
            m_tiltPrefix = "RC5_";
466 467 468 469 470 471 472
        }
        else if (value.toInt() == 6)
        {
            //RC5 is pan
            disconnect(ui.panChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updatePan()));
            ui.panChannelComboBox->setCurrentIndex(1);
            connect(ui.panChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updatePan()));
473
            m_panPrefix = "RC5_";
474 475 476 477 478 479 480 481 482 483 484 485 486
        }
        m_uas->getParamManager()->requestParameterUpdate(1,"RC5_MIN");
        m_uas->getParamManager()->requestParameterUpdate(1,"RC5_MAX");
        m_uas->getParamManager()->requestParameterUpdate(1,"RC5_REV");
    }
    else if (parameterName == "RC6_FUNCTION")
    {
        if (value.toInt() == 10)
        {
            //RC6 is shutter.
            disconnect(ui.shutterChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateShutter()));
            ui.shutterChannelComboBox->setCurrentIndex(4);
            connect(ui.shutterChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateShutter()));
487
            m_shutterPrefix = "RC6_";
488 489 490 491 492 493 494
        }
        else if (value.toInt() == 8)
        {
            //RC6 is roll
            disconnect(ui.rollChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateRoll()));
            ui.rollChannelComboBox->setCurrentIndex(2);
            connect(ui.rollChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateRoll()));
495
            m_rollPrefix = "RC6_";
496 497 498 499 500 501 502
        }
        else if (value.toInt() == 7)
        {
            //RC6 is tilt
            disconnect(ui.tiltChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateTilt()));
            ui.tiltChannelComboBox->setCurrentIndex(2);
            connect(ui.tiltChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateTilt()));
503
            m_tiltPrefix = "RC6_";
504 505 506 507 508 509 510
        }
        else if (value.toInt() == 6)
        {
            //RC6 is pan
            disconnect(ui.panChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updatePan()));
            ui.panChannelComboBox->setCurrentIndex(2);
            connect(ui.panChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updatePan()));
511
            m_panPrefix = "RC6_";
512 513 514 515 516 517 518 519 520 521 522 523 524
        }
        m_uas->getParamManager()->requestParameterUpdate(1,"RC6_MIN");
        m_uas->getParamManager()->requestParameterUpdate(1,"RC6_MAX");
        m_uas->getParamManager()->requestParameterUpdate(1,"RC6_REV");
    }
    else if (parameterName == "RC7_FUNCTION")
    {
        if (value.toInt() == 10)
        {
            //RC7 is shutter.
            disconnect(ui.shutterChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateShutter()));
            ui.shutterChannelComboBox->setCurrentIndex(5);
            connect(ui.shutterChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateShutter()));
525
            m_shutterPrefix = "RC7_";
526 527 528 529 530 531 532
        }
        else if (value.toInt() == 8)
        {
            //RC7 is roll
            disconnect(ui.rollChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateRoll()));
            ui.rollChannelComboBox->setCurrentIndex(3);
            connect(ui.rollChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateRoll()));
533
            m_rollPrefix = "RC7_";
534 535 536 537 538 539 540
        }
        else if (value.toInt() == 7)
        {
            //RC7 is tilt
            disconnect(ui.tiltChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateTilt()));
            ui.tiltChannelComboBox->setCurrentIndex(3);
            connect(ui.tiltChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateTilt()));
541
            m_tiltPrefix = "RC7_";
542 543 544 545 546 547 548
        }
        else if (value.toInt() == 6)
        {
            //RC7 is pan
            disconnect(ui.panChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updatePan()));
            ui.panChannelComboBox->setCurrentIndex(3);
            connect(ui.panChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updatePan()));
549
            m_panPrefix = "RC7_";
550 551 552 553 554 555 556 557 558 559 560 561 562
        }
        m_uas->getParamManager()->requestParameterUpdate(1,"RC7_MIN");
        m_uas->getParamManager()->requestParameterUpdate(1,"RC7_MAX");
        m_uas->getParamManager()->requestParameterUpdate(1,"RC7_REV");
    }
    else if (parameterName == "RC8_FUNCTION")
    {
        if (value.toInt() == 10)
        {
            //RC8 is shutter.
            disconnect(ui.shutterChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateShutter()));
            ui.shutterChannelComboBox->setCurrentIndex(6);
            connect(ui.shutterChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateShutter()));
563
            m_shutterPrefix = "RC8_";
564 565 566 567 568 569 570
        }
        else if (value.toInt() == 8)
        {
            //RC8 is roll
            disconnect(ui.rollChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateRoll()));
            ui.rollChannelComboBox->setCurrentIndex(4);
            connect(ui.rollChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateRoll()));
571
            m_rollPrefix = "RC8_";
572 573 574 575 576 577 578
        }
        else if (value.toInt() == 7)
        {
            //RC8 is tilt
            disconnect(ui.tiltChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateTilt()));
            ui.tiltChannelComboBox->setCurrentIndex(4);
            connect(ui.tiltChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateTilt()));
579
            m_tiltPrefix = "RC8_";
580 581 582 583 584 585 586
        }
        else if (value.toInt() == 6)
        {
            //RC8 is pan
            disconnect(ui.panChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updatePan()));
            ui.panChannelComboBox->setCurrentIndex(4);
            connect(ui.panChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updatePan()));
587
            m_panPrefix = "RC8_";
588 589 590 591 592 593 594 595 596 597 598 599 600
        }
        m_uas->getParamManager()->requestParameterUpdate(1,"RC8_MIN");
        m_uas->getParamManager()->requestParameterUpdate(1,"RC8_MAX");
        m_uas->getParamManager()->requestParameterUpdate(1,"RC8_REV");
    }
    else if (parameterName == "RC10_FUNCTION")
    {
        if (value.toInt() == 10)
        {
            //RC10 is shutter.
            disconnect(ui.shutterChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateShutter()));
            ui.shutterChannelComboBox->setCurrentIndex(7);
            connect(ui.shutterChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateShutter()));
601
            m_shutterPrefix = "RC10_";
602 603 604 605 606 607 608
        }
        else if (value.toInt() == 8)
        {
            //RC10 is roll
            disconnect(ui.rollChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateRoll()));
            ui.rollChannelComboBox->setCurrentIndex(5);
            connect(ui.rollChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateRoll()));
609
            m_rollPrefix = "RC10_";
610 611 612 613 614 615 616
        }
        else if (value.toInt() == 7)
        {
            //RC10 is tilt
            disconnect(ui.tiltChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateTilt()));
            ui.tiltChannelComboBox->setCurrentIndex(5);
            connect(ui.tiltChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateTilt()));
617
            m_tiltPrefix = "RC10_";
618 619 620 621 622 623 624
        }
        else if (value.toInt() == 6)
        {
            //RC10 is pan
            disconnect(ui.panChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updatePan()));
            ui.panChannelComboBox->setCurrentIndex(5);
            connect(ui.panChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updatePan()));
625
            m_panPrefix = "RC10_";
626 627 628 629 630 631 632 633 634 635 636 637 638
        }
        m_uas->getParamManager()->requestParameterUpdate(1,"RC10_MIN");
        m_uas->getParamManager()->requestParameterUpdate(1,"RC10_MAX");
        m_uas->getParamManager()->requestParameterUpdate(1,"RC10_REV");
    }
    else if (parameterName == "RC11_FUNCTION")
    {
        if (value.toInt() == 10)
        {
            //RC11 is shutter.
            disconnect(ui.shutterChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateShutter()));
            ui.shutterChannelComboBox->setCurrentIndex(8);
            connect(ui.shutterChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateShutter()));
639
            m_shutterPrefix = "RC11_";
640 641 642 643 644 645 646
        }
        else if (value.toInt() == 8)
        {
            //RC11 is roll
            disconnect(ui.rollChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateRoll()));
            ui.rollChannelComboBox->setCurrentIndex(6);
            connect(ui.rollChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateRoll()));
647
            m_rollPrefix = "RC11_";
648 649 650 651 652 653 654
        }
        else if (value.toInt() == 7)
        {
            //RC11 is tilt
            disconnect(ui.tiltChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateTilt()));
            ui.tiltChannelComboBox->setCurrentIndex(6);
            connect(ui.tiltChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateTilt()));
655
            m_tiltPrefix = "RC11_";
656 657 658 659 660 661 662
        }
        else if (value.toInt() == 6)
        {
            //RC11 is pan
            disconnect(ui.panChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updatePan()));
            ui.panChannelComboBox->setCurrentIndex(6);
            connect(ui.panChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updatePan()));
663
            m_panPrefix = "RC11_";
664 665 666 667 668
        }
        m_uas->getParamManager()->requestParameterUpdate(1,"RC11_MIN");
        m_uas->getParamManager()->requestParameterUpdate(1,"RC11_MAX");
        m_uas->getParamManager()->requestParameterUpdate(1,"RC11_REV");
    }
669
}