ArduPlaneFirmwarePlugin.cc 3.58 KB
Newer Older
1 2
/****************************************************************************
 *
Gus Grubba's avatar
Gus Grubba committed
3
 * (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
4 5 6 7 8 9
 *
 * 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
    setEnumToStringMapping({ 
DonLakeFlyer's avatar
DonLakeFlyer committed
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
        { 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" },
        { TAKEOFF,          "Takeoff" },
        { AVOID_ADSB,       "Avoid ADSB" },
        { GUIDED,           "Guided" },
        { INITIALIZING,     "Initializing" },
        { QSTABILIZE,       "QuadPlane Stabilize" },
        { QHOVER,           "QuadPlane Hover" },
        { QLOITER,          "QuadPlane Loiter" },
        { QLAND,            "QuadPlane Land" },
        { QRTL,             "QuadPlane RTL" },
        { QAUTOTUNE,        "QuadPlane AutoTune" },
        { QACRO,            "QuadPlane Acro" },
Tomaz Canabrava's avatar
Tomaz Canabrava committed
42
    });
43 44
}

45
ArduPlaneFirmwarePlugin::ArduPlaneFirmwarePlugin(void)
46
{
47
    setSupportedModes({
DonLakeFlyer's avatar
DonLakeFlyer committed
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
        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::TAKEOFF,         true),
        APMPlaneMode(APMPlaneMode::AVOID_ADSB,      false),
        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),
        APMPlaneMode(APMPlaneMode::QAUTOTUNE,       true),
        APMPlaneMode(APMPlaneMode::QACRO,           true),
71
    });
72 73

    if (!_remapParamNameIntialized) {
74 75 76 77 78
        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");

79 80 81 82 83 84
        _remapParamNameIntialized = true;
    }
}

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