feat(cpn): iFlight Commando8 support (#2244)
* feat(cpn): Initial iFlight Commando8 support * fix: Commando8 doesn't have trainer port * feat: Add Simulator for iFlight Commando8 Also some minor code re-order for BetaFPV LR3PRO * chore: EEPROM_VARIANT not used * chore: Remove EEPROM bits that don't seem needed * fix: Build simulator plugin * fix: Simulator PGUP/PGDN the right way around * fix: Keep trainer mode in cpn for MPM, etc
This commit is contained in:
@@ -12,6 +12,8 @@ set(simulation_SRCS
|
||||
simulateduiwidgetX9D2019.cpp
|
||||
simulateduiwidgetX10.cpp
|
||||
simulateduiwidgetX12.cpp
|
||||
simulateduiwidgetLR3PRO.cpp
|
||||
simulateduiwidgetCommando8.cpp
|
||||
simulateduiwidgetJumperT12.cpp
|
||||
simulateduiwidgetJumperTLITE.cpp
|
||||
simulateduiwidgetJumperTPRO.cpp
|
||||
@@ -19,7 +21,6 @@ set(simulation_SRCS
|
||||
simulateduiwidgetJumperT18.cpp
|
||||
simulateduiwidgetTX12.cpp
|
||||
simulateduiwidgetZorro.cpp
|
||||
simulateduiwidgetLR3PRO.cpp
|
||||
simulateduiwidgetT8.cpp
|
||||
simulateduiwidgetTX16S.cpp
|
||||
simulateduiwidgetNV14.cpp
|
||||
@@ -46,6 +47,8 @@ set(simulation_UIS
|
||||
simulateduiwidgetX9D2019.ui
|
||||
simulateduiwidgetX10.ui
|
||||
simulateduiwidgetX12.ui
|
||||
simulateduiwidgetLR3PRO.ui
|
||||
simulateduiwidgetCommando8.ui
|
||||
simulateduiwidgetJumperT12.ui
|
||||
simulateduiwidgetJumperTLITE.ui
|
||||
simulateduiwidgetJumperTPRO.ui
|
||||
@@ -53,7 +56,6 @@ set(simulation_UIS
|
||||
simulateduiwidgetJumperT18.ui
|
||||
simulateduiwidgetTX12.ui
|
||||
simulateduiwidgetZorro.ui
|
||||
simulateduiwidgetLR3PRO.ui
|
||||
simulateduiwidgetT8.ui
|
||||
simulateduiwidgetTX16S.ui
|
||||
simulateduiwidgetNV14.ui
|
||||
|
||||
@@ -111,6 +111,8 @@ namespace Ui {
|
||||
class SimulatedUIWidgetX9D2019;
|
||||
class SimulatedUIWidgetX10;
|
||||
class SimulatedUIWidgetX12;
|
||||
class SimulatedUIWidgetLR3PRO;
|
||||
class SimulatedUIWidgetCommando8;
|
||||
class SimulatedUIWidgetJumperT12;
|
||||
class SimulatedUIWidgetJumperTLITE;
|
||||
class SimulatedUIWidgetJumperTPRO;
|
||||
@@ -119,7 +121,6 @@ namespace Ui {
|
||||
class SimulatedUIWidgetTX16S;
|
||||
class SimulatedUIWidgetTX12;
|
||||
class SimulatedUIWidgetZorro;
|
||||
class SimulatedUIWidgetLR3PRO;
|
||||
class SimulatedUIWidgetT8;
|
||||
class SimulatedUIWidgetNV14;
|
||||
}
|
||||
@@ -236,6 +237,30 @@ class SimulatedUIWidgetX12: public SimulatedUIWidget
|
||||
Ui::SimulatedUIWidgetX12 * ui;
|
||||
};
|
||||
|
||||
class SimulatedUIWidgetLR3PRO: public SimulatedUIWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SimulatedUIWidgetLR3PRO(SimulatorInterface * simulator, QWidget * parent = NULL);
|
||||
virtual ~SimulatedUIWidgetLR3PRO();
|
||||
|
||||
private:
|
||||
Ui::SimulatedUIWidgetLR3PRO * ui;
|
||||
};
|
||||
|
||||
class SimulatedUIWidgetCommando8: public SimulatedUIWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SimulatedUIWidgetCommando8(SimulatorInterface * simulator, QWidget * parent = nullptr);
|
||||
virtual ~SimulatedUIWidgetCommando8();
|
||||
|
||||
private:
|
||||
Ui::SimulatedUIWidgetCommando8 * ui;
|
||||
};
|
||||
|
||||
class SimulatedUIWidgetJumperT12: public SimulatedUIWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -272,18 +297,6 @@ class SimulatedUIWidgetJumperTPRO: public SimulatedUIWidget
|
||||
Ui::SimulatedUIWidgetJumperTPRO * ui;
|
||||
};
|
||||
|
||||
class SimulatedUIWidgetLR3PRO: public SimulatedUIWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SimulatedUIWidgetLR3PRO(SimulatorInterface * simulator, QWidget * parent = NULL);
|
||||
virtual ~SimulatedUIWidgetLR3PRO();
|
||||
|
||||
private:
|
||||
Ui::SimulatedUIWidgetLR3PRO * ui;
|
||||
};
|
||||
|
||||
class SimulatedUIWidgetJumperT16: public SimulatedUIWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
#include "simulateduiwidget.h"
|
||||
#include "ui_simulateduiwidgetCommando8.h"
|
||||
|
||||
// NOTE: RadioUiAction(NUMBER,...): NUMBER relates to enum EnumKeys in the specific board.h
|
||||
|
||||
SimulatedUIWidgetCommando8::SimulatedUIWidgetCommando8(SimulatorInterface *simulator, QWidget * parent):
|
||||
SimulatedUIWidget(simulator, parent),
|
||||
ui(new Ui::SimulatedUIWidgetCommando8)
|
||||
{
|
||||
RadioUiAction * act;
|
||||
|
||||
ui->setupUi(this);
|
||||
|
||||
// add actions in order of appearance on the help menu
|
||||
|
||||
act = new RadioUiAction(5, QList<int>() << Qt::Key_Up, SIMU_STR_HLP_KEY_UP, SIMU_STR_HLP_ACT_MDL);
|
||||
addRadioWidget(ui->bottom->addArea(QRect(50, 44, 18, 18), "Commando8/left-mdl.png", act));
|
||||
|
||||
act = new RadioUiAction(6, QList<int>() << Qt::Key_Enter << Qt::Key_Return, SIMU_STR_HLP_KEYS_GO_UP, SIMU_STR_HLP_ACT_UP);
|
||||
addRadioWidget(ui->bottom->addArea(QRect(248, 25, 18, 18), "Commando8/right-up.png", act));
|
||||
|
||||
act = new RadioUiAction(7, QList<int>() << Qt::Key_Enter << Qt::Key_Return, SIMU_STR_HLP_KEYS_GO_DN, SIMU_STR_HLP_ACT_DN);
|
||||
addRadioWidget(ui->bottom->addArea(QRect(248, 62, 18, 18), "Commando8/right-dn.png", act));
|
||||
|
||||
act = new RadioUiAction(1, QList<int>() << Qt::Key_Enter << Qt::Key_Return, SIMU_STR_HLP_KEYS_ACTIVATE, SIMU_STR_HLP_ACT_ENT);
|
||||
addRadioWidget(ui->bottom->addArea(QRect(250, 45, 15, 15), "Commando8/right-ent.png", act));
|
||||
|
||||
act = new RadioUiAction(4, QList<int>() << Qt::Key_Left, SIMU_STR_HLP_KEY_LFT, SIMU_STR_HLP_ACT_SYS);
|
||||
addRadioWidget(ui->bottom->addArea(QRect(34, 46, 15, 15), "Commando8/left-sys.png", act));
|
||||
|
||||
act = new RadioUiAction(0, QList<int>() << Qt::Key_Down << Qt::Key_Delete << Qt::Key_Escape << Qt::Key_Backspace, SIMU_STR_HLP_KEYS_EXIT, SIMU_STR_HLP_ACT_EXIT);
|
||||
addRadioWidget(ui->bottom->addArea(QRect(14, 44, 18, 18), "Commando8/left-rtn.png", act));
|
||||
|
||||
act = new RadioUiAction(3, QList<int>() << Qt::Key_PageDown, SIMU_STR_HLP_KEY_PGDN, SIMU_STR_HLP_ACT_PGDN);
|
||||
addRadioWidget(ui->bottom->addArea(QRect(267, 43, 18, 18), "Commando8/right-pagedn.png", act));
|
||||
|
||||
act = new RadioUiAction(2, QList<int>() << Qt::Key_PageUp, SIMU_STR_HLP_KEY_PGUP, SIMU_STR_HLP_ACT_PGUP);
|
||||
addRadioWidget(ui->bottom->addArea(QRect(230, 43, 18, 18), "Commando8/right-pageup.png", act));
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
SimulatedUIWidgetCommando8::~SimulatedUIWidgetCommando8()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SimulatedUIWidgetCommando8</class>
|
||||
<widget class="QWidget" name="SimulatedUIWidgetCommando8">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>300</width>
|
||||
<height>310</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>310</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>310</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">iFlight Commando8 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="QWidget" name="top" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>300</width>
|
||||
<height>79</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>79</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>254</width>
|
||||
<height>79</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background:url(:/images/simulator/Commando8/top.png)</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="LcdWidget" name="lcd" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>22</x>
|
||||
<y>80</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="bottom" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>210</y>
|
||||
<width>300</width>
|
||||
<height>99</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>99</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>99</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background:url(:/images/simulator/Commando8/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>
|
||||
@@ -88,6 +88,12 @@ SimulatorWidget::SimulatorWidget(QWidget * parent, SimulatorInterface * simulato
|
||||
case Board::BOARD_X10_EXPRESS:
|
||||
radioUiWidget = new SimulatedUIWidgetX10(simulator, this);
|
||||
break;
|
||||
case Board::BOARD_BETAFPV_LR3PRO:
|
||||
radioUiWidget = new SimulatedUIWidgetLR3PRO(simulator, this);
|
||||
break;
|
||||
case Board::BOARD_IFLIGHT_COMMANDO8:
|
||||
radioUiWidget = new SimulatedUIWidgetCommando8(simulator, this);
|
||||
break;
|
||||
case Board::BOARD_JUMPER_T12:
|
||||
radioUiWidget = new SimulatedUIWidgetJumperT12(simulator, this);
|
||||
break;
|
||||
@@ -110,9 +116,6 @@ SimulatorWidget::SimulatorWidget(QWidget * parent, SimulatorInterface * simulato
|
||||
case Board::BOARD_RADIOMASTER_ZORRO:
|
||||
radioUiWidget = new SimulatedUIWidgetZorro(simulator, this);
|
||||
break;
|
||||
case Board::BOARD_BETAFPV_LR3PRO:
|
||||
radioUiWidget = new SimulatedUIWidgetLR3PRO(simulator, this);
|
||||
break;
|
||||
case Board::BOARD_RADIOMASTER_T8:
|
||||
radioUiWidget = new SimulatedUIWidgetT8(simulator, this);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user