Skip to content

Commit

Permalink
changed hats mode enum names to have prefix HATS_
Browse files Browse the repository at this point in the history
  • Loading branch information
mha1 committed Aug 5, 2023
1 parent 0a9f622 commit 0dad502
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 32 deletions.
6 changes: 3 additions & 3 deletions companion/src/firmwares/edgetx/yaml_generalsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ const YamlLookupTable internalModuleLut = {
};

static const YamlLookupTable hatsModeLut = {
{ GeneralSettings::MODE_TRIMS_ONLY, "TRIMS_ONLY" },
{ GeneralSettings::MODE_KEYS_ONLY, "KEYS_ONLY" },
{ GeneralSettings::MODE_SWITCHABLE, "SWITCHABLE" },
{ GeneralSettings::HATS_MODE_TRIMS_ONLY, "TRIMS_ONLY" },
{ GeneralSettings::HATS_MODE_KEYS_ONLY, "KEYS_ONLY" },
{ GeneralSettings::HATS_MODE_SWITCHABLE, "SWITCHABLE" },
};

YamlTelemetryBaudrate::YamlTelemetryBaudrate(
Expand Down
8 changes: 4 additions & 4 deletions companion/src/firmwares/edgetx/yaml_modeldata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ static const YamlLookupTable usbJoystickIfModeLut = {
};

static const YamlLookupTable hatsModeLut = {
{ GeneralSettings::MODE_TRIMS_ONLY, "TRIMS_ONLY" },
{ GeneralSettings::MODE_KEYS_ONLY, "KEYS_ONLY" },
{ GeneralSettings::MODE_SWITCHABLE, "SWITCHABLE" },
{ GeneralSettings::MODE_GLOBAL, "GLOBAL" },
{ GeneralSettings::HATS_MODE_TRIMS_ONLY, "TRIMS_ONLY" },
{ GeneralSettings::HATS_MODE_KEYS_ONLY, "KEYS_ONLY" },
{ GeneralSettings::HATS_MODE_SWITCHABLE, "SWITCHABLE" },
{ GeneralSettings::HATS_MODE_GLOBAL, "GLOBAL" },
};

struct YamlTrim {
Expand Down
10 changes: 5 additions & 5 deletions companion/src/firmwares/generalsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -684,13 +684,13 @@ QString GeneralSettings::hatsModeToString() const
QString GeneralSettings::hatsModeToString(int value)
{
switch(value) {
case MODE_TRIMS_ONLY:
case HATS_MODE_TRIMS_ONLY:
return tr("Trims only");
case MODE_KEYS_ONLY:
case HATS_MODE_KEYS_ONLY:
return tr("Keys only");
case MODE_SWITCHABLE:
case HATS_MODE_SWITCHABLE:
return tr("Switchable");
case MODE_GLOBAL:
case HATS_MODE_GLOBAL:
return tr("Global");
default:
return CPN_STR_UNKNOWN_ITEM;
Expand All @@ -704,7 +704,7 @@ AbstractStaticItemModel * GeneralSettings::hatsModeItemModel(bool radio_setup)
mdl->setName(AIM_GS_HATSMODE);

for (int i = 0; i < HATS_MODE_COUNT; i++) {
mdl->appendToItemList(hatsModeToString(i), i, i == MODE_GLOBAL && radio_setup ? false : true);
mdl->appendToItemList(hatsModeToString(i), i, i == HATS_MODE_GLOBAL && radio_setup ? false : true);
}

mdl->loadItemList();
Expand Down
8 changes: 4 additions & 4 deletions companion/src/firmwares/generalsettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,10 @@ class GeneralSettings {
};

enum HatsMode {
MODE_TRIMS_ONLY,
MODE_KEYS_ONLY,
MODE_SWITCHABLE,
MODE_GLOBAL,
HATS_MODE_TRIMS_ONLY,
HATS_MODE_KEYS_ONLY,
HATS_MODE_SWITCHABLE,
HATS_MODE_GLOBAL,
HATS_MODE_COUNT
};

Expand Down
8 changes: 4 additions & 4 deletions radio/src/dataconstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -658,10 +658,10 @@ enum BluetoothModes {

#if defined(USE_TRIMS_AS_BUTTONS)
enum HatsMode {
MODE_TRIMS_ONLY,
MODE_KEYS_ONLY,
MODE_SWITCHABLE,
MODE_GLOBAL
HATS_MODE_TRIMS_ONLY,
HATS_MODE_KEYS_ONLY,
HATS_MODE_SWITCHABLE,
HATS_MODE_GLOBAL
};
#endif

Expand Down
2 changes: 1 addition & 1 deletion radio/src/gui/colorlcd/radio_setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ void RadioSetupPage::build(FormWindow * window)
#if defined(USE_TRIMS_AS_BUTTONS)
line = window->newLine(&grid);
new StaticText(line, rect_t{}, STR_HATS_MODE, 0, COLOR_THEME_PRIMARY1);
new Choice(line, rect_t{}, STR_HATS_OPT, MODE_TRIMS_ONLY, MODE_SWITCHABLE,
new Choice(line, rect_t{}, STR_HATS_OPT, HATS_MODE_TRIMS_ONLY, HATS_MODE_SWITCHABLE,
GET_SET_DEFAULT(g_eeGeneral.hatsMode));
#endif

Expand Down
2 changes: 1 addition & 1 deletion radio/src/gui/colorlcd/trims_setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ TrimsSetup::TrimsSetup() : Page(ICON_MODEL_SETUP)
// Hats mode for NV14/EL18
line = body.newLine(&grid);
new StaticText(line, rect_t{}, STR_HATS_MODE, 0, COLOR_THEME_PRIMARY1);
new Choice(line, rect_t{}, STR_HATS_OPT, MODE_TRIMS_ONLY, MODE_GLOBAL,
new Choice(line, rect_t{}, STR_HATS_OPT, HATS_MODE_TRIMS_ONLY, HATS_MODE_GLOBAL,
GET_SET_DEFAULT(g_model.hatsMode));
#endif

Expand Down
4 changes: 2 additions & 2 deletions radio/src/keys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,8 @@ static void transpose_trims(uint32_t *keys)
static uint8_t state = 0;

bool allowModeSwitch =
((g_model.hatsMode == MODE_GLOBAL && g_eeGeneral.hatsMode == MODE_SWITCHABLE) ||
(g_model.hatsMode == MODE_SWITCHABLE)) &&
((g_model.hatsMode == HATS_MODE_GLOBAL && g_eeGeneral.hatsMode == HATS_MODE_SWITCHABLE) ||
(g_model.hatsMode == HATS_MODE_SWITCHABLE)) &&
!getTransposeTrimsForLUA();

if(allowModeSwitch) {
Expand Down
8 changes: 4 additions & 4 deletions radio/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,15 +268,15 @@ void checkSpeakerVolume()

#if defined(USE_TRIMS_AS_BUTTONS)
void checkTrimsAsButtons() {
uint8_t hatsMode = g_model.hatsMode == MODE_GLOBAL ? g_eeGeneral.hatsMode : g_model.hatsMode;
uint8_t hatsMode = g_model.hatsMode == HATS_MODE_GLOBAL ? g_eeGeneral.hatsMode : g_model.hatsMode;

static bool oldHatsModeButtons = hatsMode == MODE_KEYS_ONLY;
static bool oldHatsModeButtons = hatsMode == HATS_MODE_KEYS_ONLY;

if(hatsMode == MODE_TRIMS_ONLY) {
if(hatsMode == HATS_MODE_TRIMS_ONLY) {
setTrimsAsButtons(false);
}

if(hatsMode == MODE_KEYS_ONLY) {
if(hatsMode == HATS_MODE_KEYS_ONLY) {
setTrimsAsButtons(true);
}

Expand Down
8 changes: 4 additions & 4 deletions radio/src/storage/yaml/yaml_datastructs_nv14.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
//

const struct YamlIdStr enum_HatsMode[] = {
{ MODE_TRIMS_ONLY, "TRIMS_ONLY" },
{ MODE_KEYS_ONLY, "KEYS_ONLY" },
{ MODE_SWITCHABLE, "SWITCHABLE " },
{ MODE_GLOBAL, "GLOBAL" },
{ HATS_MODE_TRIMS_ONLY, "TRIMS_ONLY" },
{ HATS_MODE_KEYS_ONLY, "KEYS_ONLY" },
{ HATS_MODE_SWITCHABLE, "SWITCHABLE" },
{ HATS_MODE_GLOBAL, "GLOBAL" },
{ 0, NULL }
};

Expand Down

0 comments on commit 0dad502

Please sign in to comment.