feat(el18): Use trim hats as keys for navigation (#3894)
Co-authored-by: elecpower <neilh713@tpg.com.au> Co-authored-by: Peter Feerick <peter.feerick@gmail.com>
This commit is contained in:
co-authored by
elecpower
Peter Feerick
parent
b733ec4eae
commit
f40fa1a64b
@@ -117,6 +117,12 @@ const YamlLookupTable internalModuleLut = {
|
||||
{ MODULE_TYPE_LEMON_DSMP, "TYPE_LEMON_DSMP" },
|
||||
};
|
||||
|
||||
static const YamlLookupTable hatsModeLut = {
|
||||
{ GeneralSettings::HATSMODE_TRIMS_ONLY, "TRIMS_ONLY" },
|
||||
{ GeneralSettings::HATSMODE_KEYS_ONLY, "KEYS_ONLY" },
|
||||
{ GeneralSettings::HATSMODE_SWITCHABLE, "SWITCHABLE" },
|
||||
};
|
||||
|
||||
YamlTelemetryBaudrate::YamlTelemetryBaudrate(
|
||||
const unsigned int* moduleBaudrate)
|
||||
{
|
||||
@@ -181,6 +187,7 @@ Node convert<GeneralSettings>::encode(const GeneralSettings& rhs)
|
||||
node["disableAlarmWarning"] = (int)rhs.disableAlarmWarning;
|
||||
node["disableRssiPoweroffAlarm"] = (int)rhs.disableRssiPoweroffAlarm;
|
||||
node["USBMode"] = rhs.usbMode;
|
||||
node["hatsMode"] = hatsModeLut << rhs.hatsMode;
|
||||
node["stickDeadZone"] = rhs.stickDeadZone;
|
||||
node["jackMode"] = rhs.jackMode;
|
||||
node["hapticMode"] = rhs.hapticMode;
|
||||
@@ -431,6 +438,7 @@ bool convert<GeneralSettings>::decode(const Node& node, GeneralSettings& rhs)
|
||||
node["disableAlarmWarning"] >> rhs.disableAlarmWarning;
|
||||
node["disableRssiPoweroffAlarm"] >> rhs.disableRssiPoweroffAlarm;
|
||||
node["USBMode"] >> rhs.usbMode;
|
||||
node["hatsMode"] >> hatsModeLut >> rhs.hatsMode;
|
||||
node["stickDeadZone"] >> rhs.stickDeadZone;
|
||||
node["jackMode"] >> rhs.jackMode;
|
||||
node["hapticMode"] >> rhs.hapticMode;
|
||||
|
||||
@@ -88,6 +88,13 @@ static const YamlLookupTable usbJoystickIfModeLut = {
|
||||
{ 2, "MULTIAXIS" },
|
||||
};
|
||||
|
||||
static const YamlLookupTable hatsModeLut = {
|
||||
{ GeneralSettings::HATSMODE_TRIMS_ONLY, "TRIMS_ONLY" },
|
||||
{ GeneralSettings::HATSMODE_KEYS_ONLY, "KEYS_ONLY" },
|
||||
{ GeneralSettings::HATSMODE_SWITCHABLE, "SWITCHABLE" },
|
||||
{ GeneralSettings::HATSMODE_GLOBAL, "GLOBAL" },
|
||||
};
|
||||
|
||||
struct YamlTrim {
|
||||
int mode = 0;
|
||||
int ref = 0;
|
||||
@@ -1104,6 +1111,7 @@ Node convert<ModelData>::encode(const ModelData& rhs)
|
||||
}
|
||||
|
||||
node["modelRegistrationID"] = rhs.registrationId;
|
||||
node["hatsMode"] = hatsModeLut << rhs.hatsMode;
|
||||
|
||||
if (Boards::getCapability(board, Board::FunctionSwitches)) {
|
||||
node["functionSwitchConfig"] = rhs.functionSwitchConfig;
|
||||
@@ -1342,6 +1350,7 @@ bool convert<ModelData>::decode(const Node& node, ModelData& rhs)
|
||||
|
||||
node["view"] >> rhs.view;
|
||||
node["modelRegistrationID"] >> rhs.registrationId;
|
||||
node["hatsMode"] >> hatsModeLut >> rhs.hatsMode;
|
||||
|
||||
node["functionSwitchConfig"] >> rhs.functionSwitchConfig;
|
||||
node["functionSwitchGroup"] >> rhs.functionSwitchGroup;
|
||||
|
||||
@@ -129,6 +129,8 @@ void GeneralSettings::init()
|
||||
backlightDelay = 2; // 2 * 5 = 10 secs
|
||||
inactivityTimer = 10;
|
||||
|
||||
hatsMode = HATSMODE_SWITCHABLE;
|
||||
|
||||
// backlightBright = 0; // 0 = 100%
|
||||
|
||||
if (IS_FAMILY_HORUS_OR_T16(board)) {
|
||||
@@ -675,6 +677,42 @@ AbstractStaticItemModel * GeneralSettings::uartSampleModeItemModel()
|
||||
return mdl;
|
||||
}
|
||||
|
||||
QString GeneralSettings::hatsModeToString() const
|
||||
{
|
||||
return hatsModeToString(hatsMode);
|
||||
}
|
||||
|
||||
// static
|
||||
QString GeneralSettings::hatsModeToString(int value)
|
||||
{
|
||||
switch(value) {
|
||||
case HATSMODE_TRIMS_ONLY:
|
||||
return tr("Trims only");
|
||||
case HATSMODE_KEYS_ONLY:
|
||||
return tr("Keys only");
|
||||
case HATSMODE_SWITCHABLE:
|
||||
return tr("Switchable");
|
||||
case HATSMODE_GLOBAL:
|
||||
return tr("Global");
|
||||
default:
|
||||
return CPN_STR_UNKNOWN_ITEM;
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
AbstractStaticItemModel * GeneralSettings::hatsModeItemModel(bool radio_setup)
|
||||
{
|
||||
AbstractStaticItemModel * mdl = new AbstractStaticItemModel();
|
||||
mdl->setName(AIM_GS_HATSMODE);
|
||||
|
||||
for (int i = 0; i < HATSMODE_COUNT; i++) {
|
||||
mdl->appendToItemList(hatsModeToString(i), i, i == HATSMODE_GLOBAL && radio_setup ? false : true);
|
||||
}
|
||||
|
||||
mdl->loadItemList();
|
||||
return mdl;
|
||||
}
|
||||
|
||||
/*
|
||||
TrainerMix
|
||||
*/
|
||||
|
||||
@@ -42,6 +42,7 @@ constexpr char AIM_GS_SERIALMODE[] {"gs.serialmode"};
|
||||
constexpr char AIM_GS_INTMODULEBAUDRATE[] {"gs.intmodulebaudrate"};
|
||||
constexpr char AIM_GS_STICKDEADZONE[] {"gs.stickdeadzone"};
|
||||
constexpr char AIM_GS_UARTSAMPLEMODE[] {"gs.uartsamplemode"};
|
||||
constexpr char AIM_GS_HATSMODE[] {"gs.hatsmode"};
|
||||
constexpr char AIM_TRAINERMIX_MODE[] {"trainermix.mode"};
|
||||
constexpr char AIM_TRAINERMIX_SRC[] {"trainermix.src"};
|
||||
|
||||
@@ -171,6 +172,14 @@ class GeneralSettings {
|
||||
UART_SAMPLE_MODE_COUNT
|
||||
};
|
||||
|
||||
enum HatsMode {
|
||||
HATSMODE_TRIMS_ONLY,
|
||||
HATSMODE_KEYS_ONLY,
|
||||
HATSMODE_SWITCHABLE,
|
||||
HATSMODE_GLOBAL,
|
||||
HATSMODE_COUNT
|
||||
};
|
||||
|
||||
GeneralSettings() { clear(); }
|
||||
void clear();
|
||||
void init();
|
||||
@@ -206,6 +215,7 @@ class GeneralSettings {
|
||||
bool disableAlarmWarning;
|
||||
bool disableRssiPoweroffAlarm;
|
||||
unsigned int usbMode;
|
||||
unsigned int hatsMode;
|
||||
unsigned int stickDeadZone;
|
||||
unsigned int jackMode;
|
||||
bool sportPower;
|
||||
@@ -311,6 +321,7 @@ class GeneralSettings {
|
||||
QString serialPortModeToString(int port_nr) const;
|
||||
QString internalModuleBaudrateToString() const;
|
||||
QString uartSampleModeToString() const;
|
||||
QString hatsModeToString() const;
|
||||
|
||||
static QString antennaModeToString(int value);
|
||||
static QString bluetoothModeToString(int value);
|
||||
@@ -319,6 +330,7 @@ class GeneralSettings {
|
||||
static FieldRange getPPM_MultiplierRange();
|
||||
static FieldRange getTxCurrentCalibration();
|
||||
static QString uartSampleModeToString(int value);
|
||||
static QString hatsModeToString(int value);
|
||||
|
||||
static AbstractStaticItemModel * antennaModeItemModel(bool model_setup = false);
|
||||
static AbstractStaticItemModel * bluetoothModeItemModel();
|
||||
@@ -326,4 +338,5 @@ class GeneralSettings {
|
||||
static AbstractStaticItemModel * internalModuleBaudrateItemModel();
|
||||
static AbstractStaticItemModel * stickDeadZoneItemModel();
|
||||
static AbstractStaticItemModel * uartSampleModeItemModel();
|
||||
static AbstractStaticItemModel * hatsModeItemModel(bool radio_setup = true);
|
||||
};
|
||||
|
||||
@@ -181,6 +181,8 @@ void ModelData::clear()
|
||||
|
||||
const char * layoutId = "Layout2P1"; // currently all using same default though might change for NV14
|
||||
RadioLayout::init(layoutId, customScreens);
|
||||
|
||||
hatsMode = GeneralSettings::HATSMODE_GLOBAL;
|
||||
}
|
||||
|
||||
bool ModelData::isEmpty() const
|
||||
|
||||
@@ -192,6 +192,7 @@ class ModelData {
|
||||
unsigned int view;
|
||||
|
||||
char registrationId[8+1];
|
||||
unsigned int hatsMode;
|
||||
|
||||
// Radio level tabs control (global settings)
|
||||
unsigned int radioThemesDisabled;
|
||||
|
||||
@@ -20,6 +20,9 @@
|
||||
|
||||
#include "generalsetup.h"
|
||||
#include "ui_generalsetup.h"
|
||||
#include "compounditemmodels.h"
|
||||
#include "filtereditemmodels.h"
|
||||
#include "autocombobox.h"
|
||||
|
||||
GeneralSetupPanel::GeneralSetupPanel(QWidget * parent, GeneralSettings & generalSettings, Firmware * firmware):
|
||||
GeneralPanel(parent, generalSettings, firmware),
|
||||
@@ -27,10 +30,12 @@ ui(new Ui::GeneralSetup)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
Board::Type board = firmware->getBoard();
|
||||
|
||||
QLabel *pmsl[] = {ui->ro_label, ui->ro1_label, ui->ro2_label, ui->ro3_label, ui->ro4_label, ui->ro5_label, ui->ro6_label, ui->ro7_label, ui->ro8_label, NULL};
|
||||
QSlider *tpmsld[] = {ui->chkSA, ui->chkSB, ui->chkSC, ui->chkSD, ui->chkSE, ui->chkSF, ui->chkSG, ui->chkSH, NULL};
|
||||
|
||||
if (IS_TARANIS(firmware->getBoard())) {
|
||||
if (IS_TARANIS(board)) {
|
||||
if (firmware->getId().contains("readonly")) {
|
||||
uint16_t switchstate = generalSettings.switchUnlockStates;
|
||||
ui->chkSA->setValue(switchstate & 0x3);
|
||||
@@ -153,14 +158,14 @@ ui(new Ui::GeneralSetup)
|
||||
|
||||
ui->timezoneLE->setTime((generalSettings.timezone * 3600) + (generalSettings.timezoneMinutes/*quarter hours*/ * 15 * 60));
|
||||
|
||||
if (IS_HORUS_OR_TARANIS(firmware->getBoard())) {
|
||||
if (IS_HORUS_OR_TARANIS(board)) {
|
||||
ui->adjustRTC->setChecked(generalSettings.adjustRTC);
|
||||
}
|
||||
else {
|
||||
ui->adjustRTC->hide();
|
||||
}
|
||||
|
||||
if (IS_STM32(firmware->getBoard())) {
|
||||
if (IS_STM32(board)) {
|
||||
ui->usbModeCB->setCurrentIndex(generalSettings.usbMode);
|
||||
}
|
||||
else {
|
||||
@@ -168,6 +173,15 @@ ui(new Ui::GeneralSetup)
|
||||
ui->usbModeCB->hide();
|
||||
}
|
||||
|
||||
if (IS_FLYSKY_EL18(board) || IS_FLYSKY_NV14(board)) {
|
||||
ui->hatsModeCB->setModel(new FilteredItemModel(GeneralSettings::hatsModeItemModel()));
|
||||
ui->hatsModeCB->setField(generalSettings.hatsMode, this);
|
||||
}
|
||||
else {
|
||||
ui->hatsModeLabel->hide();
|
||||
ui->hatsModeCB->hide();
|
||||
}
|
||||
|
||||
if (firmware->getCapability(HasSwitchableJack)) {
|
||||
ui->jackModeCB->setCurrentIndex(generalSettings.jackMode);
|
||||
}
|
||||
@@ -200,13 +214,13 @@ ui(new Ui::GeneralSetup)
|
||||
ui->label_BLBright->hide();
|
||||
}
|
||||
|
||||
if (!IS_FAMILY_HORUS_OR_T16(firmware->getBoard())) {
|
||||
if (!IS_FAMILY_HORUS_OR_T16(board)) {
|
||||
ui->OFFBright_SB->hide();
|
||||
ui->OFFBright_SB->setDisabled(true);
|
||||
ui->label_OFFBright->hide();
|
||||
}
|
||||
|
||||
if (!IS_JUMPER_T18(firmware->getBoard())) {
|
||||
if (!IS_JUMPER_T18(board)) {
|
||||
ui->keysBl_ChkB->hide();
|
||||
ui->keysBl_ChkB->setDisabled(true);
|
||||
ui->label_KeysBl->hide();
|
||||
@@ -262,7 +276,7 @@ ui(new Ui::GeneralSetup)
|
||||
ui->pwrOffDelayLabel->hide();
|
||||
ui->pwrOffDelay->hide();
|
||||
}
|
||||
else if (!IS_TARANIS(firmware->getBoard())) {
|
||||
else if (!IS_TARANIS(board)) {
|
||||
ui->pwrOnDelayLabel->hide();
|
||||
ui->pwrOnDelay->hide();
|
||||
}
|
||||
@@ -279,7 +293,7 @@ ui(new Ui::GeneralSetup)
|
||||
connect(tpmsld[i], SIGNAL(valueChanged(int)),this,SLOT(unlockSwitchEdited()));
|
||||
}
|
||||
|
||||
if (!IS_HORUS_OR_TARANIS(firmware->getBoard())) {
|
||||
if (!IS_HORUS_OR_TARANIS(board)) {
|
||||
ui->stickReverse1->setChecked(generalSettings.stickReverse & (1 << 0));
|
||||
ui->stickReverse2->setChecked(generalSettings.stickReverse & (1 << 1));
|
||||
ui->stickReverse3->setChecked(generalSettings.stickReverse & (1 << 2));
|
||||
@@ -297,7 +311,7 @@ ui(new Ui::GeneralSetup)
|
||||
ui->stickReverse4->hide();
|
||||
}
|
||||
|
||||
if (IS_TARANIS_PLUS(firmware->getBoard())) {
|
||||
if (IS_TARANIS_PLUS(board)) {
|
||||
ui->backlightColor_SL->setValue(generalSettings.backlightColor);
|
||||
}
|
||||
else {
|
||||
@@ -396,7 +410,6 @@ void GeneralSetupPanel::on_jackModeCB_currentIndexChanged(int index)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GeneralSetupPanel::on_backlightColor_SL_valueChanged()
|
||||
{
|
||||
if (!lock) {
|
||||
|
||||
@@ -1682,6 +1682,16 @@ p, li { white-space: pre-wrap; }
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="25" column="0">
|
||||
<widget class="QLabel" name="hatsModeLabel">
|
||||
<property name="text">
|
||||
<string>Hats Mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="25" column="1">
|
||||
<widget class="AutoComboBox" name="hatsModeCB"/>
|
||||
</item>
|
||||
<item row="20" column="0">
|
||||
<widget class="QLabel" name="units_label">
|
||||
<property name="text">
|
||||
|
||||
@@ -36,6 +36,7 @@ constexpr char FIM_TIMERSWITCH[] {"Timer Switch"};
|
||||
constexpr char FIM_THRSOURCE[] {"Throttle Source"};
|
||||
constexpr char FIM_TRAINERMODE[] {"Trainer Mode"};
|
||||
constexpr char FIM_ANTENNAMODE[] {"Antenna Mode"};
|
||||
constexpr char FIM_HATSMODE[] {"Hats Mode"};
|
||||
|
||||
TimerPanel::TimerPanel(QWidget * parent, ModelData & model, TimerData & timer, GeneralSettings & generalSettings, Firmware * firmware,
|
||||
QWidget * prevFocus, FilteredItemModelFactory * panelFilteredModels, CompoundItemModelFactory * panelItemModels):
|
||||
@@ -1474,6 +1475,8 @@ SetupPanel::SetupPanel(QWidget * parent, ModelData & model, GeneralSettings & ge
|
||||
panelItemModels->registerItemModel(TimerData::persistentItemModel());
|
||||
panelItemModels->registerItemModel(TimerData::modeItemModel());
|
||||
panelItemModels->registerItemModel(TimerData::showElapsedItemModel());
|
||||
panelFilteredModels->registerItemModel(new FilteredItemModel(GeneralSettings::hatsModeItemModel(false)), FIM_HATSMODE);
|
||||
|
||||
Board::Type board = firmware->getBoard();
|
||||
|
||||
memset(modules, 0, sizeof(modules));
|
||||
@@ -1693,6 +1696,15 @@ SetupPanel::SetupPanel(QWidget * parent, ModelData & model, GeneralSettings & ge
|
||||
|
||||
ui->trimsDisplay->setField(model.trimsDisplay, this);
|
||||
|
||||
if (IS_FLYSKY_EL18(board) || IS_FLYSKY_NV14(board)) {
|
||||
ui->cboHatsMode->setModel(panelFilteredModels->getItemModel(FIM_HATSMODE));
|
||||
ui->cboHatsMode->setField(model.hatsMode, this);
|
||||
}
|
||||
else {
|
||||
ui->lblHatsMode->hide();
|
||||
ui->cboHatsMode->hide();
|
||||
}
|
||||
|
||||
if (Boards::getCapability(firmware->getBoard(), Board::FunctionSwitches) > 0) {
|
||||
funcswitches = new FunctionSwitchesPanel(this, model, generalSettings, firmware);
|
||||
ui->functionSwitchesLayout->addWidget(funcswitches);
|
||||
|
||||
@@ -184,7 +184,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignRight">
|
||||
<widget class="QLabel" name="label_spacer">
|
||||
<widget class="QLabel" name="lblHatsMode">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>50</weight>
|
||||
@@ -192,7 +192,7 @@
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
<string>Hats Mode</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
@@ -627,6 +627,9 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="AutoComboBox" name="cboHatsMode"/>
|
||||
</item>
|
||||
<item row="2" column="4">
|
||||
<widget class="QPushButton" name="editText">
|
||||
<property name="sizePolicy">
|
||||
|
||||
@@ -840,6 +840,10 @@ QString ModelPrinter::printSettingsTrim()
|
||||
str << printLabelValue(tr("Step"), printTrimIncrementMode());
|
||||
str << printLabelValue(tr("Display"), printTrimsDisplayMode());
|
||||
str << printLabelValue(tr("Extended"), printBoolean(model.extendedTrims, BOOLEAN_YESNO));
|
||||
Board::Type board = firmware->getBoard();
|
||||
if (IS_FLYSKY_EL18(board) || IS_FLYSKY_NV14(board)) {
|
||||
str << printLabelValue(tr("Hats Mode"), printHatsMode());
|
||||
}
|
||||
return str.join(" ");
|
||||
}
|
||||
|
||||
@@ -869,6 +873,22 @@ QString ModelPrinter::printTrimsDisplayMode()
|
||||
}
|
||||
}
|
||||
|
||||
QString ModelPrinter::printHatsMode()
|
||||
{
|
||||
switch (model.hatsMode) {
|
||||
case GeneralSettings::HATSMODE_TRIMS_ONLY:
|
||||
return tr("Trims only");
|
||||
case GeneralSettings::HATSMODE_KEYS_ONLY:
|
||||
return tr("Keys only");
|
||||
case GeneralSettings::HATSMODE_SWITCHABLE:
|
||||
return tr("Switchable");
|
||||
case GeneralSettings::HATSMODE_GLOBAL:
|
||||
return tr("Global");
|
||||
default:
|
||||
return CPN_STR_UNKNOWN_ITEM;
|
||||
}
|
||||
}
|
||||
|
||||
QString ModelPrinter::printModuleType(int idx)
|
||||
{
|
||||
return ModuleData::indexToString(idx, firmware);
|
||||
|
||||
@@ -79,6 +79,7 @@ class ModelPrinter: public QObject
|
||||
QString printModuleType(int idx);
|
||||
QString printThrottleSource(int idx);
|
||||
QString printTrimsDisplayMode();
|
||||
QString printHatsMode();
|
||||
QString printSettingsTrim();
|
||||
QString printSwitchWarnings();
|
||||
QString printPotWarnings();
|
||||
|
||||
@@ -5621,6 +5621,31 @@ Použitelné hodnoty jsou 5v..10v {3v?} {12v?}</translation>
|
||||
<source>USB Serial (CDC)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2430"/>
|
||||
<source>Hats Mode</source>
|
||||
<translation>Režim kloboučků</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2441"/>
|
||||
<source>Trims only</source>
|
||||
<translation>Pouze trimy</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2446"/>
|
||||
<source>Keys only</source>
|
||||
<translation>Pouze tlačítka</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2451"/>
|
||||
<source>Switchable</source>
|
||||
<translation>Přepinatelné</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2451"/>
|
||||
<source>Global</source>
|
||||
<translation>Globální</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2405"/>
|
||||
<source>Stick Mode</source>
|
||||
|
||||
@@ -6035,6 +6035,31 @@ Tilstand 4:
|
||||
<source>USB Serial (CDC)</source>
|
||||
<translation>Seriel USB (CDC)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2430"/>
|
||||
<source>Hats Mode</source>
|
||||
<translation>Joystik indstilling</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2441"/>
|
||||
<source>Trims only</source>
|
||||
<translation>Kun trim</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2446"/>
|
||||
<source>Keys only</source>
|
||||
<translation>Kun knap</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2451"/>
|
||||
<source>Switchable</source>
|
||||
<translation>Trim / Knap</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2451"/>
|
||||
<source>Global</source>
|
||||
<translation>Global</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="1038"/>
|
||||
<source>Owner Registration ID</source>
|
||||
|
||||
@@ -5596,6 +5596,31 @@ Werte liegen zwischen 5-10V {3v?} {12v?}</translation>
|
||||
<source>USB Serial (CDC)</source>
|
||||
<translation>USB Serial (CDC)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2430"/>
|
||||
<source>Hats Mode</source>
|
||||
<translation>Joystick Modus</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2441"/>
|
||||
<source>Trims only</source>
|
||||
<translation>Nur Trimmung</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2446"/>
|
||||
<source>Keys only</source>
|
||||
<translation>Nur Tasten</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2451"/>
|
||||
<source>Switchable</source>
|
||||
<translation>Umschaltbar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2451"/>
|
||||
<source>Global</source>
|
||||
<translation>Global</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2405"/>
|
||||
<source>Stick Mode</source>
|
||||
|
||||
@@ -5351,6 +5351,26 @@ Mode 4:
|
||||
<source>USB Serial (CDC)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2430"/>
|
||||
<source>Hats Mode</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2441"/>
|
||||
<source>Trims only</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2446"/>
|
||||
<source>Keys only</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2451"/>
|
||||
<source>Switchable</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="1390"/>
|
||||
<source><html><head/><body><p>Channel order</p><p><br/></p><p>Defines the order of the default mixes created on a new model.</p></body></html></source>
|
||||
|
||||
@@ -5670,6 +5670,26 @@ Los valores aceptables son 5v..10v {3v?} {12v?}</translation>
|
||||
<source>USB Serial (CDC)</source>
|
||||
<translation>USB Serial (CDC)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2430"/>
|
||||
<source>Hats Mode</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2441"/>
|
||||
<source>Trims only</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2446"/>
|
||||
<source>Keys only</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2451"/>
|
||||
<source>Switchable</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2405"/>
|
||||
<source>Stick Mode</source>
|
||||
|
||||
@@ -5649,6 +5649,26 @@ Hyväksytty arvo: 5v - 10v {3v?} {12v?}</translation>
|
||||
<source>USB Serial (CDC)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2430"/>
|
||||
<source>Hats Mode</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2441"/>
|
||||
<source>Trims only</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2446"/>
|
||||
<source>Keys only</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2451"/>
|
||||
<source>Switchable</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2405"/>
|
||||
<source>Stick Mode</source>
|
||||
|
||||
@@ -5648,6 +5648,31 @@ Plage de valeurs: 3v...12v</translation>
|
||||
<source>USB Serial (CDC)</source>
|
||||
<translation>Port série USB (Debug)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2430"/>
|
||||
<source>Hats Mode</source>
|
||||
<translation>Mode joystick</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2441"/>
|
||||
<source>Trims only</source>
|
||||
<translation>Trims uniquement</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2446"/>
|
||||
<source>Keys only</source>
|
||||
<translation>Touches uniquement</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2451"/>
|
||||
<source>Switchable</source>
|
||||
<translation>Commutable</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2451"/>
|
||||
<source>Global</source>
|
||||
<translation>Global</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2405"/>
|
||||
<source>Stick Mode</source>
|
||||
|
||||
@@ -5815,6 +5815,31 @@ p, li { white-space: pre-wrap; }
|
||||
<source>USB Serial (CDC)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2430"/>
|
||||
<source>Hats Mode</source>
|
||||
<translation>מצב כובעונים</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2441"/>
|
||||
<source>Trims only</source>
|
||||
<translation>קיזוזים בלבד</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2446"/>
|
||||
<source>Keys only</source>
|
||||
<translation>ניווט בלבד</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2451"/>
|
||||
<source>Switchable</source>
|
||||
<translation>משולב</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2451"/>
|
||||
<source>Global</source>
|
||||
<translation>גלובאלי</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2443"/>
|
||||
<source>Measurement Units</source>
|
||||
|
||||
@@ -5614,6 +5614,31 @@ Mode 4:
|
||||
<source>USB Serial (CDC)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2430"/>
|
||||
<source>Hats Mode</source>
|
||||
<translation>Modo joystick</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2441"/>
|
||||
<source>Trims only</source>
|
||||
<translation>Solo trims</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2446"/>
|
||||
<source>Keys only</source>
|
||||
<translation>Solo keys</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2451"/>
|
||||
<source>Switchable</source>
|
||||
<translation>Commutabile</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2451"/>
|
||||
<source>Global</source>
|
||||
<translation>Globale</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2405"/>
|
||||
<source>Stick Mode</source>
|
||||
|
||||
@@ -5977,6 +5977,31 @@ Mode 4:
|
||||
<source>USB Serial (CDC)</source>
|
||||
<translation>USBシリアル (CDC)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2430"/>
|
||||
<source>Hats Mode</source>
|
||||
<translation>アナログスティック</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2441"/>
|
||||
<source>Trims only</source>
|
||||
<translation>トリムのみ</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2446"/>
|
||||
<source>Keys only</source>
|
||||
<translation>キーのみ</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2451"/>
|
||||
<source>Switchable</source>
|
||||
<translation>スイッチ</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2451"/>
|
||||
<source>Global</source>
|
||||
<translation>すべて</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>GeneralSetupPanel</name>
|
||||
|
||||
@@ -5815,6 +5815,26 @@ p, li { white-space: pre-wrap; }
|
||||
<source>USB Serial (CDC)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2430"/>
|
||||
<source>Hats Mode</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2441"/>
|
||||
<source>Trims only</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2446"/>
|
||||
<source>Keys only</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2451"/>
|
||||
<source>Switchable</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2443"/>
|
||||
<source>Measurement Units</source>
|
||||
|
||||
@@ -5949,6 +5949,31 @@ Dopuszczalne wartości 5v-10v {3v?} {12v?}</translation>
|
||||
<source>USB Serial (CDC)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2430"/>
|
||||
<source>Hats Mode</source>
|
||||
<translation>Tryb grzybków</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2441"/>
|
||||
<source>Trims only</source>
|
||||
<translation>Tylko trymy</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2446"/>
|
||||
<source>Keys only</source>
|
||||
<translation>Tylko przyciski</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2451"/>
|
||||
<source>Switchable</source>
|
||||
<translation>Przełączane</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2451"/>
|
||||
<source>Global</source>
|
||||
<translation>Globalne</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="730"/>
|
||||
<source>Stick reverse</source>
|
||||
|
||||
@@ -5815,6 +5815,26 @@ p, li { white-space: pre-wrap; }
|
||||
<source>USB Serial (CDC)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2430"/>
|
||||
<source>Hats Mode</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2441"/>
|
||||
<source>Trims only</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2446"/>
|
||||
<source>Keys only</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2451"/>
|
||||
<source>Switchable</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2443"/>
|
||||
<source>Measurement Units</source>
|
||||
|
||||
@@ -5873,6 +5873,26 @@ p, li { white-space: pre-wrap; }
|
||||
<source>USB Serial (CDC)</source>
|
||||
<translation>Последовательный порт</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2430"/>
|
||||
<source>Hats Mode</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2441"/>
|
||||
<source>Trims only</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2446"/>
|
||||
<source>Keys only</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2451"/>
|
||||
<source>Switchable</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2443"/>
|
||||
<source>Measurement Units</source>
|
||||
|
||||
@@ -6026,7 +6026,31 @@ Mode 4:
|
||||
<translation>Seriell USB (CDC)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="1038"/>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2430"/>
|
||||
<source>Hats Mode</source>
|
||||
<translation>Hattläge</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2441"/>
|
||||
<source>Trims only</source>
|
||||
<translation>Endast trimm</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2446"/>
|
||||
<source>Keys only</source>
|
||||
<translation>Endast knapp</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2451"/>
|
||||
<source>Switchable</source>
|
||||
<translation>Ändringsbar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2451"/>
|
||||
<source>Global</source>
|
||||
<translation>Global</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Owner Registration ID</source>
|
||||
<translation>ID för ägarregistrering</translation>
|
||||
</message>
|
||||
|
||||
@@ -5703,6 +5703,31 @@ Acceptable values are 3v..12v</source>
|
||||
<source>USB Serial (CDC)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2430"/>
|
||||
<source>Hats Mode</source>
|
||||
<translation>按键帽模式</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2441"/>
|
||||
<source>Trims only</source>
|
||||
<translation>微调</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2446"/>
|
||||
<source>Keys only</source>
|
||||
<translation>导航键</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2451"/>
|
||||
<source>Switchable</source>
|
||||
<translation>可切换</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2451"/>
|
||||
<source>Global</source>
|
||||
<translation>全局</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2405"/>
|
||||
<source>Stick Mode</source>
|
||||
|
||||
@@ -5703,6 +5703,31 @@ Acceptable values are 3v..12v</source>
|
||||
<source>USB Serial (CDC)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2430"/>
|
||||
<source>Hats Mode</source>
|
||||
<translation>按鍵帽模式</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2441"/>
|
||||
<source>Trims only</source>
|
||||
<translation>微調</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2446"/>
|
||||
<source>Keys only</source>
|
||||
<translation>導航鍵</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2451"/>
|
||||
<source>Switchable</source>
|
||||
<translation>可切換</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2451"/>
|
||||
<source>Global</source>
|
||||
<translation>全局</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../generaledit/generalsetup.ui" line="2405"/>
|
||||
<source>Stick Mode</source>
|
||||
|
||||
@@ -658,6 +658,13 @@ enum BluetoothModes {
|
||||
#endif
|
||||
};
|
||||
|
||||
enum HatsMode {
|
||||
HATSMODE_TRIMS_ONLY,
|
||||
HATSMODE_KEYS_ONLY,
|
||||
HATSMODE_SWITCHABLE,
|
||||
HATSMODE_GLOBAL
|
||||
};
|
||||
|
||||
enum UartSampleModes {
|
||||
UART_SAMPLE_MODE_NORMAL = 0,
|
||||
UART_SAMPLE_MODE_ONEBIT,
|
||||
|
||||
@@ -679,7 +679,8 @@ PACK(struct ModelData {
|
||||
uint8_t disableTelemetryWarning:1;
|
||||
uint8_t showInstanceIds:1;
|
||||
uint8_t checklistInteractive:1;
|
||||
uint8_t spare3:4 SKIP; // padding to 8-bit aligment
|
||||
NOBACKUP(uint8_t hatsMode:2 ENUM(HatsMode));
|
||||
uint8_t spare3:2 SKIP; // padding to 8-bit aligment
|
||||
int8_t customThrottleWarningPosition;
|
||||
BeepANACenter beepANACenter;
|
||||
MixData mixData[MAX_MIXERS] NO_IDX;
|
||||
@@ -841,7 +842,8 @@ PACK(struct RadioData {
|
||||
// Real attributes
|
||||
NOBACKUP(uint8_t manuallyEdited:1);
|
||||
int8_t timezoneMinutes:3; // -3 to +3 ==> (-45 to 45 minutes in 15 minute increments)
|
||||
NOBACKUP(int8_t spare0:4 SKIP);
|
||||
NOBACKUP(uint8_t hatsMode:2 ENUM(HatsMode));
|
||||
NOBACKUP(int8_t spare0:2 SKIP);
|
||||
CUST_ATTR(semver,nullptr,w_semver);
|
||||
CUST_ATTR(board,nullptr,w_board);
|
||||
CalibData calib[MAX_CALIB_ANALOG_INPUTS] NO_IDX;
|
||||
|
||||
@@ -235,7 +235,27 @@ extern "C" void touchDriverRead(lv_indev_drv_t *drv, lv_indev_data_t *data)
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||
#if defined(USE_HATS_AS_KEYS)
|
||||
|
||||
int16_t getEmuRotaryData();
|
||||
|
||||
static void rotaryDriverRead(lv_indev_drv_t *drv, lv_indev_data_t *data)
|
||||
{
|
||||
int16_t diff = getEmuRotaryData();
|
||||
|
||||
if(diff != 0) {
|
||||
reset_inactivity();
|
||||
audioKeyPress();
|
||||
|
||||
data->enc_diff = diff;
|
||||
data->state = LV_INDEV_STATE_RELEASED;
|
||||
}
|
||||
}
|
||||
|
||||
// libopenui_depends.h
|
||||
int8_t rotaryEncoderGetAccel() { return 0; }
|
||||
|
||||
#elif defined(ROTARY_ENCODER_NAVIGATION)
|
||||
extern volatile uint32_t rotencDt;
|
||||
static int8_t _rotary_enc_accel = 0;
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ RadioGhostModuleConfig::RadioGhostModuleConfig(uint8_t moduleIdx) :
|
||||
lv_group_set_editing(lv_group_get_default(), true);
|
||||
lv_obj_add_event_cb(lvobj, ghostmoduleconfig_cb, LV_EVENT_KEY, this);
|
||||
#if defined(TRIMS_EMULATE_BUTTONS)
|
||||
setTrimsAsButtons(true); // Use trim joysticks to operate menu (e.g. on NV14)
|
||||
setHatsAsKeys(true); // Use trim joysticks to operate menu (e.g. on NV14)
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ void RadioGhostModuleConfig::onEvent(event_t event)
|
||||
RTOS_WAIT_MS(10);
|
||||
Page::onEvent(event);
|
||||
#if defined(TRIMS_EMULATE_BUTTONS)
|
||||
setTrimsAsButtons(false); // switch trims back to normal
|
||||
setHatsAsKeys(false); // switch trims back to normal
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
@@ -175,7 +175,7 @@ void RadioGhostModuleConfig::checkEvents()
|
||||
RTOS_WAIT_MS(10);
|
||||
deleteLater();
|
||||
#if defined(TRIMS_EMULATE_BUTTONS)
|
||||
setTrimsAsButtons(false); // switch trims back to normal
|
||||
setHatsAsKeys(false); // switch trims back to normal
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -803,7 +803,7 @@ void RadioSetupPage::build(FormWindow * window)
|
||||
new Choice(line, rect_t{}, STR_USBMODES, USB_UNSELECTED_MODE, USB_MAX_MODE,
|
||||
GET_SET_DEFAULT(g_eeGeneral.USBMode));
|
||||
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION) && !defined(USE_HATS_AS_KEYS)
|
||||
line = window->newLine(&grid);
|
||||
new StaticText(line, rect_t{}, STR_ROTARY_ENC_MODE, 0, COLOR_THEME_PRIMARY1);
|
||||
new Choice(line, rect_t{}, STR_ROTARY_ENC_OPT, ROTARY_ENCODER_MODE_NORMAL,
|
||||
@@ -811,6 +811,13 @@ void RadioSetupPage::build(FormWindow * window)
|
||||
GET_SET_DEFAULT(g_eeGeneral.rotEncMode));
|
||||
#endif
|
||||
|
||||
#if defined(USE_HATS_AS_KEYS)
|
||||
line = window->newLine(&grid);
|
||||
new StaticText(line, rect_t{}, STR_HATSMODE, 0, COLOR_THEME_PRIMARY1);
|
||||
new Choice(line, rect_t{}, STR_HATSOPT, HATSMODE_TRIMS_ONLY, HATSMODE_SWITCHABLE,
|
||||
GET_SET_DEFAULT(g_eeGeneral.hatsMode));
|
||||
#endif
|
||||
|
||||
// RX channel order
|
||||
line = window->newLine(&grid);
|
||||
new StaticText(line, rect_t{}, STR_DEF_CHAN_ORD, 0,
|
||||
|
||||
@@ -274,7 +274,7 @@ void TabsGroup::onEvent(event_t event)
|
||||
#if defined(HARDWARE_KEYS)
|
||||
TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString().c_str(), event);
|
||||
|
||||
#if defined(KEYS_GPIO_REG_PAGEUP)
|
||||
#if defined(KEYS_GPIO_REG_PAGEUP) || defined(USE_HATS_AS_KEYS)
|
||||
if (event == EVT_KEY_FIRST(KEY_PAGEDN)) {
|
||||
#else
|
||||
if (event == EVT_KEY_BREAK(KEY_PAGEDN)) {
|
||||
@@ -283,7 +283,7 @@ void TabsGroup::onEvent(event_t event)
|
||||
uint8_t current = header.carousel.getCurrentIndex() + 1;
|
||||
setCurrentTab(current >= tabs.size() ? 0 : current);
|
||||
}
|
||||
#if defined(KEYS_GPIO_REG_PAGEUP)
|
||||
#if defined(KEYS_GPIO_REG_PAGEUP) || defined(USE_HATS_AS_KEYS)
|
||||
else if (event == EVT_KEY_FIRST(KEY_PAGEUP)) {
|
||||
#else
|
||||
else if (event == EVT_KEY_LONG(KEY_PAGEDN)) {
|
||||
|
||||
@@ -55,6 +55,14 @@ TrimsSetup::TrimsSetup() : Page(ICON_MODEL_SETUP)
|
||||
auto btn_obj = btn->getLvObj();
|
||||
lv_obj_set_width(btn_obj, lv_pct(100));
|
||||
|
||||
#if defined(USE_HATS_AS_KEYS)
|
||||
// Hats mode for NV14/EL18
|
||||
line = body.newLine(&grid);
|
||||
new StaticText(line, rect_t{}, STR_HATSMODE, 0, COLOR_THEME_PRIMARY1);
|
||||
new Choice(line, rect_t{}, STR_HATSOPT, HATSMODE_TRIMS_ONLY, HATSMODE_GLOBAL,
|
||||
GET_SET_DEFAULT(g_model.hatsMode));
|
||||
#endif
|
||||
|
||||
// Trim step
|
||||
line = body.newLine(&grid);
|
||||
new StaticText(line, rect_t{}, STR_TRIMINC, 0,
|
||||
|
||||
@@ -280,7 +280,7 @@ void ViewMain::onEvent(event_t event)
|
||||
new ScreenMenu();
|
||||
break;
|
||||
|
||||
#if defined(KEYS_GPIO_REG_PAGEUP)
|
||||
#if defined(KEYS_GPIO_REG_PAGEUP) || defined(USE_HATS_AS_KEYS)
|
||||
case EVT_KEY_FIRST(KEY_PAGEDN):
|
||||
#else
|
||||
case EVT_KEY_BREAK(KEY_PAGEDN):
|
||||
@@ -293,7 +293,7 @@ void ViewMain::onEvent(event_t event)
|
||||
|
||||
//TODO: these need to go away!
|
||||
// -> board code should map the keys as required
|
||||
#if defined(KEYS_GPIO_REG_PAGEUP)
|
||||
#if defined(KEYS_GPIO_REG_PAGEUP) || defined(USE_HATS_AS_KEYS)
|
||||
case EVT_KEY_FIRST(KEY_PAGEUP):
|
||||
#else
|
||||
case EVT_KEY_LONG(KEY_PAGEDN):
|
||||
|
||||
+115
-17
@@ -18,6 +18,9 @@
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
#if !defined(BOOT) && defined(USE_HATS_AS_KEYS)
|
||||
#include "opentx.h"
|
||||
#endif
|
||||
|
||||
#include "keys.h"
|
||||
|
||||
@@ -290,27 +293,121 @@ uint8_t keysGetTrimState(uint8_t trim)
|
||||
return trim_keys[trim].pressed();
|
||||
}
|
||||
|
||||
#if defined(USE_TRIMS_AS_BUTTONS)
|
||||
#if defined(USE_HATS_AS_KEYS)
|
||||
#define ROTARY_EMU_KEY_REPEAT_RATE 12 // times 10 [ms]
|
||||
|
||||
static bool _trims_as_buttons = false;
|
||||
static bool _trims_as_buttons_LUA = false;
|
||||
|
||||
void setTrimsAsButtons(bool val) { _trims_as_buttons = val; }
|
||||
bool getTrimsAsButtons() { return _trims_as_buttons; }
|
||||
void setHatsAsKeys(bool val) { _trims_as_buttons = val; }
|
||||
bool getHatsAsKeys() { return _trims_as_buttons; }
|
||||
|
||||
static uint32_t transpose_trims()
|
||||
void setTransposeHatsForLUA(bool val) { _trims_as_buttons_LUA = val; }
|
||||
bool getTransposeHatsForLUA() { return _trims_as_buttons_LUA; }
|
||||
|
||||
int16_t getEmuRotaryData()
|
||||
{
|
||||
uint32_t keys = 0;
|
||||
static bool rotaryTrimPressed = false;
|
||||
static tmr10ms_t timePressed = 0;
|
||||
|
||||
if (getHatsAsKeys() || getTransposeHatsForLUA()) {
|
||||
tmr10ms_t now = get_tmr10ms();
|
||||
|
||||
if (rotaryTrimPressed) {
|
||||
if (now < (timePressed + ROTARY_EMU_KEY_REPEAT_RATE)) return 0;
|
||||
|
||||
rotaryTrimPressed = false;
|
||||
}
|
||||
|
||||
auto trims = readTrims();
|
||||
|
||||
if (trims & (1 << 4)) {
|
||||
rotaryTrimPressed = true;
|
||||
timePressed = now;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (trims & (1 << 5)) {
|
||||
rotaryTrimPressed = true;
|
||||
timePressed = now;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void transpose_trims(uint32_t *keys)
|
||||
{
|
||||
#if defined(BOOT)
|
||||
auto trims = readTrims();
|
||||
|
||||
if (trims & (1 << 0)) keys |= 1 << KEY_SYS;
|
||||
if (trims & (1 << 1)) keys |= 1 << KEY_TELE;
|
||||
if (trims & (1 << 2)) keys |= 1 << KEY_PAGEUP;
|
||||
if (trims & (1 << 3)) keys |= 1 << KEY_PAGEDN;
|
||||
if (trims & (1 << 4)) keys |= 1 << KEY_DOWN;
|
||||
if (trims & (1 << 5)) keys |= 1 << KEY_UP;
|
||||
if (trims & (1 << 6)) keys |= 1 << KEY_LEFT;
|
||||
if (trims & (1 << 7)) keys |= 1 << KEY_RIGHT;
|
||||
if (trims & (1 << 4)) *keys |= 1 << KEY_DOWN; // right hat, down 0x10
|
||||
if (trims & (1 << 5)) *keys |= 1 << KEY_UP; // right hat, up 0x20
|
||||
#else
|
||||
static uint8_t state = 0;
|
||||
|
||||
return keys;
|
||||
bool allowModeSwitch = ((g_model.hatsMode == HATSMODE_GLOBAL &&
|
||||
g_eeGeneral.hatsMode == HATSMODE_SWITCHABLE) ||
|
||||
(g_model.hatsMode == HATSMODE_SWITCHABLE)) &&
|
||||
!getTransposeHatsForLUA();
|
||||
|
||||
if (allowModeSwitch) {
|
||||
static bool lastExitState = false;
|
||||
static bool lastEnterState = false;
|
||||
|
||||
bool exitState =
|
||||
*keys & (1 << KEY_EXIT); // edge detection for EXIT and ENTER keys
|
||||
bool enterState = *keys & (1 << KEY_ENTER);
|
||||
|
||||
bool exitPressed = !lastExitState && exitState;
|
||||
bool exitReleased = lastExitState && !exitState;
|
||||
bool enterPressed = !lastEnterState && enterState;
|
||||
|
||||
lastExitState = exitState;
|
||||
lastEnterState = enterState;
|
||||
|
||||
switch (state) {
|
||||
case 0: // idle state waiting for EXIT or ENTER key
|
||||
if (exitPressed) {
|
||||
state = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1: // state EXIT received
|
||||
if (exitReleased) { // if exit released go back to idle state
|
||||
state = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (enterPressed) { // ENTER received with EXIT still pressed
|
||||
setHatsAsKeys(!getHatsAsKeys()); // change mode and don't forward
|
||||
// EXIT and ENTER keys
|
||||
killEvents(KEY_EXIT);
|
||||
killEvents(KEY_ENTER);
|
||||
state = 0; // go to for EXIT to be released
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else
|
||||
state = 0; // state machine in idle if not in mode "BOTH"
|
||||
|
||||
if (getHatsAsKeys() || // map hats to keys in button mode or LUA active
|
||||
getTransposeHatsForLUA()) {
|
||||
auto trims = readTrims();
|
||||
|
||||
// spare key in buttons mode: left hat left
|
||||
// if (trims & (1 << 0)) *keys |= 1 << tbd; // left hat, left 0x01
|
||||
if (trims & (1 << 1)) *keys |= 1 << KEY_MODEL; // left hat, right 0x02
|
||||
if (trims & (1 << 2)) *keys |= 1 << KEY_TELE; // left hat, down 0x04
|
||||
if (trims & (1 << 3)) *keys |= 1 << KEY_SYS; // left hat, up 0x08
|
||||
|
||||
if (trims & (1 << 6)) *keys |= 1 << KEY_PAGEUP; // rht, left 0x40
|
||||
if (trims & (1 << 7)) *keys |= 1 << KEY_PAGEDN; // rht, right 0x80
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -319,9 +416,10 @@ bool keysPollingCycle()
|
||||
uint32_t trims_input;
|
||||
uint32_t keys_input = readKeys();
|
||||
|
||||
#if defined(USE_TRIMS_AS_BUTTONS)
|
||||
if (getTrimsAsButtons()) {
|
||||
keys_input |= transpose_trims();
|
||||
#if defined(USE_HATS_AS_KEYS)
|
||||
transpose_trims(&keys_input);
|
||||
|
||||
if (getHatsAsKeys() || getTransposeHatsForLUA()) {
|
||||
trims_input = 0;
|
||||
} else {
|
||||
trims_input = readTrims();
|
||||
|
||||
+5
-3
@@ -180,9 +180,11 @@ uint8_t keysGetTrimState(uint8_t trim);
|
||||
bool keysPollingCycle();
|
||||
bool rotaryEncoderPollingCycle();
|
||||
|
||||
#if defined(USE_TRIMS_AS_BUTTONS)
|
||||
void setTrimsAsButtons(bool val);
|
||||
bool getTrimsAsButtons();
|
||||
#if defined(USE_HATS_AS_KEYS)
|
||||
void setHatsAsKeys(bool val);
|
||||
bool getHatsAsKeys();
|
||||
void setTransposeHatsForLUA(bool val);
|
||||
bool getTransposeHatsForLUA();
|
||||
#endif
|
||||
|
||||
struct InactivityData
|
||||
|
||||
@@ -886,7 +886,7 @@ Return rotary encoder mode
|
||||
*/
|
||||
static int luaGetRotEncMode(lua_State * L)
|
||||
{
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION) && !defined(USE_HATS_AS_KEYS)
|
||||
lua_pushunsigned(L, g_eeGeneral.rotEncMode);
|
||||
#else
|
||||
lua_pushunsigned(L, 0);
|
||||
@@ -3030,7 +3030,7 @@ LROT_BEGIN(etxcst, NULL, 0)
|
||||
#endif
|
||||
|
||||
// Virtual events
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION) || defined(USE_TRIMS_AS_BUTTOS)
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_PREV, EVT_ROTARY_LEFT )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_NEXT, EVT_ROTARY_RIGHT )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_DEC, EVT_ROTARY_LEFT )
|
||||
@@ -3090,12 +3090,9 @@ LROT_BEGIN(etxcst, NULL, 0)
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_ENTER_LONG, EVT_KEY_LONG(KEY_ENTER) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_EXIT, EVT_KEY_BREAK(KEY_EXIT) )
|
||||
#elif defined(COLORLCD)
|
||||
#if defined(KEYS_GPIO_REG_PAGEUP)
|
||||
#if defined(KEYS_GPIO_REG_PAGEUP) || defined(USE_HATS_AS_KEYS)
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_PREV_PAGE, EVT_KEY_BREAK(KEY_PAGEUP) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_NEXT_PAGE, EVT_KEY_BREAK(KEY_PAGEDN) )
|
||||
#elif defined(PCBNV14)
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_PREV_PAGE, EVT_KEY_BREAK(KEY_LEFT) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_NEXT_PAGE, EVT_KEY_BREAK(KEY_RIGHT) )
|
||||
#else
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_PREV_PAGE, EVT_KEY_LONG(KEY_PAGEDN) )
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_NEXT_PAGE, EVT_KEY_BREAK(KEY_PAGEDN) )
|
||||
@@ -3107,6 +3104,7 @@ LROT_BEGIN(etxcst, NULL, 0)
|
||||
LROT_NUMENTRY( EVT_VIRTUAL_EXIT, EVT_KEY_BREAK(KEY_EXIT) )
|
||||
#endif
|
||||
|
||||
// key events
|
||||
LROT_NUMENTRY( EVT_EXIT_BREAK, EVT_KEY_BREAK(KEY_EXIT) )
|
||||
|
||||
#if defined(KEYS_GPIO_REG_ENTER)
|
||||
@@ -3117,19 +3115,19 @@ LROT_BEGIN(etxcst, NULL, 0)
|
||||
KEY_EVENTS(MENU, KEY_MENU)
|
||||
#endif
|
||||
|
||||
#if defined(KEYS_GPIO_REG_RIGHT) && defined(COLORLCD)
|
||||
#if defined(KEYS_GPIO_REG_RIGHT) && defined(COLORLCD) || defined(USE_HATS_AS_KEYS)
|
||||
KEY_EVENTS(TELEM, KEY_TELE)
|
||||
#elif defined(KEYS_GPIO_REG_RIGHT)
|
||||
KEY_EVENTS(RIGHT, KEY_RIGHT)
|
||||
#endif
|
||||
|
||||
#if defined(KEYS_GPIO_REG_UP) && defined(COLORLCD)
|
||||
#if defined(KEYS_GPIO_REG_UP) && defined(COLORLCD) || defined(USE_HATS_AS_KEYS)
|
||||
KEY_EVENTS(MODEL, KEY_MODEL)
|
||||
#elif defined(KEYS_GPIO_REG_UP)
|
||||
KEY_EVENTS(UP, KEY_UP)
|
||||
#endif
|
||||
|
||||
#if defined(KEYS_GPIO_REG_LEFT) && defined(COLORLCD)
|
||||
#if defined(KEYS_GPIO_REG_LEFT) && defined(COLORLCD) || defined(USE_HATS_AS_KEYS)
|
||||
KEY_EVENTS(SYS, KEY_SYS)
|
||||
#elif defined(KEYS_GPIO_REG_LEFT)
|
||||
KEY_EVENTS(LEFT, KEY_LEFT)
|
||||
@@ -3141,11 +3139,11 @@ LROT_BEGIN(etxcst, NULL, 0)
|
||||
KEY_EVENTS(DOWN, KEY_DOWN)
|
||||
#endif
|
||||
|
||||
#if defined(KEYS_GPIO_REG_PAGEUP)
|
||||
#if defined(KEYS_GPIO_REG_PAGEUP) || defined(USE_HATS_AS_KEYS)
|
||||
KEY_EVENTS(PAGEUP, KEY_PAGEUP)
|
||||
#endif
|
||||
|
||||
#if defined(KEYS_GPIO_REG_PAGEDN)
|
||||
#if defined(KEYS_GPIO_REG_PAGEDN) || defined(USE_HATS_AS_KEYS)
|
||||
KEY_EVENTS(PAGEDN, KEY_PAGEDN)
|
||||
#endif
|
||||
|
||||
@@ -3165,12 +3163,13 @@ LROT_BEGIN(etxcst, NULL, 0)
|
||||
KEY_EVENTS(MINUS, KEY_MINUS)
|
||||
#endif
|
||||
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION) || defined(USE_HATS_AS_KEYS)
|
||||
KEY_EVENTS(ROT, KEY_ENTER)
|
||||
LROT_NUMENTRY( EVT_ROT_LEFT, EVT_ROTARY_LEFT )
|
||||
LROT_NUMENTRY( EVT_ROT_RIGHT, EVT_ROTARY_RIGHT )
|
||||
#endif
|
||||
|
||||
// touch events
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
LROT_NUMENTRY( EVT_TOUCH_FIRST, EVT_TOUCH_FIRST )
|
||||
LROT_NUMENTRY( EVT_TOUCH_BREAK, EVT_TOUCH_BREAK )
|
||||
@@ -3178,6 +3177,7 @@ LROT_BEGIN(etxcst, NULL, 0)
|
||||
LROT_NUMENTRY( EVT_TOUCH_TAP, EVT_TOUCH_TAP )
|
||||
#endif
|
||||
|
||||
// misc definitions
|
||||
#if LCD_DEPTH > 1 && !defined(COLORLCD)
|
||||
LROT_NUMENTRY( FILL_WHITE, FILL_WHITE )
|
||||
LROT_NUMENTRY( GREY_DEFAULT, GREY_DEFAULT )
|
||||
|
||||
@@ -79,7 +79,7 @@ struct our_longjmp * global_lj = 0;
|
||||
uint32_t luaExtraMemoryUsage = 0;
|
||||
#endif
|
||||
|
||||
#if defined(USE_TRIMS_AS_BUTTONS)
|
||||
#if defined(USE_HATS_AS_KEYS)
|
||||
static bool _is_standalone_script()
|
||||
{
|
||||
return scriptInternalData[0].reference == SCRIPT_STANDALONE;
|
||||
@@ -254,8 +254,8 @@ void luaDisable()
|
||||
POPUP_WARNING("Lua disabled!");
|
||||
luaState = INTERPRETER_PANIC;
|
||||
|
||||
#if defined(USE_TRIMS_AS_BUTTONS)
|
||||
if (_is_standalone_script()) setTrimsAsButtons(false);
|
||||
#if defined(USE_HATS_AS_KEYS)
|
||||
if (_is_standalone_script()) setTransposeHatsForLUA(false);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1255,8 +1255,8 @@ bool luaTask(event_t evt, bool allowLcdUsage)
|
||||
init = true;
|
||||
luaState = INTERPRETER_LOADING;
|
||||
|
||||
#if defined(USE_TRIMS_AS_BUTTONS)
|
||||
if (_is_standalone_script()) setTrimsAsButtons(false);
|
||||
#if defined(USE_HATS_AS_KEYS)
|
||||
if (_is_standalone_script()) setTransposeHatsForLUA(false);
|
||||
#endif
|
||||
|
||||
case INTERPRETER_LOADING:
|
||||
@@ -1271,8 +1271,8 @@ bool luaTask(event_t evt, bool allowLcdUsage)
|
||||
init = true;
|
||||
luaState = INTERPRETER_RUNNING;
|
||||
|
||||
#if defined(USE_TRIMS_AS_BUTTONS)
|
||||
if (_is_standalone_script()) setTrimsAsButtons(true);
|
||||
#if defined(USE_HATS_AS_KEYS)
|
||||
if (_is_standalone_script()) setTransposeHatsForLUA(true);
|
||||
#endif
|
||||
|
||||
case INTERPRETER_RUNNING:
|
||||
|
||||
@@ -175,7 +175,7 @@ void LuaEventHandler::onEvent(event_t event)
|
||||
if (event == EVT_KEY_LONG(KEY_EXIT)) {
|
||||
killEvents(KEY_EXIT);
|
||||
}
|
||||
#if !defined(KEYS_GPIO_REG_PAGEUP)
|
||||
#if !defined(KEYS_GPIO_REG_PAGEUP) && !defined(USE_HATS_AS_KEYS)
|
||||
else if (event == EVT_KEY_LONG(KEY_PAGEDN)) {
|
||||
killEvents(KEY_PAGEDN);
|
||||
}
|
||||
|
||||
@@ -268,6 +268,33 @@ void checkSpeakerVolume()
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(USE_HATS_AS_KEYS)
|
||||
void checkHatsAsKeys()
|
||||
{
|
||||
uint8_t hatsMode = g_model.hatsMode == HATSMODE_GLOBAL ? g_eeGeneral.hatsMode
|
||||
: g_model.hatsMode;
|
||||
|
||||
static bool oldHatsModeKeys = hatsMode == HATSMODE_KEYS_ONLY;
|
||||
|
||||
if (hatsMode == HATSMODE_TRIMS_ONLY) {
|
||||
setHatsAsKeys(false);
|
||||
}
|
||||
|
||||
if (hatsMode == HATSMODE_KEYS_ONLY) {
|
||||
setHatsAsKeys(true);
|
||||
}
|
||||
|
||||
bool hatsModeKeys = getHatsAsKeys();
|
||||
|
||||
if (hatsModeKeys == oldHatsModeKeys) return;
|
||||
|
||||
oldHatsModeKeys = !oldHatsModeKeys;
|
||||
|
||||
audioKeyPress();
|
||||
POPUP_BUBBLE(hatsModeKeys ? STR_HATSMODE_KEYS : STR_HATSMODE_TRIMS, 2000);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(EEPROM)
|
||||
void checkEeprom()
|
||||
{
|
||||
@@ -527,6 +554,10 @@ void perMain()
|
||||
|
||||
checkBacklight();
|
||||
|
||||
#if defined(USE_HATS_AS_KEYS)
|
||||
checkHatsAsKeys();
|
||||
#endif
|
||||
|
||||
#if !defined(LIBOPENUI)
|
||||
event_t evt = getEvent();
|
||||
#endif
|
||||
|
||||
@@ -133,6 +133,8 @@ void applyDefaultTemplate()
|
||||
g_model.switchWarningState |= (1 << (3 * i));
|
||||
}
|
||||
#endif
|
||||
|
||||
g_model.hatsMode = HATSMODE_GLOBAL;
|
||||
}
|
||||
|
||||
void setModelDefaults(uint8_t id)
|
||||
|
||||
@@ -346,6 +346,8 @@ void generalDefault()
|
||||
// disable Custom Script
|
||||
g_eeGeneral.modelCustomScriptsDisabled = true;
|
||||
|
||||
g_eeGeneral.hatsMode = HATSMODE_SWITCHABLE;
|
||||
|
||||
g_eeGeneral.chkSum = 0xFFFF;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,13 @@
|
||||
// Enums first
|
||||
//
|
||||
|
||||
const struct YamlIdStr enum_HatsMode[] = {
|
||||
{ HATSMODE_TRIMS_ONLY, "TRIMS_ONLY" },
|
||||
{ HATSMODE_KEYS_ONLY, "KEYS_ONLY" },
|
||||
{ HATSMODE_SWITCHABLE, "SWITCHABLE" },
|
||||
{ HATSMODE_GLOBAL, "GLOBAL" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
const struct YamlIdStr enum_BacklightMode[] = {
|
||||
{ e_backlight_mode_off, "backlight_mode_off" },
|
||||
{ e_backlight_mode_keys, "backlight_mode_keys" },
|
||||
@@ -267,7 +274,8 @@ static const struct YamlNode struct_CustomFunctionData[] = {
|
||||
static const struct YamlNode struct_RadioData[] = {
|
||||
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
||||
YAML_SIGNED( "timezoneMinutes", 3 ),
|
||||
YAML_PADDING( 4 ),
|
||||
YAML_ENUM("hatsMode", 2, enum_HatsMode),
|
||||
YAML_PADDING( 2 ),
|
||||
YAML_CUSTOM("semver",nullptr,w_semver),
|
||||
YAML_CUSTOM("board",nullptr,w_board),
|
||||
YAML_ARRAY("calib", 48, 12, struct_CalibData, NULL),
|
||||
@@ -791,7 +799,8 @@ static const struct YamlNode struct_ModelData[] = {
|
||||
YAML_UNSIGNED( "disableTelemetryWarning", 1 ),
|
||||
YAML_UNSIGNED( "showInstanceIds", 1 ),
|
||||
YAML_UNSIGNED( "checklistInteractive", 1 ),
|
||||
YAML_PADDING( 4 ),
|
||||
YAML_ENUM("hatsMode", 2, enum_HatsMode),
|
||||
YAML_PADDING( 2 ),
|
||||
YAML_SIGNED( "customThrottleWarningPosition", 8 ),
|
||||
YAML_UNSIGNED( "beepANACenter", 16 ),
|
||||
YAML_ARRAY("mixData", 160, 64, struct_MixData, NULL),
|
||||
|
||||
@@ -4,6 +4,13 @@
|
||||
// Enums first
|
||||
//
|
||||
|
||||
const struct YamlIdStr enum_HatsMode[] = {
|
||||
{ HATSMODE_TRIMS_ONLY, "TRIMS_ONLY" },
|
||||
{ HATSMODE_KEYS_ONLY, "KEYS_ONLY" },
|
||||
{ HATSMODE_SWITCHABLE, "SWITCHABLE" },
|
||||
{ HATSMODE_GLOBAL, "GLOBAL" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
const struct YamlIdStr enum_BacklightMode[] = {
|
||||
{ e_backlight_mode_off, "backlight_mode_off" },
|
||||
{ e_backlight_mode_keys, "backlight_mode_keys" },
|
||||
@@ -278,7 +285,8 @@ static const struct YamlNode struct_CustomFunctionData[] = {
|
||||
static const struct YamlNode struct_RadioData[] = {
|
||||
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
||||
YAML_SIGNED( "timezoneMinutes", 3 ),
|
||||
YAML_PADDING( 4 ),
|
||||
YAML_ENUM("hatsMode", 2, enum_HatsMode),
|
||||
YAML_PADDING( 2 ),
|
||||
YAML_CUSTOM("semver",nullptr,w_semver),
|
||||
YAML_CUSTOM("board",nullptr,w_board),
|
||||
YAML_ARRAY("calib", 48, 22, struct_CalibData, NULL),
|
||||
@@ -814,7 +822,8 @@ static const struct YamlNode struct_ModelData[] = {
|
||||
YAML_UNSIGNED( "disableTelemetryWarning", 1 ),
|
||||
YAML_UNSIGNED( "showInstanceIds", 1 ),
|
||||
YAML_UNSIGNED( "checklistInteractive", 1 ),
|
||||
YAML_PADDING( 4 ),
|
||||
YAML_ENUM("hatsMode", 2, enum_HatsMode),
|
||||
YAML_PADDING( 2 ),
|
||||
YAML_SIGNED( "customThrottleWarningPosition", 8 ),
|
||||
YAML_UNSIGNED( "beepANACenter", 16 ),
|
||||
YAML_ARRAY("mixData", 160, 64, struct_MixData, NULL),
|
||||
|
||||
@@ -4,6 +4,13 @@
|
||||
// Enums first
|
||||
//
|
||||
|
||||
const struct YamlIdStr enum_HatsMode[] = {
|
||||
{ HATSMODE_TRIMS_ONLY, "TRIMS_ONLY" },
|
||||
{ HATSMODE_KEYS_ONLY, "KEYS_ONLY" },
|
||||
{ HATSMODE_SWITCHABLE, "SWITCHABLE" },
|
||||
{ HATSMODE_GLOBAL, "GLOBAL" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
const struct YamlIdStr enum_BacklightMode[] = {
|
||||
{ e_backlight_mode_off, "backlight_mode_off" },
|
||||
{ e_backlight_mode_keys, "backlight_mode_keys" },
|
||||
@@ -267,7 +274,8 @@ static const struct YamlNode struct_CustomFunctionData[] = {
|
||||
static const struct YamlNode struct_RadioData[] = {
|
||||
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
||||
YAML_SIGNED( "timezoneMinutes", 3 ),
|
||||
YAML_PADDING( 4 ),
|
||||
YAML_ENUM("hatsMode", 2, enum_HatsMode),
|
||||
YAML_PADDING( 2 ),
|
||||
YAML_CUSTOM("semver",nullptr,w_semver),
|
||||
YAML_CUSTOM("board",nullptr,w_board),
|
||||
YAML_ARRAY("calib", 48, 12, struct_CalibData, NULL),
|
||||
@@ -789,7 +797,8 @@ static const struct YamlNode struct_ModelData[] = {
|
||||
YAML_UNSIGNED( "disableTelemetryWarning", 1 ),
|
||||
YAML_UNSIGNED( "showInstanceIds", 1 ),
|
||||
YAML_UNSIGNED( "checklistInteractive", 1 ),
|
||||
YAML_PADDING( 4 ),
|
||||
YAML_ENUM("hatsMode", 2, enum_HatsMode),
|
||||
YAML_PADDING( 2 ),
|
||||
YAML_SIGNED( "customThrottleWarningPosition", 8 ),
|
||||
YAML_UNSIGNED( "beepANACenter", 16 ),
|
||||
YAML_ARRAY("mixData", 160, 64, struct_MixData, NULL),
|
||||
|
||||
@@ -4,6 +4,13 @@
|
||||
// Enums first
|
||||
//
|
||||
|
||||
const struct YamlIdStr enum_HatsMode[] = {
|
||||
{ HATSMODE_TRIMS_ONLY, "TRIMS_ONLY" },
|
||||
{ HATSMODE_KEYS_ONLY, "KEYS_ONLY" },
|
||||
{ HATSMODE_SWITCHABLE, "SWITCHABLE" },
|
||||
{ HATSMODE_GLOBAL, "GLOBAL" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
const struct YamlIdStr enum_BacklightMode[] = {
|
||||
{ e_backlight_mode_off, "backlight_mode_off" },
|
||||
{ e_backlight_mode_keys, "backlight_mode_keys" },
|
||||
@@ -267,7 +274,8 @@ static const struct YamlNode struct_CustomFunctionData[] = {
|
||||
static const struct YamlNode struct_RadioData[] = {
|
||||
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
||||
YAML_SIGNED( "timezoneMinutes", 3 ),
|
||||
YAML_PADDING( 4 ),
|
||||
YAML_ENUM("hatsMode", 2, enum_HatsMode),
|
||||
YAML_PADDING( 2 ),
|
||||
YAML_CUSTOM("semver",nullptr,w_semver),
|
||||
YAML_CUSTOM("board",nullptr,w_board),
|
||||
YAML_ARRAY("calib", 48, 12, struct_CalibData, NULL),
|
||||
@@ -789,7 +797,8 @@ static const struct YamlNode struct_ModelData[] = {
|
||||
YAML_UNSIGNED( "disableTelemetryWarning", 1 ),
|
||||
YAML_UNSIGNED( "showInstanceIds", 1 ),
|
||||
YAML_UNSIGNED( "checklistInteractive", 1 ),
|
||||
YAML_PADDING( 4 ),
|
||||
YAML_ENUM("hatsMode", 2, enum_HatsMode),
|
||||
YAML_PADDING( 2 ),
|
||||
YAML_SIGNED( "customThrottleWarningPosition", 8 ),
|
||||
YAML_UNSIGNED( "beepANACenter", 16 ),
|
||||
YAML_ARRAY("mixData", 160, 64, struct_MixData, NULL),
|
||||
|
||||
@@ -4,6 +4,13 @@
|
||||
// Enums first
|
||||
//
|
||||
|
||||
const struct YamlIdStr enum_HatsMode[] = {
|
||||
{ HATSMODE_TRIMS_ONLY, "TRIMS_ONLY" },
|
||||
{ HATSMODE_KEYS_ONLY, "KEYS_ONLY" },
|
||||
{ HATSMODE_SWITCHABLE, "SWITCHABLE" },
|
||||
{ HATSMODE_GLOBAL, "GLOBAL" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
const struct YamlIdStr enum_BacklightMode[] = {
|
||||
{ e_backlight_mode_off, "backlight_mode_off" },
|
||||
{ e_backlight_mode_keys, "backlight_mode_keys" },
|
||||
@@ -286,7 +293,8 @@ static const struct YamlNode struct_CustomFunctionData[] = {
|
||||
static const struct YamlNode struct_RadioData[] = {
|
||||
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
||||
YAML_SIGNED( "timezoneMinutes", 3 ),
|
||||
YAML_PADDING( 4 ),
|
||||
YAML_ENUM("hatsMode", 2, enum_HatsMode),
|
||||
YAML_PADDING( 2 ),
|
||||
YAML_CUSTOM("semver",nullptr,w_semver),
|
||||
YAML_CUSTOM("board",nullptr,w_board),
|
||||
YAML_ARRAY("calib", 48, 22, struct_CalibData, NULL),
|
||||
@@ -822,7 +830,8 @@ static const struct YamlNode struct_ModelData[] = {
|
||||
YAML_UNSIGNED( "disableTelemetryWarning", 1 ),
|
||||
YAML_UNSIGNED( "showInstanceIds", 1 ),
|
||||
YAML_UNSIGNED( "checklistInteractive", 1 ),
|
||||
YAML_PADDING( 4 ),
|
||||
YAML_ENUM("hatsMode", 2, enum_HatsMode),
|
||||
YAML_PADDING( 2 ),
|
||||
YAML_SIGNED( "customThrottleWarningPosition", 8 ),
|
||||
YAML_UNSIGNED( "beepANACenter", 16 ),
|
||||
YAML_ARRAY("mixData", 160, 64, struct_MixData, NULL),
|
||||
|
||||
@@ -4,6 +4,13 @@
|
||||
// Enums first
|
||||
//
|
||||
|
||||
const struct YamlIdStr enum_HatsMode[] = {
|
||||
{ HATSMODE_TRIMS_ONLY, "TRIMS_ONLY" },
|
||||
{ HATSMODE_KEYS_ONLY, "KEYS_ONLY" },
|
||||
{ HATSMODE_SWITCHABLE, "SWITCHABLE" },
|
||||
{ HATSMODE_GLOBAL, "GLOBAL" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
const struct YamlIdStr enum_BacklightMode[] = {
|
||||
{ e_backlight_mode_off, "backlight_mode_off" },
|
||||
{ e_backlight_mode_keys, "backlight_mode_keys" },
|
||||
@@ -286,7 +293,8 @@ static const struct YamlNode struct_CustomFunctionData[] = {
|
||||
static const struct YamlNode struct_RadioData[] = {
|
||||
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
||||
YAML_SIGNED( "timezoneMinutes", 3 ),
|
||||
YAML_PADDING( 4 ),
|
||||
YAML_ENUM("hatsMode", 2, enum_HatsMode),
|
||||
YAML_PADDING( 2 ),
|
||||
YAML_CUSTOM("semver",nullptr,w_semver),
|
||||
YAML_CUSTOM("board",nullptr,w_board),
|
||||
YAML_ARRAY("calib", 48, 22, struct_CalibData, NULL),
|
||||
@@ -822,7 +830,8 @@ static const struct YamlNode struct_ModelData[] = {
|
||||
YAML_UNSIGNED( "disableTelemetryWarning", 1 ),
|
||||
YAML_UNSIGNED( "showInstanceIds", 1 ),
|
||||
YAML_UNSIGNED( "checklistInteractive", 1 ),
|
||||
YAML_PADDING( 4 ),
|
||||
YAML_ENUM("hatsMode", 2, enum_HatsMode),
|
||||
YAML_PADDING( 2 ),
|
||||
YAML_SIGNED( "customThrottleWarningPosition", 8 ),
|
||||
YAML_UNSIGNED( "beepANACenter", 16 ),
|
||||
YAML_ARRAY("mixData", 160, 64, struct_MixData, NULL),
|
||||
|
||||
@@ -4,6 +4,13 @@
|
||||
// Enums first
|
||||
//
|
||||
|
||||
const struct YamlIdStr enum_HatsMode[] = {
|
||||
{ HATSMODE_TRIMS_ONLY, "TRIMS_ONLY" },
|
||||
{ HATSMODE_KEYS_ONLY, "KEYS_ONLY" },
|
||||
{ HATSMODE_SWITCHABLE, "SWITCHABLE" },
|
||||
{ HATSMODE_GLOBAL, "GLOBAL" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
const struct YamlIdStr enum_BacklightMode[] = {
|
||||
{ e_backlight_mode_off, "backlight_mode_off" },
|
||||
{ e_backlight_mode_keys, "backlight_mode_keys" },
|
||||
@@ -267,7 +274,8 @@ static const struct YamlNode struct_CustomFunctionData[] = {
|
||||
static const struct YamlNode struct_RadioData[] = {
|
||||
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
||||
YAML_SIGNED( "timezoneMinutes", 3 ),
|
||||
YAML_PADDING( 4 ),
|
||||
YAML_ENUM("hatsMode", 2, enum_HatsMode),
|
||||
YAML_PADDING( 2 ),
|
||||
YAML_CUSTOM("semver",nullptr,w_semver),
|
||||
YAML_CUSTOM("board",nullptr,w_board),
|
||||
YAML_ARRAY("calib", 48, 12, struct_CalibData, NULL),
|
||||
@@ -792,7 +800,8 @@ static const struct YamlNode struct_ModelData[] = {
|
||||
YAML_UNSIGNED( "disableTelemetryWarning", 1 ),
|
||||
YAML_UNSIGNED( "showInstanceIds", 1 ),
|
||||
YAML_UNSIGNED( "checklistInteractive", 1 ),
|
||||
YAML_PADDING( 4 ),
|
||||
YAML_ENUM("hatsMode", 2, enum_HatsMode),
|
||||
YAML_PADDING( 2 ),
|
||||
YAML_SIGNED( "customThrottleWarningPosition", 8 ),
|
||||
YAML_UNSIGNED( "beepANACenter", 16 ),
|
||||
YAML_ARRAY("mixData", 160, 64, struct_MixData, NULL),
|
||||
|
||||
@@ -4,6 +4,13 @@
|
||||
// Enums first
|
||||
//
|
||||
|
||||
const struct YamlIdStr enum_HatsMode[] = {
|
||||
{ HATSMODE_TRIMS_ONLY, "TRIMS_ONLY" },
|
||||
{ HATSMODE_KEYS_ONLY, "KEYS_ONLY" },
|
||||
{ HATSMODE_SWITCHABLE, "SWITCHABLE" },
|
||||
{ HATSMODE_GLOBAL, "GLOBAL" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
const struct YamlIdStr enum_BacklightMode[] = {
|
||||
{ e_backlight_mode_off, "backlight_mode_off" },
|
||||
{ e_backlight_mode_keys, "backlight_mode_keys" },
|
||||
@@ -267,7 +274,8 @@ static const struct YamlNode struct_CustomFunctionData[] = {
|
||||
static const struct YamlNode struct_RadioData[] = {
|
||||
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
||||
YAML_SIGNED( "timezoneMinutes", 3 ),
|
||||
YAML_PADDING( 4 ),
|
||||
YAML_ENUM("hatsMode", 2, enum_HatsMode),
|
||||
YAML_PADDING( 2 ),
|
||||
YAML_CUSTOM("semver",nullptr,w_semver),
|
||||
YAML_CUSTOM("board",nullptr,w_board),
|
||||
YAML_ARRAY("calib", 48, 12, struct_CalibData, NULL),
|
||||
@@ -792,7 +800,8 @@ static const struct YamlNode struct_ModelData[] = {
|
||||
YAML_UNSIGNED( "disableTelemetryWarning", 1 ),
|
||||
YAML_UNSIGNED( "showInstanceIds", 1 ),
|
||||
YAML_UNSIGNED( "checklistInteractive", 1 ),
|
||||
YAML_PADDING( 4 ),
|
||||
YAML_ENUM("hatsMode", 2, enum_HatsMode),
|
||||
YAML_PADDING( 2 ),
|
||||
YAML_SIGNED( "customThrottleWarningPosition", 8 ),
|
||||
YAML_UNSIGNED( "beepANACenter", 16 ),
|
||||
YAML_ARRAY("mixData", 160, 64, struct_MixData, NULL),
|
||||
|
||||
@@ -4,6 +4,13 @@
|
||||
// Enums first
|
||||
//
|
||||
|
||||
const struct YamlIdStr enum_HatsMode[] = {
|
||||
{ HATSMODE_TRIMS_ONLY, "TRIMS_ONLY" },
|
||||
{ HATSMODE_KEYS_ONLY, "KEYS_ONLY" },
|
||||
{ HATSMODE_SWITCHABLE, "SWITCHABLE" },
|
||||
{ HATSMODE_GLOBAL, "GLOBAL" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
const struct YamlIdStr enum_BacklightMode[] = {
|
||||
{ e_backlight_mode_off, "backlight_mode_off" },
|
||||
{ e_backlight_mode_keys, "backlight_mode_keys" },
|
||||
@@ -267,7 +274,8 @@ static const struct YamlNode struct_CustomFunctionData[] = {
|
||||
static const struct YamlNode struct_RadioData[] = {
|
||||
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
||||
YAML_SIGNED( "timezoneMinutes", 3 ),
|
||||
YAML_PADDING( 4 ),
|
||||
YAML_ENUM("hatsMode", 2, enum_HatsMode),
|
||||
YAML_PADDING( 2 ),
|
||||
YAML_CUSTOM("semver",nullptr,w_semver),
|
||||
YAML_CUSTOM("board",nullptr,w_board),
|
||||
YAML_ARRAY("calib", 48, 12, struct_CalibData, NULL),
|
||||
@@ -789,7 +797,8 @@ static const struct YamlNode struct_ModelData[] = {
|
||||
YAML_UNSIGNED( "disableTelemetryWarning", 1 ),
|
||||
YAML_UNSIGNED( "showInstanceIds", 1 ),
|
||||
YAML_UNSIGNED( "checklistInteractive", 1 ),
|
||||
YAML_PADDING( 4 ),
|
||||
YAML_ENUM("hatsMode", 2, enum_HatsMode),
|
||||
YAML_PADDING( 2 ),
|
||||
YAML_SIGNED( "customThrottleWarningPosition", 8 ),
|
||||
YAML_UNSIGNED( "beepANACenter", 16 ),
|
||||
YAML_ARRAY("mixData", 160, 64, struct_MixData, NULL),
|
||||
|
||||
@@ -4,6 +4,13 @@
|
||||
// Enums first
|
||||
//
|
||||
|
||||
const struct YamlIdStr enum_HatsMode[] = {
|
||||
{ HATSMODE_TRIMS_ONLY, "TRIMS_ONLY" },
|
||||
{ HATSMODE_KEYS_ONLY, "KEYS_ONLY" },
|
||||
{ HATSMODE_SWITCHABLE, "SWITCHABLE" },
|
||||
{ HATSMODE_GLOBAL, "GLOBAL" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
const struct YamlIdStr enum_BacklightMode[] = {
|
||||
{ e_backlight_mode_off, "backlight_mode_off" },
|
||||
{ e_backlight_mode_keys, "backlight_mode_keys" },
|
||||
@@ -269,7 +276,8 @@ static const struct YamlNode struct_CustomFunctionData[] = {
|
||||
static const struct YamlNode struct_RadioData[] = {
|
||||
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
||||
YAML_SIGNED( "timezoneMinutes", 3 ),
|
||||
YAML_PADDING( 4 ),
|
||||
YAML_ENUM("hatsMode", 2, enum_HatsMode),
|
||||
YAML_PADDING( 2 ),
|
||||
YAML_CUSTOM("semver",nullptr,w_semver),
|
||||
YAML_CUSTOM("board",nullptr,w_board),
|
||||
YAML_ARRAY("calib", 48, 12, struct_CalibData, NULL),
|
||||
@@ -795,7 +803,8 @@ static const struct YamlNode struct_ModelData[] = {
|
||||
YAML_UNSIGNED( "disableTelemetryWarning", 1 ),
|
||||
YAML_UNSIGNED( "showInstanceIds", 1 ),
|
||||
YAML_UNSIGNED( "checklistInteractive", 1 ),
|
||||
YAML_PADDING( 4 ),
|
||||
YAML_ENUM("hatsMode", 2, enum_HatsMode),
|
||||
YAML_PADDING( 2 ),
|
||||
YAML_SIGNED( "customThrottleWarningPosition", 8 ),
|
||||
YAML_UNSIGNED( "beepANACenter", 16 ),
|
||||
YAML_ARRAY("mixData", 160, 64, struct_MixData, NULL),
|
||||
|
||||
@@ -106,7 +106,7 @@ void per10ms()
|
||||
|
||||
keysPollingCycle();
|
||||
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION) && !defined(USE_HATS_AS_KEYS)
|
||||
static rotenc_t rePreviousValue;
|
||||
|
||||
rotenc_t reNewValue = rotaryEncoderGetValue();
|
||||
@@ -256,7 +256,7 @@ void bootloaderInitApp()
|
||||
|
||||
pwrOn();
|
||||
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION) && !defined(USE_HATS_AS_KEYS)
|
||||
rotaryEncoderInit();
|
||||
#endif
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ set(PCB_RF_BAUD 921600 CACHE STRING "INTERNAL_MODULE_BAUDRATE: ${RF_BAUD_RATE}")
|
||||
set_property(CACHE PCB_RF_BAUD PROPERTY STRINGS ${RF_BAUD_RATE})
|
||||
|
||||
add_definitions(-DPCBNV14 -DPCBFLYSKY -DAFHDS2_BAUDRATE=${PCB_RF_BAUD})
|
||||
add_definitions(-DBATTERY_CHARGE -DUSE_TRIMS_AS_BUTTONS)
|
||||
add_definitions(-DBATTERY_CHARGE -DUSE_HATS_AS_KEYS)
|
||||
|
||||
if (PCBREV STREQUAL EL18)
|
||||
set(FLAVOUR el18)
|
||||
|
||||
@@ -70,7 +70,7 @@ void bootloaderInitScreen()
|
||||
lcdInitDisplayDriver();
|
||||
backlightInit();
|
||||
backlightEnable(100);
|
||||
setTrimsAsButtons(true);
|
||||
setHatsAsKeys(true);
|
||||
}
|
||||
|
||||
static void bootloaderDrawTitle(const char* text)
|
||||
|
||||
@@ -517,6 +517,9 @@
|
||||
#define BLUETOOTH_ON_GPIO GPIOI
|
||||
#define BLUETOOTH_ON_GPIO_PIN GPIO_Pin_8 // PI.8
|
||||
|
||||
//ROTARY emulation for trims as buttons
|
||||
#define ROTARY_ENCODER_NAVIGATION
|
||||
|
||||
// Bluetooth
|
||||
#define BT_RCC_AHB1Periph (RCC_AHB1Periph_GPIOB | RCC_AHB1Periph_GPIOI | RCC_AHB1Periph_GPIOH)
|
||||
#define BT_RCC_APB1Periph (RCC_APB1Periph_USART3)
|
||||
|
||||
@@ -298,7 +298,7 @@ extern volatile uint32_t rotencDt;
|
||||
|
||||
void OpenTxSimulator::rotaryEncoderEvent(int steps)
|
||||
{
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION) && !defined(USE_HATS_AS_KEYS)
|
||||
static uint32_t last_tick = 0;
|
||||
if (steps != 0) {
|
||||
if (g_eeGeneral.rotEncMode >= ROTARY_ENCODER_MODE_INVERT_BOTH) steps *= -1;
|
||||
|
||||
@@ -448,9 +448,9 @@ void SET_POWER_REASON(uint32_t value) {}
|
||||
#if defined(TRIMS_EMULATE_BUTTONS)
|
||||
bool trimsAsButtons = false;
|
||||
|
||||
void setTrimsAsButtons(bool val) { trimsAsButtons = val; }
|
||||
void setHatsAsKeys(bool val) { trimsAsButtons = val; }
|
||||
|
||||
bool getTrimsAsButtons()
|
||||
bool getHatsAsKeys()
|
||||
{
|
||||
bool lua = false;
|
||||
#if defined(LUA)
|
||||
|
||||
@@ -66,7 +66,11 @@ void NumberEdit::onEvent(event_t event)
|
||||
auto step = getStep();
|
||||
step += (rotaryEncoderGetAccel() * getAccelFactor()) / 8;
|
||||
do {
|
||||
#if defined(USE_HATS_AS_KEYS)
|
||||
value -= step;
|
||||
#else
|
||||
value += step;
|
||||
#endif
|
||||
} while (isValueAvailable && !isValueAvailable(value) && value <= vmax);
|
||||
if (value <= vmax) {
|
||||
setValue(value);
|
||||
@@ -83,7 +87,11 @@ void NumberEdit::onEvent(event_t event)
|
||||
auto step = getStep();
|
||||
step += (rotaryEncoderGetAccel() * getAccelFactor()) / 8;
|
||||
do {
|
||||
#if defined(USE_HATS_AS_KEYS)
|
||||
value += step;
|
||||
#else
|
||||
value -= step;
|
||||
#endif
|
||||
} while (isValueAvailable && !isValueAvailable(value) && value >= vmin);
|
||||
if (value >= vmin) {
|
||||
setValue(value);
|
||||
|
||||
-1
@@ -231,4 +231,3 @@ class Window
|
||||
|
||||
virtual void invalidate(const rect_t & rect);
|
||||
};
|
||||
|
||||
|
||||
@@ -537,6 +537,14 @@ const char STR_DATE[] = TR_DATE;
|
||||
const char STR_CHANNELS_MONITOR[] = TR_CHANNELS_MONITOR;
|
||||
const char STR_ROTARY_ENCODER[] = TR_ROTARY_ENCODER;
|
||||
const char STR_ROTARY_ENC_MODE[] = TR_ROTARY_ENC_MODE;
|
||||
|
||||
#if defined(USE_HATS_AS_KEYS)
|
||||
const char STR_HATSMODE[] = TR_HATSMODE;
|
||||
ISTR(HATSOPT);
|
||||
const char STR_HATSMODE_TRIMS[] = TR_HATSMODE_TRIMS;
|
||||
const char STR_HATSMODE_KEYS[] = TR_HATSMODE_KEYS;
|
||||
#endif
|
||||
|
||||
const char STR_MIXERS_MONITOR[] = TR_MIXERS_MONITOR;
|
||||
const char STR_PATH_TOO_LONG[] = TR_PATH_TOO_LONG;
|
||||
const char STR_VIEW_TEXT[] = TR_VIEW_TEXT;
|
||||
|
||||
@@ -172,6 +172,13 @@ extern const char* const STR_CYC_VSRCRAW[];
|
||||
|
||||
extern const char* const STR_ROTARY_ENC_OPT[];
|
||||
|
||||
#if defined(USE_HATS_AS_KEYS)
|
||||
extern const char STR_HATSMODE[];
|
||||
extern const char* const STR_HATSOPT[];
|
||||
extern const char STR_HATSMODE_TRIMS[];
|
||||
extern const char STR_HATSMODE_KEYS[];
|
||||
#endif
|
||||
|
||||
extern const char* const STR_VTMRMODES[];
|
||||
extern const char* const STR_VPERSISTENT[];
|
||||
|
||||
|
||||
@@ -156,6 +156,13 @@
|
||||
|
||||
#define TR_ON_ONE_SWITCHES "ON","One"
|
||||
|
||||
#if defined(USE_HATS_AS_KEYS)
|
||||
#define TR_HATSMODE "按键帽模式"
|
||||
#define TR_HATSOPT "微调","导航键","可切换","全局"
|
||||
#define TR_HATSMODE_TRIMS "按键帽: 微调"
|
||||
#define TR_HATSMODE_KEYS "按键帽: 导航键"
|
||||
#endif
|
||||
|
||||
#if defined(COLORLCD)
|
||||
#define TR_ROTARY_ENC_OPT "正常","反向"
|
||||
#else
|
||||
|
||||
@@ -169,6 +169,13 @@
|
||||
|
||||
#define TR_ON_ONE_SWITCHES "ZAP","One"
|
||||
|
||||
#if defined(USE_HATS_AS_KEYS)
|
||||
#define TR_HATSMODE "Režim kloboučků"
|
||||
#define TR_HATSOPT "Pouze trimy","Pouze tlačítka","Přepinatelné","Globální"
|
||||
#define TR_HATSMODE_TRIMS "Režim kloboučků: Trimy"
|
||||
#define TR_HATSMODE_KEYS "Režim kloboučků: Tlačítka"
|
||||
#endif
|
||||
|
||||
#if defined(COLORLCD)
|
||||
#define TR_ROTARY_ENC_OPT "Normal","Invertován"
|
||||
#else
|
||||
|
||||
@@ -164,6 +164,13 @@
|
||||
|
||||
#define TR_ON_ONE_SWITCHES "EN","En"
|
||||
|
||||
#if defined(USE_HATS_AS_KEYS)
|
||||
#define TR_HATSMODE "Joystik indstilling"
|
||||
#define TR_HATSOPT "Kun trim","Kun knap","Trim / Knap", "Global"
|
||||
#define TR_HATSMODE_TRIMS "Joystik: Trim"
|
||||
#define TR_HATSMODE_KEYS "Joystik: Knap"
|
||||
#endif
|
||||
|
||||
#if defined(COLORLCD)
|
||||
#define TR_ROTARY_ENC_OPT "Normal","Invers"
|
||||
#else
|
||||
|
||||
@@ -159,6 +159,13 @@
|
||||
|
||||
#define TR_ON_ONE_SWITCHES "ON","One"
|
||||
|
||||
#if defined(USE_HATS_AS_KEYS)
|
||||
#define TR_HATSMODE "Joystick Modus"
|
||||
#define TR_HATSOPT "Nur Trimmung","Nur Tasten","Umschaltbar","Global"
|
||||
#define TR_HATSMODE_TRIMS "Joystick Modus: Trimmung"
|
||||
#define TR_HATSMODE_KEYS "Joystick Modus: Tasten"
|
||||
#endif
|
||||
|
||||
#if defined(COLORLCD)
|
||||
#define TR_ROTARY_ENC_OPT "Normal","Inverted"
|
||||
#else
|
||||
|
||||
@@ -161,6 +161,13 @@
|
||||
|
||||
#define TR_ON_ONE_SWITCHES "ON","One"
|
||||
|
||||
#if defined(USE_HATS_AS_KEYS)
|
||||
#define TR_HATSMODE "Hats mode"
|
||||
#define TR_HATSOPT "Trims only","Keys only","Switchable","Global"
|
||||
#define TR_HATSMODE_TRIMS "Hats mode: Trims"
|
||||
#define TR_HATSMODE_KEYS "Hats mode: Keys"
|
||||
#endif
|
||||
|
||||
#if defined(COLORLCD)
|
||||
#define TR_ROTARY_ENC_OPT "Normal","Inverted"
|
||||
#else
|
||||
|
||||
@@ -157,6 +157,13 @@
|
||||
|
||||
#define TR_ON_ONE_SWITCHES "ON","One"
|
||||
|
||||
#if defined(USE_HATS_AS_KEYS)
|
||||
#define TR_HATSMODE "Hats mode"
|
||||
#define TR_HATSOPT "Trims only","Keys only","Switchable","Global"
|
||||
#define TR_HATSMODE_TRIMS "Hats mode: Trims"
|
||||
#define TR_HATSMODE_KEYS "Hats mode: Keys"
|
||||
#endif
|
||||
|
||||
#if defined(COLORLCD)
|
||||
#define TR_ROTARY_ENC_OPT "Normal","Inverted"
|
||||
#else
|
||||
|
||||
@@ -168,6 +168,13 @@
|
||||
|
||||
#define TR_ON_ONE_SWITCHES "ON","One"
|
||||
|
||||
#if defined(USE_HATS_AS_KEYS)
|
||||
#define TR_HATSMODE "Hats mode"
|
||||
#define TR_HATSOPT "Trims only","Keys only","Switchable","Global"
|
||||
#define TR_HATSMODE_TRIMS "Hats mode: Trims"
|
||||
#define TR_HATSMODE_KEYS "Hats mode: Keys"
|
||||
#endif
|
||||
|
||||
#if defined(COLORLCD)
|
||||
#define TR_ROTARY_ENC_OPT "Normal","Inverted"
|
||||
#else
|
||||
|
||||
@@ -169,6 +169,13 @@
|
||||
|
||||
#define TR_ON_ONE_SWITCHES "ON","Un"
|
||||
|
||||
#if defined(USE_HATS_AS_KEYS)
|
||||
#define TR_HATSMODE "Mode joystick"
|
||||
#define TR_HATSOPT "Trims uniquement","Touches uniquement","Commutable","Global"
|
||||
#define TR_HATSMODE_TRIMS "Mode joystick: trims"
|
||||
#define TR_HATSMODE_KEYS "Mode joystick: touches"
|
||||
#endif
|
||||
|
||||
#if defined(COLORLCD)
|
||||
#define TR_ROTARY_ENC_OPT "Normal","Inversé"
|
||||
#else
|
||||
|
||||
@@ -166,6 +166,13 @@
|
||||
|
||||
#define TR_ON_ONE_SWITCHES "ON","One"
|
||||
|
||||
#if defined(USE_HATS_AS_KEYS)
|
||||
#define TR_HATSMODE "מצב כובעונים"
|
||||
#define TR_HATSOPT "קיזוזים בלבד","ניווט בלבד","משולב","גלובאלי"
|
||||
#define TR_HATSMODE_TRIMS "מצב כובעונים: קיזוזים"
|
||||
#define TR_HATSMODE_KEYS "מצב כובעונים: ניווט"
|
||||
#endif
|
||||
|
||||
#if defined(COLORLCD)
|
||||
#define TR_ROTARY_ENC_OPT "רגיל","הפוך"
|
||||
#else
|
||||
|
||||
@@ -162,6 +162,13 @@
|
||||
|
||||
#define TR_ON_ONE_SWITCHES "ON","One"
|
||||
|
||||
#if defined(USE_HATS_AS_KEYS)
|
||||
#define TR_HATSMODE "Modo joystick"
|
||||
#define TR_HATSOPT "Solo trims","Solo keys","Commutabile","Globale"
|
||||
#define TR_HATSMODE_TRIMS "Modo joystick: trims"
|
||||
#define TR_HATSMODE_KEYS "Modo joystick: keys"
|
||||
#endif
|
||||
|
||||
#if defined(COLORLCD)
|
||||
#define TR_ROTARY_ENC_OPT "Normale","Invertito"
|
||||
#else
|
||||
|
||||
@@ -161,6 +161,13 @@
|
||||
|
||||
#define TR_ON_ONE_SWITCHES "ON","One"
|
||||
|
||||
#if defined(USE_HATS_AS_KEYS)
|
||||
#define TR_HATSMODE "アナログスティック"
|
||||
#define TR_HATSOPT "トリムのみ","キーのみ","スイッチ","すべて"
|
||||
#define TR_HATSMODE_TRIMS "アナログスティック: トリム"
|
||||
#define TR_HATSMODE_KEYS "アナログスティック: キー"
|
||||
#endif
|
||||
|
||||
#if defined(COLORLCD)
|
||||
#define TR_ROTARY_ENC_OPT "標準","リバース"
|
||||
#else
|
||||
|
||||
@@ -158,6 +158,13 @@
|
||||
|
||||
#define TR_ON_ONE_SWITCHES "ON","One"
|
||||
|
||||
#if defined(USE_HATS_AS_KEYS)
|
||||
#define TR_HATSMODE "Hats mode"
|
||||
#define TR_HATSOPT "Trims only","Keys only","Switchable","Global"
|
||||
#define TR_HATSMODE_TRIMS "Hats mode: Trims"
|
||||
#define TR_HATSMODE_KEYS "Hats mode: Keys"
|
||||
#endif
|
||||
|
||||
#if defined(COLORLCD)
|
||||
#define TR_ROTARY_ENC_OPT "Normal","Inverted"
|
||||
#else
|
||||
|
||||
@@ -157,6 +157,13 @@
|
||||
|
||||
#define TR_ON_ONE_SWITCHES "ON","One"
|
||||
|
||||
#if defined(USE_HATS_AS_KEYS)
|
||||
#define TR_HATSMODE "Tryb grzybków"
|
||||
#define TR_HATSOPT "Tylko trymy","Tylko przyciski","Przełączane","Globalne"
|
||||
#define TR_HATSMODE_TRIMS "Tryb grzybków: trymy"
|
||||
#define TR_HATSMODE_KEYS "Tryb grzybków: przyciski"
|
||||
#endif
|
||||
|
||||
#if defined(COLORLCD)
|
||||
#define TR_ROTARY_ENC_OPT "Normal","Inverted"
|
||||
#else
|
||||
|
||||
@@ -164,6 +164,13 @@
|
||||
|
||||
#define TR_ON_ONE_SWITCHES "LIG","UM"
|
||||
|
||||
#if defined(USE_HATS_AS_KEYS)
|
||||
#define TR_HATSMODE "Hats mode"
|
||||
#define TR_HATSOPT "Trims only","Keys only","Switchable","Global"
|
||||
#define TR_HATSMODE_TRIMS "Hats mode: Trims"
|
||||
#define TR_HATSMODE_KEYS "Hats mode: Keys"
|
||||
#endif
|
||||
|
||||
#if defined(COLORLCD)
|
||||
#define TR_ROTARY_ENC_OPT "Normal","Invert"
|
||||
#else
|
||||
|
||||
@@ -179,6 +179,13 @@
|
||||
|
||||
#define TR_ON_ONE_SWITCHES "PÅ","Ett"
|
||||
|
||||
#if defined(USE_HATS_AS_KEYS)
|
||||
#define TR_HATSMODE "Hattläge"
|
||||
#define TR_HATSOPT "Endast trimm","Endast knapp","Ändringsbar","Global"
|
||||
#define TR_HATSMODE_TRIMS "Hattläge: Trimmar"
|
||||
#define TR_HATSMODE_KEYS "Hattläge: Knappar"
|
||||
#endif
|
||||
|
||||
#if defined(IMU)
|
||||
#define TR_IMU_VSRCRAW "TltX","TltY",
|
||||
#else
|
||||
|
||||
@@ -162,6 +162,13 @@
|
||||
|
||||
#define TR_ON_ONE_SWITCHES "ON","One"
|
||||
|
||||
#if defined(USE_HATS_AS_KEYS)
|
||||
#define TR_HATSMODE "按鍵帽模式"
|
||||
#define TR_HATSOPT "微調","導航鍵","可切換","全局"
|
||||
#define TR_HATSMODE_TRIMS "按鍵帽: 微調"
|
||||
#define TR_HATSMODE_KEYS "按鍵帽: 導航鍵"
|
||||
#endif
|
||||
|
||||
#if defined(COLORLCD)
|
||||
#define TR_ROTARY_ENC_OPT "正常","反向"
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user