X3 switch fixes

This commit is contained in:
Bertrand Songis
2019-02-18 16:15:56 +01:00
parent decfa57149
commit 8772123250
5 changed files with 24 additions and 15 deletions
+6 -1
View File
@@ -170,6 +170,10 @@ void writeHeader()
#define STR_SWITCHES_LOG_HEADER "SA,SB,SC,SD,SF,SH"
#elif defined(PCBXLITE)
#define STR_SWITCHES_LOG_HEADER "SA,SB,SC,SD"
#elif defined(PCBXLITES)
#define STR_SWITCHES_LOG_HEADER "SA,SB,SC,SD,SE,SF"
#elif defined(PCBX3)
#define STR_SWITCHES_LOG_HEADER "SA,SB,SC,SE,SF"
#else
#define STR_SWITCHES_LOG_HEADER "SA,SB,SC,SD,SE,SF,SG,SH"
#endif
@@ -275,7 +279,8 @@ f_printf(&g_oLogFile, "%d,%d,%d,%d,0x%08X%08X,",
GET_3POS_STATE(SA),
GET_3POS_STATE(SB),
GET_3POS_STATE(SC),
GET_3POS_STATE(SD),
GET_2POS_STATE(SE),
GET_2POS_STATE(SF),
getLogicalSwitchesStates(32),
getLogicalSwitchesStates(0));
#elif defined(PCBXLITE)
+4 -2
View File
@@ -132,15 +132,17 @@ void getSwitchesPosition(bool startup)
CHECK_3POS(0, SW_SA);
CHECK_3POS(1, SW_SB);
CHECK_3POS(2, SW_SC);
#if !defined(PCBX3)
CHECK_3POS(3, SW_SD);
#if defined(PCBXLITES)
#endif
#if defined(PCBXLITES) || defined(PCBX3)
CHECK_2POS(SW_SE);
#elif defined(PCBX7) || defined(PCBXLITE) || defined(PCBX3)
// No SE
#else
CHECK_3POS(4, SW_SE);
#endif
#if defined(PCBXLITE) && !defined(PCBXLITES) || defined(PCBX3)
#if defined(PCBXLITE) && !defined(PCBXLITES)
// No SF
#else
CHECK_2POS(SW_SF);
+4 -2
View File
@@ -300,15 +300,17 @@ enum EnumSwitchesPositions
SW_SC0,
SW_SC1,
SW_SC2,
#if !defined(PCBX3)
SW_SD0,
SW_SD1,
SW_SD2,
#if defined(PCBX9) || defined(PCBXLITES)
#endif
#if defined(PCBX9) || defined(PCBXLITES) || defined(PCBX3)
SW_SE0,
SW_SE1,
SW_SE2,
#endif
#if defined(PCBX9) || defined(PCBX7) || defined(PCBXLITES)
#if defined(PCBX9) || defined(PCBX7) || defined(PCBXLITES) || defined(PCBX3)
SW_SF0,
SW_SF1,
SW_SF2,
+7 -5
View File
@@ -288,8 +288,7 @@
#define SWITCHES_GPIO_REG_D_H GPIOE->IDR
#define SWITCHES_GPIO_PIN_D_H GPIO_Pin_2 // PE.02
#elif defined(PCBX3)
#define SWITCHES_GPIO_REG_D GPIOC->IDR
#define SWITCHES_GPIO_PIN_D GPIO_Pin_13 // PC.13
// no SWD
#else
#define SWITCHES_GPIO_REG_D_H GPIOE->IDR
#define SWITCHES_GPIO_PIN_D_H GPIO_Pin_7 // PE.07
@@ -305,7 +304,10 @@
#elif defined(PCBXLITES)
#define SWITCHES_GPIO_REG_E GPIOE->IDR
#define SWITCHES_GPIO_PIN_E GPIO_Pin_5 // PE.05
#elif defined(PCBX7) || defined(PCBXLITE) || defined(PCBX3)
#elif defined(PCBX3)
#define SWITCHES_GPIO_REG_E GPIOC->IDR
#define SWITCHES_GPIO_PIN_E GPIO_Pin_13 // PC.13
#elif defined(PCBX7) || defined(PCBXLITE)
// no SWE
#else
#define SWITCHES_GPIO_REG_E_H GPIOB->IDR
@@ -338,7 +340,7 @@
#define SWITCHES_GPIO_PIN_G_H GPIO_Pin_3 // PF.03
#define SWITCHES_GPIO_REG_G_L GPIOF->IDR
#define SWITCHES_GPIO_PIN_G_L GPIO_Pin_4 // PF.04
#elif defined(PCBX7) || defined(PCBXLITE)
#elif defined(PCBX7) || defined(PCBXLITE) || defined(PCBX3)
// no SWG
#else
#define SWITCHES_GPIO_REG_G_H GPIOE->IDR
@@ -353,7 +355,7 @@
#elif defined(PCBX9DP)
#define SWITCHES_GPIO_REG_H GPIOD->IDR
#define SWITCHES_GPIO_PIN_H GPIO_Pin_14 // PD.14
#elif defined(PCBXLITE)
#elif defined(PCBXLITE) || defined(PCBX3)
// no SWH
#elif defined(PCBX7)
#define SWITCHES_GPIO_REG_H GPIOD->IDR
+3 -5
View File
@@ -207,15 +207,13 @@ uint32_t switchState(uint8_t index)
ADD_3POS_CASE(A, 0);
ADD_3POS_CASE(B, 1);
ADD_3POS_CASE(C, 2);
#if defined(PCBX3)
ADD_2POS_CASE(D);
#else
#if !defined(PCBX3)
ADD_3POS_CASE(D, 3);
#endif
#if defined(PCBXLITES)
#if defined(PCBXLITES) || defined(PCBX3)
ADD_2POS_CASE(E);
ADD_2POS_CASE(F);
// no SWF, SWG and SWH on XLITE
// no SWG and SWH on XLITES and X3
#elif defined(PCBXLITE) || defined(PCBX3)
// no SWE, SWF, SWG and SWH on X3 and XLITE
#elif defined(PCBX7)