Bsongis/companion r9m fixes (#5914)

* Cosmetics

* First part ...

* First part ...

* Second part ...

* End?

* Handle new  R9M and R9M lite

* Display 'mini' module in case of R9M and xlite
This commit is contained in:
Bertrand Songis
2018-06-02 18:16:51 +02:00
committed by GitHub
parent 0e1a6bd60b
commit 806715e166
9 changed files with 536 additions and 67 deletions
+1
View File
@@ -9,6 +9,7 @@ set(firmwares_SRCS
io_data.cpp
logicalswitchdata.cpp
modeldata.cpp
moduledata.cpp
multiprotocols.cpp
radiodata.cpp
radiodataconversionstate.cpp
+4
View File
@@ -454,4 +454,8 @@ void ModelData::convert(RadioDataConversionState & cstate)
for (int i=0; i<CPN_MAX_FLIGHT_MODES; i++) {
flightModeData[i].convert(cstate.withComponentIndex(i));
}
for (int i=0; i<CPN_MAX_MODULES; i++) {
moduleData[i].convert(cstate.withComponentIndex(i));
}
}
+29
View File
@@ -0,0 +1,29 @@
/*
* Copyright (C) OpenTX
*
* Based on code named
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "moduledata.h"
#include "radiodataconversionstate.h"
void ModuleData::convert(RadioDataConversionState & cstate)
{
if (protocol == PULSES_PXX_R9M && (IS_TARANIS_XLITE(cstate.fromType) || IS_TARANIS_XLITE(cstate.toType))) {
clear();
}
}
+8
View File
@@ -25,6 +25,8 @@
#include <QtCore>
class RadioDataConversionState;
enum PulsesProtocol {
PULSES_OFF,
PULSES_PPM,
@@ -97,6 +99,11 @@ enum TrainerProtocol {
TRAINER_MASTER_SBUS_BATT_COMPARTMENT
};
enum R9MSubTypes {
R9M_FCC,
R9M_LBT
};
class ModuleData {
Q_DECLARE_TR_FUNCTIONS(ModuleData)
@@ -138,6 +145,7 @@ class ModuleData {
void clear() { memset(this, 0, sizeof(ModuleData)); }
QString polarityToString() const { return ppm.pulsePol ? tr("Positive") : tr("Negative"); } // TODO ModelPrinter
void convert(RadioDataConversionState & cstate);
};
#endif // MODULEDATA_H