ArduPlaneFirmwarePlugin.cc 3.1 KB
Newer Older
1 2 3 4 5 6 7 8 9
/****************************************************************************
 *
 *   (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/

10 11
#include "ArduPlaneFirmwarePlugin.h"

12 13 14
bool ArduPlaneFirmwarePlugin::_remapParamNameIntialized = false;
FirmwarePlugin::remapParamNameMajorVersionMap_t ArduPlaneFirmwarePlugin::_remapParamName;

Don Gagne's avatar
Don Gagne committed
15 16
APMPlaneMode::APMPlaneMode(uint32_t mode, bool settable)
    : APMCustomMode(mode, settable)
17
{
Tomaz Canabrava's avatar
Tomaz Canabrava committed
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
    setEnumToStringMapping({ 
        {MANUAL,         "Manual"},
        {CIRCLE,         "Circle"},
        {STABILIZE,      "Stabilize"},
        {TRAINING,       "Training"},
        {ACRO,           "Acro"},
        {FLY_BY_WIRE_A,  "FBW A"},
        {FLY_BY_WIRE_B,  "FBW B"},
        {CRUISE,         "Cruise"},
        {AUTOTUNE,       "Autotune"},
        {AUTO,           "Auto"},
        {RTL,            "RTL"},
        {LOITER,         "Loiter"},
        {GUIDED,         "Guided"},
        {INITIALIZING,   "Initializing"},
        {QSTABILIZE,     "QuadPlane Stabilize"},
        {QHOVER,         "QuadPlane Hover"},
        {QLOITER,        "QuadPlane Loiter"},
        {QLAND,          "QuadPlane Land"},
        {QRTL,           "QuadPlane RTL"},
    });
39 40
}

41
ArduPlaneFirmwarePlugin::ArduPlaneFirmwarePlugin(void)
42
{
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
    setSupportedModes({
        APMPlaneMode(APMPlaneMode::MANUAL          ,true),
        APMPlaneMode(APMPlaneMode::CIRCLE          ,true),
        APMPlaneMode(APMPlaneMode::STABILIZE       ,true),
        APMPlaneMode(APMPlaneMode::TRAINING        ,true),
        APMPlaneMode(APMPlaneMode::ACRO            ,true),
        APMPlaneMode(APMPlaneMode::FLY_BY_WIRE_A   ,true),
        APMPlaneMode(APMPlaneMode::FLY_BY_WIRE_B   ,true),
        APMPlaneMode(APMPlaneMode::CRUISE          ,true),
        APMPlaneMode(APMPlaneMode::AUTOTUNE        ,true),
        APMPlaneMode(APMPlaneMode::AUTO            ,true),
        APMPlaneMode(APMPlaneMode::RTL             ,true),
        APMPlaneMode(APMPlaneMode::LOITER          ,true),
        APMPlaneMode(APMPlaneMode::GUIDED          ,true),
        APMPlaneMode(APMPlaneMode::INITIALIZING    ,false),
        APMPlaneMode(APMPlaneMode::QSTABILIZE      ,true),
        APMPlaneMode(APMPlaneMode::QHOVER          ,true),
        APMPlaneMode(APMPlaneMode::QLOITER         ,true),
        APMPlaneMode(APMPlaneMode::QLAND           ,true),
        APMPlaneMode(APMPlaneMode::QRTL            ,true),
    });
64 65

    if (!_remapParamNameIntialized) {
66 67 68 69 70
        FirmwarePlugin::remapParamNameMap_t& remapV3_10 = _remapParamName[3][10];

        remapV3_10["BATT_ARM_VOLT"] =    QStringLiteral("ARMING_VOLT_MIN");
        remapV3_10["BATT2_ARM_VOLT"] =   QStringLiteral("ARMING_VOLT2_MIN");

71 72 73 74 75 76
        _remapParamNameIntialized = true;
    }
}

int ArduPlaneFirmwarePlugin::remapParamNameHigestMinorVersionNumber(int majorVersionNumber) const
{
77 78
    // Remapping supports up to 3.10
    return majorVersionNumber == 3 ? 10 : Vehicle::versionNotSetValue;
79
}