Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(cpn): simulators for EL18, TProV2, Pocket, T20 #4687

Merged
merged 9 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions companion/src/companion.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,10 @@
<file>images/simulator/JumperT18/left_tele.png</file>
<file>images/simulator/JumperT18/right_ent.png</file>
<file>images/simulator/JumperT18/right_rtn.png</file>
<file>images/simulator/JumperT20/left.png</file>
<file>images/simulator/JumperT20/right.png</file>
<file>images/simulator/JumperT20/top.png</file>
<file>images/simulator/JumperT20/bottom.png</file>
<file>images/simulator/TX16S/left.png</file>
<file>images/simulator/TX16S/right.png</file>
<file>images/simulator/TX16S/top.png</file>
Expand All @@ -297,6 +301,10 @@
<file>images/simulator/PL18/right.png</file>
<file>images/simulator/PL18/top.png</file>
<file>images/simulator/PL18/bottom.png</file>
<file>images/simulator/Pocket/left.png</file>
<file>images/simulator/Pocket/right.png</file>
<file>images/simulator/Pocket/top.png</file>
<file>images/simulator/Pocket/bottom.png</file>
<file>images/wizard/ailerons.png</file>
<file>images/wizard/airbrakes.png</file>
<file>images/wizard/elevons.png</file>
Expand Down
2 changes: 1 addition & 1 deletion companion/src/firmwares/boards.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ QString Boards::getBoardName(Board::Type board)
case BOARD_JUMPER_TPRO:
return "Jumper T-Pro";
case BOARD_JUMPER_TPROV2:
return "Jumper T-ProV2";
return "Jumper T-Pro V2";
case BOARD_JUMPER_T16:
return "Jumper T16";
case BOARD_JUMPER_T18:
Expand Down
2 changes: 1 addition & 1 deletion companion/src/firmwares/opentx/opentxinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1382,7 +1382,7 @@ void registerOpenTxFirmwares()
addOpenTxRfOptions(firmware, FLEX);

/* Jumper T-Pro V2 board */
firmware = new OpenTxFirmware(FIRMWAREID("tprov2"), QCoreApplication::translate("Firmware", "Jumper T-Pro v2"), BOARD_JUMPER_TPROV2);
firmware = new OpenTxFirmware(FIRMWAREID("tprov2"), QCoreApplication::translate("Firmware", "Jumper T-Pro V2"), BOARD_JUMPER_TPROV2);
addOpenTxCommonOptions(firmware);
firmware->addOption("noheli", Firmware::tr("Disable HELI menu and cyclic mix support"));
firmware->addOption("nogvars", Firmware::tr("Disable Global variables"));
Expand Down
Binary file added companion/src/images/simulator/JumperT20/bottom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added companion/src/images/simulator/JumperT20/left.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added companion/src/images/simulator/JumperT20/top.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added companion/src/images/simulator/Pocket/bottom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added companion/src/images/simulator/Pocket/left.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added companion/src/images/simulator/Pocket/right.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added companion/src/images/simulator/Pocket/top.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions companion/src/simulation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@ set(${PROJECT_NAME}_SRCS
simulateduiwidgetJumperT12.cpp
simulateduiwidgetJumperT16.cpp
simulateduiwidgetJumperT18.cpp
simulateduiwidgetJumperT20.cpp
simulateduiwidgetJumperTLITE.cpp
simulateduiwidgetJumperTPRO.cpp
simulateduiwidgetLR3PRO.cpp
simulateduiwidgetNV14.cpp
simulateduiwidgetPL18.cpp
simulateduiwidgetPocket.cpp
simulateduiwidgetT8.cpp
simulateduiwidgetTX12.cpp
simulateduiwidgetTX16S.cpp
Expand Down
26 changes: 26 additions & 0 deletions companion/src/simulation/simulateduiwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,12 @@ namespace Ui {
class SimulatedUIWidgetJumperTPRO;
class SimulatedUIWidgetJumperT16;
class SimulatedUIWidgetJumperT18;
class SimulatedUIWidgetJumperT20;
class SimulatedUIWidgetTX16S;
class SimulatedUIWidgetTX12;
class SimulatedUIWidgetZorro;
class SimulatedUIWidgetBoxer;
class SimulatedUIWidgetPocket;
class SimulatedUIWidgetT8;
class SimulatedUIWidgetNV14;
class SimulatedUIWidgetEL18;
Expand Down Expand Up @@ -324,6 +326,18 @@ class SimulatedUIWidgetJumperT18: public SimulatedUIWidget
Ui::SimulatedUIWidgetJumperT18 * ui;
};

class SimulatedUIWidgetJumperT20: public SimulatedUIWidget
{
Q_OBJECT

public:
explicit SimulatedUIWidgetJumperT20(SimulatorInterface * simulator, QWidget * parent = nullptr);
virtual ~SimulatedUIWidgetJumperT20();

private:
Ui::SimulatedUIWidgetJumperT20 * ui;
};

class SimulatedUIWidgetTX12: public SimulatedUIWidget
{
Q_OBJECT
Expand Down Expand Up @@ -360,6 +374,18 @@ class SimulatedUIWidgetBoxer: public SimulatedUIWidget
Ui::SimulatedUIWidgetBoxer * ui;
};

class SimulatedUIWidgetPocket: public SimulatedUIWidget
{
Q_OBJECT

public:
explicit SimulatedUIWidgetPocket(SimulatorInterface * simulator, QWidget * parent = nullptr);
virtual ~SimulatedUIWidgetPocket();

private:
Ui::SimulatedUIWidgetPocket * ui;
};

class SimulatedUIWidgetT8: public SimulatedUIWidget
{
Q_OBJECT
Expand Down
52 changes: 52 additions & 0 deletions companion/src/simulation/simulateduiwidgetJumperT20.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#include "simulateduiwidget.h"
#include "ui_simulateduiwidgetJumperT20.h"

// NOTE: RadioUiAction(NUMBER,...): NUMBER relates to enum EnumKeys in the specific board.h

SimulatedUIWidgetJumperT20::SimulatedUIWidgetJumperT20(SimulatorInterface *simulator, QWidget * parent):
SimulatedUIWidget(simulator, parent),
ui(new Ui::SimulatedUIWidgetJumperT20)
{
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(0, 30, 51, 28), "JumperT20/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(0, 70, 51, 28), "JumperT20/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(10, 110, 51, 28), "JumperT20/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(130, 50, 50, 70), "JumperT20/right.png", m_mouseMidClickAction));

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);
}

SimulatedUIWidgetJumperT20::~SimulatedUIWidgetJumperT20()
{
delete ui;
}
211 changes: 211 additions & 0 deletions companion/src/simulation/simulateduiwidgetJumperT20.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SimulatedUIWidgetJumperT20</class>
<widget class="QWidget" name="SimulatedUIWidgetJumperT20">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>627</width>
<height>164</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>627</width>
<height>164</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>627</width>
<height>164</height>
</size>
</property>
<property name="windowTitle">
<string notr="true">Jumper T20 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>
<widget class="ButtonsWidget" name="leftbuttons" native="true">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>184</width>
<height>164</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>184</width>
<height>164</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>184</width>
<height>164</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background:url(:/images/simulator/JumperT20/left.png);</string>
</property>
</widget>
<widget class="LcdWidget" name="lcd" native="true">
<property name="geometry">
<rect>
<x>184</x>
<y>19</y>
<width>256</width>
<height>128</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>256</width>
<height>128</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>256</width>
<height>128</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(215, 243, 255);</string>
</property>
</widget>
<widget class="ButtonsWidget" name="rightbuttons" native="true">
<property name="geometry">
<rect>
<x>440</x>
<y>0</y>
<width>184</width>
<height>164</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>184</width>
<height>164</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>184</width>
<height>164</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background:url(:/images/simulator/JumperT20/right.png)</string>
</property>
</widget>
<widget class="QWidget" name="top" native="true">
<property name="geometry">
<rect>
<x>184</x>
<y>0</y>
<width>256</width>
<height>19</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>256</width>
<height>19</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>256</width>
<height>19</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background:url(:/images/simulator/JumperT20/top.png)</string>
</property>
</widget>
<widget class="QWidget" name="bottom" native="true">
<property name="geometry">
<rect>
<x>184</x>
<y>147</y>
<width>256</width>
<height>17</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>256</width>
<height>17</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>256</width>
<height>17</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background:url(:/images/simulator/JumperT20/bottom.png)</string>
</property>
</widget>
</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>
<include location="../companion.qrc"/>
</resources>
<connections/>
</ui>
Loading