feat: Add facilty for custom throttle warning position (#1395)

* replace magic number for throttle idle with correct define

* settings for custom throttle warning position

* settings fixed not to break byte-aligment of bit-fields

* evaluate custom throttle warning position

* add requested throttle value to warning text

* comment about field alignment in ModelData struct

* Menu for editing custom throttle warning for 128x64 radios
Tested on RM TX12

* Improoved menu display

* move displayed strings to translation

* translation template added for each language

* support for 212x64 B&W radios

* menu for colorlcd
not tested

* corrected translation entry for TW

* corrected handling of padding bits in ModelData structure

* Companion support for custom throttle warning position

* Rebase catchup

Co-authored-by: Peter Feerick <peter.feerick@gmail.com>
This commit is contained in:
piotrva
2022-01-30 15:04:40 +10:00
committed by GitHub
co-authored by Peter Feerick
parent a052ba63c2
commit bf931a5097
42 changed files with 249 additions and 40 deletions
+18
View File
@@ -74,6 +74,8 @@ enum MenuModelSetupItems {
ITEM_MODEL_SETUP_PREFLIGHT_LABEL,
ITEM_MODEL_SETUP_CHECKLIST_DISPLAY,
ITEM_MODEL_SETUP_THROTTLE_WARNING,
ITEM_MODEL_SETUP_CUSTOM_THROTTLE_WARNING,
ITEM_MODEL_SETUP_CUSTOM_THROTTLE_WARNING_VALUE,
ITEM_MODEL_SETUP_SWITCHES_WARNING1,
#if defined(PCBX9E)
ITEM_MODEL_SETUP_SWITCHES_WARNING2,
@@ -377,6 +379,8 @@ void menuModelSetup(event_t event)
LABEL(PreflightCheck),
0, // Checklist
0, // Throttle warning
0, // Custom position for throttle warning enable
0, // Custom position for throttle warning value
SW_WARN_ROWS, // Switch warning
POT_WARN_ROWS, // Pot warning
@@ -644,6 +648,20 @@ void menuModelSetup(event_t event)
g_model.disableThrottleWarning = !editCheckBox(!g_model.disableThrottleWarning, MODEL_SETUP_2ND_COLUMN, y, STR_THROTTLE_WARNING, attr, event);
break;
case ITEM_MODEL_SETUP_CUSTOM_THROTTLE_WARNING:
g_model.enableCustomThrottleWarning = editCheckBox(g_model.enableCustomThrottleWarning, MODEL_SETUP_2ND_COLUMN, y, STR_CUSTOM_THROTTLE_WARNING, attr, event);
break;
case ITEM_MODEL_SETUP_CUSTOM_THROTTLE_WARNING_VALUE:
{
lcdDrawText(INDENT_WIDTH * 4, y, STR_CUSTOM_THROTTLE_WARNING_VAL);
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, g_model.customThrottleWarningPosition, attr | LEFT, 2);
if (attr) {
CHECK_INCDEC_MODELVAR(event, g_model.customThrottleWarningPosition, -100, 100);
}
}
break;
#if defined(PCBX9E)
case ITEM_MODEL_SETUP_SWITCHES_WARNING2:
case ITEM_MODEL_SETUP_SWITCHES_WARNING3: