chores(flysky): Separate AFHDS2A and AFHDS3 into 2 different module type (#3783)

* chores(flysky): separate AFHDS2A and AFHDS3 into 2 different module type

This should allow to remove some of the hacks added earlier.

* chore: Add some EL18 CI bits

* fix(afhds): cmake defs

* fix(ci): add el18 to commit-tests.sh

* chore(cpn): separate AFHDS2A and AFHDS3

* chore(cpn): remove binary import of afhds and legacy fxFreq field for afhds3

* fix(cpn): limit available internal afhds protocols to those supported by hardware

* chore(cpn): update Flysky int module test

* fix(cpn): compile error

* fix(cpn): afhds2a max channels

* fix: TR_MODULE_PROTOCOLS

* enh(cpn): more support for afhds2a and 3

* fix(cpn): rebase compile error

* fix(cpn): bit indexes

* fix(cpn): emi toString

* fix(cpn): limit available internal afhds protocols to those supported by hardware

* enh(cpn): add support for Flysky EL18

* fix(cpn): available protocols

* fix(cpn): rebase moduledata

* chore(cpn): add module fields to model print

* Separate AFHDS2A and AFHDS3 UI settings.

* Fix AFHDS3 conversion from old subtype value.
Fix 'Channel Range' layout on portrait LCD.

* Fix name.

---------

Co-authored-by: Peter Feerick <peter.feerick@gmail.com>
Co-authored-by: elecpower <neilh713@tpg.com.au>
Co-authored-by: Phil Mitchell <phil.a.mitchell@gmail.com>
This commit is contained in:
Raphael Coeffic
2023-09-07 19:24:03 +10:00
committed by GitHub
co-authored by Peter Feerick elecpower Phil Mitchell
parent 9515d29c9d
commit c4f1e7127d
59 changed files with 1098 additions and 463 deletions
+2
View File
@@ -25,6 +25,7 @@ set(simulation_SRCS
simulateduiwidgetT8.cpp
simulateduiwidgetTX16S.cpp
simulateduiwidgetNV14.cpp
simulateduiwidgetEL18.cpp
simulatorinterface.cpp
simulatormainwindow.cpp
simulatorstartupdialog.cpp
@@ -61,6 +62,7 @@ set(simulation_UIS
simulateduiwidgetT8.ui
simulateduiwidgetTX16S.ui
simulateduiwidgetNV14.ui
simulateduiwidgetEL18.ui
simulatormainwindow.ui
simulatorstartupdialog.ui
simulatorwidget.ui
+14 -1
View File
@@ -124,6 +124,7 @@ namespace Ui {
class SimulatedUIWidgetBoxer;
class SimulatedUIWidgetT8;
class SimulatedUIWidgetNV14;
class SimulatedUIWidgetEL18;
}
class SimulatedUIWidget9X: public SimulatedUIWidget
@@ -241,7 +242,7 @@ class SimulatedUIWidgetX12: public SimulatedUIWidget
class SimulatedUIWidgetLR3PRO: public SimulatedUIWidget
{
Q_OBJECT
public:
explicit SimulatedUIWidgetLR3PRO(SimulatorInterface * simulator, QWidget * parent = NULL);
virtual ~SimulatedUIWidgetLR3PRO();
@@ -394,4 +395,16 @@ class SimulatedUIWidgetNV14: public SimulatedUIWidget
Ui::SimulatedUIWidgetNV14 * ui;
};
class SimulatedUIWidgetEL18: public SimulatedUIWidget
{
Q_OBJECT
public:
explicit SimulatedUIWidgetEL18(SimulatorInterface * simulator, QWidget * parent = nullptr);
virtual ~SimulatedUIWidgetEL18();
private:
Ui::SimulatedUIWidgetEL18 * ui;
};
#endif // SIMULATEDUIWIDGET_H
@@ -0,0 +1,76 @@
/*
* 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.
*/
// NOTE: RadioUiAction(NUMBER,...): NUMBER relates to enum EnumKeys in the specific board.h
#include "simulateduiwidget.h"
#include "ui_simulateduiwidgetEL18.h"
SimulatedUIWidgetEL18::SimulatedUIWidgetEL18(SimulatorInterface *simulator, QWidget * parent):
SimulatedUIWidget(simulator, parent),
ui(new Ui::SimulatedUIWidgetEL18)
{
RadioUiAction * act;
ui->setupUi(this);
// add actions in order of appearance on the help menu
// Note: the EL18 has no physical buttons though at some point the trim joystick is repurposed
// allow for colorlcd key events and see what works
// the mouse click areas do not map to visual buttons on the background images
act = new RadioUiAction(12, QList<int>() << Qt::Key_Up, SIMU_STR_HLP_KEY_UP, SIMU_STR_HLP_ACT_MDL);
addRadioWidget(ui->rightbuttons->addArea(QRect(10, 1, 80, 35), "NV14/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, 40, 80, 35), "NV14/left.png", m_mouseMidClickAction));
act = new RadioUiAction(14, QList<int>() << Qt::Key_Left, SIMU_STR_HLP_KEY_LFT, SIMU_STR_HLP_ACT_SYS);
addRadioWidget(ui->leftbuttons->addArea(QRect(10, 80, 80, 35), "NV14/left.png", act));
act = new RadioUiAction(13, QList<int>() << Qt::Key_Right, SIMU_STR_HLP_KEY_RGT, SIMU_STR_HLP_ACT_TELE);
addRadioWidget(ui->leftbuttons->addArea(QRect(10, 120, 80, 35), "NV14/left.png", act));
act = new RadioUiAction(5, QList<int>() << Qt::Key_PageDown, SIMU_STR_HLP_KEY_PGDN, SIMU_STR_HLP_ACT_PGDN);
addRadioWidget(ui->leftbuttons->addArea(QRect(10, 160, 80, 35), "NV14/left.png", act));
act = new RadioUiAction(4, QList<int>() << Qt::Key_PageUp, SIMU_STR_HLP_KEY_PGUP, SIMU_STR_HLP_ACT_PGUP);
addRadioWidget(ui->leftbuttons->addArea(QRect(10, 200, 80, 35), "NV14/left.png", act));
act = new RadioUiAction(1, QList<int>() << Qt::Key_Down << Qt::Key_Delete << Qt::Key_Escape << Qt::Key_Backspace,
SIMU_STR_HLP_KEY_DN % "<br>" % SIMU_STR_HLP_KEYS_EXIT, SIMU_STR_HLP_ACT_RTN);
addRadioWidget(ui->leftbuttons->addArea(QRect(10, 240, 80, 35), "NV14/left.png", act));
m_scrollUpAction = new RadioUiAction(-1, QList<int>() << Qt::Key_Minus, SIMU_STR_HLP_KEY_MIN % "|" % SIMU_STR_HLP_MOUSE_UP, SIMU_STR_HLP_ACT_ROT_LFT);
m_scrollDnAction = new RadioUiAction(-1, QList<int>() << Qt::Key_Plus << Qt::Key_Equal, SIMU_STR_HLP_KEY_PLS % "|" % SIMU_STR_HLP_MOUSE_DN, SIMU_STR_HLP_ACT_ROT_RGT);
connectScrollActions();
addRadioWidget(ui->leftbuttons->addArea(QRect(10, 280, 30, 30), "NV14/left.png", m_screenshotAction));
m_backlightColors << QColor(47, 123, 227);
setLcd(ui->lcd);
}
SimulatedUIWidgetEL18::~SimulatedUIWidgetEL18()
{
delete ui;
}
@@ -0,0 +1,206 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SimulatedUIWidgetEL18</class>
<widget class="QWidget" name="SimulatedUIWidgetEL18">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>520</width>
<height>500</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>520</width>
<height>500</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>520</width>
<height>500</height>
</size>
</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="0" 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>100</width>
<height>500</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>500</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background:url(:/images/simulator/NV14/right.png)</string>
</property>
</widget>
</item>
<item row="1" 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>320</width>
<height>480</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>320</width>
<height>480</height>
</size>
</property>
<property name="font">
<font>
<pointsize>5</pointsize>
</font>
</property>
</widget>
</item>
<item row="0" 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>100</width>
<height>500</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>500</height>
</size>
</property>
<property name="mouseTracking">
<bool>true</bool>
</property>
<property name="styleSheet">
<string notr="true">background:url(:/images/simulator/NV14/left.png);</string>
</property>
</widget>
</item>
<item row="0" 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>320</width>
<height>10</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>320</width>
<height>10</height>
</size>
</property>
<property name="font">
<font>
<pointsize>5</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">background:url(:/images/simulator/NV14/top.png)</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QWidget" name="bottom" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>320</width>
<height>10</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>320</width>
<height>10</height>
</size>
</property>
<property name="font">
<font>
<pointsize>5</pointsize>
<kerning>false</kerning>
</font>
</property>
<property name="styleSheet">
<string notr="true">background:url(:/images/simulator/NV14/bottom.png)</string>
</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>
@@ -128,6 +128,9 @@ SimulatorWidget::SimulatorWidget(QWidget * parent, SimulatorInterface * simulato
case Board::BOARD_FLYSKY_NV14:
radioUiWidget = new SimulatedUIWidgetNV14(simulator, this);
break;
case Board::BOARD_FLYSKY_EL18:
radioUiWidget = new SimulatedUIWidgetEL18(simulator, this);
break;
default:
radioUiWidget = new SimulatedUIWidget9X(simulator, this);
break;