feat(cpn): add support for surface radios inc Radiomaster MT12 (#5381)

This commit is contained in:
Neil Horne
2024-09-26 20:39:51 +10:00
committed by GitHub
parent 2bd62c95c8
commit 149e1a2df0
90 changed files with 3746 additions and 2387 deletions
+52 -4
View File
@@ -19,8 +19,7 @@
* GNU General Public License for more details.
*/
#ifndef SIMULATEDUIWIDGET_H
#define SIMULATEDUIWIDGET_H
#pragma once
#include "boards.h"
#include "constants.h"
@@ -35,6 +34,8 @@ class SimulatorInterface;
class LcdWidget;
class RadioKeyWidget;
class RadioUiAction;
class ButtonsWidget;
class QPushButton;
// Match with /radio/src/hal/key_driver.h
enum EnumKeys {
@@ -64,6 +65,23 @@ enum EnumKeys {
MAX_KEYS
};
struct GenericKeyDefinition {
int index = 0;
QChar side = 'L';
int gridRow = 0;
int gridCol = 0;
QList<int> keys = QList<int>();
QString helpKeys = "";
QString helpActions = "";
GenericKeyDefinition(int index, QChar side, int gridRow, int gridCol,
QList<int> keys, QString helpKeys, QString helpActions) :
index(index), side(side), gridRow(gridRow), gridCol(gridCol),
keys(keys), helpKeys(helpKeys), helpActions(helpActions) {}
GenericKeyDefinition() = default;
};
/*
* This is a base class for the main hardware-specific radio user interface, including LCD screen and navigation buttons/widgets.
* It is responsible for hanlding all interactions with this part of the simulation (vs. common radio widgets like sticks/switches/knobs).
@@ -126,11 +144,20 @@ class SimulatedUIWidget : public QWidget
unsigned int m_backLight;
int m_beepShow;
int m_beepVal;
static int strKeyToInt(std::string key);
void addGenericPushButton(int index, QString label, ButtonsWidget * leftButtons, QGridLayout * leftButtonsGrid,
ButtonsWidget * rightButtons, QGridLayout * rightButtonsGrid);
void addGenericPushButtons(ButtonsWidget * leftButtons, ButtonsWidget * rightButtons);
void addScrollActions();
void addMouseActions();
};
// Each subclass is responsible for its own Ui
namespace Ui {
class SimulatedUIWidgetGeneric;
class SimulatedUIWidget9X;
class SimulatedUIWidgetX9LITE;
class SimulatedUIWidgetX7;
@@ -156,6 +183,7 @@ namespace Ui {
class SimulatedUIWidgetTX12;
class SimulatedUIWidgetZorro;
class SimulatedUIWidgetBoxer;
class SimulatedUIWidgetMT12;
class SimulatedUIWidgetPocket;
class SimulatedUIWidgetT8;
class SimulatedUIWidgetFatfishF16;
@@ -165,6 +193,19 @@ namespace Ui {
class SimulatedUIWidgetV16;
}
class SimulatedUIWidgetGeneric: public SimulatedUIWidget
{
Q_OBJECT
public:
explicit SimulatedUIWidgetGeneric(SimulatorInterface * simulator, QWidget * parent = nullptr);
virtual ~SimulatedUIWidgetGeneric();
private:
Ui::SimulatedUIWidgetGeneric * ui;
};
class SimulatedUIWidget9X: public SimulatedUIWidget
{
Q_OBJECT
@@ -469,6 +510,15 @@ class SimulatedUIWidgetBoxer: public SimulatedUIWidget
Ui::SimulatedUIWidgetBoxer * ui;
};
class SimulatedUIWidgetMT12: public SimulatedUIWidgetGeneric
{
Q_OBJECT
public:
explicit SimulatedUIWidgetMT12(SimulatorInterface * simulator, QWidget * parent = nullptr);
virtual ~SimulatedUIWidgetMT12();
};
class SimulatedUIWidgetPocket: public SimulatedUIWidget
{
Q_OBJECT
@@ -552,5 +602,3 @@ class SimulatedUIWidgetV16: public SimulatedUIWidget
private:
Ui::SimulatedUIWidgetV16 * ui;
};
#endif // SIMULATEDUIWIDGET_H