QGCPX4AirframeConfig.h 2.53 KB
Newer Older
Lorenz Meier's avatar
Lorenz Meier committed
1 2 3 4
#ifndef QGCPX4AIRFRAMECONFIG_H
#define QGCPX4AIRFRAMECONFIG_H

#include <QWidget>
5
#include <UASInterface.h>
Lorenz Meier's avatar
Lorenz Meier committed
6

7 8
class QProgressDialog;

Lorenz Meier's avatar
Lorenz Meier committed
9 10 11 12 13 14 15 16 17 18 19
namespace Ui {
class QGCPX4AirframeConfig;
}

class QGCPX4AirframeConfig : public QWidget
{
    Q_OBJECT
    
public:
    explicit QGCPX4AirframeConfig(QWidget *parent = 0);
    ~QGCPX4AirframeConfig();
20 21 22 23 24 25 26 27 28

public slots:

    /**
     * @brief Set the system currently operated on by this widget
     * @param uas The currently active / configured system
     */
    void setActiveUAS(UASInterface* uas);

Lorenz Meier's avatar
Lorenz Meier committed
29 30 31 32 33 34 35 36 37
    /**
     * @brief Handle parameter changes
     * @param uas
     * @param component
     * @param parameterName
     * @param value
     */
    void parameterChanged(int uas, int component, QString parameterName, QVariant value);

38 39 40 41 42 43 44 45 46 47 48
    /**
     * @brief Quadrotor in X configuration has been selected
     */
    void quadXSelected();

    /**
     * @brief Quadrotor in X configuration has been selected with sub-type
     * @param index The autostart index which maps to a particular sub-type
     */
    void quadXSelected(int index);

49 50
    void simSelected();
    void simSelected(int index);
51 52
    void planeSelected();
    void planeSelected(int index);
53 54
    void flyingWingSelected();
    void flyingWingSelected(int index);
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
    void quadPlusSelected();
    void quadPlusSelected(int index);
    void hexaXSelected();
    void hexaXSelected(int index);
    void hexaPlusSelected();
    void hexaPlusSelected(int index);
    void octoXSelected();
    void octoXSelected(int index);
    void octoPlusSelected();
    void octoPlusSelected(int index);
    void hSelected();
    void hSelected(int index);

    /**
     * @brief Apply changes and reboot system
     */
    void applyAndReboot();

73 74 75
protected slots:
    void checkConfigState();

76 77 78 79 80 81 82 83 84 85 86 87 88 89
protected:

    /**
     * @brief Set the ID of the current airframe
     * @param id the ID as defined by the PX4 SYS_AUTOSTART enum
     */
    void setAirframeID(int id);

    /**
     * @brief Enable automatic configuration
     * @param enabled If true, the system sets the default gains for this platform on the next boot
     */
    void setAutoConfig(bool enabled);

90 91
    void uncheckAll();

92 93 94 95 96 97 98
    enum CONFIG_STATE {
        CONFIG_STATE_ABORT = 0,
        CONFIG_STATE_SEND,
        CONFIG_STATE_WAIT_PENDING,
        CONFIG_STATE_REBOOT
    };

Lorenz Meier's avatar
Lorenz Meier committed
99
private:
100
    UASInterface* mav;
101
    QGCUASParamManagerInterface *paramMgr;
102 103 104
    QProgressDialog* progress;
    unsigned pendingParams;
    enum CONFIG_STATE configState;
105
    int selectedId;
Lorenz Meier's avatar
Lorenz Meier committed
106 107 108 109
    Ui::QGCPX4AirframeConfig *ui;
};

#endif // QGCPX4AIRFRAMECONFIG_H