diff --git a/src/main_views.cpp b/src/main_views.cpp index 32b47c7fa..7d9dd5ce4 100644 --- a/src/main_views.cpp +++ b/src/main_views.cpp @@ -438,17 +438,22 @@ void menuMainView(uint8_t event) // Switches for (uint8_t i=0; i<8; i++) { uint8_t sw; + int16_t val; switch(i) { - case 0: - sw = getValue(MIXSRC_SA-1) > 0 ? 2 : 1; + case 5: + sw = getValue(MIXSRC_SF-1) > 0 ? 3*i+2 : 3*i+1; break; + case 6: + val = getValue(MIXSRC_SG-1); + sw = ((val < 0) ? 3*i : ((val == 0) ? 3*i+1 : 3*i+2)); + break; case 7: - sw = getValue(MIXSRC_SH-1) > 0 ? 2+2+3*6 : 1+2+3*6; + sw = getValue(MIXSRC_SH-1) > 0 ? 3*i+1 : 3*i; break; default: { - int16_t val = getValue(MIXSRC_SA+i-1); - sw = ((val < 0) ? 3*i : ((val == 0) ? 3*i+1 : 3*i+2)); + val = getValue(MIXSRC_SA+i-1); + sw = ((val < 0) ? 3*i+1 : ((val == 0) ? 3*i+2 : 3*i+3)); break; } } diff --git a/src/simpgmspace.cpp b/src/simpgmspace.cpp index faaefcbad..37ac76e2b 100644 --- a/src/simpgmspace.cpp +++ b/src/simpgmspace.cpp @@ -103,8 +103,8 @@ void setSwitch(int8_t swtch) GPIOB->IDR &= ~PIN_SW_A_H; break; case DSW(SW_SA1): - GPIOE->IDR |= PIN_SW_A_H; - GPIOB->IDR |= PIN_SW_A_L; + GPIOB->IDR |= PIN_SW_A_H; + GPIOE->IDR |= PIN_SW_A_L; break; case DSW(SW_SA2): GPIOE->IDR &= ~PIN_SW_A_L; @@ -165,15 +165,15 @@ void setSwitch(int8_t swtch) GPIOE->IDR |= PIN_SW_F; break; case DSW(SW_SG0): - GPIOE->IDR |= PIN_SW_G_L; + GPIOB->IDR |= PIN_SW_G_L; GPIOA->IDR &= ~PIN_SW_G_H; break; case DSW(SW_SG1): GPIOA->IDR |= PIN_SW_G_H; - GPIOE->IDR |= PIN_SW_G_L; + GPIOB->IDR |= PIN_SW_G_L; break; case DSW(SW_SG2): - GPIOE->IDR &= ~PIN_SW_G_L; + GPIOB->IDR &= ~PIN_SW_G_L; GPIOA->IDR |= PIN_SW_G_H; break; case DSW(SW_SH0): diff --git a/src/simu.cpp b/src/simu.cpp index 3640e9c56..0dcb19180 100644 --- a/src/simu.cpp +++ b/src/simu.cpp @@ -444,12 +444,12 @@ long Open9xSim::onTimeout(FXObject*,FXSelector,void*) #endif #if defined(PCBX9D) - SWITCH_KEY(A, SA0, 2); + SWITCH_KEY(A, SA0, 3); SWITCH_KEY(B, SB0, 3); SWITCH_KEY(C, SC0, 3); SWITCH_KEY(D, SD0, 3); SWITCH_KEY(E, SE0, 3); - SWITCH_KEY(F, SF0, 3); + SWITCH_KEY(F, SF0, 2); SWITCH_KEY(G, SG0, 3); SWITCH_KEY(H, SH0, 2); #else diff --git a/src/x9d/delays.cpp b/src/x9d/delays.cpp index ebb5967fa..edb37871f 100644 --- a/src/x9d/delays.cpp +++ b/src/x9d/delays.cpp @@ -48,5 +48,7 @@ void delaysInit(void) { void delay_01us(uint16_t nb){ TIM13->CNT = 0; - while(TIM13->CNT < nb); + TIM13->EGR = 1; + while(((uint16_t)TIM13->CNT) < nb); + TIM13->EGR = 0; } diff --git a/src/x9d/i2c_ee.c b/src/x9d/i2c_ee.c index 6ff1981f9..339959821 100644 --- a/src/x9d/i2c_ee.c +++ b/src/x9d/i2c_ee.c @@ -12,7 +12,7 @@ #include "../open9x.h" -#define I2C_delay() delay_01us(15); +#define I2C_delay() delay_01us(30); /** * @brief Configure the used I/O ports pin diff --git a/src/x9d/keys_driver.cpp b/src/x9d/keys_driver.cpp index 2606de6c0..81533ec22 100644 --- a/src/x9d/keys_driver.cpp +++ b/src/x9d/keys_driver.cpp @@ -124,13 +124,13 @@ uint32_t keyState(EnumKeys enuk) switch ((uint8_t) enuk) { case SW_SA0: - xxx = (~b & PIN_SW_A_H) && (b & PIN_SW_A_L); + xxx = (~b & PIN_SW_A_H) && (e & PIN_SW_A_L); break; case SW_SA1: - xxx = (b & PIN_SW_A_H) && (b & PIN_SW_A_L); + xxx = (b & PIN_SW_A_H) && (e & PIN_SW_A_L); break; case SW_SA2: - xxx = (b & PIN_SW_A_H) && (~b & PIN_SW_A_L); + xxx = (b & PIN_SW_A_H) && (~e & PIN_SW_A_L); break; case SW_SB0: