ArduRoverFirmwarePlugin.cc 3.08 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
#include "ArduRoverFirmwarePlugin.h"
11
#include "QGCApplication.h"
12

13 14 15
bool ArduRoverFirmwarePlugin::_remapParamNameIntialized = false;
FirmwarePlugin::remapParamNameMajorVersionMap_t ArduRoverFirmwarePlugin::_remapParamName;

Don Gagne's avatar
Don Gagne committed
16 17
APMRoverMode::APMRoverMode(uint32_t mode, bool settable)
    : APMCustomMode(mode, settable)
18
{
19 20 21 22 23 24
    setEnumToStringMapping({
        {MANUAL,         "Manual"},
        {ACRO,           "Acro"},
        {STEERING,       "Steering"},
        {HOLD,           "Hold"},
        {LOITER,         "Loiter"},
25 26
#if 0
    // Follow me not ready for Stable
27
        {FOLLOW,         "Follow"},
28
#endif
29 30 31 32 33 34 35
        {SIMPLE,         "Simple"},
        {AUTO,           "Auto"},
        {RTL,            "RTL"},
        {SMART_RTL,      "Smart RTL"},
        {GUIDED,         "Guided"},
        {INITIALIZING,   "Initializing"},
    });
36 37
}

38
ArduRoverFirmwarePlugin::ArduRoverFirmwarePlugin(void)
39
{
40 41 42 43 44 45
    setSupportedModes({
        APMRoverMode(APMRoverMode::MANUAL       ,true),
        APMRoverMode(APMRoverMode::ACRO         ,true),
        APMRoverMode(APMRoverMode::STEERING     ,true),
        APMRoverMode(APMRoverMode::HOLD         ,true),
        APMRoverMode(APMRoverMode::LOITER       ,true),
46 47
#if 0
    // Follow me not ready for Stable
48
        APMRoverMode(APMRoverMode::FOLLOW       ,true),
49
#endif
50 51 52 53 54 55 56
        APMRoverMode(APMRoverMode::SIMPLE       ,true),
        APMRoverMode(APMRoverMode::AUTO         ,true),
        APMRoverMode(APMRoverMode::RTL          ,true),
        APMRoverMode(APMRoverMode::SMART_RTL    ,true),
        APMRoverMode(APMRoverMode::GUIDED       ,true),
        APMRoverMode(APMRoverMode::INITIALIZING ,false),
    });
57 58

    if (!_remapParamNameIntialized) {
59 60 61 62 63
        FirmwarePlugin::remapParamNameMap_t& remapV3_5 = _remapParamName[3][5];

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

64 65
        _remapParamNameIntialized = true;
    }
66
}
67 68 69

int ArduRoverFirmwarePlugin::remapParamNameHigestMinorVersionNumber(int majorVersionNumber) const
{
70 71
    // Remapping supports up to 3.5
    return majorVersionNumber == 3 ? 5 : Vehicle::versionNotSetValue;
72 73
}

74 75 76 77 78
void ArduRoverFirmwarePlugin::guidedModeChangeAltitude(Vehicle* vehicle, double altitudeChange)
{
    Q_UNUSED(vehicle);
    Q_UNUSED(altitudeChange);

79
    qgcApp()->showAppMessage(QStringLiteral("Change altitude not supported."));
80
}
81

82
bool ArduRoverFirmwarePlugin::supportsNegativeThrust(Vehicle* /*vehicle*/)
83 84 85
{
    return true;
}
86

87 88
#if 0
    // Follow me not ready for Stable
89 90 91 92
void ArduRoverFirmwarePlugin::sendGCSMotionReport(Vehicle* vehicle, FollowMe::GCSMotionReport& motionReport, uint8_t estimatationCapabilities)
{
    _sendGCSMotionReport(vehicle, motionReport, estimatationCapabilities);
}
93
#endif