Introduce T-pro and function switches handling

This commit is contained in:
3djc
2021-12-17 17:07:48 +01:00
committed by Raphael Coeffic
parent 69dafd13c0
commit d31482c18b
63 changed files with 1324 additions and 70 deletions
+2
View File
@@ -323,6 +323,8 @@ elseif(PCB STREQUAL X7 AND PCBREV STREQUAL T12)
set(FLAVOUR t12)
elseif(PCB STREQUAL X7 AND PCBREV STREQUAL TLITE)
set(FLAVOUR tlite)
elseif(PCB STREQUAL X7 AND PCBREV STREQUAL TPRO)
set(FLAVOUR tpro)
elseif(PCB STREQUAL X7 AND PCBREV STREQUAL TX12)
set(FLAVOUR tx12)
elseif(PCB STREQUAL X7 AND PCBREV STREQUAL ZORRO)
+4
View File
@@ -188,6 +188,10 @@
<file>images/simulator/JumperTLITE/right_top.png</file>
<file>images/simulator/JumperTLITE/right_bottom.png</file>
<file>images/simulator/JumperTLITE/top.png</file>
<file>images/simulator/JumperTPRO/bottom.png</file>
<file>images/simulator/JumperTPRO/left.png</file>
<file>images/simulator/JumperTPRO/right.png</file>
<file>images/simulator/JumperTPRO/top.png</file>
<file>images/simulator/TX12/left.png</file>
<file>images/simulator/TX12/left-pageup.png</file>
<file>images/simulator/TX12/left-pagedn.png</file>
+1
View File
@@ -43,6 +43,7 @@
#define CPN_MAX_POTS (CPN_MAX_KNOBS + CPN_MAX_SLIDERS)
#define CPN_MAX_CYC 3
#define CPN_MAX_SWITCHES 32
#define CPN_MAX_FUNCTION_SWITCHES 6
#define CPN_MAX_MOUSE_ANALOGS 2
#define CPN_MAX_GYRO_ANALOGS 2
#define CPN_MAX_ANALOGS (CPN_MAX_STICKS + CPN_MAX_POTS + CPN_MAX_MOUSE_ANALOGS + CPN_MAX_GYRO_ANALOGS)
+13 -4
View File
@@ -82,6 +82,8 @@ uint32_t Boards::getFourCC(Type board)
return 0x3D78746F;
case BOARD_JUMPER_TLITE:
return 0x4278746F;
case BOARD_JUMPER_TPRO:
return 0x4678746F;
case BOARD_JUMPER_T16:
return 0x3F78746F;
case BOARD_JUMPER_T18:
@@ -121,6 +123,7 @@ int Boards::getEEpromSize(Board::Type board)
case BOARD_TARANIS_X9E:
case BOARD_JUMPER_T12:
case BOARD_JUMPER_TLITE:
case BOARD_JUMPER_TPRO:
case BOARD_RADIOMASTER_TX12:
case BOARD_RADIOMASTER_T8:
case BOARD_RADIOMASTER_ZORRO:
@@ -160,6 +163,7 @@ int Boards::getFlashSize(Type board)
case BOARD_TARANIS_X9E:
case BOARD_JUMPER_T12:
case BOARD_JUMPER_TLITE:
case BOARD_JUMPER_TPRO:
case BOARD_RADIOMASTER_TX12:
case BOARD_RADIOMASTER_ZORRO:
case BOARD_RADIOMASTER_T8:
@@ -196,7 +200,7 @@ SwitchInfo Boards::getSwitchInfo(Board::Type board, int index)
if (index < DIM(switches))
return switches[index];
}
else if (IS_TARANIS_XLITE(board) || IS_JUMPER_TLITE(board)) {
else if (IS_TARANIS_XLITE(board) || IS_JUMPER_TLITE(board) || IS_JUMPER_TPRO(board)) {
const Board::SwitchInfo switches[] = {
{SWITCH_3POS, "SA"},
{SWITCH_3POS, "SB"},
@@ -365,7 +369,7 @@ int Boards::getCapability(Board::Type board, Board::Capability capability)
return 1;
else if (IS_JUMPER_TLITE(board))
return 0;
else if (IS_TARANIS_SMALL(board))
else if (IS_TARANIS_SMALL(board) || IS_JUMPER_TPRO(board))
return 2;
else if (IS_TARANIS_X9E(board))
return 4;
@@ -427,7 +431,7 @@ int Boards::getCapability(Board::Type board, Board::Capability capability)
return 7;
else if (board == BOARD_TARANIS_X7)
return 8;
else if (board == BOARD_JUMPER_TLITE)
else if (board == BOARD_JUMPER_TLITE || board == BOARD_JUMPER_TPRO)
return 4;
else if (board == BOARD_FLYSKY_NV14)
return 8;
@@ -447,7 +451,7 @@ int Boards::getCapability(Board::Type board, Board::Capability capability)
case FactoryInstalledSwitches:
if (IS_TARANIS_X9E(board))
return 8;
else if (IS_JUMPER_TLITE(board))
else if (IS_JUMPER_TLITE(board) || IS_JUMPER_TPRO(board))
return 4;
else if(IS_RADIOMASTER_ZORRO(board))
return 8;
@@ -479,6 +483,9 @@ int Boards::getCapability(Board::Type board, Board::Capability capability)
case HasColorLcd:
return IS_FAMILY_HORUS_OR_T16(board);
case NumFunctionSwitches:
return IS_JUMPER_TPRO(board) ? 6 : 0;
default:
return 0;
}
@@ -645,6 +652,8 @@ QString Boards::getBoardName(Board::Type board)
return "Jumper T12";
case BOARD_JUMPER_TLITE:
return "Jumper T-Lite";
case BOARD_JUMPER_TPRO:
return "Jumper T-Pro";
case BOARD_JUMPER_T16:
return "Jumper T16";
case BOARD_JUMPER_T18:
+9 -2
View File
@@ -63,6 +63,7 @@ namespace Board {
BOARD_JUMPER_TLITE,
BOARD_FLYSKY_NV14,
BOARD_RADIOMASTER_ZORRO,
BOARD_JUMPER_TPRO,
BOARD_TYPE_COUNT,
BOARD_TYPE_MAX = BOARD_TYPE_COUNT - 1
};
@@ -143,7 +144,8 @@ namespace Board {
NumTrims,
NumTrimSwitches,
HasRTC,
HasColorLcd
HasColorLcd,
NumFunctionSwitches
};
struct SwitchInfo
@@ -237,6 +239,11 @@ inline bool IS_JUMPER_TLITE(Board::Type board)
return board == Board::BOARD_JUMPER_TLITE;
}
inline bool IS_JUMPER_TPRO(Board::Type board)
{
return board == Board::BOARD_JUMPER_TPRO;
}
inline bool IS_JUMPER_T16(Board::Type board)
{
return board == Board::BOARD_JUMPER_T16;
@@ -335,7 +342,7 @@ inline bool IS_TARANIS_X9E(Board::Type board)
inline bool IS_TARANIS_SMALL(Board::Type board)
{
return IS_TARANIS_X7(board) || IS_TARANIS_XLITE(board) || IS_TARANIS_X9LITE(board) || IS_FAMILY_T12(board);
return IS_TARANIS_X7(board) || IS_TARANIS_XLITE(board) || IS_TARANIS_X9LITE(board) || IS_FAMILY_T12(board) || IS_JUMPER_TPRO(board);
}
inline bool IS_TARANIS(Board::Type board)
+1 -1
View File
@@ -568,7 +568,7 @@ class TransformedField: public DataField {
virtual void afterImport() = 0;
int dump(int level, int offset) override
int dump(int level=0, int offset=0) override
{
beforeExport();
return field.dump(level, offset);
+2 -1
View File
@@ -162,7 +162,8 @@ enum Capability {
HasAntennaChoice,
HasADCJitterFilter,
HasTelemetryBaudrate,
TopBarZones
TopBarZones,
FunctionSwitches
};
class EEPROMInterface
+12
View File
@@ -212,6 +212,17 @@ void ModelData::setDefaultMixes(const GeneralSettings & settings)
}
}
void ModelData::setDefaultFunctionSwitches(int functionSwitchCount)
{
if (functionSwitchCount == 0)
return;
for (int i = 0; i < functionSwitchCount; i++) {
functionSwitchConfig |= (Board::SWITCH_2POS << 2 * i);
functionSwitchGroup |= (1 << 2 * i);
}
}
void ModelData::setDefaultValues(unsigned int id, const GeneralSettings & settings)
{
clear();
@@ -221,6 +232,7 @@ void ModelData::setDefaultValues(unsigned int id, const GeneralSettings & settin
moduleData[i].modelId = id + 1;
}
setDefaultMixes(settings);
setDefaultFunctionSwitches(getCurrentFirmware()->getCapability(FunctionSwitches));
}
int ModelData::getTrimValue(int phaseIdx, int trimIdx)
+9
View File
@@ -145,6 +145,7 @@ class ModelData {
bool potsWarnEnabled[CPN_MAX_POTS];
int potsWarnPosition[CPN_MAX_POTS];
bool displayChecklist;
GVarData gvarData[CPN_MAX_GVARS];
MavlinkData mavlink;
unsigned int telemetryProtocol;
@@ -170,10 +171,18 @@ class ModelData {
char registrationId[8+1];
// Function switches
unsigned int functionSwitchConfig;
unsigned int functionSwitchGroup;
unsigned int functionSwitchStartConfig;
unsigned int functionSwitchLogicalState;
char functionSwitchNames[CPN_MAX_FUNCTION_SWITCHES][HARDWARE_NAME_LEN + 1];
void clear();
bool isEmpty() const;
void setDefaultInputs(const GeneralSettings & settings);
void setDefaultMixes(const GeneralSettings & settings);
void setDefaultFunctionSwitches(int functionSwitchCount);
void setDefaultValues(unsigned int id, const GeneralSettings & settings);
int getTrimValue(int phaseIdx, int trimIdx);
@@ -51,6 +51,9 @@ inline int MAX_SWITCHES(Board::Type board, int version)
if (IS_TARANIS_X7(board))
return 8;
if (IS_JUMPER_TPRO(board))
return 10;
return Boards::getCapability(board, Board::Switches);
}
@@ -81,6 +84,13 @@ inline int MAX_POTS(Board::Type board, int version)
return Boards::getCapability(board, Board::Pots);
}
inline int MAX_FUNCTION_SWITCHES(Board::Type board, int version)
{
if (IS_JUMPER_TPRO(board))
return 6;
return 0;
}
inline int MAX_POTS_STORAGE(Board::Type board, int version)
{
if (version <= 218 && IS_FAMILY_HORUS_OR_T16(board))
@@ -2630,17 +2640,17 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, Board::Type board, unsig
internalField.Append(new LimitField(this, modelData.limitData[i], board, version));
for (int i=0; i<MAX_EXPOS(board, version); i++)
internalField.Append(new InputField(this, modelData.expoData[i], board, version));
internalField.Append(new CurvesField(this, modelData.curves, board, version));
for (int i=0; i<MAX_LOGICAL_SWITCHES(board, version); i++)
internalField.Append(new LogicalSwitchField(this, modelData.logicalSw[i], board, version, variant, &modelData));
for (int i=0; i<MAX_CUSTOM_FUNCTIONS(board, version); i++) {
for (int i=0; i<MAX_CUSTOM_FUNCTIONS(board, version); i++)
internalField.Append(new ArmCustomFunctionField(this, modelData.customFn[i], board, version, variant));
}
internalField.Append(new HeliField(this, modelData.swashRingData, board, version, variant));
for (int i=0; i<MAX_FLIGHT_MODES(board, version); i++) {
internalField.Append(new HeliField(this, modelData.swashRingData, board, version, variant)); // SwashRingData
for (int i=0; i<MAX_FLIGHT_MODES(board, version); i++)
internalField.Append(new FlightModeField(this, modelData.flightModeData[i], i, board, version));
}
internalField.Append(new UnsignedField<8>(this, modelData.thrTraceSrc, "Throttle Source"));
@@ -2836,6 +2846,16 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, Board::Type board, unsig
else if (version >= 219) {
internalField.Append(new ZCharField<8>(this, modelData.registrationId, "ACCESS Registration ID"));
}
if (IS_JUMPER_TPRO(board)) {
internalField.Append(new UnsignedField<16>(this, modelData.functionSwitchConfig));
internalField.Append(new UnsignedField<16>(this, modelData.functionSwitchGroup));
internalField.Append(new UnsignedField<16>(this, modelData.functionSwitchStartConfig));
internalField.Append(new UnsignedField<8>(this, modelData.functionSwitchLogicalState));
for (int i=0; i < MAX_FUNCTION_SWITCHES(board, version); ++i) {
internalField.Append(new ZCharField<3>(this, modelData.functionSwitchNames[i], "Function switch name"));
}
}
}
void OpenTxModelData::beforeExport()
@@ -40,6 +40,7 @@
#define JUMPER_TLITE_VARIANT 0x4003
#define RADIOMASTER_T8_VARIANT 0x4004
#define RADIOMASTER_ZORRO_VARIANT 0x4006
#define JUMPER_TPRO_VARIANT 0x4005
class OpenTxGeneralData: public TransformedField {
public:
@@ -62,6 +62,8 @@ const char * OpenTxEepromInterface::getName()
return "OpenTX for Jumper T12";
case BOARD_JUMPER_TLITE:
return "OpenTX for Jumper T-Lite";
case BOARD_JUMPER_TPRO:
return "OpenTX for Jumper T-Pro";
case BOARD_JUMPER_T16:
return "OpenTX for Jumper T16";
case BOARD_JUMPER_T18:
@@ -347,6 +349,9 @@ int OpenTxEepromInterface::save(uint8_t * eeprom, const RadioData & radioData, u
else if (IS_JUMPER_TLITE(board)) {
variant |= JUMPER_TLITE_VARIANT;
}
else if (IS_JUMPER_TPRO(board)) {
variant |= JUMPER_TPRO_VARIANT;
}
else if (IS_RADIOMASTER_TX12(board)) {
variant |= RADIOMASTER_TX12_VARIANT;
}
@@ -752,6 +757,9 @@ int OpenTxFirmware::getCapability(::Capability capability)
return IS_HORUS_OR_TARANIS(board) ? true : false;
case TopBarZones:
return getCapability(LcdWidth) > getCapability(LcdHeight) ? 4 : 2;
case FunctionSwitches:
return IS_JUMPER_TPRO(board) ? 6 : 0;
default:
return 0;
}
@@ -1025,6 +1033,11 @@ bool OpenTxEepromInterface::checkVariant(unsigned int version, unsigned int vari
variantError = true;
}
}
else if (IS_JUMPER_TPRO(board)) {
if (variant != JUMPER_TPRO_VARIANT) {
variantError = true;
}
}
else if (IS_RADIOMASTER_TX12(board)) {
if (variant != RADIOMASTER_TX12_VARIANT) {
variantError = true;
@@ -1371,6 +1384,16 @@ void registerOpenTxFirmwares()
registerOpenTxFirmware(firmware);
addOpenTxRfOptions(firmware, FLEX);
/* Jumper T-Pro board */
firmware = new OpenTxFirmware("opentx-tpro", QCoreApplication::translate("Firmware", "Jumper T-Pro"), BOARD_JUMPER_TPRO);
addOpenTxCommonOptions(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"));
addOpenTxFontOptions(firmware);
registerOpenTxFirmware(firmware);
addOpenTxRfOptions(firmware, FLEX);
/* Jumper T16 board */
firmware = new OpenTxFirmware("opentx-t16", Firmware::tr("Jumper T16 / T16+ / T16 Pro"), BOARD_JUMPER_T16);
addOpenTxFrskyOptions(firmware);
Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

+1
View File
@@ -45,6 +45,7 @@ set(modeledit_HDRS
set(modeledit_UIS
setup_timer.ui
setup_module.ui
setup_function_switches.ui
flightmode.ui
telemetry_customscreen.ui
telemetry_sensor.ui
+170
View File
@@ -22,6 +22,7 @@
#include "ui_setup.h"
#include "ui_setup_timer.h"
#include "ui_setup_module.h"
#include "ui_setup_function_switches.h"
#include "appdata.h"
#include "modelprinter.h"
#include "multiprotocols.h"
@@ -982,6 +983,170 @@ void ModulePanel::onClearAccessRxClicked()
}
}
/******************************************************************************/
FunctionSwitchesPanel::FunctionSwitchesPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware):
ModelPanel(parent, model, generalSettings, firmware),
ui(new Ui::FunctionSwitches)
{
ui->setupUi(this);
lock = true;
QRegExp rx(CHAR_FOR_NAMES_REGEX);
switchcnt = Boards::getCapability(firmware->getBoard(), Board::NumFunctionSwitches);
for (int i = 0; i < switchcnt; i++) {
QLabel * lblSwitchId = new QLabel(this);
lblSwitchId->setText(tr("SW%1").arg(i + 1));
AutoLineEdit * aleName = new AutoLineEdit(this);
aleName->setProperty("index", i);
aleName->setValidator(new QRegExpValidator(rx, this));
aleName->setField((char *)model.functionSwitchNames[i], 3);
// TODO itemmodel
QComboBox * cboConfig = new QComboBox(this);
cboConfig->setProperty("index", i);
cboConfig->addItem(tr("NONE"));
cboConfig->addItem(tr("TOGGLE"));
cboConfig->addItem(tr("2POS"));
// TODO itemmodel
QComboBox * cboStartPosn = new QComboBox(this);
cboStartPosn->setProperty("index", i);
cboStartPosn->addItem(CPN_STR_SW_INDICATOR_UP);
cboStartPosn->addItem(CPN_STR_SW_INDICATOR_DN);
cboStartPosn->addItem("=");
QSpinBox * sbGroup = new QSpinBox(this);
sbGroup->setProperty("index", i);
sbGroup->setMaximum(3);
int row = 0;
int coloffset = 1;
ui->gridSwitches->addWidget(lblSwitchId, row++, i + coloffset);
ui->gridSwitches->addWidget(aleName, row++, i + coloffset);
ui->gridSwitches->addWidget(cboConfig, row++, i + coloffset);
ui->gridSwitches->addWidget(cboStartPosn, row++, i + coloffset);
ui->gridSwitches->addWidget(sbGroup, row++, i + coloffset);
connect(cboConfig, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &FunctionSwitchesPanel::on_configCurrentIndexChanged);
connect(cboStartPosn, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &FunctionSwitchesPanel::on_startPosnCurrentIndexChanged);
connect(sbGroup, QOverload<int>::of(&QSpinBox::valueChanged), this, &FunctionSwitchesPanel::on_groupChanged);
aleNames << aleName;
cboConfigs << cboConfig;
cboStartupPosns << cboStartPosn;
sbGroups << sbGroup;
}
update();
lock = false;
}
FunctionSwitchesPanel::~FunctionSwitchesPanel()
{
delete ui;
}
void FunctionSwitchesPanel::update()
{
for (int i = 0; i < switchcnt; i++) {
update(i);
}
}
void FunctionSwitchesPanel::update(int index)
{
lock = true;
for (int i = 0; i < switchcnt; i++) {
aleNames[i]->update();
cboConfigs[i]->setCurrentIndex((model->functionSwitchConfig >> (2 * i)) & 0x03);
cboStartupPosns[i]->setCurrentIndex((model->functionSwitchStartConfig >> (2 * i)) & 0x03);
sbGroups[i]->setValue((model->functionSwitchGroup >> (2 * i)) & 0x03);
if (cboConfigs[i]->currentIndex() < 2)
cboStartupPosns[i]->setEnabled(false);
else
cboStartupPosns[i]->setEnabled(true);
if (cboConfigs[i]->currentIndex() < 1)
sbGroups[i]->setEnabled(false);
else
sbGroups[i]->setEnabled(true);
}
lock = false;
}
void FunctionSwitchesPanel::on_configCurrentIndexChanged(int index)
{
if (!sender())
return;
QComboBox * cb = qobject_cast<QComboBox *>(sender());
if (cb && !lock) {
lock = true;
bool ok = false;
int i = sender()->property("index").toInt(&ok);
if (ok && ((model->functionSwitchConfig >> (2 * i)) & 0x03) != (unsigned int)index) {
unsigned int mask = ((unsigned int) 0x03 << (2 * i));
model->functionSwitchConfig = (model->functionSwitchConfig & ~ mask) | ((unsigned int) index << (2 * i));
if (index < 2)
model->functionSwitchStartConfig = (model->functionSwitchStartConfig & ~ mask) | ((unsigned int) 0 << (2 * i));
if (index < 1)
model->functionSwitchGroup = (model->functionSwitchGroup & ~ mask) | ((unsigned int) 0 << (2 * i));
update(i);
emit modified();
}
lock = false;
}
}
void FunctionSwitchesPanel::on_startPosnCurrentIndexChanged(int index)
{
if (!sender())
return;
QComboBox * cb = qobject_cast<QComboBox *>(sender());
if (cb && !lock) {
lock = true;
bool ok = false;
int i = sender()->property("index").toInt(&ok);
if (ok && ((model->functionSwitchStartConfig >> (2 * i)) & 0x03) != (unsigned int)index) {
unsigned int mask = ((unsigned int) 0x03 << (2 * i));
model->functionSwitchStartConfig = (model->functionSwitchStartConfig & ~ mask) | ((unsigned int) index << (2 * i));
emit modified();
}
lock = false;
}
}
void FunctionSwitchesPanel::on_groupChanged(int value)
{
if (!sender())
return;
QSpinBox * sb = qobject_cast<QSpinBox *>(sender());
if (sb && !lock) {
lock = true;
bool ok = false;
int i = sender()->property("index").toInt(&ok);
if (ok && ((model->functionSwitchGroup >> (2 * i)) & 0x03) != (unsigned int)value) {
unsigned int mask = ((unsigned int) 0x03 << (2 * i));
model->functionSwitchGroup = (model->functionSwitchGroup & ~ mask) | ((unsigned int) value << (2 * i));
emit modified();
}
lock = false;
}
}
/******************************************************************************/
SetupPanel::SetupPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware,
@@ -1221,6 +1386,11 @@ SetupPanel::SetupPanel(QWidget * parent, ModelData & model, GeneralSettings & ge
ui->trimsDisplay->setField(model.trimsDisplay, this);
if (Boards::getCapability(firmware->getBoard(), Board::NumFunctionSwitches) > 0)
ui->functionSwitchesLayout->addWidget(new FunctionSwitchesPanel(this, model, generalSettings, firmware));
//else
// ui->functionSwitchesLayout->hide();
for (int i = firmware->getCapability(NumFirstUsableModule); i < firmware->getCapability(NumModules); i++) {
modules[i] = new ModulePanel(this, model, model.moduleData[i], generalSettings, firmware, i);
ui->modulesLayout->addWidget(modules[i]);
+28
View File
@@ -31,8 +31,11 @@ namespace Ui {
class Setup;
class Timer;
class Module;
class FunctionSwitches;
}
class AutoLineEdit;
class TimerPanel : public ModelPanel
{
Q_OBJECT
@@ -128,6 +131,31 @@ class ModulePanel : public ModelPanel
void updateFailsafeUI(unsigned channel, quint8 updtSb);
};
class FunctionSwitchesPanel : public ModelPanel
{
Q_OBJECT
public:
FunctionSwitchesPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware);
virtual ~FunctionSwitchesPanel();
virtual void update();
void update(int index);
private slots:
void on_configCurrentIndexChanged(int index);
void on_startPosnCurrentIndexChanged(int index);
void on_groupChanged(int value);
private:
Ui::FunctionSwitches * ui;
QVector<AutoLineEdit *> aleNames;
QVector<QComboBox *> cboConfigs;
QVector<QComboBox *> cboStartupPosns;
QVector<QSpinBox *> sbGroups;
int switchcnt;
};
class SetupPanel : public ModelPanel
{
Q_OBJECT
+4 -1
View File
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>1007</width>
<height>405</height>
<height>435</height>
</rect>
</property>
<property name="windowTitle">
@@ -630,6 +630,9 @@ If this is checked the throttle will be reversed. Idle will be forward, trim wi
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="functionSwitchesLayout"/>
</item>
<item>
<layout class="QVBoxLayout" name="modulesLayout"/>
</item>
@@ -0,0 +1,121 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>FunctionSwitches</class>
<widget class="QWidget" name="FunctionSwitches">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>231</width>
<height>140</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="lblSwitch">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Function Switches</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridSwitches">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
<item row="2" column="0">
<widget class="QLabel" name="lblType">
<property name="text">
<string>Type</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="lblGroup">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Group</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="lblStartupPosn">
<property name="text">
<string>Start</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lblName">
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<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>
</layout>
</widget>
<resources/>
<connections/>
</ui>
+2
View File
@@ -14,6 +14,7 @@ set(simulation_SRCS
simulateduiwidgetX12.cpp
simulateduiwidgetJumperT12.cpp
simulateduiwidgetJumperTLITE.cpp
simulateduiwidgetJumperTPRO.cpp
simulateduiwidgetJumperT16.cpp
simulateduiwidgetJumperT18.cpp
simulateduiwidgetTX12.cpp
@@ -46,6 +47,7 @@ set(simulation_UIS
simulateduiwidgetX12.ui
simulateduiwidgetJumperT12.ui
simulateduiwidgetJumperTLITE.ui
simulateduiwidgetJumperTPRO.ui
simulateduiwidgetJumperT16.ui
simulateduiwidgetJumperT18.ui
simulateduiwidgetTX12.ui
@@ -113,6 +113,7 @@ namespace Ui {
class SimulatedUIWidgetX12;
class SimulatedUIWidgetJumperT12;
class SimulatedUIWidgetJumperTLITE;
class SimulatedUIWidgetJumperTPRO;
class SimulatedUIWidgetJumperT16;
class SimulatedUIWidgetJumperT18;
class SimulatedUIWidgetTX16S;
@@ -258,6 +259,18 @@ class SimulatedUIWidgetJumperTLITE: public SimulatedUIWidget
Ui::SimulatedUIWidgetJumperTLITE * ui;
};
class SimulatedUIWidgetJumperTPRO: public SimulatedUIWidget
{
Q_OBJECT
public:
explicit SimulatedUIWidgetJumperTPRO(SimulatorInterface * simulator, QWidget * parent = NULL);
virtual ~SimulatedUIWidgetJumperTPRO();
private:
Ui::SimulatedUIWidgetJumperTPRO * ui;
};
class SimulatedUIWidgetJumperT16: public SimulatedUIWidget
{
Q_OBJECT
@@ -0,0 +1,54 @@
#include "simulateduiwidget.h"
#include "ui_simulateduiwidgetJumperTPRO.h"
// NOTE: RadioUiAction(NUMBER,...): NUMBER relates to enum EnumKeys in the specific board.h
SimulatedUIWidgetJumperTPRO::SimulatedUIWidgetJumperTPRO(SimulatorInterface *simulator, QWidget * parent):
SimulatedUIWidget(simulator, parent),
ui(new Ui::SimulatedUIWidgetJumperTPRO)
{
RadioUiAction * act;
ui->setupUi(this);
act = new RadioUiAction(0, QList<int>() << Qt::Key_PageUp << Qt::Key_Up, SIMU_STR_HLP_KEYS_GO_UP, SIMU_STR_HLP_ACT_MENU_ICN);
addRadioWidget(ui->leftbuttons->addArea(QRect(70, 85, 110, 90), "JumperTPRO/left.png", act));
act = new RadioUiAction(3, QList<int>() << Qt::Key_PageDown << Qt::Key_Down, SIMU_STR_HLP_KEYS_GO_DN, SIMU_STR_HLP_ACT_PAGE);
addRadioWidget(ui->leftbuttons->addArea(QRect(53, 174, 110, 90), "JumperTPRO/left.png", act));
act = new RadioUiAction(1, QList<int>() << Qt::Key_Delete << Qt::Key_Escape << Qt::Key_Backspace, SIMU_STR_HLP_KEYS_EXIT, SIMU_STR_HLP_ACT_EXIT);
addRadioWidget(ui->leftbuttons->addArea(QRect(11, 257, 110, 90), "JumperTPRO/left.png", act));
m_mouseMidClickAction = new RadioUiAction(2, QList<int>() << Qt::Key_Enter << Qt::Key_Return, SIMU_STR_HLP_KEYS_ACTIVATE, SIMU_STR_HLP_ACT_ROT_DN);
addRadioWidget(ui->rightbuttons->addArea(QRect(10, 96, 200, 220), "JumperTPRO/right.png", m_mouseMidClickAction));
//addRadioWidget(ui->leftbuttons->addArea(QRect(10, 65, 70, 50), "JumperTPRO/left_scrnshot.png", m_screenshotAction));
m_backlightColors << QColor(215, 243, 255); // X7 Blue
m_backlightColors << QColor(166,247,159);
m_backlightColors << QColor(247,159,166);
m_backlightColors << QColor(255,195,151);
m_backlightColors << QColor(247,242,159);
setLcd(ui->lcd);
QString css = "#radioUiWidget {"
"background-color: qlineargradient(spread:reflect, x1:0, y1:0, x2:0, y2:1,"
"stop:0 rgba(255, 255, 255, 255),"
"stop:0.757062 rgba(241, 238, 238, 255),"
"stop:1 rgba(247, 245, 245, 255));"
"}";
QTimer * tim = new QTimer(this);
tim->setSingleShot(true);
connect(tim, &QTimer::timeout, [this, css]() {
emit customStyleRequest(css);
});
tim->start(100);
}
SimulatedUIWidgetJumperTPRO::~SimulatedUIWidgetJumperTPRO()
{
delete ui;
}
@@ -0,0 +1,258 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SimulatedUIWidgetJumperTPRO</class>
<widget class="QWidget" name="SimulatedUIWidgetJumperTPRO">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>725</width>
<height>389</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>725</width>
<height>389</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>501</width>
<height>310 </height>
</size>
</property>
<property name="windowTitle">
<string notr="true">Jumper T-Pro Simulator</string>
</property>
<property name="styleSheet">
<string notr="true">background-color: qlineargradient(spread:reflect, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(255, 255, 255, 255), stop:0.757062 rgba(241, 238, 238, 255), stop:1 rgba(247, 245, 245, 255));</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="1" column="0" rowspan="3">
<widget class="ButtonsWidget" name="leftbuttons" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>234</width>
<height>368</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>234</width>
<height>368</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background:url(:/images/simulator/JumperTPRO/left.png);</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="LcdWidget" name="lcd" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>256</width>
<height>231</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>256</width>
<height>231</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(215, 243, 255);</string>
</property>
</widget>
</item>
<item row="1" column="2" rowspan="3">
<widget class="ButtonsWidget" name="rightbuttons" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>236</width>
<height>368</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>236</width>
<height>368</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background:url(:/images/simulator/JumperTPRO/right.png)</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QWidget" name="top" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>255</width>
<height>85</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>255</width>
<height>85</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background:url(:/images/simulator/JumperTPRO/top.png)</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="ButtonsWidget" name="bottombuttons" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>255</width>
<height>131</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>255</width>
<height>131</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background:url(:/images/simulator/JumperTPRO/bottom.png)</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="3">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>10</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>12</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>12</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item row="4" column="0" colspan="3">
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>10</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>10</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(247, 245, 245);</string>
</property>
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>LcdWidget</class>
<extends>QWidget</extends>
<header>lcdwidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ButtonsWidget</class>
<extends>QWidget</extends>
<header>buttonswidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
@@ -94,6 +94,9 @@ SimulatorWidget::SimulatorWidget(QWidget * parent, SimulatorInterface * simulato
case Board::BOARD_JUMPER_TLITE:
radioUiWidget = new SimulatedUIWidgetJumperTLITE(simulator, this);
break;
case Board::BOARD_JUMPER_TPRO:
radioUiWidget = new SimulatedUIWidgetJumperTPRO(simulator, this);
break;
case Board::BOARD_JUMPER_T16:
radioUiWidget = new SimulatedUIWidgetJumperT16(simulator, this);
break;