<commit_before>/*===================================================================
APM_PLANNER Open Source Ground Control Station

(c) 2013 APM_PLANNER PROJECT <http://www.diydrones.com>

This file is part of the APM_PLANNER project

    APM_PLANNER is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    APM_PLANNER is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with APM_PLANNER. If not, see <http://www.gnu.org/licenses/>.

======================================================================*/

#include "QsLog.h"
#include <QMessageBox>

#include "CameraGimbalConfig.h"

CameraGimbalConfig::CameraGimbalConfig(QWidget *parent) : AP2ConfigWidget(parent)
{
    ui.setupUi(this);

    ui.camTriggerGroupBox->setEnabled(false);
    ui.tiltGroupBox->setEnabled(false);
    ui.rollGroupBox->setEnabled(false);
    ui.panGroupBox->setEnabled(false);

    addOutputRcChannels(ui.tiltChannelComboBox);
    addOutputRcChannels(ui.rollChannelComboBox);
    addOutputRcChannels(ui.panChannelComboBox);
    addOutputRcChannels(ui.camTriggerOutChannelComboBox);

    addInputRcChannels(ui.tiltInputChannelComboBox);
    addInputRcChannels(ui.rollInputChannelComboBox);
    addInputRcChannels(ui.panInputChannelComboBox);

    addTriggerTypes(ui.camTriggerTypeComboBox);

    ui.mountModeComboBox->insertItem(0, "Retract", MAV_MOUNT_MODE_RETRACT);
    ui.mountModeComboBox->insertItem(1, "Neutral", MAV_MOUNT_MODE_NEUTRAL );
    ui.mountModeComboBox->insertItem(2, "MAVLink Targeting", MAV_MOUNT_MODE_MAVLINK_TARGETING );
    ui.mountModeComboBox->insertItem(3, "RC Targeting", MAV_MOUNT_MODE_RC_TARGETING );
    ui.mountModeComboBox->insertItem(4, "GPS Point", MAV_MOUNT_MODE_GPS_POINT );

    initConnections();
}

void CameraGimbalConfig::initConnections()
{
    connectSignals();
    AP2ConfigWidget::initConnections();
}

void CameraGimbalConfig::connectSignals()
{
    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(int)));
    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()));

    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(int)));
    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(int)));
    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()));

    connect(ui.camTriggerServoMinSpinBox,SIGNAL(editingFinished()),this,SLOT(updateCameraTriggerSettings()));
    connect(ui.camTriggerServoMaxSpinBox,SIGNAL(editingFinished()),this,SLOT(updateCameraTriggerSettings()));
    connect(ui.camTriggerOnPwmSpinBox,SIGNAL(editingFinished()),this,SLOT(updateCameraTriggerSettings()));
    connect(ui.camTriggerOffPwmSpinBox,SIGNAL(editingFinished()),this,SLOT(updateCameraTriggerSettings()));
    connect(ui.camTriggerDurationSpinBox,SIGNAL(editingFinished()),this,SLOT(updateCameraTriggerSettings()));
    connect(ui.camTriggerOutChannelComboBox,SIGNAL(currentIndexChanged(int)),
            this,SLOT(updateCameraTriggerOutputCh(int)));
    connect(ui.camTriggerTypeComboBox, SIGNAL(currentIndexChanged(int)),
            this, SLOT(updateCameraTriggerSettings()));

    connect(ui.retractXSpinBox,SIGNAL(editingFinished()),this,SLOT(updateRetractAngles()));
    connect(ui.retractYSpinBox,SIGNAL(editingFinished()),this,SLOT(updateRetractAngles()));
    connect(ui.retractZSpinBox,SIGNAL(editingFinished()),this,SLOT(updateRetractAngles()));

    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()));

    connect(ui.mountModeComboBox,SIGNAL(currentIndexChanged(int)), this, SLOT(updateMountMode(int)));
}

void CameraGimbalConfig::disconnectSignals()
{
    disconnect(ui.tiltServoMinSpinBox,SIGNAL(editingFinished()),this,SLOT(updateTilt()));
    disconnect(ui.tiltServoMaxSpinBox,SIGNAL(editingFinished()),this,SLOT(updateTilt()));
    disconnect(ui.tiltAngleMinSpinBox,SIGNAL(editingFinished()),this,SLOT(updateTilt()));
    disconnect(ui.tiltAngleMaxSpinBox,SIGNAL(editingFinished()),this,SLOT(updateTilt()));
    disconnect(ui.tiltChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateTilt(int)));
    disconnect(ui.tiltInputChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateTilt()));
    disconnect(ui.tiltReverseCheckBox,SIGNAL(clicked(bool)),this,SLOT(updateTilt()));
    disconnect(ui.tiltStabilizeCheckBox,SIGNAL(clicked(bool)),this,SLOT(updateTilt()));

    disconnect(ui.rollServoMinSpinBox,SIGNAL(editingFinished()),this,SLOT(updateRoll()));
    disconnect(ui.rollServoMaxSpinBox,SIGNAL(editingFinished()),this,SLOT(updateRoll()));
    disconnect(ui.rollAngleMinSpinBox,SIGNAL(editingFinished()),this,SLOT(updateRoll()));
    disconnect(ui.rollAngleMaxSpinBox,SIGNAL(editingFinished()),this,SLOT(updateRoll()));
    disconnect(ui.rollChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateRoll(int)));
    disconnect(ui.rollInputChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateRoll()));
    disconnect(ui.rollReverseCheckBox,SIGNAL(clicked(bool)),this,SLOT(updateRoll()));
    disconnect(ui.rollStabilizeCheckBox,SIGNAL(clicked(bool)),this,SLOT(updateRoll()));

    disconnect(ui.panServoMinSpinBox,SIGNAL(editingFinished()),this,SLOT(updatePan()));
    disconnect(ui.panServoMaxSpinBox,SIGNAL(editingFinished()),this,SLOT(updatePan()));
    disconnect(ui.panAngleMinSpinBox,SIGNAL(editingFinished()),this,SLOT(updatePan()));
    disconnect(ui.panAngleMaxSpinBox,SIGNAL(editingFinished()),this,SLOT(updatePan()));
    disconnect(ui.panChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updatePan(int)));
    disconnect(ui.panInputChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updatePan()));
    disconnect(ui.panReverseCheckBox,SIGNAL(clicked(bool)),this,SLOT(updatePan()));
    disconnect(ui.panStabilizeCheckBox,SIGNAL(clicked(bool)),this,SLOT(updatePan()));

    disconnect(ui.camTriggerServoMinSpinBox,SIGNAL(editingFinished()),this,SLOT(updateCameraTriggerSettings()));
    disconnect(ui.camTriggerServoMaxSpinBox,SIGNAL(editingFinished()),this,SLOT(updateCameraTriggerSettings()));
    disconnect(ui.camTriggerOnPwmSpinBox,SIGNAL(editingFinished()),this,SLOT(updateCameraTriggerSettings()));
    disconnect(ui.camTriggerOffPwmSpinBox,SIGNAL(editingFinished()),this,SLOT(updateCameraTriggerSettings()));
    disconnect(ui.camTriggerDurationSpinBox,SIGNAL(editingFinished()),this,SLOT(updateCameraTriggerSettings()));
    disconnect(ui.camTriggerOutChannelComboBox,SIGNAL(currentIndexChanged(int)),
            this,SLOT(updateCameraTriggerOutputCh(int)));
    disconnect(ui.camTriggerTypeComboBox, SIGNAL(currentIndexChanged(int)),
            this, SLOT(updateCameraTriggerSettings()));

    disconnect(ui.retractXSpinBox,SIGNAL(editingFinished()),this,SLOT(updateRetractAngles()));
    disconnect(ui.retractYSpinBox,SIGNAL(editingFinished()),this,SLOT(updateRetractAngles()));
    disconnect(ui.retractZSpinBox,SIGNAL(editingFinished()),this,SLOT(updateRetractAngles()));

    disconnect(ui.controlXSpinBox,SIGNAL(editingFinished()),this,SLOT(updateControlAngles()));
    disconnect(ui.controlYSpinBox,SIGNAL(editingFinished()),this,SLOT(updateControlAngles()));
    disconnect(ui.controlZSpinBox,SIGNAL(editingFinished()),this,SLOT(updateControlAngles()));

    disconnect(ui.neutralXSpinBox,SIGNAL(editingFinished()),this,SLOT(updateNeutralAngles()));
    disconnect(ui.neutralYSpinBox,SIGNAL(editingFinished()),this,SLOT(updateNeutralAngles()));
    disconnect(ui.neutralZSpinBox,SIGNAL(editingFinished()),this,SLOT(updateNeutralAngles()));
}


void CameraGimbalConfig::addOutputRcChannels(QComboBox* comboBox)
{
    comboBox->addItem(tr("Disable"), 0);
    comboBox->addItem("RC5", 5);
    comboBox->addItem("RC6", 6);
    comboBox->addItem("RC7", 7);
    comboBox->addItem("RC8", 8);
    comboBox->addItem("RC9", 9);
    comboBox->addItem("RC10", 10);
    comboBox->addItem("RC11", 11);
    comboBox->addItem("RC12", 12);

}

void CameraGimbalConfig::addInputRcChannels(QComboBox* comboBox)
{
    comboBox->addItem(tr("None", 0));
    comboBox->addItem("RC5", 5);
    comboBox->addItem("RC6", 6);
    comboBox->addItem("RC7", 7);
    comboBox->addItem("RC8", 8);
}

void CameraGimbalConfig::addTriggerTypes(QComboBox *comboBox)
{
    comboBox->addItem("Servo", CAM_TRIGG_TYPE_SERVO);
    comboBox->addItem("Relay", CAM_TRIGG_TYPE_RELAY);
}

void CameraGimbalConfig::activeUASSet(UASInterface *uas)<commit_msg>Camera Setup: Add extra RC channel selectors to support up to 16 channels<commit_after>/*===================================================================
APM_PLANNER Open Source Ground Control Station

(c) 2013 APM_PLANNER PROJECT <http://www.diydrones.com>

This file is part of the APM_PLANNER project

    APM_PLANNER is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    APM_PLANNER is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with APM_PLANNER. If not, see <http://www.gnu.org/licenses/>.

======================================================================*/

#include "QsLog.h"
#include <QMessageBox>

#include "CameraGimbalConfig.h"

CameraGimbalConfig::CameraGimbalConfig(QWidget *parent) : AP2ConfigWidget(parent)
{
    ui.setupUi(this);

    ui.camTriggerGroupBox->setEnabled(false);
    ui.tiltGroupBox->setEnabled(false);
    ui.rollGroupBox->setEnabled(false);
    ui.panGroupBox->setEnabled(false);

    addOutputRcChannels(ui.tiltChannelComboBox);
    addOutputRcChannels(ui.rollChannelComboBox);
    addOutputRcChannels(ui.panChannelComboBox);
    addOutputRcChannels(ui.camTriggerOutChannelComboBox);

    addInputRcChannels(ui.tiltInputChannelComboBox);
    addInputRcChannels(ui.rollInputChannelComboBox);
    addInputRcChannels(ui.panInputChannelComboBox);

    addTriggerTypes(ui.camTriggerTypeComboBox);

    ui.mountModeComboBox->insertItem(0, "Retract", MAV_MOUNT_MODE_RETRACT);
    ui.mountModeComboBox->insertItem(1, "Neutral", MAV_MOUNT_MODE_NEUTRAL );
    ui.mountModeComboBox->insertItem(2, "MAVLink Targeting", MAV_MOUNT_MODE_MAVLINK_TARGETING );
    ui.mountModeComboBox->insertItem(3, "RC Targeting", MAV_MOUNT_MODE_RC_TARGETING );
    ui.mountModeComboBox->insertItem(4, "GPS Point", MAV_MOUNT_MODE_GPS_POINT );

    initConnections();
}

void CameraGimbalConfig::initConnections()
{
    connectSignals();
    AP2ConfigWidget::initConnections();
}

void CameraGimbalConfig::connectSignals()
{
    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(int)));
    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()));

    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(int)));
    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(int)));
    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()));

    connect(ui.camTriggerServoMinSpinBox,SIGNAL(editingFinished()),this,SLOT(updateCameraTriggerSettings()));
    connect(ui.camTriggerServoMaxSpinBox,SIGNAL(editingFinished()),this,SLOT(updateCameraTriggerSettings()));
    connect(ui.camTriggerOnPwmSpinBox,SIGNAL(editingFinished()),this,SLOT(updateCameraTriggerSettings()));
    connect(ui.camTriggerOffPwmSpinBox,SIGNAL(editingFinished()),this,SLOT(updateCameraTriggerSettings()));
    connect(ui.camTriggerDurationSpinBox,SIGNAL(editingFinished()),this,SLOT(updateCameraTriggerSettings()));
    connect(ui.camTriggerOutChannelComboBox,SIGNAL(currentIndexChanged(int)),
            this,SLOT(updateCameraTriggerOutputCh(int)));
    connect(ui.camTriggerTypeComboBox, SIGNAL(currentIndexChanged(int)),
            this, SLOT(updateCameraTriggerSettings()));

    connect(ui.retractXSpinBox,SIGNAL(editingFinished()),this,SLOT(updateRetractAngles()));
    connect(ui.retractYSpinBox,SIGNAL(editingFinished()),this,SLOT(updateRetractAngles()));
    connect(ui.retractZSpinBox,SIGNAL(editingFinished()),this,SLOT(updateRetractAngles()));

    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()));

    connect(ui.mountModeComboBox,SIGNAL(currentIndexChanged(int)), this, SLOT(updateMountMode(int)));
}

void CameraGimbalConfig::disconnectSignals()
{
    disconnect(ui.tiltServoMinSpinBox,SIGNAL(editingFinished()),this,SLOT(updateTilt()));
    disconnect(ui.tiltServoMaxSpinBox,SIGNAL(editingFinished()),this,SLOT(updateTilt()));
    disconnect(ui.tiltAngleMinSpinBox,SIGNAL(editingFinished()),this,SLOT(updateTilt()));
    disconnect(ui.tiltAngleMaxSpinBox,SIGNAL(editingFinished()),this,SLOT(updateTilt()));
    disconnect(ui.tiltChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateTilt(int)));
    disconnect(ui.tiltInputChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateTilt()));
    disconnect(ui.tiltReverseCheckBox,SIGNAL(clicked(bool)),this,SLOT(updateTilt()));
    disconnect(ui.tiltStabilizeCheckBox,SIGNAL(clicked(bool)),this,SLOT(updateTilt()));

    disconnect(ui.rollServoMinSpinBox,SIGNAL(editingFinished()),this,SLOT(updateRoll()));
    disconnect(ui.rollServoMaxSpinBox,SIGNAL(editingFinished()),this,SLOT(updateRoll()));
    disconnect(ui.rollAngleMinSpinBox,SIGNAL(editingFinished()),this,SLOT(updateRoll()));
    disconnect(ui.rollAngleMaxSpinBox,SIGNAL(editingFinished()),this,SLOT(updateRoll()));
    disconnect(ui.rollChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateRoll(int)));
    disconnect(ui.rollInputChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateRoll()));
    disconnect(ui.rollReverseCheckBox,SIGNAL(clicked(bool)),this,SLOT(updateRoll()));
    disconnect(ui.rollStabilizeCheckBox,SIGNAL(clicked(bool)),this,SLOT(updateRoll()));

    disconnect(ui.panServoMinSpinBox,SIGNAL(editingFinished()),this,SLOT(updatePan()));
    disconnect(ui.panServoMaxSpinBox,SIGNAL(editingFinished()),this,SLOT(updatePan()));
    disconnect(ui.panAngleMinSpinBox,SIGNAL(editingFinished()),this,SLOT(updatePan()));
    disconnect(ui.panAngleMaxSpinBox,SIGNAL(editingFinished()),this,SLOT(updatePan()));
    disconnect(ui.panChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updatePan(int)));
    disconnect(ui.panInputChannelComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updatePan()));
    disconnect(ui.panReverseCheckBox,SIGNAL(clicked(bool)),this,SLOT(updatePan()));
    disconnect(ui.panStabilizeCheckBox,SIGNAL(clicked(bool)),this,SLOT(updatePan()));

    disconnect(ui.camTriggerServoMinSpinBox,SIGNAL(editingFinished()),this,SLOT(updateCameraTriggerSettings()));
    disconnect(ui.camTriggerServoMaxSpinBox,SIGNAL(editingFinished()),this,SLOT(updateCameraTriggerSettings()));
    disconnect(ui.camTriggerOnPwmSpinBox,SIGNAL(editingFinished()),this,SLOT(updateCameraTriggerSettings()));
    disconnect(ui.camTriggerOffPwmSpinBox,SIGNAL(editingFinished()),this,SLOT(updateCameraTriggerSettings()));
    disconnect(ui.camTriggerDurationSpinBox,SIGNAL(editingFinished()),this,SLOT(updateCameraTriggerSettings()));
    disconnect(ui.camTriggerOutChannelComboBox,SIGNAL(currentIndexChanged(int)),
            this,SLOT(updateCameraTriggerOutputCh(int)));
    disconnect(ui.camTriggerTypeComboBox, SIGNAL(currentIndexChanged(int)),
            this, SLOT(updateCameraTriggerSettings()));

    disconnect(ui.retractXSpinBox,SIGNAL(editingFinished()),this,SLOT(updateRetractAngles()));
    disconnect(ui.retractYSpinBox,SIGNAL(editingFinished()),this,SLOT(updateRetractAngles()));
    disconnect(ui.retractZSpinBox,SIGNAL(editingFinished()),this,SLOT(updateRetractAngles()));

    disconnect(ui.controlXSpinBox,SIGNAL(editingFinished()),this,SLOT(updateControlAngles()));
    disconnect(ui.controlYSpinBox,SIGNAL(editingFinished()),this,SLOT(updateControlAngles()));
    disconnect(ui.controlZSpinBox,SIGNAL(editingFinished()),this,SLOT(updateControlAngles()));

    disconnect(ui.neutralXSpinBox,SIGNAL(editingFinished()),this,SLOT(updateNeutralAngles()));
    disconnect(ui.neutralYSpinBox,SIGNAL(editingFinished()),this,SLOT(updateNeutralAngles()));
    disconnect(ui.neutralZSpinBox,SIGNAL(editingFinished()),this,SLOT(updateNeutralAngles()));
}


void CameraGimbalConfig::addOutputRcChannels(QComboBox* comboBox)
{
    comboBox->addItem(tr("Disable"), 0);
    comboBox->addItem("RC5", 5);
    comboBox->addItem("RC6", 6);
    comboBox->addItem("RC7", 7);
    comboBox->addItem("RC8", 8);
    comboBox->addItem("RC9", 9);
    comboBox->addItem("RC10", 10);
    comboBox->addItem("RC11", 11);
    comboBox->addItem("RC12", 12);
    comboBox->addItem("RC13", 13);
    comboBox->addItem("RC14", 14);
    comboBox->addItem("RC15", 15);
    comboBox->addItem("RC16", 16);
}

void CameraGimbalConfig::addInputRcChannels(QComboBox* comboBox)
{
    comboBox->addItem(tr("None", 0));
    comboBox->addItem("RC5", 5);
    comboBox->addItem("RC6", 6);
    comboBox->addItem("RC7", 7);
    comboBox->addItem("RC8", 8);
    comboBox->addItem("RC9", 9);
    comboBox->addItem("RC10", 10);
    comboBox->addItem("RC11", 11);
    comboBox->addItem("RC12", 12);
    comboBox->addItem("RC13", 13);
    comboBox->addItem("RC14", 14);
    comboBox->addItem("RC15", 15);
    comboBox->addItem("RC16", 16);
}

void CameraGimbalConfig::addTriggerTypes(QComboBox *comboBox)
{
    comboBox->addItem("Servo", CAM_TRIGG_TYPE_SERVO);
    comboBox->addItem("Relay", CAM_TRIGG_TYPE_RELAY);
}

void CameraGimbalConfig::activeUASSet(UASInterface *uas)
{'fraction_non_alphanumeric': 0.15650741350906094, 'fraction_numerical': 0.006055478872612316, 'mean_word_length': 9.12623985572588, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 71, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '922110', 'n_tokens_mistral': 7572, 'n_tokens_neox': 7220, 'n_words': 635}