3djc/x7 hardware screen (#4221)

* Introduce hardware screen for X7

* Cosmetics

* Shorten pot string for 128, other cosmetics

* Fix translation strings
This commit is contained in:
3djc
2017-01-11 22:44:26 +01:00
committed by Bertrand Songis
parent 4fd42e0e3d
commit 3944f30d06
13 changed files with 149 additions and 33 deletions
+2 -2
View File
@@ -81,7 +81,7 @@ enum MenuRadioIndexes
MENU_RADIO_VERSION,
MENU_RADIO_SWITCHES_TEST,
MENU_RADIO_ANALOGS_TEST,
CASE_PCBSKY9X(MENU_RADIO_HARDWARE)
CASE_CPUARM(MENU_RADIO_HARDWARE)
MENU_RADIO_CALIBRATION,
MENU_RADIO_PAGES_COUNT
};
@@ -104,7 +104,7 @@ static const MenuHandlerFunc menuTabGeneral[] PROGMEM = {
menuRadioVersion,
menuRadioDiagKeys,
menuRadioDiagAnalogs,
CASE_PCBSKY9X(menuRadioHardware)
CASE_CPUARM(menuRadioHardware)
menuRadioCalibration
};
+125 -9
View File
@@ -2,7 +2,7 @@
* Copyright (C) OpenTX
*
* Based on code named
* th9x - http://code.google.com/p/th9x
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
@@ -20,6 +20,8 @@
#include "opentx.h"
#if defined(PCBSKY9X)
#define HW_SETTINGS_COLUMN (2+(15*FW))
enum MenuRadioHardwareItems {
ITEM_RADIO_HARDWARE_OPTREX_DISPLAY,
ITEM_RADIO_HARDWARE_STICKS_GAINS_LABELS,
@@ -32,11 +34,8 @@ enum MenuRadioHardwareItems {
ITEM_RADIO_HARDWARE_MAX
};
#define GENERAL_HW_PARAM_OFS (2+(15*FW))
void menuRadioHardware(event_t event)
{
#if defined(PCBX7)
#else
MENU(STR_HARDWARE, menuTabGeneral, MENU_RADIO_HARDWARE, ITEM_RADIO_HARDWARE_MAX+1, {0, 0, (uint8_t)-1, 0, 0, 0, IF_ROTARY_ENCODERS(0) CASE_BLUETOOTH(0)});
uint8_t sub = menuVerticalPosition - 1;
@@ -49,7 +48,7 @@ void menuRadioHardware(event_t event)
switch(k) {
case ITEM_RADIO_HARDWARE_OPTREX_DISPLAY:
g_eeGeneral.optrexDisplay = editChoice(GENERAL_HW_PARAM_OFS, y, STR_LCD, STR_VLCD, g_eeGeneral.optrexDisplay, 0, 1, attr, event);
g_eeGeneral.optrexDisplay = editChoice(HW_SETTINGS_COLUMN, y, STR_LCD, STR_VLCD, g_eeGeneral.optrexDisplay, 0, 1, attr, event);
break;
case ITEM_RADIO_HARDWARE_STICKS_GAINS_LABELS:
@@ -65,7 +64,7 @@ void menuRadioHardware(event_t event)
lcdDrawText(INDENT_WIDTH+3*FW, y, PSTR("Gain"));
uint8_t mask = (1<<(k-ITEM_RADIO_HARDWARE_STICK_LV_GAIN));
uint8_t val = (g_eeGeneral.sticksGain & mask ? 1 : 0);
lcdDrawChar(GENERAL_HW_PARAM_OFS, y, val ? '2' : '1', attr);
lcdDrawChar(HW_SETTINGS_COLUMN, y, val ? '2' : '1', attr);
if (attr) {
CHECK_INCDEC_GENVAR(event, val, 0, 1);
if (checkIncDec_Ret) {
@@ -78,13 +77,13 @@ void menuRadioHardware(event_t event)
#if defined(ROTARY_ENCODERS)
case ITEM_RADIO_HARDWARE_ROTARY_ENCODER:
g_eeGeneral.rotarySteps = editChoice(GENERAL_HW_PARAM_OFS, y, PSTR("Rotary Encoder"), PSTR("\0062steps4steps"), g_eeGeneral.rotarySteps, 0, 1, attr, event);
g_eeGeneral.rotarySteps = editChoice(HW_SETTINGS_COLUMN, y, PSTR("Rotary Encoder"), PSTR("\0062steps4steps"), g_eeGeneral.rotarySteps, 0, 1, attr, event);
break;
#endif
#if defined(BLUETOOTH)
case ITEM_RADIO_HARDWARE_BT_BAUDRATE:
g_eeGeneral.btBaudrate = editChoice(GENERAL_HW_PARAM_OFS, y, STR_BAUDRATE, PSTR("\005115k 9600 19200"), g_eeGeneral.btBaudrate, 0, 2, attr, event);
g_eeGeneral.btBaudrate = editChoice(HW_SETTINGS_COLUMN, y, STR_BAUDRATE, PSTR("\005115k 9600 19200"), g_eeGeneral.btBaudrate, 0, 2, attr, event);
if (attr && checkIncDec_Ret) {
btInit();
}
@@ -92,5 +91,122 @@ void menuRadioHardware(event_t event)
#endif
}
}
#endif
}
#endif // PCBSKY9X
#if defined(PCBX7)
enum MenuRadioHardwareItems {
ITEM_RADIO_HARDWARE_LABEL_STICKS,
ITEM_RADIO_HARDWARE_STICK1,
ITEM_RADIO_HARDWARE_STICK2,
ITEM_RADIO_HARDWARE_STICK3,
ITEM_RADIO_HARDWARE_STICK4,
ITEM_RADIO_HARDWARE_LABEL_POTS,
ITEM_RADIO_HARDWARE_POT1,
ITEM_RADIO_HARDWARE_POT2,
ITEM_RADIO_HARDWARE_LABEL_SWITCHES,
ITEM_RADIO_HARDWARE_SA,
ITEM_RADIO_HARDWARE_SB,
ITEM_RADIO_HARDWARE_SC,
ITEM_RADIO_HARDWARE_SD,
ITEM_RADIO_HARDWARE_SE,
ITEM_RADIO_HARDWARE_SF,
ITEM_RADIO_HARDWARE_JITTER_FILTER,
ITEM_RADIO_HARDWARE_MAX
};
#define POTS_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1
#define SWITCHES_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1
#define SWITCH_TYPE_MAX(sw) ((MIXSRC_SF-MIXSRC_FIRST_SWITCH == sw || MIXSRC_SH-MIXSRC_FIRST_SWITCH == sw) ? SWITCH_2POS : SWITCH_3POS)
#define HW_SETTINGS_COLUMN 30
void menuRadioHardware(event_t event)
{
MENU(STR_HARDWARE, menuTabGeneral, MENU_RADIO_HARDWARE, ITEM_RADIO_HARDWARE_MAX, { LABEL(Sticks), 0, 0, 0, 0, LABEL(Pots), POTS_ROWS, LABEL(Switches), SWITCHES_ROWS });
uint8_t sub = menuVerticalPosition;
for (uint8_t i=0; i<LCD_LINES-1; i++) {
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
uint8_t k = i+menuVerticalOffset;
for (int j=0; j<=k; j++) {
if (mstate_tab[j] == HIDDEN_ROW)
k++;
}
uint8_t blink = ((s_editMode>0) ? BLINK|INVERS : INVERS);
uint8_t attr = (sub == k ? blink : 0);
switch(k) {
case ITEM_RADIO_HARDWARE_LABEL_STICKS:
lcdDrawTextAlignedLeft(y, STR_STICKS);
break;
case ITEM_RADIO_HARDWARE_STICK1:
case ITEM_RADIO_HARDWARE_STICK2:
case ITEM_RADIO_HARDWARE_STICK3:
case ITEM_RADIO_HARDWARE_STICK4:
{
int idx = k-1;
lcdDrawTextAtIndex(INDENT_WIDTH, y, STR_VSRCRAW, idx+1, 0);
if (ZEXIST(g_eeGeneral.anaNames[idx]) || attr)
editName(HW_SETTINGS_COLUMN, y, g_eeGeneral.anaNames[idx], LEN_ANA_NAME, event, attr);
else
lcdDrawTextAtIndex(HW_SETTINGS_COLUMN, y, STR_MMMINV, 0, 0);
break;
}
case ITEM_RADIO_HARDWARE_LABEL_POTS:
lcdDrawTextAlignedLeft(y, STR_POTS);
break;
case ITEM_RADIO_HARDWARE_POT1:
case ITEM_RADIO_HARDWARE_POT2:
{
int idx = k - ITEM_RADIO_HARDWARE_POT1;
uint8_t shift = (2*idx);
uint8_t mask = (0x03 << shift);
lcdDrawTextAtIndex(INDENT_WIDTH, y, STR_VSRCRAW, NUM_STICKS+idx+1, menuHorizontalPosition < 0 ? attr : 0);
if (ZEXIST(g_eeGeneral.anaNames[NUM_STICKS+idx]) || (attr && menuHorizontalPosition == 0))
editName(HW_SETTINGS_COLUMN, y, g_eeGeneral.anaNames[NUM_STICKS+idx], LEN_ANA_NAME, event, attr && menuHorizontalPosition == 0);
else
lcdDrawTextAtIndex(HW_SETTINGS_COLUMN, y, STR_MMMINV, 0, 0);
uint8_t potType = (g_eeGeneral.potsConfig & mask) >> shift;
potType = editChoice(HW_SETTINGS_COLUMN+3*FW, y, "", STR_POTTYPES, potType, POT_NONE, POT_WITHOUT_DETENT, menuHorizontalPosition == 1 ? attr : 0, event);
g_eeGeneral.potsConfig &= ~mask;
g_eeGeneral.potsConfig |= (potType << shift);
break;
}
case ITEM_RADIO_HARDWARE_LABEL_SWITCHES:
lcdDrawTextAlignedLeft(y, STR_SWITCHES);
break;
case ITEM_RADIO_HARDWARE_SA:
case ITEM_RADIO_HARDWARE_SB:
case ITEM_RADIO_HARDWARE_SC:
case ITEM_RADIO_HARDWARE_SD:
case ITEM_RADIO_HARDWARE_SE:
case ITEM_RADIO_HARDWARE_SF:
{
int index = k-ITEM_RADIO_HARDWARE_SA;
int config = SWITCH_CONFIG(index);
lcdDrawTextAtIndex(INDENT_WIDTH, y, STR_VSRCRAW, MIXSRC_FIRST_SWITCH-MIXSRC_Rud+index+1, menuHorizontalPosition < 0 ? attr : 0);
if (ZEXIST(g_eeGeneral.switchNames[index]) || (attr && menuHorizontalPosition == 0))
editName(HW_SETTINGS_COLUMN, y, g_eeGeneral.switchNames[index], LEN_SWITCH_NAME, event, menuHorizontalPosition == 0 ? attr : 0);
else
lcdDrawTextAtIndex(HW_SETTINGS_COLUMN, y, STR_MMMINV, 0, 0);
config = editChoice(HW_SETTINGS_COLUMN+5*FW, y, "", STR_SWTYPES, config, SWITCH_NONE, SWITCH_TYPE_MAX(index), menuHorizontalPosition == 1 ? attr : 0, event);
if (attr && checkIncDec_Ret) {
swconfig_t mask = (swconfig_t)0x03 << (2*index);
g_eeGeneral.switchConfig = (g_eeGeneral.switchConfig & ~mask) | ((swconfig_t(config) & 0x03) << (2*index));
}
break;
}
case ITEM_RADIO_HARDWARE_JITTER_FILTER:
{
uint8_t b = 1-g_eeGeneral.jitterFilter;
g_eeGeneral.jitterFilter = 1 - editCheckBox(b, HW_SETTINGS_COLUMN+5*FW, y, STR_JITTER_FILTER, attr, event);
break;
}
}
}
}
#endif // PCBSKY9X
+2 -2
View File
@@ -76,8 +76,8 @@
#define LEN_SWTYPES "\013"
#define TR_SWTYPES "Žádný\0 ""Bez aretace""2-polohový\0""3-polohový\0"
#define LEN_POTTYPES "\016"
#define TR_POTTYPES "Žádný\0 ""Pot s aretací\0""Vícepol. přep.""Potenciometr\0 "
#define LEN_POTTYPES TR("\013","\016")
#define TR_POTTYPES TR("None\0 ""Pot w. det\0""Multipos\0 ""Pot\0 ", "Žádný\0 ""Pot s aretací\0""Vícepol. přep.""Potenciometr\0 ")
#define LEN_SLIDERTYPES "\006"
#define TR_SLIDERTYPES "Žádný\0""Slider"
+2 -2
View File
@@ -80,8 +80,8 @@
#define LEN_SWTYPES "\006"
#define TR_SWTYPES "Kein\0 ""Taster""2POS\0 ""3POS\0"
#define LEN_POTTYPES "\017"
#define TR_POTTYPES "Kein\0 ""Poti mit Raste ""Stufen-Schalter""Poti ohne Raste\0"
#define LEN_POTTYPES TR("\013","\017")
#define TR_POTTYPES TR("None\0 ""Pot w. det\0""Multipos\0 ""Pot\0 ", "Kein\0 ""Poti mit Raste ""Stufen-Schalter""Poti ohne Raste\0")
#define LEN_SLIDERTYPES "\006"
#define TR_SLIDERTYPES "Keine\0""Slider"
+2 -2
View File
@@ -80,8 +80,8 @@
#define LEN_SWTYPES "\006"
#define TR_SWTYPES "None\0 ""Toggle""2POS\0 ""3POS\0"
#define LEN_POTTYPES "\017"
#define TR_POTTYPES "None\0 ""Pot with detent""Multipos Switch""Pot\0"
#define LEN_POTTYPES TR("\013", "\017")
#define TR_POTTYPES TR("None\0 ""Pot w. det\0""Multipos\0 ""Pot\0 ", "None\0 ""Pot with detent""Multipos Switch""Pot\0")
#define LEN_SLIDERTYPES "\006"
#define TR_SLIDERTYPES "None\0 ""Slider"
+2 -2
View File
@@ -76,8 +76,8 @@
#define LEN_SWTYPES "\006"
#define TR_SWTYPES "None\0 ""Toggle""2POS\0 ""3POS\0"
#define LEN_POTTYPES "\017"
#define TR_POTTYPES "None\0 ""Pot with detent""Multipos Switch""Pot\0"
#define LEN_POTTYPES TR("\013", "\017")
#define TR_POTTYPES TR("None ""Pot w det ""Multipos ""Pot ", "None ""Pot with detent""Multipos Switch""Pot\0")
#define LEN_SLIDERTYPES "\006"
#define TR_SLIDERTYPES "Rien\0 ""Slider"
+2 -2
View File
@@ -76,8 +76,8 @@
#define LEN_SWTYPES "\006"
#define TR_SWTYPES "None\0 ""Toggle""2POS\0 ""3POS\0"
#define LEN_POTTYPES "\017"
#define TR_POTTYPES "None\0 ""Pot with detent""Monias. Kytkin\0""Potikka\0"
#define LEN_POTTYPES TR("\013","\017")
#define TR_POTTYPES TR("None\0 ""Pot w. det\0""Multipos\0 ""Pot\0 ", "None\0 ""Pot with detent""Monias. Kytkin\0""Potikka\0")
#define LEN_SLIDERTYPES "\006"
#define TR_SLIDERTYPES "Rien\0 ""Slider"
+2 -2
View File
@@ -76,8 +76,8 @@
#define LEN_SWTYPES "\006"
#define TR_SWTYPES "Rien\0 ""Levier""2-POS\0""3-POS\0"
#define LEN_POTTYPES "\017"
#define TR_POTTYPES "Rien\0 ""Pot avec centre""Inter multi-pos""Potentiomètre\0"
#define LEN_POTTYPES TR("\013","\017")
#define TR_POTTYPES TR("Rien ""Pot w. det ""Multipos ""Pot ", "Rien\0 ""Pot avec centre""Inter multi-pos""Potentiomètre\0")
#define LEN_SLIDERTYPES "\006"
#define TR_SLIDERTYPES "Rien\0 ""Slider"
+2 -2
View File
@@ -76,8 +76,8 @@
#define LEN_SWTYPES "\006"
#define TR_SWTYPES "None\0 ""Toggle""2POS\0 ""3POS\0"
#define LEN_POTTYPES "\017"
#define TR_POTTYPES "None\0 ""Pot. con centro""Inter. Multipos""Potenziometro\0 "
#define LEN_POTTYPES TR("\013","\017")
#define TR_POTTYPES TR("None\0 ""Pot w. det\0""Multipos\0 ""Pot\0 ", "None\0 ""Pot. con centro""Inter. Multipos""Potenziometro\0 ")
#define LEN_SLIDERTYPES "\006"
#define TR_SLIDERTYPES "Niente""Slider"
+2 -2
View File
@@ -80,8 +80,8 @@
#define TR_SWTYPES "Geen\0 ""Wissel""2POS\0 ""3POS\0"
#define LEN_POTTYPES "\021"
#define TR_POTTYPES "Geen\0 ""Pot met Klik\0 ""Standenschakelaar""Pot zonder Klik\0 "
#define LEN_POTTYPES TR("\013","\021")
#define TR_POTTYPES TR("None\0 ""Pot w. det\0""Multipos\0 ""Pot\0 ", "Geen\0 ""Pot met Klik\0 ""Standenschakelaar""Pot zonder Klik\0 ")
#define LEN_SLIDERTYPES "\006"
+2 -2
View File
@@ -77,8 +77,8 @@
#define LEN_SWTYPES "\006"
#define TR_SWTYPES "Brak\0 ""Chwil.""2POZ\0 ""3POZ\0"
#define LEN_POTTYPES "\017" /*15 decimal*/
#define TR_POTTYPES "Brak\0 ""Poten z zapadką""Przeł.Wielopoz.""Potencjometr\0 "
#define LEN_POTTYPES TR("\013","\017") /*15 decimal*/
#define TR_POTTYPES TR("None\0 ""Pot w. det\0""Multipos\0 ""Pot\0 ", "Brak\0 ""Poten z zapadką""Przeł.Wielopoz.""Potencjometr\0 ")
#define LEN_SLIDERTYPES "\006"
#define TR_SLIDERTYPES "Brak\0 ""Suwak "
+2 -2
View File
@@ -76,8 +76,8 @@
#define LEN_SWTYPES "\006"
#define TR_SWTYPES "None\0 ""Toggle""2POS\0 ""3POS\0"
#define LEN_POTTYPES "\017"
#define TR_POTTYPES "None\0 ""Pot with detent""Multipos Switch""Pot\0"
#define LEN_POTTYPES TR("\013","\017")
#define TR_POTTYPES TR("None\0 ""Pot w. det\0""Multipos\0 ""Pot\0 ", "None\0 ""Pot with detent""Multipos Switch""Pot\0")
#define LEN_SLIDERTYPES "\006"
#define TR_SLIDERTYPES "Rien\0 ""Slider"
+2 -2
View File
@@ -76,8 +76,8 @@
#define LEN_SWTYPES "\006"
#define TR_SWTYPES "Ingen\0""Flipp\0""2Pos\0 ""3Pos\0"
#define LEN_POTTYPES "\020"
#define TR_POTTYPES "Ingen\0 ""Mittläges-pot\0 ""Flerlägesväljare""Potentiometer\0"
#define LEN_POTTYPES TR("\013","\020")
#define TR_POTTYPES TR("None\0 ""Pot w. det\0""Multipos\0 ""Pot\0 ", "Ingen\0 ""Mittläges-pot\0 ""Flerlägesväljare""Potentiometer\0")
#define LEN_SLIDERTYPES "\010"
#define TR_SLIDERTYPES "Ingen\0 ""Skjutpot"