mirror of
https://github.com/opentx/opentx.git
synced 2025-07-23 08:15:17 +03:00
X10 fixes (#5221)
1. BackLight < 42 was bad 2. SWB D E F direction inverted 3. Wrong battery voltage
This commit is contained in:
parent
9cb4b782e1
commit
509df44c4f
6 changed files with 43 additions and 20 deletions
|
@ -376,18 +376,12 @@ bool menuRadioSetup(event_t event)
|
|||
|
||||
case ITEM_SETUP_BRIGHTNESS:
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_BLONBRIGHTNESS);
|
||||
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, 100-g_eeGeneral.backlightBright, attr|LEFT) ;
|
||||
if (attr) {
|
||||
uint8_t b = 100 - g_eeGeneral.backlightBright;
|
||||
CHECK_INCDEC_GENVAR(event, b, 5, 100);
|
||||
g_eeGeneral.backlightBright = 100 - b;
|
||||
}
|
||||
g_eeGeneral.backlightBright = BACKLIGHT_LEVEL_MAX - editSlider(RADIO_SETUP_2ND_COLUMN, y, event, BACKLIGHT_LEVEL_MAX - g_eeGeneral.backlightBright, BACKLIGHT_LEVEL_MIN, BACKLIGHT_LEVEL_MAX, attr);
|
||||
break;
|
||||
|
||||
case ITEM_SETUP_DIM_LEVEL:
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_BLOFFBRIGHTNESS);
|
||||
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.blOffBright, attr|LEFT) ;
|
||||
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.blOffBright, 5, 100);
|
||||
g_eeGeneral.blOffBright = editSlider(RADIO_SETUP_2ND_COLUMN, y, event, g_eeGeneral.blOffBright, BACKLIGHT_LEVEL_MIN, BACKLIGHT_LEVEL_MAX, attr);
|
||||
break;
|
||||
|
||||
case ITEM_SETUP_LABEL_GPS:
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#if defined(SIMU)
|
||||
// not needed
|
||||
#elif defined(PCBX10)
|
||||
const int8_t ana_direction[NUM_ANALOGS] = {1,-1,1,-1, -1,1,-1, 1,-1, -1, 1,1};
|
||||
const int8_t ana_direction[NUM_ANALOGS] = {1,-1,1,-1, -1,1,-1, 1,-1, 1, 1,1};
|
||||
#elif defined(PCBX9E)
|
||||
#if defined(HORUS_STICKS)
|
||||
const int8_t ana_direction[NUM_ANALOGS] = {1,-1,1,-1, -1,-1,-1,1, -1,1,1,1, -1};
|
||||
|
|
|
@ -67,18 +67,14 @@ void backlightInit()
|
|||
|
||||
void backlightEnable(uint8_t dutyCycle)
|
||||
{
|
||||
if (dutyCycle < 5) {
|
||||
dutyCycle = 5;
|
||||
}
|
||||
|
||||
#if defined(PCBX12S)
|
||||
if (IS_HORUS_PROD()) {
|
||||
BL_TIMER->CCR4 = dutyCycle;
|
||||
}
|
||||
else {
|
||||
BL_TIMER->CCR1 = (100 - dutyCycle);
|
||||
BL_TIMER->CCR1 = BACKLIGHT_LEVEL_MAX - dutyCycle;
|
||||
}
|
||||
#elif defined(PCBX10)
|
||||
BL_TIMER->CCR3 = (100 - dutyCycle);
|
||||
BL_TIMER->CCR3 = BACKLIGHT_LEVEL_MAX - dutyCycle;
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -445,8 +445,14 @@ void backlightInit(void);
|
|||
#else
|
||||
void backlightEnable(uint8_t dutyCycle);
|
||||
#endif
|
||||
#define BACKLIGHT_ENABLE() backlightEnable(unexpectedShutdown ? 100 : 100-g_eeGeneral.backlightBright)
|
||||
#define BACKLIGHT_DISABLE() backlightEnable(unexpectedShutdown ? 100 : g_eeGeneral.blOffBright)
|
||||
#define BACKLIGHT_LEVEL_MAX 100
|
||||
#if defined(PCBX12S)
|
||||
#define BACKLIGHT_LEVEL_MIN 5
|
||||
#else
|
||||
#define BACKLIGHT_LEVEL_MIN 42
|
||||
#endif
|
||||
#define BACKLIGHT_ENABLE() backlightEnable(unexpectedShutdown ? BACKLIGHT_LEVEL_MAX : BACKLIGHT_LEVEL_MAX-g_eeGeneral.backlightBright)
|
||||
#define BACKLIGHT_DISABLE() backlightEnable(unexpectedShutdown ? BACKLIGHT_LEVEL_MAX : g_eeGeneral.blOffBright)
|
||||
#define isBacklightEnabled() true
|
||||
|
||||
#if !defined(SIMU)
|
||||
|
|
|
@ -221,7 +221,7 @@
|
|||
#define ADC_CHANNEL_POT1 ADC_Channel_10 // ADC3_IN10
|
||||
#define ADC_CHANNEL_POT2 ADC_Channel_11 // ADC3_IN11
|
||||
#define ADC_CHANNEL_POT3 ADC_Channel_12 // ADC3_IN12
|
||||
#define ADC_CHANNEL_SLIDER1 ADC_Channel_4 // ADC3_IN13
|
||||
#define ADC_CHANNEL_SLIDER1 ADC_Channel_4 // ADC3_IN4
|
||||
#define ADC_CHANNEL_SLIDER2 ADC_Channel_13 // ADC3_IN13
|
||||
#define ADC_CHANNEL_BATT ADC_Channel_5 // ADC3_IN5
|
||||
#define ADC_CHANNEL_EXT1 ADC_Channel_6 // ADC3_IN6
|
||||
|
|
|
@ -129,7 +129,7 @@ void readKeysAndTrims()
|
|||
case SW_S ## x ## 2: \
|
||||
xxx = ~SWITCHES_GPIO_REG_ ## x & SWITCHES_GPIO_PIN_ ## x ; \
|
||||
break
|
||||
#define ADD_NEG_2POS_CASE(x) \
|
||||
#define ADD_INV_2POS_CASE(x) \
|
||||
case SW_S ## x ## 2: \
|
||||
xxx = SWITCHES_GPIO_REG_ ## x & SWITCHES_GPIO_PIN_ ## x ; \
|
||||
break; \
|
||||
|
@ -152,6 +152,22 @@ void readKeysAndTrims()
|
|||
xxx = xxx && (SWITCHES_GPIO_REG_ ## x ## _L & SWITCHES_GPIO_PIN_ ## x ## _L); \
|
||||
} \
|
||||
break
|
||||
#define ADD_INV_3POS_CASE(x, i) \
|
||||
case SW_S ## x ## 2: \
|
||||
xxx = (SWITCHES_GPIO_REG_ ## x ## _H & SWITCHES_GPIO_PIN_ ## x ## _H); \
|
||||
if (IS_3POS(i)) { \
|
||||
xxx = xxx && (~SWITCHES_GPIO_REG_ ## x ## _L & SWITCHES_GPIO_PIN_ ## x ## _L); \
|
||||
} \
|
||||
break; \
|
||||
case SW_S ## x ## 1: \
|
||||
xxx = (SWITCHES_GPIO_REG_ ## x ## _H & SWITCHES_GPIO_PIN_ ## x ## _H) && (SWITCHES_GPIO_REG_ ## x ## _L & SWITCHES_GPIO_PIN_ ## x ## _L); \
|
||||
break; \
|
||||
case SW_S ## x ## 0: \
|
||||
xxx = (~SWITCHES_GPIO_REG_ ## x ## _H & SWITCHES_GPIO_PIN_ ## x ## _H); \
|
||||
if (IS_3POS(i)) { \
|
||||
xxx = xxx && (SWITCHES_GPIO_REG_ ## x ## _L & SWITCHES_GPIO_PIN_ ## x ## _L); \
|
||||
} \
|
||||
break
|
||||
|
||||
#if !defined(BOOT)
|
||||
uint8_t keyState(uint8_t index)
|
||||
|
@ -164,14 +180,25 @@ uint32_t switchState(uint8_t index)
|
|||
uint32_t xxx = 0;
|
||||
|
||||
switch (index) {
|
||||
#if defined(PBX12S)
|
||||
ADD_3POS_CASE(A, 0);
|
||||
ADD_3POS_CASE(B, 1);
|
||||
ADD_3POS_CASE(C, 2);
|
||||
ADD_3POS_CASE(D, 3);
|
||||
ADD_3POS_CASE(E, 4);
|
||||
ADD_NEG_2POS_CASE(F);
|
||||
ADD_INV_2POS_CASE(F);
|
||||
ADD_3POS_CASE(G, 6);
|
||||
ADD_2POS_CASE(H);
|
||||
#else
|
||||
ADD_3POS_CASE(A, 0);
|
||||
ADD_INV_3POS_CASE(B, 1);
|
||||
ADD_3POS_CASE(C, 2);
|
||||
ADD_INV_3POS_CASE(D, 3);
|
||||
ADD_INV_3POS_CASE(E, 4);
|
||||
ADD_2POS_CASE(F);
|
||||
ADD_3POS_CASE(G, 6);
|
||||
ADD_2POS_CASE(H);
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue