FlightModeConfig.h 2.97 KB
Newer Older
Don Gagne's avatar
Don Gagne committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
/*=====================================================================
 
 QGroundControl Open Source Ground Control Station
 
 (c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
 
 This file is part of the QGROUNDCONTROL project
 
 QGROUNDCONTROL 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.
 
 QGROUNDCONTROL 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 QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
 
 ======================================================================*/

24 25 26 27
#ifndef FLIGHTMODECONFIG_H
#define FLIGHTMODECONFIG_H

#include <QWidget>
Don Gagne's avatar
Don Gagne committed
28
#include <QComboBox>
29
#include "ui_FlightModeConfig.h"
30
#include "AP2ConfigWidget.h"
31

32
class FlightModeConfig : public AP2ConfigWidget
33 34 35 36 37
{
    Q_OBJECT
    
public:
    explicit FlightModeConfig(QWidget *parent = 0);
Don Gagne's avatar
Don Gagne committed
38
    
39
private slots:
Don Gagne's avatar
Don Gagne committed
40 41 42 43 44
    // Overrides from AP2ConfigWidget
    virtual void activeUASSet(UASInterface *uas);
    virtual void parameterChanged(int uas, int component, QString parameterName, QVariant value);

    // Signalled from UAS
45
    void remoteControlChannelRawChanged(int chan,float val);
Don Gagne's avatar
Don Gagne committed
46 47 48 49 50

    // Signalled from FlightModeConfig UI
    void saveButtonClicked(void);
    
    
51
private:
Don Gagne's avatar
Don Gagne committed
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
    typedef struct {
        const char* label;
        int         value;
    } FlightModeInfo_t;

    static const FlightModeInfo_t   _rgModeInfoFixedWing[];
    static const FlightModeInfo_t   _rgModeInfoRotor[];
    static const FlightModeInfo_t   _rgModeInfoRover[];
    const FlightModeInfo_t*         _rgModeInfo;
    size_t                          _cModeInfo;
    
    static const size_t _cModes = 6;

    static const char*  _rgModeParamFixedWing[_cModes];
    static const char*  _rgModeParamRotor[_cModes];
    static const char*  _rgModeParamRover[_cModes];
    const char**        _rgModeParam;
    
    static const int    _rgModePWMBoundary[_cModes];

    bool                _simpleModeSupported;
    static const char*  _simpleModeBitMaskParam;

    static const char*  _modeSwitchRCChannelParamFixedWing;
    static const char*  _modeSwitchRCChannelParamRover;
    const char*         _modeSwitchRCChannelParam;
    static const int    _modeSwitchRCChannelRotor = 4;  // ArduCopter harcoded to 0-based channel 4
    static const int    _modeSwitchRCChannelInvalid = -1;
    int                 _modeSwitchRCChannel;
    
    QLabel*                 _rgLabel[_cModes];
    QComboBox*              _rgCombo[_cModes];
    QCheckBox*              _rgSimpleModeCheckBox[_cModes];
    QLabel*                 _rgPWMLabel[_cModes];
    Ui::FlightModeConfig    _ui;
87 88 89
};

#endif // FLIGHTMODECONFIG_H