Merge branch '2.3' of https://github.com/opentx/opentx into 2.3
This commit is contained in:
@@ -326,6 +326,10 @@ set(simu_SRCS simulator.cpp )
|
||||
add_executable(${SIMULATOR_NAME} MACOSX_BUNDLE ${WIN_EXECUTABLE_TYPE} ${simu_SRCS} ${icon_RC})
|
||||
target_link_libraries(${SIMULATOR_NAME} PRIVATE ${CPN_COMMON_LIB})
|
||||
|
||||
if(NOT MSVC)
|
||||
add_subdirectory(tests)
|
||||
endif()
|
||||
|
||||
############# Install ####################
|
||||
|
||||
# Generate list of simulator plugins, used by all platforms
|
||||
@@ -341,6 +345,8 @@ if(PCB STREQUAL X7 AND PCBREV STREQUAL T12)
|
||||
set(FLAVOUR t12)
|
||||
elseif(PCB STREQUAL X9D+ AND PCBREV STREQUAL 2019)
|
||||
set(FLAVOUR x9d+2019)
|
||||
elseif(PCB STREQUAL X10 AND PCBREV STREQUAL EXPRESS)
|
||||
set(FLAVOUR x10express)
|
||||
else()
|
||||
string(TOLOWER ${PCB} FLAVOUR)
|
||||
endif()
|
||||
|
||||
@@ -188,7 +188,7 @@ void AppPreferencesDialog::initSettings()
|
||||
ui->backLightColor->setCurrentIndex(g.backLight());
|
||||
ui->volumeGain->setValue(profile.volumeGain() / 10.0);
|
||||
|
||||
if (IS_TARANIS(getCurrentBoard())) {
|
||||
if (IS_HORUS_OR_TARANIS(getCurrentBoard())) {
|
||||
ui->backLightColor->setEnabled(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@ uint32_t Boards::getFourCC(Type board)
|
||||
case BOARD_X12S:
|
||||
return 0x3478746F;
|
||||
case BOARD_X10:
|
||||
case BOARD_X10_EXPRESS:
|
||||
return 0x3778746F;
|
||||
case BOARD_TARANIS_XLITE:
|
||||
return 0x3978746F;
|
||||
@@ -122,6 +123,7 @@ const int Boards::getEEpromSize(Board::Type board)
|
||||
return EESIZE_MAX;
|
||||
case BOARD_X12S:
|
||||
case BOARD_X10:
|
||||
case BOARD_X10_EXPRESS:
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -155,6 +157,7 @@ const int Boards::getFlashSize(Type board)
|
||||
return FSIZE_TARANIS;
|
||||
case BOARD_X12S:
|
||||
case BOARD_X10:
|
||||
case BOARD_X10_EXPRESS:
|
||||
return FSIZE_HORUS;
|
||||
case BOARD_UNKNOWN:
|
||||
return FSIZE_MAX;
|
||||
@@ -333,14 +336,12 @@ const int Boards::getCapability(Board::Type board, Board::Capability capability)
|
||||
return 8;
|
||||
else if (IS_JUMPER_T12(board))
|
||||
return 6;
|
||||
else if (IS_TARANIS_XLITES(board))
|
||||
return 6;
|
||||
else if (IS_TARANIS_XLITE(board))
|
||||
return 6;
|
||||
else if (IS_TARANIS(board))
|
||||
return 8;
|
||||
else if (board == Board::BOARD_TARANIS_X9DP_2019)
|
||||
return 9;
|
||||
else if (IS_TARANIS(board))
|
||||
return 8;
|
||||
else if (IS_HORUS(board))
|
||||
return 10;
|
||||
else
|
||||
@@ -524,6 +525,8 @@ const QString Boards::getBoardName(Board::Type board)
|
||||
return "Horus X12S";
|
||||
case BOARD_X10:
|
||||
return "Horus X10/X10S";
|
||||
case BOARD_X10_EXPRESS:
|
||||
return "Horus X10 Express";
|
||||
default:
|
||||
return tr("Unknown");
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ namespace Board {
|
||||
BOARD_TARANIS_X9E,
|
||||
BOARD_X12S,
|
||||
BOARD_X10,
|
||||
BOARD_X10_EXPRESS,
|
||||
BOARD_TARANIS_XLITE,
|
||||
BOARD_TARANIS_XLITES,
|
||||
BOARD_TARANIS_X9LITE,
|
||||
@@ -206,12 +207,11 @@ class Boards
|
||||
#define IS_TARANIS(board) (IS_TARANIS_X9(board) || IS_TARANIS_X7(board) || IS_TARANIS_X9LITE(board) || IS_TARANIS_XLITE(board) || IS_JUMPER_T12(board))
|
||||
#define IS_TARANIS_SMALL(board) (IS_TARANIS_X7(board) || IS_TARANIS_XLITE(board) || IS_TARANIS_X9LITE(board) || IS_JUMPER_T12(board))
|
||||
#define IS_HORUS_X12S(board) (board==Board::BOARD_X12S)
|
||||
#define IS_HORUS_X10(board) (board==Board::BOARD_X10)
|
||||
#define IS_HORUS_X10(board) (board==Board::BOARD_X10 || board==Board::BOARD_X10_EXPRESS)
|
||||
#define IS_HORUS(board) (IS_HORUS_X12S(board) || IS_HORUS_X10(board))
|
||||
#define IS_HORUS_OR_TARANIS(board) (IS_HORUS(board) || IS_TARANIS(board))
|
||||
#define IS_STM32(board) (IS_TARANIS(board) || IS_HORUS(board))
|
||||
#define IS_ARM(board) (IS_STM32(board) || IS_SKY9X(board))
|
||||
#define IS_ACCESS_RADIO(board) (IS_TARANIS_X9LITE(board) || IS_TARANIS_XLITES(board))
|
||||
#define HAS_LARGE_LCD(board) (IS_HORUS(board) || IS_TARANIS_X9(board))
|
||||
|
||||
#endif // _BOARDS_H_
|
||||
|
||||
@@ -585,6 +585,78 @@ class TransformedField: public DataField {
|
||||
DataField & field;
|
||||
};
|
||||
|
||||
template<class selectorT>
|
||||
class UnionField: public DataField {
|
||||
public:
|
||||
|
||||
class UnionMember {
|
||||
public:
|
||||
virtual ~UnionMember() {}
|
||||
virtual bool select(const selectorT& attr) const = 0;
|
||||
virtual DataField* getField() = 0;
|
||||
};
|
||||
|
||||
class TransformedMember: public UnionMember, public TransformedField {
|
||||
public:
|
||||
TransformedMember(DataField* parent, DataField& field):
|
||||
TransformedField(parent, field)
|
||||
{
|
||||
}
|
||||
virtual DataField* getField()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
};
|
||||
|
||||
UnionField(DataField * parent, selectorT& selectField, const char * name="Union"):
|
||||
DataField(parent, name), selectField(selectField), maxSize(0)
|
||||
{
|
||||
}
|
||||
|
||||
~UnionField() {
|
||||
foreach(UnionMember *member, members) {
|
||||
delete member;
|
||||
}
|
||||
}
|
||||
|
||||
inline void Append(UnionMember * member) {
|
||||
members.append(member);
|
||||
if (member->getField()->size() > maxSize)
|
||||
maxSize = member->getField()->size();
|
||||
}
|
||||
|
||||
virtual void ExportBits(QBitArray & output)
|
||||
{
|
||||
foreach(UnionMember *member, members) {
|
||||
if (member->select(selectField)) {
|
||||
member->getField()->ExportBits(output);
|
||||
break;
|
||||
}
|
||||
}
|
||||
output.resize(maxSize);
|
||||
}
|
||||
|
||||
virtual void ImportBits(const QBitArray & input)
|
||||
{
|
||||
foreach(UnionMember *member, members) {
|
||||
if (member->select(selectField)) {
|
||||
member->getField()->ImportBits(input);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual unsigned int size()
|
||||
{
|
||||
return maxSize;
|
||||
}
|
||||
|
||||
protected:
|
||||
selectorT& selectField;
|
||||
QList<UnionMember *> members;
|
||||
unsigned int maxSize;
|
||||
};
|
||||
|
||||
class ConversionTable {
|
||||
|
||||
public:
|
||||
|
||||
@@ -103,20 +103,18 @@ void EEPROMInterface::showEepromErrors(QWidget *parent, const QString &title, co
|
||||
#endif
|
||||
|
||||
// TODO: No GUI here, e.g. return string list instead
|
||||
void EEPROMInterface::showEepromWarnings(QWidget *parent, const QString &title, unsigned long errorsFound)
|
||||
QString EEPROMInterface::getEepromWarnings(unsigned long errorsFound)
|
||||
{
|
||||
std::bitset<NUM_ERRORS> errors((unsigned long long)errorsFound);
|
||||
QStringList warningsList;
|
||||
if (errors.test(WARNING_WRONG_FIRMWARE)) { warningsList << tr("- Your radio probably uses a wrong firmware,\n eeprom size is 4096 but only the first 2048 are used"); }
|
||||
if (errors.test(OLD_VERSION)) { warningsList << tr("- Your eeprom is from an old version of OpenTX, upgrading!\n To keep your original file as a backup, please choose File -> Save As specifying a different name."); }
|
||||
if (errors.test(WARNING_WRONG_FIRMWARE)) {
|
||||
warningsList << tr("- Your radio probably uses a wrong firmware,\n eeprom size is 4096 but only the first 2048 are used");
|
||||
}
|
||||
if (errors.test(OLD_VERSION)) {
|
||||
warningsList << tr("- Your eeprom is from an old version of OpenTX, upgrading!\n To keep your original file as a backup, please choose File -> Save As specifying a different name.");
|
||||
}
|
||||
|
||||
QMessageBox msgBox(parent);
|
||||
msgBox.setWindowTitle(title);
|
||||
msgBox.setIcon(QMessageBox::Warning);
|
||||
msgBox.setText(tr("Warnings!"));
|
||||
msgBox.setInformativeText(warningsList.join("\n"));
|
||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||
msgBox.exec();
|
||||
return warningsList.join("\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ class EEPROMInterface
|
||||
virtual int getSize(const GeneralSettings &) = 0;
|
||||
|
||||
//static void showEepromErrors(QWidget *parent, const QString &title, const QString &mainMessage, unsigned long errorsFound);
|
||||
static void showEepromWarnings(QWidget *parent, const QString &title, unsigned long errorsFound);
|
||||
static QString getEepromWarnings(unsigned long errorsFound);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -345,7 +345,7 @@ class Firmware
|
||||
|
||||
virtual QTime getMaxTimerStart() = 0;
|
||||
|
||||
virtual int isAvailable(PulsesProtocol proto, int port=0) = 0;
|
||||
virtual bool isAvailable(PulsesProtocol proto, int port=0) = 0;
|
||||
|
||||
const int getFlashSize();
|
||||
|
||||
|
||||
@@ -203,7 +203,7 @@ int Er9xInterface::getSize(const GeneralSettings &settings)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Er9xInterface::isAvailable(PulsesProtocol prot, int port)
|
||||
bool Er9xInterface::isAvailable(PulsesProtocol prot, int port)
|
||||
{
|
||||
switch (prot) {
|
||||
case PULSES_PPM:
|
||||
|
||||
@@ -52,7 +52,7 @@ class Er9xInterface : public EEPROMInterface
|
||||
|
||||
virtual int getSize(const GeneralSettings &settings);
|
||||
|
||||
virtual int isAvailable(PulsesProtocol proto, int port=0);
|
||||
virtual bool isAvailable(PulsesProtocol proto, int port=0);
|
||||
|
||||
virtual int getCapability(Capability capability);
|
||||
|
||||
|
||||
@@ -251,7 +251,7 @@ int Ersky9xInterface::getSize(const GeneralSettings & settings)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Ersky9xInterface::isAvailable(PulsesProtocol prot, int port)
|
||||
bool Ersky9xInterface::isAvailable(PulsesProtocol prot, int port)
|
||||
{
|
||||
switch (prot) {
|
||||
case PULSES_PPM:
|
||||
|
||||
@@ -51,7 +51,7 @@ class Ersky9xInterface : public EEPROMInterface
|
||||
|
||||
virtual int getSize(const GeneralSettings & settings);
|
||||
|
||||
virtual int isAvailable(PulsesProtocol proto, int port=0);
|
||||
virtual bool isAvailable(PulsesProtocol proto, int port=0);
|
||||
|
||||
virtual int getCapability(Capability capability);
|
||||
|
||||
|
||||
@@ -163,8 +163,9 @@ void ModelData::clear()
|
||||
moduleData[0].ppm.delay = 300;
|
||||
moduleData[1].ppm.delay = 300;
|
||||
moduleData[2].ppm.delay = 300;
|
||||
int board = getCurrentBoard();
|
||||
if (IS_ACCESS_RADIO(board)) {
|
||||
Firmware * firmware = Firmware::getCurrentVariant();
|
||||
int board = firmware->getBoard();
|
||||
if (firmware->isAvailable(PULSES_ACCESS_ISRM, 0)) {
|
||||
moduleData[0].protocol = PULSES_ACCESS_ISRM;
|
||||
moduleData[1].protocol = PULSES_OFF;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,20 @@ void ModuleData::convert(RadioDataConversionState & cstate)
|
||||
}
|
||||
}
|
||||
|
||||
bool ModuleData::isPxx2Module() const
|
||||
{
|
||||
switch(protocol){
|
||||
case PULSES_ACCESS_ISRM:
|
||||
case PULSES_ACCESS_R9M:
|
||||
case PULSES_ACCESS_R9M_LITE:
|
||||
case PULSES_ACCESS_R9M_LITE_PRO:
|
||||
case PULSES_XJT_LITE_X16:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
QString ModuleData::rfProtocolToString() const
|
||||
{
|
||||
switch (protocol) {
|
||||
@@ -105,11 +119,13 @@ QString ModuleData::protocolToString(unsigned protocol)
|
||||
"DIY Multiprotocol Module",
|
||||
"FrSky PXX R9M",
|
||||
"FrSky PXX R9M Lite",
|
||||
"FrSky PXX R9M Lite Pro",
|
||||
"SBUS output at VBat",
|
||||
"FrSky ACCESS ISRM",
|
||||
"FrSky ACCESS ISRM", "FrSky ACCST ISRM D16",
|
||||
"FrSky ACCESS R9M",
|
||||
"FrSky ACCESS R9M Lite",
|
||||
"FrSky ACCESS R9M Lite Pro"
|
||||
"FrSky ACCESS R9M Lite Pro",
|
||||
"FrSky XJT lite (D16)", "FrSky XJT lite (D8)", "FrSky XJT lite (LR12)"
|
||||
};
|
||||
|
||||
return CHECK_IN_ARRAY(strings, protocol);
|
||||
|
||||
@@ -48,11 +48,16 @@ enum PulsesProtocol {
|
||||
PULSES_MULTIMODULE,
|
||||
PULSES_PXX_R9M,
|
||||
PULSES_PXX_R9M_LITE,
|
||||
PULSES_PXX_R9M_LITE_PRO,
|
||||
PULSES_SBUS,
|
||||
PULSES_ACCESS_ISRM,
|
||||
PULSES_ACCST_ISRM_D16,
|
||||
PULSES_ACCESS_R9M,
|
||||
PULSES_ACCESS_R9M_LITE,
|
||||
PULSES_ACCESS_R9M_LITE_PRO,
|
||||
PULSES_XJT_LITE_X16,
|
||||
PULSES_XJT_LITE_D8,
|
||||
PULSES_XJT_LITE_LR12,
|
||||
PULSES_PROTOCOL_LAST
|
||||
};
|
||||
|
||||
@@ -128,13 +133,18 @@ enum ModuleSubtypeR9M {
|
||||
MODULE_SUBTYPE_R9M_LAST=MODULE_SUBTYPE_R9M_AUPLUS
|
||||
};
|
||||
|
||||
constexpr int PXX2_MAX_RECEIVERS_PER_MODULE = 3;
|
||||
constexpr int PXX2_LEN_RX_NAME = 8;
|
||||
|
||||
class ModuleData {
|
||||
Q_DECLARE_TR_FUNCTIONS(ModuleData)
|
||||
|
||||
public:
|
||||
ModuleData() { clear(); }
|
||||
unsigned int modelId;
|
||||
int protocol;
|
||||
unsigned int protocol; // type in datastructs.h
|
||||
int rfProtocol; // rfProtocol in datastructs.h
|
||||
|
||||
unsigned int subType;
|
||||
bool invertedSerial;
|
||||
unsigned int channelsStart;
|
||||
@@ -142,14 +152,14 @@ class ModuleData {
|
||||
unsigned int failsafeMode;
|
||||
int failsafeChannels[CPN_MAX_CHNOUT];
|
||||
|
||||
struct {
|
||||
struct PPM {
|
||||
int delay;
|
||||
bool pulsePol; // false = positive
|
||||
bool outputType; // false = open drain, true = push pull
|
||||
int frameLength;
|
||||
} ppm;
|
||||
|
||||
struct {
|
||||
struct Multi {
|
||||
unsigned int rfProtocol;
|
||||
bool autoBindMode;
|
||||
bool lowPowerMode;
|
||||
@@ -157,22 +167,22 @@ class ModuleData {
|
||||
int optionValue;
|
||||
} multi;
|
||||
|
||||
struct {
|
||||
int power; // 0 10 mW, 1 100 mW, 2 500 mW, 3 1W
|
||||
struct PXX {
|
||||
unsigned int power; // 0 10 mW, 1 100 mW, 2 500 mW, 3 1W
|
||||
bool receiver_telem_off; // false = receiver telem enabled
|
||||
bool receiver_channel_9_16; // false = pwm out 1-8, true 9-16
|
||||
bool external_antenna; // false = internal antenna, true = external antenna
|
||||
bool sport_out;
|
||||
} pxx;
|
||||
|
||||
struct {
|
||||
// unsigned int receivers;
|
||||
// char receiverName[3][8];
|
||||
char data[1 + 3 * 8];
|
||||
struct Access {
|
||||
unsigned int receivers;
|
||||
char receiverName[PXX2_MAX_RECEIVERS_PER_MODULE][PXX2_LEN_RX_NAME+1];
|
||||
} access;
|
||||
|
||||
void clear() { memset(this, 0, sizeof(ModuleData)); }
|
||||
void convert(RadioDataConversionState & cstate);
|
||||
bool isPxx2Module() const;
|
||||
QString polarityToString() const { return ppm.pulsePol ? tr("Positive") : tr("Negative"); }
|
||||
QString rfProtocolToString() const;
|
||||
QString subTypeToString(int type = -1) const;
|
||||
|
||||
@@ -40,7 +40,13 @@ inline int MAX_SWITCHES(Board::Type board, int version)
|
||||
return Boards::getCapability(board, Board::Switches);
|
||||
}
|
||||
|
||||
#define MAX_KNOBS(board, version) (IS_HORUS(board) ? 8 : 4)
|
||||
inline int MAX_KNOBS(Board::Type board, int version)
|
||||
{
|
||||
if (version >= 219 && IS_HORUS(board))
|
||||
return 8;
|
||||
|
||||
return 4;
|
||||
}
|
||||
|
||||
inline int MAX_POTS(Board::Type board, int version)
|
||||
{
|
||||
@@ -56,6 +62,14 @@ inline int MAX_POTS_STORAGE(Board::Type board, int version)
|
||||
return Boards::getCapability(board, Board::PotsStorage);
|
||||
}
|
||||
|
||||
inline int MAX_SLIDERS_SLOTS(Board::Type board, int version)
|
||||
{
|
||||
if (version >= 219 && IS_HORUS(board))
|
||||
return 8;
|
||||
|
||||
return 4;
|
||||
}
|
||||
|
||||
// bitsize of swconfig_t / 2 (see radio/src/datastructs.h)
|
||||
inline int MAX_SWITCH_SLOTS(Board::Type board, int version)
|
||||
{
|
||||
@@ -71,7 +85,17 @@ inline int MAX_SWITCH_SLOTS(Board::Type board, int version)
|
||||
return 8;
|
||||
}
|
||||
|
||||
#define MAX_SWITCHES_POSITION(board, version) (Boards::getCapability(board, Board::SwitchPositions))
|
||||
inline int MAX_SWITCHES_POSITION(Board::Type board, int version)
|
||||
{
|
||||
if (version < 219) {
|
||||
if (IS_TARANIS_X7(board) || IS_HORUS(board))
|
||||
return Boards::getCapability(board, Board::SwitchPositions) - 2*3;
|
||||
}
|
||||
|
||||
return Boards::getCapability(board, Board::SwitchPositions);
|
||||
}
|
||||
|
||||
//#define MAX_SWITCHES_POSITION(board, version) (Boards::getCapability(board, Board::SwitchPositions))
|
||||
#define MAX_ROTARY_ENCODERS(board) (IS_SKY9X(board) ? 1 : 0)
|
||||
#define MAX_FLIGHT_MODES(board, version) 9
|
||||
#define MAX_TIMERS(board, version) 3
|
||||
@@ -244,8 +268,13 @@ class SourcesConversionTable: public ConversionTable {
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=0; i<CPN_MAX_STICKS+MAX_POTS(board,version)+Boards::getCapability(board, Board::Sliders)+Boards::getCapability(board, Board::MouseAnalogs)+MAX_GYRO_ANALOGS(board, version); i++) {
|
||||
addConversion(RawSource(SOURCE_TYPE_STICK, i), val++);
|
||||
for (int i=0; i<CPN_MAX_STICKS+MAX_POTS_STORAGE(board, version)+Boards::getCapability(board, Board::SlidersStorage)+Boards::getCapability(board, Board::MouseAnalogs)+MAX_GYRO_ANALOGS(board, version); i++) {
|
||||
|
||||
int offset = 0;
|
||||
if (version <= 218 && IS_HORUS(board) && i>=CPN_MAX_STICKS+MAX_POTS_STORAGE(board, version))
|
||||
offset += 2;
|
||||
|
||||
addConversion(RawSource(SOURCE_TYPE_STICK, i + offset), val++);
|
||||
}
|
||||
|
||||
for (int i=0; i<MAX_ROTARY_ENCODERS(board); i++) {
|
||||
@@ -1868,7 +1897,8 @@ class SensorField: public TransformedField {
|
||||
if (sensor.type == SensorData::TELEM_TYPE_CUSTOM) {
|
||||
_id = sensor.id;
|
||||
_subid = sensor.subid;
|
||||
_instance = sensor.instance;
|
||||
// keep highest 3 bits from instance (rxIdx & moduleIdx are read-only)
|
||||
_instance = (sensor.instance & 0x1F) | (_instance & 0xE0);
|
||||
_ratio = sensor.ratio;
|
||||
_offset = sensor.offset;
|
||||
}
|
||||
@@ -1891,7 +1921,9 @@ class SensorField: public TransformedField {
|
||||
if (sensor.type == SensorData::TELEM_TYPE_CUSTOM) {
|
||||
sensor.id = _id;
|
||||
sensor.subid = _subid;
|
||||
sensor.instance = _instance;
|
||||
sensor.instance = (_instance & 0x1F) + (version <= 218 ? -1 : 0); // 5 bits instance
|
||||
sensor.rxIdx = (_instance >> 5) & 0x03; // 2 bits Rx idx
|
||||
sensor.moduleIdx = (_instance >> 7) & 0x1; // 1 bit module idx
|
||||
sensor.ratio = _ratio;
|
||||
sensor.offset = _offset;
|
||||
}
|
||||
@@ -1939,14 +1971,239 @@ class SensorField: public TransformedField {
|
||||
int exportPpmDelay(int delay) { return (delay - 300) / 50; }
|
||||
int importPpmDelay(int delay) { return 300 + 50 * delay; }
|
||||
|
||||
class ModuleUnionField: public UnionField<unsigned int> {
|
||||
|
||||
class PPMField: public UnionField::UnionMember, public StructField {
|
||||
public:
|
||||
PPMField(DataField * parent, ModuleData::PPM& ppm):
|
||||
StructField(parent, "PPM")
|
||||
{
|
||||
Append(new ConversionField< SignedField<6> >(parent, ppm.delay, exportPpmDelay, importPpmDelay));
|
||||
Append(new BoolField<1>(parent, ppm.pulsePol));
|
||||
Append(new BoolField<1>(parent, ppm.outputType));
|
||||
Append(new SignedField<8>(parent, ppm.frameLength));
|
||||
}
|
||||
|
||||
virtual bool select(const unsigned int& attr) const
|
||||
{
|
||||
return true; // take what's left
|
||||
}
|
||||
|
||||
virtual DataField* getField()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
};
|
||||
|
||||
class MultiField: public UnionField::TransformedMember {
|
||||
public:
|
||||
MultiField(DataField * parent, ModuleData& module):
|
||||
UnionField::TransformedMember(parent, internalField),
|
||||
internalField(this, "Multi"),
|
||||
module(module),
|
||||
rfProtExtra(0)
|
||||
{
|
||||
ModuleData::Multi& multi = module.multi;
|
||||
internalField.Append(new UnsignedField<2>(this, rfProtExtra));
|
||||
internalField.Append(new SpareBitsField<3>(this));
|
||||
internalField.Append(new BoolField<1>(this, multi.autoBindMode));
|
||||
internalField.Append(new BoolField<1>(this, multi.lowPowerMode));
|
||||
internalField.Append(new BoolField<1>(this, multi.customProto));
|
||||
internalField.Append(new SignedField<8>(this, multi.optionValue));
|
||||
}
|
||||
|
||||
virtual bool select(const unsigned int& attr) const
|
||||
{
|
||||
return attr==PULSES_MULTIMODULE;
|
||||
}
|
||||
|
||||
virtual void beforeExport()
|
||||
{
|
||||
module.rfProtocol = module.multi.rfProtocol & 0xf;
|
||||
rfProtExtra = (module.multi.rfProtocol >> 4) & 0x03;
|
||||
}
|
||||
|
||||
virtual void afterImport()
|
||||
{
|
||||
module.multi.rfProtocol =
|
||||
(rfProtExtra & 0x3) << 4 | (module.rfProtocol & 0xf);
|
||||
}
|
||||
|
||||
private:
|
||||
StructField internalField;
|
||||
ModuleData& module;
|
||||
unsigned int rfProtExtra;
|
||||
};
|
||||
|
||||
class PxxField: public UnionField::TransformedMember {
|
||||
public:
|
||||
PxxField(DataField * parent, ModuleData& module):
|
||||
UnionField::TransformedMember(parent, internalField),
|
||||
internalField(this, "Pxx"),
|
||||
module(module)
|
||||
{
|
||||
ModuleData::PXX& pxx = module.pxx;
|
||||
internalField.Append(new UnsignedField<2>(this, pxx.power));
|
||||
internalField.Append(new SpareBitsField<2>(this));
|
||||
internalField.Append(new BoolField<1>(this, pxx.receiver_telem_off));
|
||||
internalField.Append(new BoolField<1>(this, pxx.receiver_channel_9_16));
|
||||
internalField.Append(new BoolField<1>(this, pxx.external_antenna));
|
||||
internalField.Append(new BoolField<1>(this, pxx.sport_out));
|
||||
}
|
||||
|
||||
bool select(const unsigned int& attr) const {
|
||||
return attr==PULSES_PXX_XJT_X16 ||
|
||||
attr==PULSES_PXX_DJT ||
|
||||
attr==PULSES_PXX_R9M ||
|
||||
attr==PULSES_PXX_R9M_LITE;
|
||||
}
|
||||
|
||||
virtual void beforeExport()
|
||||
{
|
||||
if (module.protocol >= PULSES_PXX_XJT_X16 && module.protocol <= PULSES_PXX_XJT_LR12) {
|
||||
module.subType = module.protocol - PULSES_PXX_XJT_X16;
|
||||
}
|
||||
}
|
||||
|
||||
virtual void afterImport()
|
||||
{
|
||||
if (module.protocol == PULSES_PXX_XJT_X16) {
|
||||
module.protocol += module.subType;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
StructField internalField;
|
||||
ModuleData& module;
|
||||
};
|
||||
|
||||
class AccessField: public UnionField::TransformedMember {
|
||||
public:
|
||||
AccessField(DataField * parent, ModuleData& module):
|
||||
UnionField::TransformedMember(parent, internalField),
|
||||
internalField(this, "Access"),
|
||||
module(module)
|
||||
{
|
||||
internalField.Append(new UnsignedField<3>(this, module.access.receivers));
|
||||
internalField.Append(new SpareBitsField<5>(this));
|
||||
|
||||
for (int i=0; i<PXX2_MAX_RECEIVERS_PER_MODULE; i++)
|
||||
internalField.Append(new CharField<8>(this, receiverName[i]));
|
||||
}
|
||||
|
||||
bool select(const unsigned int& attr) const {
|
||||
return attr >= PULSES_ACCESS_ISRM && attr <= PULSES_ACCESS_R9M_LITE_PRO;
|
||||
}
|
||||
|
||||
virtual void beforeExport()
|
||||
{
|
||||
if (module.protocol == PULSES_ACCST_ISRM_D16 ||
|
||||
module.protocol == PULSES_ACCESS_ISRM) {
|
||||
module.subType = module.protocol - PULSES_ACCESS_ISRM;
|
||||
}
|
||||
for (int i=0; i<PXX2_MAX_RECEIVERS_PER_MODULE; i++) {
|
||||
for (int pos=0; pos<PXX2_LEN_RX_NAME+1; pos++) {
|
||||
|
||||
if (pos == PXX2_LEN_RX_NAME
|
||||
|| module.access.receiverName[i][pos] == '\0') {
|
||||
|
||||
memset(module.access.receiverName[i]+pos,'\0',PXX2_LEN_RX_NAME-pos);
|
||||
break;
|
||||
}
|
||||
receiverName[i][pos] = module.access.receiverName[i][pos];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual void afterImport()
|
||||
{
|
||||
if (module.protocol == PULSES_ACCESS_ISRM) {
|
||||
module.protocol += module.subType;
|
||||
}
|
||||
for (int i=0; i<PXX2_MAX_RECEIVERS_PER_MODULE; i++) {
|
||||
for (int pos=0; pos<PXX2_LEN_RX_NAME+1; pos++) {
|
||||
|
||||
if (pos == PXX2_LEN_RX_NAME || receiverName[i][pos] == ' '
|
||||
|| receiverName[i][pos] == '\0') {
|
||||
|
||||
module.access.receiverName[i][pos] = '\0';
|
||||
break;
|
||||
}
|
||||
module.access.receiverName[i][pos] = receiverName[i][pos];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
StructField internalField;
|
||||
ModuleData& module;
|
||||
char receiverName[PXX2_MAX_RECEIVERS_PER_MODULE][PXX2_LEN_RX_NAME+1];
|
||||
};
|
||||
|
||||
public:
|
||||
ModuleUnionField(DataField * parent, ModuleData & module, Board::Type board, unsigned int version):
|
||||
UnionField<unsigned int>(parent, module.protocol)
|
||||
{
|
||||
if (version >= 219)
|
||||
Append(new AccessField(parent, module));
|
||||
Append(new PxxField(parent, module));
|
||||
Append(new MultiField(parent, module));
|
||||
Append(new PPMField(parent, module.ppm));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class ModuleField: public TransformedField {
|
||||
public:
|
||||
ModuleField(DataField * parent, ModuleData & module, Board::Type board, unsigned int version):
|
||||
TransformedField(parent, internalField),
|
||||
internalField(this, "Module"),
|
||||
module(module),
|
||||
protocolsConversionTable(board, version)
|
||||
{
|
||||
internalField.Append(new ConversionField<UnsignedField<4> >(this, module.protocol, &protocolsConversionTable, "Protocol", DataField::tr("OpenTX doesn't accept this radio protocol")));
|
||||
internalField.Append(new SignedField<4>(this, module.rfProtocol));
|
||||
internalField.Append(new UnsignedField<8>(this, module.channelsStart));
|
||||
internalField.Append(new ConversionField<SignedField<8> >(this, module.channelsCount, -8));
|
||||
internalField.Append(new UnsignedField<4>(this, module.failsafeMode));
|
||||
internalField.Append(new UnsignedField<3>(this, module.subType));
|
||||
internalField.Append(new BoolField<1>(this, module.invertedSerial));
|
||||
if (version <= 218) {
|
||||
for (int i=0; i<32; i++) {
|
||||
internalField.Append(new SignedField<16>(this, module.failsafeChannels[i]));
|
||||
}
|
||||
}
|
||||
|
||||
internalField.Append(new ModuleUnionField(parent, module, board, version));
|
||||
}
|
||||
|
||||
virtual void beforeExport()
|
||||
{
|
||||
if (module.protocol >= PULSES_LP45 && module.protocol <= PULSES_DSMX) {
|
||||
module.rfProtocol = module.protocol - PULSES_LP45;
|
||||
}
|
||||
}
|
||||
|
||||
virtual void afterImport()
|
||||
{
|
||||
if (module.protocol == PULSES_LP45) {
|
||||
module.protocol += module.rfProtocol;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
StructField internalField;
|
||||
ModuleData& module;
|
||||
ProtocolsConversionTable protocolsConversionTable;
|
||||
};
|
||||
|
||||
OpenTxModelData::OpenTxModelData(ModelData & modelData, Board::Type board, unsigned int version, unsigned int variant):
|
||||
TransformedField(nullptr, internalField),
|
||||
internalField(this, "ModelData"),
|
||||
modelData(modelData),
|
||||
board(board),
|
||||
version(version),
|
||||
variant(variant),
|
||||
protocolsConversionTable(board)
|
||||
variant(variant)
|
||||
{
|
||||
sprintf(name, "Model %s", modelData.name);
|
||||
|
||||
@@ -2094,26 +2351,8 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, Board::Type board, unsig
|
||||
|
||||
int modulesCount = (version <= 218 ? 3 : 2);
|
||||
for (int module=0; module<modulesCount; module++) {
|
||||
internalField.Append(new ConversionField<SignedField<4> >(this, modelData.moduleData[module].protocol, &protocolsConversionTable, "Protocol", DataField::tr("OpenTX doesn't accept this radio protocol")));
|
||||
internalField.Append(new SignedField<4>(this, subprotocols[module]));
|
||||
internalField.Append(new UnsignedField<8>(this, modelData.moduleData[module].channelsStart));
|
||||
internalField.Append(new ConversionField<SignedField<8> >(this, modelData.moduleData[module].channelsCount, -8));
|
||||
internalField.Append(new UnsignedField<4>(this, modelData.moduleData[module].failsafeMode));
|
||||
internalField.Append(new UnsignedField<3>(this, modelData.moduleData[module].subType));
|
||||
internalField.Append(new BoolField<1>(this, modelData.moduleData[module].invertedSerial));
|
||||
if (version <= 218) {
|
||||
for (int i=0; i<32; i++) {
|
||||
internalField.Append(new SignedField<16>(this, modelData.moduleData[module].failsafeChannels[i]));
|
||||
}
|
||||
}
|
||||
internalField.Append(new ConversionField< SignedField<6> >(this, modelData.moduleData[module].ppm.delay, exportPpmDelay, importPpmDelay));
|
||||
internalField.Append(new BoolField<1>(this, modelData.moduleData[module].ppm.pulsePol));
|
||||
internalField.Append(new BoolField<1>(this, modelData.moduleData[module].ppm.outputType));
|
||||
internalField.Append(new SignedField<8>(this, modelData.moduleData[module].ppm.frameLength));
|
||||
if (version >= 219) {
|
||||
// TODO ACCESS
|
||||
internalField.Append(new CharField<1 + 3 * 8 - 2>(this, modelData.moduleData[module].access.data));
|
||||
}
|
||||
|
||||
internalField.Append(new ModuleField(this, modelData.moduleData[module], board, version));
|
||||
}
|
||||
|
||||
if (version >= 219) {
|
||||
@@ -2221,35 +2460,6 @@ void OpenTxModelData::beforeExport()
|
||||
// qDebug() << QString("before export model") << modelData.name;
|
||||
|
||||
for (int module=0; module<2; module++) {
|
||||
if ((modelData.moduleData[module].protocol >= PULSES_PXX_XJT_X16 && modelData.moduleData[module].protocol <= PULSES_PXX_XJT_LR12) ||
|
||||
modelData.moduleData[module].protocol == PULSES_PXX_R9M) {
|
||||
if (modelData.moduleData[module].protocol != PULSES_PXX_R9M) {
|
||||
subprotocols[module] = modelData.moduleData[module].protocol - PULSES_PXX_XJT_X16;
|
||||
}
|
||||
int pxxByte = (modelData.moduleData[module].pxx.power & 0x03)
|
||||
| modelData.moduleData[module].pxx.receiver_telem_off << 4
|
||||
| modelData.moduleData[module].pxx.receiver_channel_9_16 << 5;
|
||||
modelData.moduleData[module].ppm.delay = 300 + 50 * pxxByte;
|
||||
modelData.moduleData[module].ppm.pulsePol = modelData.moduleData[module].pxx.external_antenna;
|
||||
modelData.moduleData[module].ppm.outputType = modelData.moduleData[module].pxx.sport_out;
|
||||
|
||||
}
|
||||
else if (modelData.moduleData[module].protocol >= PULSES_LP45 && modelData.moduleData[module].protocol <= PULSES_DSMX) {
|
||||
subprotocols[module] = modelData.moduleData[module].protocol - PULSES_LP45;
|
||||
}
|
||||
else if (modelData.moduleData[module].protocol == PULSES_MULTIMODULE) {
|
||||
// copy multi settings to ppm settings to get them written to the eeprom
|
||||
// (reverse the int => ms logic of the ppm delay) since only ppm is written
|
||||
subprotocols[module] = modelData.moduleData[module].multi.rfProtocol & (0x1f);
|
||||
int multiByte = ((modelData.moduleData[module].multi.rfProtocol >> 4) & 0x03) | (modelData.moduleData[module].multi.customProto << 7);
|
||||
modelData.moduleData[module].ppm.delay = 300 + 50 * multiByte;
|
||||
modelData.moduleData[module].ppm.frameLength = modelData.moduleData[module].multi.optionValue;
|
||||
modelData.moduleData[module].ppm.outputType = modelData.moduleData[module].multi.lowPowerMode;
|
||||
modelData.moduleData[module].ppm.pulsePol = modelData.moduleData[module].multi.autoBindMode;
|
||||
}
|
||||
else {
|
||||
subprotocols[module] = (module == 0 ? -1 : 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (IS_HORUS(board)) {
|
||||
@@ -2268,39 +2478,11 @@ void OpenTxModelData::afterImport()
|
||||
{
|
||||
qCDebug(eepromImport) << QString("OpenTxModelData::afterImport()") << modelData.name;
|
||||
|
||||
// ??? what's this ???
|
||||
if (IS_HORUS(board)) {
|
||||
modelData.moduleData[0].protocol = PULSES_PXX_XJT_X16;
|
||||
}
|
||||
|
||||
for (int module=0; module<2; module++) {
|
||||
if (modelData.moduleData[module].protocol == PULSES_PXX_XJT_X16 || modelData.moduleData[module].protocol == PULSES_LP45) {
|
||||
if (subprotocols[module] >= 0)
|
||||
modelData.moduleData[module].protocol += subprotocols[module];
|
||||
else
|
||||
modelData.moduleData[module].protocol = PULSES_OFF;
|
||||
}
|
||||
else if (modelData.moduleData[module].protocol == PULSES_MULTIMODULE) {
|
||||
// Copy data from ppm struct to multi struct
|
||||
auto multiByte = (unsigned int)((modelData.moduleData[module].ppm.delay - 300) / 50);
|
||||
modelData.moduleData[module].multi.rfProtocol = (subprotocols[module] & 0x0f) | ((multiByte & 0x3) << 4);
|
||||
modelData.moduleData[module].multi.customProto = (multiByte & 0x80) == 0x80;
|
||||
modelData.moduleData[module].multi.optionValue = modelData.moduleData[module].ppm.frameLength;
|
||||
modelData.moduleData[module].multi.lowPowerMode = modelData.moduleData[module].ppm.outputType;
|
||||
modelData.moduleData[module].multi.autoBindMode = modelData.moduleData[module].ppm.pulsePol;
|
||||
}
|
||||
|
||||
if ((modelData.moduleData[module].protocol >= PULSES_PXX_XJT_X16 && modelData.moduleData[module].protocol <= PULSES_PXX_XJT_LR12) ||
|
||||
modelData.moduleData[module].protocol == PULSES_PXX_R9M) {
|
||||
// Do the same for pxx
|
||||
auto pxxByte = (unsigned int)((modelData.moduleData[module].ppm.delay - 300) / 50);
|
||||
modelData.moduleData[module].pxx.power = pxxByte & 0x03;
|
||||
modelData.moduleData[module].pxx.receiver_telem_off = static_cast<bool>(pxxByte & (1 << 4));
|
||||
modelData.moduleData[module].pxx.receiver_channel_9_16 = static_cast<bool>(pxxByte & (1 << 5));
|
||||
modelData.moduleData[module].pxx.sport_out = modelData.moduleData[module].ppm.outputType;
|
||||
modelData.moduleData[module].pxx.external_antenna = modelData.moduleData[module].ppm.pulsePol;
|
||||
}
|
||||
}
|
||||
|
||||
if (IS_HORUS(board)) {
|
||||
uint32_t newSwitchWarningStates = 0;
|
||||
for (int i = 0; i < MAX_SWITCHES(board, version); i++) {
|
||||
@@ -2312,6 +2494,9 @@ void OpenTxModelData::afterImport()
|
||||
}
|
||||
modelData.switchWarningStates = newSwitchWarningStates;
|
||||
}
|
||||
|
||||
if (version <= 218 && IS_HORUS_X10(board) && modelData.thrTraceSrc > 3)
|
||||
modelData.thrTraceSrc += 2;
|
||||
}
|
||||
|
||||
OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, Board::Type board, unsigned int version, unsigned int variant):
|
||||
@@ -2472,13 +2657,17 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, Board::Type
|
||||
internalField.Append(new ArmCustomFunctionField(this, generalData.customFn[i], board, version, variant));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (IS_STM32(board)) {
|
||||
if (version >= 218) {
|
||||
internalField.Append(new UnsignedField<4>(this, generalData.hw_uartMode));
|
||||
// not on Horus...
|
||||
for (uint8_t i=0; i<4; i++) {
|
||||
internalField.Append(new UnsignedField<1>(this, generalData.sliderConfig[i]));
|
||||
if (!IS_HORUS(board) || version < 219) {
|
||||
for (uint8_t i=0; i<4; i++) {
|
||||
internalField.Append(new UnsignedField<1>(this, generalData.sliderConfig[i]));
|
||||
}
|
||||
}
|
||||
else {
|
||||
internalField.Append(new SpareBitsField<4>(this));
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -2502,17 +2691,18 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, Board::Type
|
||||
}
|
||||
for (int i=0; i<MAX_KNOBS(board, version); i++) {
|
||||
|
||||
int offset = 0;
|
||||
// 2 new pots for Horus from 219 on
|
||||
if (version <= 218 && IS_HORUS(board) && (i == 3))
|
||||
i += 2;
|
||||
if (version <= 218 && IS_HORUS(board) && (i >= 3))
|
||||
offset += 2;
|
||||
|
||||
if (i < Boards::getCapability(board, Board::PotsStorage))
|
||||
internalField.Append(new UnsignedField<2>(this, generalData.potConfig[i]));
|
||||
internalField.Append(new UnsignedField<2>(this, generalData.potConfig[i+offset]));
|
||||
else
|
||||
internalField.Append(new SpareBitsField<2>(this));
|
||||
}
|
||||
if (IS_HORUS(board)) {
|
||||
for (int i=0; i<8; i++) {
|
||||
if (IS_HORUS(board) && version >= 219) {
|
||||
for (int i=0; i<MAX_SLIDERS_SLOTS(board,version); i++) {
|
||||
if (i < Boards::getCapability(board, Board::SlidersStorage))
|
||||
internalField.Append(new UnsignedField<1>(this, generalData.sliderConfig[i]));
|
||||
else
|
||||
@@ -2536,6 +2726,8 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, Board::Type
|
||||
|
||||
if (IS_TARANIS_X9E(board))
|
||||
internalField.Append(new SpareBitsField<64>(this)); // switchUnlockStates
|
||||
else if (version >= 219 && IS_TARANIS_X9D(board))
|
||||
internalField.Append(new SpareBitsField<32>(this)); // switchUnlockStates
|
||||
else if (IS_TARANIS(board))
|
||||
internalField.Append(new SpareBitsField<16>(this)); // switchUnlockStates
|
||||
|
||||
@@ -2552,11 +2744,7 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, Board::Type
|
||||
for (int i=0; i<CPN_MAX_STICKS; ++i) {
|
||||
internalField.Append(new ZCharField<3>(this, generalData.stickName[i], "Stick name"));
|
||||
}
|
||||
for (int i=0; i<Boards::getCapability(board, Board::PotsStorage); ++i) {
|
||||
if (version <= 218 && IS_HORUS(board) && (i == 3)) {
|
||||
// skip not yet existing pots (EXT1 / EXT2 for X10)
|
||||
i += 2;
|
||||
}
|
||||
for (int i=0; i<MAX_POTS_STORAGE(board, version); ++i) {
|
||||
internalField.Append(new ZCharField<3>(this, generalData.potName[i], "Pot name"));
|
||||
}
|
||||
for (int i=0; i<Boards::getCapability(board, Board::SlidersStorage); ++i) {
|
||||
@@ -2590,7 +2778,7 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, Board::Type
|
||||
internalField.Append(new UnsignedField<7>(this, generalData.backlightOffBright));
|
||||
internalField.Append(new ZCharField<10>(this, generalData.bluetoothName, "Bluetooth name"));
|
||||
}
|
||||
else if (IS_TARANIS_X9E(board) || (version >= 219 && (IS_TARANIS_X7(board) || IS_TARANIS_XLITE(board) || IS_TARANIS_XLITES(board)))) {
|
||||
else if (IS_TARANIS_X9E(board) || (version >= 219 && (IS_TARANIS_X7(board) || IS_TARANIS_X9D(board) || IS_TARANIS_XLITE(board)))) {
|
||||
internalField.Append(new SpareBitsField<8>(this));
|
||||
internalField.Append(new ZCharField<10>(this, generalData.bluetoothName, "Bluetooth name"));
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ class OpenTxGeneralData: public TransformedField {
|
||||
class ProtocolsConversionTable: public ConversionTable
|
||||
{
|
||||
public:
|
||||
ProtocolsConversionTable(Board::Type board)
|
||||
ProtocolsConversionTable(Board::Type board, int version)
|
||||
{
|
||||
int val = 0;
|
||||
addConversion(PULSES_OFF, val++);
|
||||
@@ -83,7 +83,10 @@ class ProtocolsConversionTable: public ConversionTable
|
||||
addConversion(PULSES_PXX_XJT_D8, val);
|
||||
addConversion(PULSES_PXX_XJT_LR12, val++);
|
||||
|
||||
addConversion(PULSES_ACCESS_ISRM, val++);
|
||||
if (version >= 219) {
|
||||
addConversion(PULSES_ACCESS_ISRM, val);
|
||||
addConversion(PULSES_ACCST_ISRM_D16, val++);
|
||||
}
|
||||
|
||||
addConversion(PULSES_LP45, val);
|
||||
addConversion(PULSES_DSM2, val);
|
||||
@@ -96,9 +99,14 @@ class ProtocolsConversionTable: public ConversionTable
|
||||
addConversion(PULSES_ACCESS_R9M, val++);
|
||||
addConversion(PULSES_PXX_R9M_LITE, val++);
|
||||
addConversion(PULSES_ACCESS_R9M_LITE, val++);
|
||||
addConversion(PULSES_PXX_R9M_LITE_PRO, val++);
|
||||
addConversion(PULSES_ACCESS_R9M_LITE_PRO, val++);
|
||||
|
||||
addConversion(PULSES_SBUS, val++);
|
||||
|
||||
addConversion(PULSES_XJT_LITE_X16, val);
|
||||
addConversion(PULSES_XJT_LITE_D8, val);
|
||||
addConversion(PULSES_XJT_LITE_LR12, val++);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -141,7 +149,6 @@ class OpenTxModelData: public TransformedField {
|
||||
unsigned int variant;
|
||||
char name[256];
|
||||
int subprotocols[CPN_MAX_MODULES+1/*trainer*/];
|
||||
ProtocolsConversionTable protocolsConversionTable;
|
||||
ChannelsConversionTable channelsConversionTable;
|
||||
QStringList _errors;
|
||||
};
|
||||
|
||||
@@ -94,6 +94,8 @@ const char * OpenTxEepromInterface::getName()
|
||||
return "OpenTX for FrSky Horus";
|
||||
case BOARD_X10:
|
||||
return "OpenTX for FrSky X10";
|
||||
case BOARD_X10_EXPRESS:
|
||||
return "OpenTX for FrSky X10 Express";
|
||||
default:
|
||||
return "OpenTX for an unknown board";
|
||||
}
|
||||
@@ -756,66 +758,67 @@ QTime OpenTxFirmware::getMaxTimerStart()
|
||||
return QTime(0, 59, 59);
|
||||
}
|
||||
|
||||
int OpenTxFirmware::isAvailable(PulsesProtocol proto, int port)
|
||||
bool OpenTxFirmware::isAvailable(PulsesProtocol proto, int port)
|
||||
{
|
||||
if (IS_HORUS_OR_TARANIS(board)) {
|
||||
switch (port) {
|
||||
case 0:
|
||||
switch (proto) {
|
||||
case PULSES_OFF:
|
||||
return 1;
|
||||
return true;
|
||||
case PULSES_PXX_XJT_X16:
|
||||
case PULSES_PXX_XJT_LR12:
|
||||
return (IS_TARANIS_XLITES(board) || IS_TARANIS_X9LITE(board)) ? 0 : 1;
|
||||
return !(IS_TARANIS_XLITES(board) || IS_TARANIS_X9LITE(board));
|
||||
case PULSES_PXX_XJT_D8:
|
||||
return (IS_TARANIS_XLITES(board) || IS_TARANIS_X9LITE(board) || id.contains("eu")) ? 0 : 1;
|
||||
return !(IS_TARANIS_XLITES(board) || IS_TARANIS_X9LITE(board) || id.contains("eu"));
|
||||
case PULSES_PPM:
|
||||
return id.contains("internalppm") ? 1 : 0;
|
||||
return id.contains("internalppm");
|
||||
case PULSES_ACCESS_ISRM:
|
||||
return (IS_TARANIS_XLITES(board) || IS_TARANIS_X9LITE(board)) ? 1 : 0;
|
||||
return IS_TARANIS_XLITES(board) || IS_TARANIS_X9LITE(board) || board == BOARD_TARANIS_X9DP_2019 || board == BOARD_X10_EXPRESS || (IS_HORUS(board) && id.contains("internalaccess"));
|
||||
case PULSES_ACCST_ISRM_D16:
|
||||
return (IS_TARANIS_XLITES(board) || IS_TARANIS_X9LITE(board));
|
||||
default:
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
case 1:
|
||||
switch (proto) {
|
||||
case PULSES_OFF:
|
||||
case PULSES_PPM:
|
||||
return 1;
|
||||
return true;
|
||||
case PULSES_PXX_XJT_X16:
|
||||
case PULSES_PXX_XJT_D8:
|
||||
case PULSES_PXX_XJT_LR12:
|
||||
return (IS_TARANIS_XLITES(board) || IS_TARANIS_X9LITE(board)) ? 0 : 1;
|
||||
return !(IS_TARANIS_XLITES(board) || IS_TARANIS_X9LITE(board));
|
||||
case PULSES_PXX_R9M:
|
||||
case PULSES_LP45:
|
||||
case PULSES_DSM2:
|
||||
case PULSES_DSMX:
|
||||
case PULSES_SBUS:
|
||||
return 1;
|
||||
case PULSES_MULTIMODULE:
|
||||
if(IS_JUMPER_T12(board))
|
||||
return 1;
|
||||
else
|
||||
return id.contains("multimodule") ? 1 : 0;
|
||||
case PULSES_CROSSFIRE:
|
||||
return id.contains("crossfire") ? 1 : 0;
|
||||
return true;
|
||||
case PULSES_ACCESS_R9M_LITE:
|
||||
case PULSES_ACCESS_R9M_LITE_PRO:
|
||||
return (IS_TARANIS_XLITES(board) || IS_TARANIS_X9LITE(board)) ? 1 : 0;
|
||||
return (IS_TARANIS_XLITES(board) || IS_TARANIS_X9LITE(board));
|
||||
case PULSES_XJT_LITE_X16:
|
||||
case PULSES_XJT_LITE_D8:
|
||||
case PULSES_XJT_LITE_LR12:
|
||||
return (IS_TARANIS_XLITES(board) || IS_TARANIS_X9LITE(board));
|
||||
default:
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
case -1:
|
||||
switch (proto) {
|
||||
case PULSES_PPM:
|
||||
return 1;
|
||||
return true;
|
||||
default:
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
default:
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (IS_SKY9X(board)) {
|
||||
@@ -831,23 +834,22 @@ int OpenTxFirmware::isAvailable(PulsesProtocol proto, int port)
|
||||
case PULSES_DSM2:
|
||||
case PULSES_DSMX:
|
||||
case PULSES_SBUS:
|
||||
return 1;
|
||||
case PULSES_MULTIMODULE:
|
||||
return id.contains("multimodule") ? 1 : 0;
|
||||
return true;
|
||||
default:
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
switch (proto) {
|
||||
case PULSES_PPM:
|
||||
return 1;
|
||||
return true;
|
||||
default:
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -859,9 +861,9 @@ int OpenTxFirmware::isAvailable(PulsesProtocol proto, int port)
|
||||
// case PULSES_PXX_DJT: // Unavailable for now
|
||||
case PULSES_PPM16:
|
||||
case PULSES_PPMSIM:
|
||||
return 1;
|
||||
return true;
|
||||
default:
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1150,7 +1152,6 @@ void addOpenTxRfOptions(OpenTxFirmware * firmware, bool flex = true)
|
||||
{
|
||||
static const Firmware::Option opt_eu("eu", Firmware::tr("Removes D8 FrSky protocol support which is not legal for use in the EU on radios sold after Jan 1st, 2015"));
|
||||
static const Firmware::Option opt_fl("flexr9m", Firmware::tr("Enable non certified firmwares"));
|
||||
firmware->addOption("multimodule", Firmware::tr("Support for the DIY-Multiprotocol-TX-Module"));
|
||||
if (flex)
|
||||
firmware->addOptionsGroup({opt_eu, opt_fl});
|
||||
else
|
||||
@@ -1168,8 +1169,6 @@ void addOpenTxFrskyOptions(OpenTxFirmware * firmware)
|
||||
firmware->addOption("noheli", Firmware::tr("Disable HELI menu and cyclic mix support"));
|
||||
firmware->addOption("nogvars", Firmware::tr("Disable Global variables"));
|
||||
firmware->addOption("lua", Firmware::tr("Enable Lua custom scripts screen"));
|
||||
firmware->addOption("luac", Firmware::tr("Enable Lua compiler"));
|
||||
firmware->addOption("crossfire", Firmware::tr("Support for Crossfire TX Module"));
|
||||
addOpenTxRfOptions(firmware);
|
||||
}
|
||||
|
||||
@@ -1260,23 +1259,28 @@ void registerOpenTxFirmwares()
|
||||
/* FrSky X10 board */
|
||||
firmware = new OpenTxFirmware("opentx-x10", Firmware::tr("FrSky Horus X10 / X10S"), BOARD_X10);
|
||||
addOpenTxFrskyOptions(firmware);
|
||||
firmware->addOption("internalaccess", Firmware::tr("Support for ACCESS internal module replacement"));
|
||||
registerOpenTxFirmware(firmware);
|
||||
|
||||
/* FrSky X10 Express board */
|
||||
firmware = new OpenTxFirmware("opentx-x10express", Firmware::tr("FrSky Horus X10 Express"), BOARD_X10_EXPRESS);
|
||||
addOpenTxFrskyOptions(firmware);
|
||||
registerOpenTxFirmware(firmware);
|
||||
|
||||
/* FrSky X12 (Horus) board */
|
||||
firmware = new OpenTxFirmware("opentx-x12s", Firmware::tr("FrSky Horus X12S"), BOARD_X12S);
|
||||
addOpenTxFrskyOptions(firmware);
|
||||
firmware->addOption("internalaccess", Firmware::tr("Support for ACCESS internal module replacement"));
|
||||
firmware->addOption("pcbdev", Firmware::tr("Use ONLY with first DEV pcb version"));
|
||||
registerOpenTxFirmware(firmware);
|
||||
|
||||
/* Jumper T12 board */
|
||||
firmware = new OpenTxFirmware("opentx-t12", QCoreApplication::translate("Firmware", "Jumper T12"), BOARD_JUMPER_T12);
|
||||
addOpenTxCommonOptions(firmware);
|
||||
firmware->addOption("multimodule", Firmware::tr("Support for the DIY-Multiprotocol-TX-Module"));
|
||||
firmware->addOption("noheli", Firmware::tr("Disable HELI menu and cyclic mix support"));
|
||||
firmware->addOption("nogvars", Firmware::tr("Disable Global variables"));
|
||||
firmware->addOption("lua", Firmware::tr("Enable Lua custom scripts screen"));
|
||||
firmware->addOption("luac", Firmware::tr("Enable Lua compiler"));
|
||||
firmware->addOption("crossfire", Firmware::tr("Support for Crossfire TX Module"));
|
||||
firmware->addOption("flexr9m", Firmware::tr("Enable non certified R9M firmwares"));
|
||||
addOpenTxFontOptions(firmware);
|
||||
registerOpenTxFirmware(firmware);
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ class OpenTxFirmware: public Firmware
|
||||
|
||||
virtual QTime getMaxTimerStart();
|
||||
|
||||
virtual int isAvailable(PulsesProtocol proto, int port=0);
|
||||
virtual bool isAvailable(PulsesProtocol proto, int port=0);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
@@ -259,11 +259,11 @@ class RawSource {
|
||||
bool isTimeBased(Board::Type board = Board::BOARD_UNKNOWN) const;
|
||||
bool isAvailable(const ModelData * const model = NULL, const GeneralSettings * const gs = NULL, Board::Type board = Board::BOARD_UNKNOWN) const;
|
||||
|
||||
bool operator == ( const RawSource & other) {
|
||||
bool operator == ( const RawSource & other) const {
|
||||
return (this->type == other.type) && (this->index == other.index);
|
||||
}
|
||||
|
||||
bool operator != ( const RawSource & other) {
|
||||
bool operator != ( const RawSource & other) const {
|
||||
return (this->type != other.type) || (this->index != other.index);
|
||||
}
|
||||
|
||||
|
||||
@@ -91,11 +91,11 @@ class RawSwitch {
|
||||
QString toString(Board::Type board = Board::BOARD_UNKNOWN, const GeneralSettings * const generalSettings = NULL, const ModelData * const modelData = NULL) const;
|
||||
bool isAvailable(const ModelData * const model = NULL, const GeneralSettings * const gs = NULL, Board::Type board = Board::BOARD_UNKNOWN) const;
|
||||
|
||||
bool operator== ( const RawSwitch& other) {
|
||||
bool operator== ( const RawSwitch& other) const {
|
||||
return (this->type == other.type) && (this->index == other.index);
|
||||
}
|
||||
|
||||
bool operator!= ( const RawSwitch& other) {
|
||||
bool operator!= ( const RawSwitch& other) const {
|
||||
return (this->type != other.type) || (this->index != other.index);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "sensordata.h"
|
||||
|
||||
#include "radiodata.h"
|
||||
#include "modeldata.h"
|
||||
|
||||
void SensorData::updateUnit()
|
||||
{
|
||||
@@ -90,3 +91,25 @@ QString SensorData::nameToString(int index) const
|
||||
{
|
||||
return RadioData::getElementName(tr("TELE"), index + 1, label);
|
||||
}
|
||||
|
||||
QString SensorData::getRxOrModName(const ModelData* model) const
|
||||
{
|
||||
if ((type != TELEM_TYPE_CUSTOM) || (!id && !instance))
|
||||
return QString();
|
||||
|
||||
const ModuleData& module = model->moduleData[moduleIdx];
|
||||
|
||||
if (module.isPxx2Module()) {
|
||||
if (module.access.receivers & (1 << rxIdx)) {
|
||||
return QString(module.access.receiverName[rxIdx]);
|
||||
}
|
||||
|
||||
// receiver does not seem to be active
|
||||
return QString();
|
||||
}
|
||||
|
||||
if (moduleIdx)
|
||||
return tr("Internal");
|
||||
|
||||
return tr("External");
|
||||
}
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
|
||||
constexpr int CPN_MAX_SENSORS = 60;
|
||||
|
||||
class ModelData;
|
||||
|
||||
class SensorData {
|
||||
Q_DECLARE_TR_FUNCTIONS(SensorData)
|
||||
|
||||
@@ -111,6 +113,8 @@ class SensorData {
|
||||
unsigned int id;
|
||||
unsigned int subid;
|
||||
unsigned int instance;
|
||||
unsigned int rxIdx;
|
||||
unsigned int moduleIdx;
|
||||
unsigned int persistentValue;
|
||||
unsigned int formula;
|
||||
char label[4+1];
|
||||
@@ -144,6 +148,7 @@ class SensorData {
|
||||
void updateUnit();
|
||||
QString unitString() const;
|
||||
QString nameToString(int index) const;
|
||||
QString getRxOrModName(const ModelData* model) const;
|
||||
void clear() { memset(this, 0, sizeof(SensorData)); }
|
||||
};
|
||||
|
||||
|
||||
@@ -455,6 +455,9 @@ void GeneralSetupPanel::setValues()
|
||||
|
||||
ui->pwrOnSpeed->setValue(generalSettings.pwrOnSpeed);
|
||||
ui->pwrOffSpeed->setValue(generalSettings.pwrOffSpeed);
|
||||
|
||||
// TODO: only if ACCESS available??
|
||||
ui->registrationId->setText(generalSettings.registrationId);
|
||||
}
|
||||
|
||||
void GeneralSetupPanel::on_faimode_CB_stateChanged(int)
|
||||
@@ -747,6 +750,15 @@ void GeneralSetupPanel::on_blAlarm_ChkB_stateChanged()
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void GeneralSetupPanel::on_ownerID_editingFinished()
|
||||
{
|
||||
//copy ownerID back to generalSettings.registrationId
|
||||
QByteArray array = ui->registrationId->text().toLocal8Bit();
|
||||
strncpy(generalSettings.registrationId, "pafleraf", 9);
|
||||
generalSettings.registrationId[8] = '\0';
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void GeneralSetupPanel::stickReverseEdited()
|
||||
{
|
||||
generalSettings.stickReverse = ((int)ui->stickReverse1->isChecked()) | ((int)ui->stickReverse2->isChecked()<<1) | ((int)ui->stickReverse3->isChecked()<<2) | ((int)ui->stickReverse4->isChecked()<<3);
|
||||
|
||||
@@ -87,6 +87,7 @@ class GeneralSetupPanel : public GeneralPanel
|
||||
void on_vBatMinDSB_editingFinished();
|
||||
void on_vBatMaxDSB_editingFinished();
|
||||
void on_contrastSB_editingFinished();
|
||||
void on_ownerID_editingFinished();
|
||||
|
||||
void on_pwrOnSpeed_valueChanged();
|
||||
void on_pwrOffSpeed_valueChanged();
|
||||
|
||||
@@ -554,6 +554,33 @@
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<layout class="QGridLayout" name="gridLayout_3" columnstretch="0,0">
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="volume_SB">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>23</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="0">
|
||||
<widget class="QLabel" name="re_label">
|
||||
<property name="text">
|
||||
<string>RotEnc Navigation</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QCheckBox" name="blAlarm_ChkB">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="0">
|
||||
<widget class="QLabel" name="stickReverseLB">
|
||||
<property name="sizePolicy">
|
||||
@@ -567,59 +594,89 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="16" column="0">
|
||||
<widget class="QLabel" name="countrycode_label">
|
||||
<property name="text">
|
||||
<string>Country Code</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="1">
|
||||
<widget class="QCheckBox" name="faimode_CB">
|
||||
<item row="7" column="1">
|
||||
<widget class="QComboBox" name="backlightswCB">
|
||||
<property name="toolTip">
|
||||
<string>If you enable FAI, only RSSI and RxBt sensors will keep working. This function cannot be disabled by the radio.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="0">
|
||||
<widget class="QLabel" name="label_faimode">
|
||||
<property name="text">
|
||||
<string>FAI Mode</string>
|
||||
<property name="statusTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>This is the switch selectrion for turning on the backlight (if installed).
|
||||
|
||||
</string>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="17" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QSpinBox" name="timezoneSB">
|
||||
<property name="minimum">
|
||||
<number>-14</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="adjustRTC">
|
||||
<property name="toolTip">
|
||||
<string>Automatically adjust the radio's clock if a GPS is connected to telemetry.</string>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Adjust RTC</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="blAlarm_LB">
|
||||
<property name="text">
|
||||
<string>Backlight flash on alarm</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Backlight Auto OFF after</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Backlight Switch</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QSpinBox" name="varioR0_SB">
|
||||
<property name="suffix">
|
||||
<string> ms</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>200</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>500</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="18" column="0">
|
||||
<widget class="QLabel" name="VoiceLang_label">
|
||||
<property name="text">
|
||||
<string>Voice Language</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QSpinBox" name="varioP0_SB">
|
||||
<property name="suffix">
|
||||
<string> Hz</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>300</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1100</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>700</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
@@ -653,94 +710,38 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_volume">
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="varioR0_label">
|
||||
<property name="text">
|
||||
<string>Speaker Volume</string>
|
||||
<string>Vario repeat at zero</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QSpinBox" name="varioPMax_SB">
|
||||
<property name="suffix">
|
||||
<string> Hz</string>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="varioP0_label">
|
||||
<property name="text">
|
||||
<string>Vario pitch at zero</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1300</number>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="0">
|
||||
<widget class="QLabel" name="label_faimode">
|
||||
<property name="text">
|
||||
<string>FAI Mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="label_OFFBright">
|
||||
<property name="text">
|
||||
<string>Backlight OFF Brightness</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<widget class="QSpinBox" name="BLBright_SB">
|
||||
<property name="maximum">
|
||||
<number>2900</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1700</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="varioPMax_label">
|
||||
<property name="text">
|
||||
<string>Vario pitch at max</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Backlight Switch</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="volume_SB">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>23</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<layout class="QHBoxLayout" name="backlightColor_Layout">
|
||||
<item>
|
||||
<widget class="QLabel" name="backlightColor1_label">
|
||||
<property name="text">
|
||||
<string>Color 1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSlider" name="backlightColor_SL">
|
||||
<property name="maximum">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="backlightColor2_label">
|
||||
<property name="text">
|
||||
<string>Color 2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_soundMode">
|
||||
<property name="text">
|
||||
<string>Sound Mode</string>
|
||||
<number>100</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -772,17 +773,95 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="0">
|
||||
<widget class="QLabel" name="backlightColor_label">
|
||||
<property name="text">
|
||||
<string>Backlight color</string>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="speakerPitchSB">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">LCD Screen Contrast</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Values can be 20-45</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_speakerPitch">
|
||||
<item row="5" column="1">
|
||||
<widget class="QSpinBox" name="varioPMax_SB">
|
||||
<property name="suffix">
|
||||
<string> Hz</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1300</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>2900</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1700</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="17" column="0">
|
||||
<widget class="QLabel" name="label_timezone">
|
||||
<property name="text">
|
||||
<string>Speaker Pitch (spkr only)</string>
|
||||
<string>Timeshift from UTC</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<widget class="QSpinBox" name="OFFBright_SB">
|
||||
<property name="minimum">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="16" column="1">
|
||||
<widget class="QComboBox" name="countrycode_CB">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>America</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Japan</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Europe</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="1">
|
||||
<widget class="QCheckBox" name="faimode_CB">
|
||||
<property name="toolTip">
|
||||
<string>If you enable FAI, only RSSI and RxBt sensors will keep working. This function cannot be disabled by the radio.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -810,6 +889,13 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="label_BLBright">
|
||||
<property name="text">
|
||||
<string>Backlight Brightness</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<layout class="QGridLayout" name="gridLayout_9" columnstretch="1,0,1,0">
|
||||
<item row="0" column="0">
|
||||
@@ -906,168 +992,116 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QSpinBox" name="varioR0_SB">
|
||||
<property name="suffix">
|
||||
<string> ms</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>200</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>500</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QSpinBox" name="varioP0_SB">
|
||||
<property name="suffix">
|
||||
<string> Hz</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>300</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1100</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>700</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="blAlarm_LB">
|
||||
<item row="12" column="0">
|
||||
<widget class="QLabel" name="backlightColor_label">
|
||||
<property name="text">
|
||||
<string>Backlight flash on alarm</string>
|
||||
<string>Backlight color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="varioP0_label">
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="varioPMax_label">
|
||||
<property name="text">
|
||||
<string>Vario pitch at zero</string>
|
||||
<string>Vario pitch at max</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="varioR0_label">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_speakerPitch">
|
||||
<property name="text">
|
||||
<string>Vario repeat at zero</string>
|
||||
<string>Speaker Pitch (spkr only)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<widget class="QSpinBox" name="BLBright_SB">
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Backlight Auto OFF after</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QComboBox" name="backlightswCB">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>This is the switch selectrion for turning on the backlight (if installed).
|
||||
|
||||
</string>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="speakerPitchSB">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">LCD Screen Contrast</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Values can be 20-45</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="0">
|
||||
<widget class="QLabel" name="re_label">
|
||||
<property name="text">
|
||||
<string>RotEnc Navigation</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QCheckBox" name="blAlarm_ChkB">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="label_BLBright">
|
||||
<property name="text">
|
||||
<string>Backlight Brightness</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="16" column="1">
|
||||
<widget class="QComboBox" name="countrycode_CB">
|
||||
<item row="12" column="1">
|
||||
<layout class="QHBoxLayout" name="backlightColor_Layout">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>America</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="backlightColor1_label">
|
||||
<property name="text">
|
||||
<string>Color 1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Japan</string>
|
||||
</property>
|
||||
<widget class="QSlider" name="backlightColor_SL">
|
||||
<property name="maximum">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Europe</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="backlightColor2_label">
|
||||
<property name="text">
|
||||
<string>Color 2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="16" column="0">
|
||||
<widget class="QLabel" name="countrycode_label">
|
||||
<property name="text">
|
||||
<string>Country Code</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="1">
|
||||
<widget class="QComboBox" name="re_CB"/>
|
||||
</item>
|
||||
<item row="19" column="0">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_soundMode">
|
||||
<property name="text">
|
||||
<string>Sound Mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_volume">
|
||||
<property name="text">
|
||||
<string>Speaker Volume</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="17" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QSpinBox" name="timezoneSB">
|
||||
<property name="minimum">
|
||||
<number>-14</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="adjustRTC">
|
||||
<property name="toolTip">
|
||||
<string>Automatically adjust the radio's clock if a GPS is connected to telemetry.</string>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Adjust RTC</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="18" column="1">
|
||||
<widget class="QComboBox" name="voiceLang_CB"/>
|
||||
</item>
|
||||
<item row="20" column="0">
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@@ -1080,37 +1114,20 @@ p, li { white-space: pre-wrap; }
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="18" column="0">
|
||||
<widget class="QLabel" name="VoiceLang_label">
|
||||
<item row="19" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Voice Language</string>
|
||||
<string>Owner Registration ID</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="17" column="0">
|
||||
<widget class="QLabel" name="label_timezone">
|
||||
<property name="text">
|
||||
<string>Timeshift from UTC</string>
|
||||
<item row="19" column="1">
|
||||
<widget class="QLineEdit" name="registrationId">
|
||||
<property name="inputMask">
|
||||
<string>aaaaaaAA</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="18" column="1">
|
||||
<widget class="QComboBox" name="voiceLang_CB"/>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="label_OFFBright">
|
||||
<property name="text">
|
||||
<string>Backlight OFF Brightness</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<widget class="QSpinBox" name="OFFBright_SB">
|
||||
<property name="minimum">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
<property name="maxLength">
|
||||
<number>8</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -1334,7 +1334,7 @@ bool MdiChild::loadFile(const QString & filename, bool resetCurrentFile)
|
||||
|
||||
QString warning = storage.warning();
|
||||
if (!warning.isEmpty()) {
|
||||
// TODO EEPROMInterface::showEepromWarnings(this, CPN_STR_TTL_WARNING, warning);
|
||||
QMessageBox::warning(this, CPN_STR_TTL_WARNING, warning);
|
||||
}
|
||||
|
||||
if (resetCurrentFile) {
|
||||
|
||||
@@ -162,11 +162,6 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
|
||||
if (IS_HORUS_OR_TARANIS(firmware->getBoard())) {
|
||||
curveCB[i] = new QComboBox(this);
|
||||
curveCB[i]->setProperty("index", i);
|
||||
int numcurves = firmware->getCapability(NumCurves);
|
||||
for (int j=-numcurves; j<=numcurves; j++) {
|
||||
curveCB[i]->addItem(CurveReference(CurveReference::CURVE_REF_CUSTOM, j).toString(&model, false), j);
|
||||
}
|
||||
curveCB[i]->setCurrentIndex(model.limitData[i].curve.value+numcurves);
|
||||
connect(curveCB[i], SIGNAL(currentIndexChanged(int)), this, SLOT(curveEdited()));
|
||||
tableLayout->addWidget(i, col++, curveCB[i]);
|
||||
}
|
||||
@@ -298,7 +293,12 @@ void Channels::updateLine(int i)
|
||||
chnMax[i]->setValue(model->limitData[i].max);
|
||||
invCB[i]->setCurrentIndex((model->limitData[i].revert) ? 1 : 0);
|
||||
if (IS_HORUS_OR_TARANIS(firmware->getBoard())) {
|
||||
curveCB[i]->setCurrentIndex(model->limitData[i].curve.value + firmware->getCapability(NumCurves));
|
||||
int numcurves = firmware->getCapability(NumCurves);
|
||||
curveCB[i]->clear();
|
||||
for (int j=-numcurves; j<=numcurves; j++) {
|
||||
curveCB[i]->addItem(CurveReference(CurveReference::CURVE_REF_CUSTOM, j).toString(model, false), j);
|
||||
}
|
||||
curveCB[i]->setCurrentIndex(model->limitData[i].curve.value + numcurves);
|
||||
}
|
||||
if (firmware->getCapability(PPMCenter)) {
|
||||
centerSB[i]->setValue(model->limitData[i].ppmCenter + 1500);
|
||||
|
||||
@@ -384,7 +384,6 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
|
||||
cfn.swtch = RawSwitch(fswtchSwtch[i]->currentData().toInt());
|
||||
cfn.func = func;
|
||||
cfn.enabled = fswtchEnable[i]->isChecked();
|
||||
cfn.adjustMode = (AssignFunc)fswtchGVmode[i]->currentIndex();
|
||||
}
|
||||
|
||||
if (!cfn.isEmpty()) {
|
||||
@@ -418,6 +417,7 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
|
||||
int gvidx = func - FuncAdjustGV1;
|
||||
if (modified)
|
||||
cfn.adjustMode = fswtchGVmode[i]->currentIndex();
|
||||
fswtchGVmode[i]->setCurrentIndex(cfn.adjustMode);
|
||||
widgetsMask |= CUSTOM_FUNCTION_GV_MODE | CUSTOM_FUNCTION_ENABLE;
|
||||
if (cfn.adjustMode==FUNC_ADJUST_GVAR_CONSTANT || cfn.adjustMode==FUNC_ADJUST_GVAR_INCDEC) {
|
||||
if (modified)
|
||||
|
||||
@@ -166,19 +166,20 @@ void TimerPanel::on_name_editingFinished()
|
||||
#define FAILSAFE_CHANNEL_HOLD 2000
|
||||
#define FAILSAFE_CHANNEL_NOPULSE 2001
|
||||
|
||||
#define MASK_PROTOCOL 1
|
||||
#define MASK_CHANNELS_COUNT 2
|
||||
#define MASK_RX_NUMBER 4
|
||||
#define MASK_CHANNELS_RANGE 8
|
||||
#define MASK_PPM_FIELDS 16
|
||||
#define MASK_FAILSAFES 32
|
||||
#define MASK_OPEN_DRAIN 64
|
||||
#define MASK_MULTIMODULE 128
|
||||
#define MASK_ANTENNA 256
|
||||
#define MASK_MULTIOPTION 512
|
||||
#define MASK_R9M 1024
|
||||
#define MASK_SBUSPPM_FIELDS 2048
|
||||
#define MASK_SUBTYPES 4096
|
||||
#define MASK_PROTOCOL (1<<0)
|
||||
#define MASK_CHANNELS_COUNT (1<<1)
|
||||
#define MASK_RX_NUMBER (1<<2)
|
||||
#define MASK_CHANNELS_RANGE (1<<3)
|
||||
#define MASK_PPM_FIELDS (1<<4)
|
||||
#define MASK_FAILSAFES (1<<5)
|
||||
#define MASK_OPEN_DRAIN (1<<6)
|
||||
#define MASK_MULTIMODULE (1<<7)
|
||||
#define MASK_ANTENNA (1<<8)
|
||||
#define MASK_MULTIOPTION (1<<9)
|
||||
#define MASK_R9M (1<<10)
|
||||
#define MASK_SBUSPPM_FIELDS (1<<11)
|
||||
#define MASK_SUBTYPES (1<<12)
|
||||
#define MASK_ACCESS (1<<13)
|
||||
|
||||
quint8 ModulePanel::failsafesValueDisplayType = ModulePanel::FAILSAFE_DISPLAY_PERCENT;
|
||||
|
||||
@@ -214,7 +215,7 @@ ModulePanel::ModulePanel(QWidget * parent, ModelData & model, ModuleData & modul
|
||||
}
|
||||
|
||||
// The protocols available on this board
|
||||
for (int i=0; i<PULSES_PROTOCOL_LAST; i++) {
|
||||
for (unsigned int i=0; i<PULSES_PROTOCOL_LAST; i++) {
|
||||
if (firmware->isAvailable((PulsesProtocol) i, moduleIdx)) {
|
||||
if (IS_TARANIS_XLITE(firmware->getBoard()) && i == PULSES_PXX_R9M) //TODO remove when mini are handled as a different module type
|
||||
ui->protocol->addItem("FrSky R9M Mini", (QVariant) i);
|
||||
@@ -232,6 +233,8 @@ ModulePanel::ModulePanel(QWidget * parent, ModelData & model, ModuleData & modul
|
||||
ui->btnGrpValueType->setId(ui->optUs, FAILSAFE_DISPLAY_USEC);
|
||||
ui->btnGrpValueType->button(failsafesValueDisplayType)->setChecked(true);
|
||||
|
||||
ui->registrationId->setText(model.registrationId);
|
||||
|
||||
setupFailsafes();
|
||||
|
||||
disableMouseScrolling();
|
||||
@@ -244,6 +247,10 @@ ModulePanel::ModulePanel(QWidget * parent, ModelData & model, ModuleData & modul
|
||||
connect(this, &ModulePanel::channelsRangeChanged, this, &ModulePanel::setupFailsafes);
|
||||
connect(ui->btnGrpValueType, static_cast<void(QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), this, &ModulePanel::onFailsafesDisplayValueTypeChanged);
|
||||
|
||||
connect(ui->clearRx1, SIGNAL(clicked()), this, SLOT(onClearAccessRxClicked()));
|
||||
connect(ui->clearRx2, SIGNAL(clicked()), this, SLOT(onClearAccessRxClicked()));
|
||||
connect(ui->clearRx3, SIGNAL(clicked()), this, SLOT(onClearAccessRxClicked()));
|
||||
|
||||
lock = false;
|
||||
|
||||
}
|
||||
@@ -257,8 +264,13 @@ bool ModulePanel::moduleHasFailsafes()
|
||||
{
|
||||
return firmware->getCapability(HasFailsafe) && (
|
||||
(PulsesProtocol)module.protocol == PulsesProtocol::PULSES_ACCESS_ISRM ||
|
||||
(PulsesProtocol)module.protocol == PulsesProtocol::PULSES_ACCST_ISRM_D16 ||
|
||||
(PulsesProtocol)module.protocol == PulsesProtocol::PULSES_PXX_XJT_X16 ||
|
||||
(PulsesProtocol)module.protocol == PulsesProtocol::PULSES_PXX_R9M);
|
||||
(PulsesProtocol)module.protocol == PulsesProtocol::PULSES_PXX_R9M ||
|
||||
(PulsesProtocol)module.protocol == PulsesProtocol::PULSES_ACCESS_R9M ||
|
||||
(PulsesProtocol)module.protocol == PulsesProtocol::PULSES_ACCESS_R9M_LITE ||
|
||||
(PulsesProtocol)module.protocol == PulsesProtocol::PULSES_ACCESS_R9M_LITE_PRO ||
|
||||
(PulsesProtocol)module.protocol == PulsesProtocol::PULSES_XJT_LITE_X16);
|
||||
}
|
||||
|
||||
void ModulePanel::setupFailsafes()
|
||||
@@ -364,18 +376,30 @@ void ModulePanel::update()
|
||||
if (moduleIdx >= 0) {
|
||||
mask |= MASK_PROTOCOL;
|
||||
switch (protocol) {
|
||||
case PULSES_ACCESS_ISRM:
|
||||
mask |= MASK_CHANNELS_RANGE | MASK_CHANNELS_COUNT | MASK_RX_NUMBER;
|
||||
break;
|
||||
case PULSES_PXX_R9M:
|
||||
mask |= MASK_R9M | MASK_SUBTYPES;
|
||||
case PULSES_ACCESS_R9M:
|
||||
case PULSES_ACCESS_R9M_LITE:
|
||||
case PULSES_ACCESS_R9M_LITE_PRO:
|
||||
case PULSES_ACCESS_ISRM:
|
||||
case PULSES_ACCST_ISRM_D16:
|
||||
case PULSES_XJT_LITE_X16:
|
||||
case PULSES_XJT_LITE_D8:
|
||||
case PULSES_XJT_LITE_LR12:
|
||||
case PULSES_PXX_XJT_X16:
|
||||
case PULSES_PXX_XJT_D8:
|
||||
case PULSES_PXX_XJT_LR12:
|
||||
case PULSES_PXX_DJT:
|
||||
mask |= MASK_CHANNELS_RANGE | MASK_CHANNELS_COUNT;
|
||||
if (protocol==PULSES_PXX_XJT_X16 || protocol==PULSES_PXX_XJT_LR12 || protocol==PULSES_PXX_R9M)
|
||||
// ACCST Rx ID
|
||||
if (protocol==PULSES_PXX_XJT_X16 || protocol==PULSES_PXX_XJT_LR12 ||
|
||||
protocol==PULSES_PXX_R9M || protocol==PULSES_ACCST_ISRM_D16 ||
|
||||
protocol==PULSES_XJT_LITE_X16 || protocol==PULSES_XJT_LITE_LR12)
|
||||
mask |= MASK_RX_NUMBER;
|
||||
// ACCESS
|
||||
else if (protocol==PULSES_ACCESS_ISRM || protocol==PULSES_ACCESS_R9M ||
|
||||
protocol==PULSES_ACCESS_R9M_LITE || protocol==PULSES_ACCESS_R9M_LITE_PRO)
|
||||
mask |= MASK_RX_NUMBER | MASK_ACCESS;
|
||||
if ((IS_HORUS(board) || board == Board::BOARD_TARANIS_XLITE) && moduleIdx == 0)
|
||||
mask |= MASK_ANTENNA;
|
||||
break;
|
||||
@@ -492,10 +516,17 @@ void ModulePanel::update()
|
||||
if (mask & MASK_SUBTYPES) {
|
||||
unsigned numEntries = 2; // R9M FCC/EU
|
||||
unsigned i = 0;
|
||||
if (mask & MASK_MULTIMODULE)
|
||||
switch(protocol){
|
||||
case PULSES_MULTIMODULE:
|
||||
numEntries = (module.multi.customProto ? 8 : pdef.numSubTypes());
|
||||
else if (firmware->getCapability(HasModuleR9MFlex))
|
||||
i = 2;
|
||||
break;
|
||||
case PULSES_PXX_R9M:
|
||||
if (firmware->getCapability(HasModuleR9MFlex))
|
||||
i = 2;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
numEntries += i;
|
||||
const QSignalBlocker blocker(ui->multiSubType);
|
||||
ui->multiSubType->clear();
|
||||
@@ -525,6 +556,27 @@ void ModulePanel::update()
|
||||
ui->label_option->setText(qApp->translate("Multiprotocols", qPrintable(pdef.optionsstr)));
|
||||
}
|
||||
|
||||
if (mask & MASK_ACCESS) {
|
||||
ui->rx1->setText(module.access.receiverName[0]);
|
||||
ui->rx2->setText(module.access.receiverName[1]);
|
||||
ui->rx3->setText(module.access.receiverName[2]);
|
||||
}
|
||||
|
||||
ui->registrationIdLabel->setVisible(mask & MASK_ACCESS);
|
||||
ui->registrationId->setVisible(mask & MASK_ACCESS);
|
||||
|
||||
ui->rx1Label->setVisible((mask & MASK_ACCESS) && (module.access.receivers & (1<<0)));
|
||||
ui->clearRx1->setVisible((mask & MASK_ACCESS) && (module.access.receivers & (1<<0)));
|
||||
ui->rx1->setVisible((mask & MASK_ACCESS) && (module.access.receivers & (1<<0)));
|
||||
|
||||
ui->rx2Label->setVisible((mask & MASK_ACCESS) && (module.access.receivers & (1<<1)));
|
||||
ui->clearRx2->setVisible((mask & MASK_ACCESS) && (module.access.receivers & (1<<1)));
|
||||
ui->rx2->setVisible((mask & MASK_ACCESS) && (module.access.receivers & (1<<1)));
|
||||
|
||||
ui->rx3Label->setVisible((mask & MASK_ACCESS) && (module.access.receivers & (1<<2)));
|
||||
ui->clearRx3->setVisible((mask & MASK_ACCESS) && (module.access.receivers & (1<<2)));
|
||||
ui->rx3->setVisible((mask & MASK_ACCESS) && (module.access.receivers & (1<<2)));
|
||||
|
||||
// Failsafes
|
||||
ui->label_failsafeMode->setVisible(mask & MASK_FAILSAFES);
|
||||
ui->failsafeMode->setVisible(mask & MASK_FAILSAFES);
|
||||
@@ -575,7 +627,7 @@ void ModulePanel::on_trainerMode_currentIndexChanged(int index)
|
||||
|
||||
void ModulePanel::onProtocolChanged(int index)
|
||||
{
|
||||
if (!lock && module.protocol != ui->protocol->itemData(index).toInt()) {
|
||||
if (!lock && module.protocol != ui->protocol->itemData(index).toUInt()) {
|
||||
module.protocol = ui->protocol->itemData(index).toInt();
|
||||
update();
|
||||
emit modified();
|
||||
@@ -600,7 +652,7 @@ void ModulePanel::on_antennaMode_currentIndexChanged(int index)
|
||||
|
||||
void ModulePanel::on_r9mPower_currentIndexChanged(int index)
|
||||
{
|
||||
if (!lock && module.pxx.power != index) {
|
||||
if (!lock && module.pxx.power != (unsigned int)index) {
|
||||
module.pxx.power = index;
|
||||
emit modified();
|
||||
}
|
||||
@@ -827,6 +879,30 @@ void ModulePanel::updateFailsafe(int channel)
|
||||
setChannelFailsafeValue(channel, failsafeValue, (FAILSAFE_DISPLAY_PERCENT | FAILSAFE_DISPLAY_USEC));
|
||||
}
|
||||
|
||||
void ModulePanel::onClearAccessRxClicked()
|
||||
{
|
||||
QPushButton *button = qobject_cast<QPushButton *>(sender());
|
||||
|
||||
if (button == ui->clearRx1) {
|
||||
module.access.receivers &= ~(1<<0);
|
||||
ui->rx1->clear();
|
||||
update();
|
||||
emit modified();
|
||||
}
|
||||
else if (button == ui->clearRx2) {
|
||||
module.access.receivers &= ~(1<<1);
|
||||
ui->rx2->clear();
|
||||
update();
|
||||
emit modified();
|
||||
}
|
||||
else if (button == ui->clearRx3) {
|
||||
module.access.receivers &= ~(1<<2);
|
||||
ui->rx3->clear();
|
||||
update();
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
SetupPanel::SetupPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware):
|
||||
@@ -1108,7 +1184,7 @@ void SetupPanel::on_trimIncrement_currentIndexChanged(int index)
|
||||
void SetupPanel::on_throttleSource_currentIndexChanged(int index)
|
||||
{
|
||||
if (!lock) {
|
||||
model->thrTraceSrc = index;
|
||||
model->thrTraceSrc = ui->throttleSource->currentData().toUInt();
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
@@ -1168,14 +1244,20 @@ void SetupPanel::populateThrottleSourceCB()
|
||||
Board::Type board = firmware->getBoard();
|
||||
lock = true;
|
||||
ui->throttleSource->clear();
|
||||
ui->throttleSource->addItem(tr("THR"));
|
||||
for (int i=0; i<getBoardCapability(board, Board::Pots)+getBoardCapability(board, Board::Sliders); i++) {
|
||||
ui->throttleSource->addItem(firmware->getAnalogInputName(4+i), i);
|
||||
ui->throttleSource->addItem(tr("THR"), 0);
|
||||
|
||||
int idx=1;
|
||||
for (int i=0; i<getBoardCapability(board, Board::Pots)+getBoardCapability(board, Board::Sliders); i++, idx++) {
|
||||
if (RawSource(SOURCE_TYPE_STICK,4+i).isAvailable(model,&generalSettings,board)) {
|
||||
ui->throttleSource->addItem(firmware->getAnalogInputName(4+i), idx);
|
||||
}
|
||||
}
|
||||
for (int i=0; i<firmware->getCapability(Outputs); i++) {
|
||||
ui->throttleSource->addItem(RawSource(SOURCE_TYPE_CH, i).toString(model, &generalSettings));
|
||||
for (int i=0; i<firmware->getCapability(Outputs); i++, idx++) {
|
||||
ui->throttleSource->addItem(RawSource(SOURCE_TYPE_CH, i).toString(model, &generalSettings), idx);
|
||||
}
|
||||
ui->throttleSource->setCurrentIndex(model->thrTraceSrc);
|
||||
|
||||
int thrTraceSrcIdx = ui->throttleSource->findData(model->thrTraceSrc);
|
||||
ui->throttleSource->setCurrentIndex(thrTraceSrcIdx);
|
||||
lock = false;
|
||||
}
|
||||
|
||||
@@ -1373,3 +1455,4 @@ void SetupPanel::on_editText_clicked()
|
||||
g->exec();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -95,6 +95,7 @@ class ModulePanel : public ModelPanel
|
||||
void onFailsafesDisplayValueTypeChanged(int type);
|
||||
void updateFailsafe(int channel);
|
||||
void on_optionValue_editingFinished();
|
||||
void onClearAccessRxClicked();
|
||||
|
||||
private:
|
||||
enum FailsafeValueDisplayTypes { FAILSAFE_DISPLAY_PERCENT = 1, FAILSAFE_DISPLAY_USEC = 2 };
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1042</width>
|
||||
<height>297</height>
|
||||
<height>375</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -239,25 +239,136 @@
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="r9mPower"/>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="rx1Label">
|
||||
<property name="text">
|
||||
<string>Receiver 1</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<layout class="QHBoxLayout" name="rx1Layout">
|
||||
<property name="spacing">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="autoBind">
|
||||
<widget class="QLineEdit" name="rx1">
|
||||
<property name="text">
|
||||
<string>Bind on startup</string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="clearButtonEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="lowPower">
|
||||
<widget class="QPushButton" name="clearRx1">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Low Power</string>
|
||||
<string>X</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="rx2Label">
|
||||
<property name="text">
|
||||
<string>Receiver 2</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<layout class="QHBoxLayout" name="rx2Layout">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="rx2">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="clearRx2">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>X</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="rx3Label">
|
||||
<property name="text">
|
||||
<string>Receiver 3</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<layout class="QHBoxLayout" name="rx3Layout">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="rx3">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="clearRx3">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>X</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<widget class="QLabel" name="warning_r9mPower">
|
||||
<property name="palette">
|
||||
<palette>
|
||||
@@ -301,6 +412,37 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="autoBind">
|
||||
<property name="text">
|
||||
<string>Bind on startup</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="lowPower">
|
||||
<property name="text">
|
||||
<string>Low Power</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="9" column="0" colspan="2">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
@@ -535,6 +677,19 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
@@ -577,7 +732,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_multiProtocol">
|
||||
<property name="text">
|
||||
<string>Multi Radio Protocol</string>
|
||||
@@ -587,7 +742,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="multiProtocol">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
@@ -600,14 +755,14 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_multiSubType">
|
||||
<property name="text">
|
||||
<string>Sub Type</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="multiSubType">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
@@ -620,7 +775,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_failsafeMode">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
@@ -636,7 +791,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<item row="5" column="1">
|
||||
<widget class="QComboBox" name="failsafeMode">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
@@ -674,7 +829,7 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_trainerMode">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
@@ -690,7 +845,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<item row="6" column="1">
|
||||
<widget class="QComboBox" name="trainerMode">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
@@ -728,7 +883,7 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QLabel" name="warning_r9mFlex">
|
||||
<property name="palette">
|
||||
<palette>
|
||||
@@ -772,6 +927,39 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="registrationIdLabel">
|
||||
<property name="text">
|
||||
<string>Registration ID</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="registrationId">
|
||||
<property name="inputMask">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3">
|
||||
|
||||
@@ -653,6 +653,9 @@ void TelemetrySensorPanel::update()
|
||||
ui->id->hide();
|
||||
ui->instanceLabel->hide();
|
||||
ui->instance->hide();
|
||||
ui->rxLabel->hide();
|
||||
ui->moduleLabel->hide();
|
||||
ui->rxOrMod->hide();
|
||||
ui->formula->show();
|
||||
ui->formula->setCurrentIndex(sensor.formula);
|
||||
isConfigurable = (sensor.formula < SensorData::TELEM_FORMULA_CELL);
|
||||
@@ -676,6 +679,14 @@ void TelemetrySensorPanel::update()
|
||||
ui->id->show();
|
||||
ui->instanceLabel->show();
|
||||
ui->instance->show();
|
||||
|
||||
bool is_pxx2 = model->moduleData[sensor.moduleIdx].isPxx2Module();
|
||||
ui->rxLabel->setVisible(is_pxx2);
|
||||
ui->moduleLabel->setVisible(!is_pxx2);
|
||||
|
||||
ui->rxOrMod->setText(sensor.getRxOrModName(model));
|
||||
ui->rxOrMod->show();
|
||||
|
||||
ui->formula->hide();
|
||||
isConfigurable = sensor.unit < SensorData::UNIT_FIRST_VIRTUAL;
|
||||
ratioFieldsDisplayed = (sensor.unit < SensorData::UNIT_FIRST_VIRTUAL);
|
||||
@@ -741,14 +752,24 @@ void populateTelemetrySourcesComboBox(AutoComboBox * cb, const ModelData * model
|
||||
cb->clear();
|
||||
if (negative) {
|
||||
for (int i=-CPN_MAX_SENSORS; i<0; ++i) {
|
||||
if (model->sensorData[-i-1].isAvailable())
|
||||
cb->addItem(QString("-%1").arg(model->sensorData[-i-1].label), i);
|
||||
const SensorData& sensor = model->sensorData[-i-1];
|
||||
if (sensor.isAvailable()) {
|
||||
if (sensor.type == SensorData::TELEM_TYPE_CUSTOM)
|
||||
cb->addItem(QString("-%1 (%2)").arg(sensor.label, sensor.getRxOrModName(model)), i);
|
||||
else
|
||||
cb->addItem(QString("-%1").arg(sensor.label), i);
|
||||
}
|
||||
}
|
||||
}
|
||||
cb->addItem("---", 0);
|
||||
for (unsigned i=1; i<=CPN_MAX_SENSORS; ++i) {
|
||||
if (model->sensorData[i-1].isAvailable())
|
||||
cb->addItem(model->sensorData[i-1].label, i);
|
||||
const SensorData& sensor = model->sensorData[i-1];
|
||||
if (sensor.isAvailable()) {
|
||||
if (sensor.type == SensorData::TELEM_TYPE_CUSTOM)
|
||||
cb->addItem(QString("%1 (%2)").arg(sensor.label, sensor.getRxOrModName(model)), i);
|
||||
else
|
||||
cb->addItem(QString("%1").arg(sensor.label), i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1,0,0,0,1,1,1,1,0,0,1,0,1,0,1,1,1,1,1,1,0,1,0,0,1,0,0,1,0,0,0,0,0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1,0,0,0,1,0,0,0,1,1,1,0,0,1,0,1,0,1,1,1,1,1,1,0,1,0,0,1,0,0,1,0,0,0,0,0">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
@@ -28,6 +28,12 @@
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>4</number>
|
||||
</property>
|
||||
@@ -114,6 +120,48 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="rxLabel">
|
||||
<property name="text">
|
||||
<string>Rx</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="moduleLabel">
|
||||
<property name="text">
|
||||
<string>Mod.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="rxOrMod">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="acceptDrops">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="formula">
|
||||
<property name="sizePolicy">
|
||||
|
||||
@@ -90,6 +90,7 @@ SimulatorWidget::SimulatorWidget(QWidget * parent, SimulatorInterface * simulato
|
||||
radioUiWidget = new SimulatedUIWidgetX12(simulator, this);
|
||||
break;
|
||||
case Board::BOARD_X10:
|
||||
case Board::BOARD_X10_EXPRESS:
|
||||
radioUiWidget = new SimulatedUIWidgetX10(simulator, this);
|
||||
break;
|
||||
case Board::BOARD_JUMPER_T12:
|
||||
|
||||
@@ -42,7 +42,7 @@ class RadioSwitchWidget : public RadioWidget
|
||||
init();
|
||||
}
|
||||
|
||||
explicit RadioSwitchWidget(Board::SwitchType type, const QString & labelText, int value = 0, QWidget * parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags()) :
|
||||
explicit RadioSwitchWidget(Board::SwitchType type, const QString & labelText, int value = -1, QWidget * parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags()) :
|
||||
RadioWidget(labelText, value, parent, f),
|
||||
swType(type)
|
||||
{
|
||||
@@ -127,7 +127,7 @@ class RadioSwitchWidget : public RadioWidget
|
||||
|
||||
void resetToggle()
|
||||
{
|
||||
setValue(0);
|
||||
setValue(-1);
|
||||
}
|
||||
|
||||
private slots:
|
||||
|
||||
@@ -43,6 +43,7 @@ bool BinEepromFormat::load(RadioData & radioData)
|
||||
return false;
|
||||
}
|
||||
|
||||
//TODO: show warnings if any
|
||||
return extract(radioData, eeprom);
|
||||
}
|
||||
|
||||
@@ -94,7 +95,7 @@ bool BinEepromFormat::extract(RadioData & radioData, const QByteArray & eeprom)
|
||||
std::bitset<NUM_ERRORS> result((unsigned long long)eepromInterface->load(radioData, (uint8_t *)eeprom.data(), eeprom.size()));
|
||||
if (result.test(ALL_OK)) {
|
||||
if (errors.test(HAS_WARNINGS)) {
|
||||
EEPROMInterface::showEepromWarnings(NULL, CPN_STR_TTL_WARNING, errors.to_ulong());
|
||||
setWarning(EEPROMInterface::getEepromWarnings(errors.to_ulong()));
|
||||
}
|
||||
board = eepromInterface->getBoard();
|
||||
return true;
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
set(GTEST_ROOT /usr CACHE STRING "Base path to Google Test headers and source.")
|
||||
|
||||
find_path(GTEST_INCDIR gtest/gtest.h HINTS "${GTEST_ROOT}/include" DOC "Path to Google Test header files folder ('gtest/gtest.h').")
|
||||
find_path(GTEST_SRCDIR src/gtest-all.cc HINTS "${GTEST_ROOT}" "${GTEST_ROOT}/src/gtest" DOC "Path of Google Test 'src' folder.")
|
||||
|
||||
if(GTEST_INCDIR AND GTEST_SRCDIR AND Qt5Widgets_FOUND)
|
||||
add_library(gtests-companion-lib STATIC EXCLUDE_FROM_ALL ${GTEST_SRCDIR}/src/gtest-all.cc )
|
||||
target_include_directories(gtests-companion-lib PUBLIC ${GTEST_INCDIR} ${GTEST_INCDIR}/gtest ${GTEST_SRCDIR})
|
||||
add_definitions(-DGTESTS)
|
||||
set(TESTS_PATH ${COMPANION_SRC_DIRECTORY}/tests)
|
||||
set(RADIO_TESTS_PATH ${RADIO_SRC_DIRECTORY}/tests)
|
||||
configure_file(${TESTS_PATH}/location.h.in ${CMAKE_CURRENT_BINARY_DIR}/location.h @ONLY)
|
||||
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
if(WIN32)
|
||||
target_include_directories(gtests-companion-lib PUBLIC ${WIN_INCLUDE_DIRS})
|
||||
target_link_libraries(gtests-companion-lib PRIVATE ${WIN_LINK_LIBRARIES})
|
||||
endif(WIN32)
|
||||
|
||||
file(GLOB TEST_SRC_FILES ${TESTS_PATH}/*.cpp)
|
||||
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 ${WARNING_FLAGS}")
|
||||
|
||||
use_cxx11() # ensure gnu++11 in CXX_FLAGS with CMake < 3.1
|
||||
|
||||
add_executable(gtests-companion EXCLUDE_FROM_ALL ${TEST_SRC_FILES} ${CMAKE_CURRENT_SOURCE_DIR}/location.h)
|
||||
add_dependencies(gtests-companion gtests-companion-lib)
|
||||
target_link_libraries(gtests-companion gtests-companion-lib simulation firmwares storage common)
|
||||
message(STATUS "Added optional gtests-companion target")
|
||||
else()
|
||||
message(WARNING "WARNING: gtests target will not be available (check that GTEST_INCDIR, GTEST_SRCDIR, and Qt5Widgets are configured).")
|
||||
endif()
|
||||
@@ -0,0 +1,188 @@
|
||||
#include "gtests.h"
|
||||
#include "location.h"
|
||||
#include "storage/otx.h"
|
||||
#include "storage/storage.h"
|
||||
#include "firmwares/opentx/opentxinterface.h"
|
||||
#include "firmwares/customfunctiondata.h"
|
||||
|
||||
TEST(Conversions, ConversionX9DPFrom22)
|
||||
{
|
||||
RadioData radioData;
|
||||
Storage store = Storage(RADIO_TESTS_PATH "/eeprom_22_x9d+.bin");
|
||||
|
||||
ASSERT_EQ(true, store.load(radioData));
|
||||
|
||||
ASSERT_EQ(true, store.load(radioData));
|
||||
|
||||
const GeneralSettings& settings = radioData.generalSettings;
|
||||
EXPECT_EQ(RawSwitch(SWITCH_TYPE_TELEMETRY,1), settings.customFn[0].swtch);
|
||||
EXPECT_EQ(FuncLogs, settings.customFn[0].func);
|
||||
EXPECT_EQ(20, settings.customFn[0].param);
|
||||
|
||||
EXPECT_STREQ("Tes", settings.switchName[0]);
|
||||
EXPECT_EQ(Board::SWITCH_3POS, settings.switchConfig[0]);
|
||||
|
||||
const ModelData& model = radioData.models[0];
|
||||
EXPECT_STREQ("Test", model.name);
|
||||
EXPECT_EQ(RawSwitch(SWITCH_TYPE_SWITCH,SWITCH_SA0), model.timers[0].mode);
|
||||
EXPECT_EQ(80, model.mixData[0].weight);
|
||||
EXPECT_EQ(900, model.limitData[0].max); // -100
|
||||
EXPECT_EQ(80, model.expoData[0].weight);
|
||||
EXPECT_EQ(HELI_SWASH_TYPE_120X, model.swashRingData.type);
|
||||
EXPECT_EQ(10, model.flightModeData[0].gvars[0]);
|
||||
EXPECT_STREQ("Tes", model.gvarData[0].name);
|
||||
EXPECT_EQ(PULSES_PXX_XJT_X16, model.moduleData[0].protocol);
|
||||
EXPECT_EQ(0, model.moduleData[0].subType);
|
||||
EXPECT_EQ(PULSES_PXX_R9M, model.moduleData[1].protocol);
|
||||
EXPECT_EQ(MODULE_SUBTYPE_R9M_FCC, model.moduleData[1].subType);
|
||||
EXPECT_STREQ("Thr", model.inputNames[0]);
|
||||
EXPECT_STREQ("Tes", model.sensorData[0].label);
|
||||
EXPECT_EQ(10, model.sensorData[0].id);
|
||||
EXPECT_EQ(9, model.sensorData[0].instance);
|
||||
EXPECT_EQ(RawSource(SOURCE_TYPE_TELEMETRY,0).toValue(), model.logicalSw[0].val1);
|
||||
}
|
||||
|
||||
TEST(Conversions, ConversionX7From22)
|
||||
{
|
||||
RadioData radioData;
|
||||
Storage store = Storage(RADIO_TESTS_PATH "/eeprom_22_x7.bin");
|
||||
|
||||
ASSERT_EQ(true, store.load(radioData));
|
||||
|
||||
const GeneralSettings& settings = radioData.generalSettings;
|
||||
EXPECT_EQ(RawSwitch(SWITCH_TYPE_TELEMETRY,1), settings.customFn[0].swtch);
|
||||
EXPECT_EQ(FuncLogs, settings.customFn[0].func);
|
||||
EXPECT_EQ(20, settings.customFn[0].param);
|
||||
|
||||
EXPECT_STREQ("Tes", settings.switchName[0]);
|
||||
EXPECT_EQ(Board::SWITCH_3POS, settings.switchConfig[0]);
|
||||
|
||||
const ModelData& model = radioData.models[0];
|
||||
EXPECT_STREQ("Test", model.name);
|
||||
EXPECT_EQ(PULSES_PXX_R9M, model.moduleData[1].protocol);
|
||||
EXPECT_EQ(MODULE_SUBTYPE_R9M_EU, model.moduleData[1].subType);
|
||||
|
||||
EXPECT_EQ(80, model.mixData[0].weight);
|
||||
EXPECT_EQ(80, model.expoData[0].weight);
|
||||
|
||||
EXPECT_EQ(RawSource(SOURCE_TYPE_PPM,0), model.mixData[4].srcRaw);
|
||||
EXPECT_EQ(RawSwitch(SWITCH_TYPE_TELEMETRY,1), model.mixData[4].swtch);
|
||||
EXPECT_EQ(HELI_SWASH_TYPE_120X, model.swashRingData.type);
|
||||
EXPECT_STREQ("Thr", model.inputNames[0]);
|
||||
|
||||
EXPECT_STREQ("Tes", model.sensorData[0].label);
|
||||
EXPECT_EQ(10, model.sensorData[0].id);
|
||||
EXPECT_EQ(9, model.sensorData[0].instance);
|
||||
EXPECT_EQ(900, model.limitData[0].max); // -100
|
||||
|
||||
EXPECT_EQ(10, model.flightModeData[0].gvars[0]);
|
||||
EXPECT_STREQ("FMtest", model.flightModeData[1].name);
|
||||
EXPECT_EQ(RawSwitch(SWITCH_TYPE_VIRTUAL,1), model.flightModeData[1].swtch);
|
||||
EXPECT_STREQ("Tes", model.gvarData[0].name);
|
||||
|
||||
EXPECT_EQ(LS_FN_VPOS, model.logicalSw[0].func);
|
||||
EXPECT_EQ(RawSource(SOURCE_TYPE_PPM,0).toValue(), model.logicalSw[0].val1);
|
||||
EXPECT_EQ(0, model.logicalSw[0].val2);
|
||||
|
||||
const FrSkyScreenData& screen = model.frsky.screens[0];
|
||||
EXPECT_EQ(TELEMETRY_SCREEN_NUMBERS, screen.type);
|
||||
EXPECT_EQ(RawSource(SOURCE_TYPE_PPM,0), screen.body.lines[0].source[0]);
|
||||
EXPECT_EQ(RawSource(SOURCE_TYPE_SPECIAL,4), screen.body.lines[0].source[1]);
|
||||
}
|
||||
|
||||
|
||||
bool loadFile(QByteArray & filedata, const QString & filename)
|
||||
{
|
||||
QFile file(filename);
|
||||
if (!file.open(QFile::ReadOnly)) {
|
||||
qDebug() << QString("Error opening file %1:\n%2.").arg(filename).arg(file.errorString());
|
||||
return false;
|
||||
}
|
||||
filedata = file.readAll();
|
||||
qDebug() << "File" << filename << "read, size:" << filedata.size();
|
||||
return true;
|
||||
}
|
||||
|
||||
TEST(Conversions, ConversionX10From22)
|
||||
{
|
||||
QByteArray byteBuffer;
|
||||
|
||||
#define USE_OTX
|
||||
|
||||
#if defined(USE_OTX)
|
||||
OtxFormat otx(RADIO_TESTS_PATH "/model_22_x10.otx");
|
||||
RadioData radio;
|
||||
EXPECT_EQ(true, otx.load(radio));
|
||||
|
||||
const GeneralSettings& settings = radio.generalSettings;
|
||||
const ModelData& model = radio.models[0];
|
||||
#else
|
||||
ASSERT_EQ(true, loadFile(byteBuffer, RADIO_TESTS_PATH "/model_22_x10/RADIO/radio.bin"));
|
||||
|
||||
GeneralSettings settings;
|
||||
EXPECT_NE(nullptr, loadRadioSettingsFromByteArray(settings, byteBuffer));
|
||||
#endif
|
||||
|
||||
EXPECT_EQ(100, settings.calibSpanNeg[9]);
|
||||
EXPECT_EQ(500, settings.calibMid[9]);
|
||||
EXPECT_EQ(900, settings.calibSpanPos[9]);
|
||||
|
||||
EXPECT_EQ(200, settings.calibSpanNeg[10]);
|
||||
EXPECT_EQ(400, settings.calibMid[10]);
|
||||
EXPECT_EQ(600, settings.calibSpanPos[10]);
|
||||
|
||||
EXPECT_EQ(-23, settings.vBatMin);
|
||||
EXPECT_EQ(20, settings.speakerVolume);
|
||||
EXPECT_STREQ("en", settings.ttsLanguage);
|
||||
EXPECT_STREQ("model1.bin", settings.currModelFilename);
|
||||
|
||||
EXPECT_EQ(RawSwitch(SWITCH_TYPE_TELEMETRY,1), settings.customFn[0].swtch);
|
||||
EXPECT_EQ(FuncLogs, settings.customFn[0].func);
|
||||
EXPECT_EQ(20, settings.customFn[0].param);
|
||||
|
||||
EXPECT_EQ(RawSwitch(SWITCH_TYPE_ON), settings.customFn[1].swtch);
|
||||
EXPECT_EQ(FuncVolume, settings.customFn[1].func);
|
||||
EXPECT_EQ(RawSource(SOURCE_TYPE_STICK,4+5+1).toValue(), settings.customFn[1].param); // RS
|
||||
|
||||
EXPECT_STREQ("Tes", settings.switchName[0]);
|
||||
EXPECT_EQ(Board::SWITCH_3POS, settings.switchConfig[0]);
|
||||
|
||||
EXPECT_STREQ("BT_X10", settings.bluetoothName);
|
||||
EXPECT_STREQ("Default", settings.themeName);
|
||||
|
||||
#if !defined(USE_OTX)
|
||||
byteBuffer.clear();
|
||||
ASSERT_EQ(true, loadFile(byteBuffer, RADIO_TESTS_PATH "/model_22_x10/MODELS/model1.bin"));
|
||||
|
||||
ModelData model;
|
||||
ASSERT_NE(nullptr, loadModelFromByteArray(model, byteBuffer));
|
||||
#endif
|
||||
|
||||
EXPECT_STREQ("Test", model.name);
|
||||
EXPECT_EQ(0, model.noGlobalFunctions);
|
||||
EXPECT_EQ(0, model.beepANACenter);
|
||||
EXPECT_EQ(80, model.mixData[0].weight);
|
||||
EXPECT_EQ(RawSource(SOURCE_TYPE_MAX), model.mixData[2].srcRaw); // MAX
|
||||
EXPECT_EQ(RawSource(SOURCE_TYPE_STICK,4+5), model.mixData[3].srcRaw); // LS
|
||||
EXPECT_EQ(RawSource(SOURCE_TYPE_PPM,0), model.mixData[5].srcRaw);
|
||||
EXPECT_EQ(RawSwitch(SWITCH_TYPE_TELEMETRY,1), model.mixData[5].swtch);
|
||||
EXPECT_EQ(900, model.limitData[0].max); // -100
|
||||
EXPECT_EQ(80, model.expoData[0].weight);
|
||||
EXPECT_EQ(LS_FN_VPOS, model.logicalSw[0].func);
|
||||
EXPECT_EQ(RawSource(SOURCE_TYPE_PPM,0).toValue(), model.logicalSw[0].val1); // TR1
|
||||
EXPECT_EQ(0, model.logicalSw[0].val2);
|
||||
EXPECT_EQ(RawSource(SOURCE_TYPE_TELEMETRY,19*3).toValue(), model.logicalSw[1].val1); // TELE:20
|
||||
EXPECT_EQ(20, model.logicalSw[1].val2);
|
||||
EXPECT_EQ(RawSwitch(SWITCH_TYPE_VIRTUAL,1).toValue(), model.logicalSw[1].andsw);
|
||||
EXPECT_EQ(HELI_SWASH_TYPE_120X, model.swashRingData.type);
|
||||
EXPECT_STREQ("Tes", model.flightModeData[0].name);
|
||||
EXPECT_EQ(10, model.flightModeData[0].gvars[0]);
|
||||
EXPECT_STREQ("Tes", model.gvarData[0].name);
|
||||
EXPECT_EQ(PULSES_PXX_R9M, model.moduleData[1].protocol);
|
||||
EXPECT_EQ(MODULE_SUBTYPE_R9M_EU, model.moduleData[1].subType);
|
||||
EXPECT_STREQ("Rud", model.inputNames[0]);
|
||||
EXPECT_STREQ("Tes", model.sensorData[0].label);
|
||||
EXPECT_EQ(10, model.sensorData[0].id);
|
||||
EXPECT_EQ(9, model.sensorData[0].instance);
|
||||
EXPECT_EQ(5 + 2 + 3, model.thrTraceSrc); // CH3
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
/*
|
||||
* 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 <QApplication>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <memory>
|
||||
#include "gtests.h"
|
||||
|
||||
#include "storage.h"
|
||||
#include "opentxinterface.h"
|
||||
#include "customdebug.h"
|
||||
|
||||
|
||||
using ::testing::TestEventListener;
|
||||
using ::testing::EmptyTestEventListener;
|
||||
using ::testing::Test;
|
||||
using ::testing::TestCase;
|
||||
using ::testing::TestEventListeners;
|
||||
using ::testing::TestInfo;
|
||||
using ::testing::TestPartResult;
|
||||
using ::testing::UnitTest;
|
||||
using ::testing::InitGoogleTest;
|
||||
|
||||
namespace {
|
||||
|
||||
void printColorCode(int color)
|
||||
{
|
||||
#if !GTEST_OS_WINDOWS
|
||||
if (isatty(fileno(stdout)))
|
||||
fprintf(stdout, "\033[0;%dm", color);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces gtest's PrettyUnitTestResultPrinter with something less verbose.
|
||||
* Uses the default printer if/when the messages might be interesting,
|
||||
* e.g. for full error info or tests summary.
|
||||
*/
|
||||
class TersePrinter : public EmptyTestEventListener {
|
||||
public:
|
||||
explicit TersePrinter(TestEventListener * prettyPrinter)
|
||||
: prettyPrinter(prettyPrinter), currentTestInfo(NULL)
|
||||
{
|
||||
}
|
||||
void OnTestProgramStart(const UnitTest & unit_test)
|
||||
{
|
||||
prettyPrinter->OnTestProgramStart(unit_test);
|
||||
}
|
||||
void OnTestIterationStart(const UnitTest & unit_test, int iteration)
|
||||
{
|
||||
printColorCode(36);
|
||||
fprintf(stdout, "############ ");
|
||||
fprintf(stdout, "Running %d test(s) from %d test case(s), iteration: %d.\n", unit_test.test_to_run_count(), unit_test.test_case_to_run_count(), iteration + 1);
|
||||
printColorCode(0);
|
||||
fflush(stdout);
|
||||
}
|
||||
void OnTestCaseStart(const TestCase & test_case)
|
||||
{
|
||||
prettyPrinter->OnTestCaseStart(test_case);
|
||||
}
|
||||
void OnTestStart(const TestInfo & test_info)
|
||||
{
|
||||
currentTestInfo = &test_info;
|
||||
}
|
||||
void OnTestPartResult(const TestPartResult & test_part_result)
|
||||
{
|
||||
if (test_part_result.failed()) {
|
||||
prettyPrinter->OnTestStart(*currentTestInfo);
|
||||
prettyPrinter->OnTestPartResult(test_part_result);
|
||||
}
|
||||
}
|
||||
void OnTestEnd(const TestInfo & test_info)
|
||||
{
|
||||
currentTestInfo = NULL;
|
||||
if (test_info.result()->Failed()) {
|
||||
prettyPrinter->OnTestEnd(test_info);
|
||||
}
|
||||
else {
|
||||
printColorCode(32);
|
||||
fprintf(stdout, "+");
|
||||
printColorCode(0);
|
||||
fflush(stdout);
|
||||
}
|
||||
}
|
||||
void OnTestCaseEnd(const TestCase & test_case)
|
||||
{
|
||||
fprintf(stdout, "\n");
|
||||
fflush(stdout);
|
||||
}
|
||||
void OnTestIterationEnd(const UnitTest & unit_test, int iteration)
|
||||
{
|
||||
prettyPrinter->OnTestIterationEnd(unit_test, iteration);
|
||||
}
|
||||
void OnTestProgramEnd(const UnitTest & unit_test)
|
||||
{
|
||||
prettyPrinter->OnTestProgramEnd(unit_test);
|
||||
}
|
||||
|
||||
private:
|
||||
// gtest's default unit test result printer.
|
||||
std::unique_ptr<TestEventListener> prettyPrinter;
|
||||
// The currently running TestInfo, if any.
|
||||
const TestInfo * currentTestInfo;
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QCoreApplication app(argc, argv);
|
||||
|
||||
CustomDebug::setFilterRules();
|
||||
registerStorageFactories();
|
||||
registerOpenTxFirmwares();
|
||||
|
||||
InitGoogleTest(&argc, argv);
|
||||
|
||||
// use --verbose option to revert to gtest's default output format
|
||||
bool verbose = false;
|
||||
if (argc > 1 && !strcmp(argv[1], "--verbose"))
|
||||
verbose = true;
|
||||
|
||||
if (!verbose) {
|
||||
TestEventListeners & listeners = UnitTest::GetInstance()->listeners();
|
||||
TestEventListener * defaultPrinter = listeners.Release(listeners.default_result_printer());
|
||||
listeners.Append(new TersePrinter(defaultPrinter));
|
||||
}
|
||||
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _GTESTS_H_
|
||||
#define _GTESTS_H_
|
||||
|
||||
#include <QtCore/QString>
|
||||
#include <math.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
class OpenTxTest : public testing::Test
|
||||
{
|
||||
protected: // You should make the members protected s.t. they can be
|
||||
// accessed from sub-classes.
|
||||
|
||||
// virtual void SetUp() will be called before each test is run. You
|
||||
// should define it if you need to initialize the varaibles.
|
||||
// Otherwise, this can be skipped.
|
||||
virtual void SetUp()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
#endif // _GTESTS_H_
|
||||
@@ -0,0 +1,2 @@
|
||||
#define TESTS_PATH "@TESTS_PATH@"
|
||||
#define RADIO_TESTS_PATH "@RADIO_TESTS_PATH@"
|
||||
Reference in New Issue
Block a user