QGCPX4AirframeConfig.h 2.47 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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
    /**
     * @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);

    void flyingWingSelected();
    void flyingWingSelected(int index);
    void planeSelected();
    void planeSelected(int index);

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

72 73 74
protected slots:
    void checkConfigState();

75 76 77 78 79 80 81 82 83 84 85 86 87 88
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);

89 90
    void uncheckAll();

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

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

#endif // QGCPX4AIRFRAMECONFIG_H