Default switchs / pots / sliders configuration moved to the HAL (#6514)

Default switchs / pots / sliders configuration moved to the HAL
This commit is contained in:
Bertrand Songis
2019-06-18 15:47:38 +02:00
committed by GitHub
parent 6ab73f3ece
commit 0ec02f096c
9 changed files with 93 additions and 79 deletions
+18 -37
View File
@@ -235,41 +235,22 @@ void generalDefault()
g_eeGeneral.version = EEPROM_VER;
g_eeGeneral.variant = EEPROM_VARIANT;
#if !defined(PCBHORUS)
#if defined(PCBHORUS)
g_eeGeneral.blOffBright = 20;
#else
g_eeGeneral.contrast = LCD_CONTRAST_DEFAULT;
#endif
#if defined(PCBHORUS)
#if PCBREV >= 13
g_eeGeneral.potsConfig = 0x1B; // S1 = pot, 6P = multipos, S2 = pot with detent
#else
g_eeGeneral.potsConfig = 0x19; // S1 = pot without detent, 6P = multipos, S2 = pot with detent
#endif
g_eeGeneral.slidersConfig = 0x0f; // 4 sliders
g_eeGeneral.blOffBright = 20;
#elif defined(PCBXLITE)
g_eeGeneral.potsConfig = 0x0F; // S1 and S2 = pot without detent
#elif defined(PCBX7)
g_eeGeneral.potsConfig = (POT_WITHOUT_DETENT << 0) + (POT_WITH_DETENT << 2); // S1 = pot without detent, S2 = pot with detent
#elif defined(PCBX9LITE)
g_eeGeneral.potsConfig = (POT_WITH_DETENT << 0); // S1 = pot with detent
#elif defined(PCBTARANIS)
g_eeGeneral.potsConfig = 0x05; // S1 and S2 = pots with detent
g_eeGeneral.slidersConfig = 0x03; // LS and RS = sliders with detent
#if defined(DEFAULT_POTS_CONFIG)
g_eeGeneral.potsConfig = DEFAULT_POTS_CONFIG;
#endif
#if defined(PCBXLITES)
g_eeGeneral.switchConfig = (SWITCH_TOGGLE << 10) + (SWITCH_TOGGLE << 8) + (SWITCH_2POS << 6) + (SWITCH_2POS << 4) + (SWITCH_3POS << 2) + (SWITCH_3POS << 0);
#elif defined(PCBXLITE)
g_eeGeneral.switchConfig = (SWITCH_2POS << 6) + (SWITCH_2POS << 4) + (SWITCH_3POS << 2) + (SWITCH_3POS << 0);
#elif defined(RADIO_X7)
g_eeGeneral.switchConfig = 0x000006ff; // 4x3POS, 1x2POS, 1xTOGGLE
#elif defined(RADIO_T12)
g_eeGeneral.switchConfig = (SWITCH_2POS << 10) + (SWITCH_2POS << 8) + (SWITCH_3POS << 6) + (SWITCH_3POS << 4) + (SWITCH_3POS << 2) + (SWITCH_3POS << 0);
#elif defined(PCBX9LITE)
g_eeGeneral.switchConfig = (SWITCH_TOGGLE << 8) + (SWITCH_2POS << 6) + (SWITCH_3POS << 4) + (SWITCH_3POS << 2) + (SWITCH_3POS << 0);
#elif defined(PCBTARANIS) || defined(PCBHORUS)
g_eeGeneral.switchConfig = 0x00007bff; // 6x3POS, 1x2POS, 1xTOGGLE
#if defined(DEFAULT_SWITCH_CONFIG)
g_eeGeneral.switchConfig = DEFAULT_SWITCH_CONFIG;
#endif
#if defined(DEFAULT_SLIDERS_CONFIG)
g_eeGeneral.slidersConfig = DEFAULT_SLIDERS_CONFIG;
#endif
// vBatWarn is voltage in 100mV, vBatMin is in 100mV but with -9V offset, vBatMax has a -12V offset
@@ -311,7 +292,7 @@ void generalDefault()
strcpy(g_eeGeneral.currModelFilename, DEFAULT_MODEL_FILENAME);
#endif
#if defined(PCBHORUS)
#if defined(COLORLCD)
strcpy(g_eeGeneral.themeName, theme->getName());
theme->init();
#endif
@@ -1563,7 +1544,7 @@ void opentxClose(uint8_t shutdown)
#endif
#if defined(LUA)
luaClose(&lsScripts);
#if defined(PCBHORUS)
#if defined(COLORLCD)
luaClose(&lsWidgets);
#endif
#endif
@@ -1614,7 +1595,8 @@ void opentxResume()
sdMount();
storageReadAll();
#if defined(PCBHORUS)
#if defined(COLORLCD)
loadTheme();
loadFontCache();
#endif
@@ -1790,7 +1772,7 @@ void opentxInit()
storageReadCurrentModel();
#endif
#if defined(PCBHORUS)
#if defined(COLORLCD)
if (!unexpectedShutdown) {
// g_model.topbarData is still zero here (because it was not yet read from SDCARD),
// but we only remember the pointer to in in constructor.
@@ -1861,7 +1843,7 @@ void opentxInit()
btInit();
#endif
#if defined(PCBHORUS)
#if defined(COLORLCD)
loadTheme();
loadFontCache();
#endif
@@ -1919,11 +1901,10 @@ int main()
boardInit();
#if defined(PCBHORUS)
#if defined(COLORLCD)
loadFonts();
#endif
#if defined(GUI) && !defined(PCBTARANIS) && !defined(PCBHORUS)
// TODO remove this
lcdInit();