1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-23 16:25:16 +03:00
1. BackLight < 42 was bad
2. SWB D E F direction inverted
3. Wrong battery voltage
This commit is contained in:
Bertrand Songis 2017-09-17 21:40:51 +02:00 committed by GitHub
parent 9cb4b782e1
commit 509df44c4f
6 changed files with 43 additions and 20 deletions

View file

@ -376,18 +376,12 @@ bool menuRadioSetup(event_t event)
case ITEM_SETUP_BRIGHTNESS: case ITEM_SETUP_BRIGHTNESS:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_BLONBRIGHTNESS); lcdDrawText(MENUS_MARGIN_LEFT, y, STR_BLONBRIGHTNESS);
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, 100-g_eeGeneral.backlightBright, attr|LEFT) ; 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);
if (attr) {
uint8_t b = 100 - g_eeGeneral.backlightBright;
CHECK_INCDEC_GENVAR(event, b, 5, 100);
g_eeGeneral.backlightBright = 100 - b;
}
break; break;
case ITEM_SETUP_DIM_LEVEL: case ITEM_SETUP_DIM_LEVEL:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_BLOFFBRIGHTNESS); lcdDrawText(MENUS_MARGIN_LEFT, y, STR_BLOFFBRIGHTNESS);
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.blOffBright, attr|LEFT) ; g_eeGeneral.blOffBright = editSlider(RADIO_SETUP_2ND_COLUMN, y, event, g_eeGeneral.blOffBright, BACKLIGHT_LEVEL_MIN, BACKLIGHT_LEVEL_MAX, attr);
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.blOffBright, 5, 100);
break; break;
case ITEM_SETUP_LABEL_GPS: case ITEM_SETUP_LABEL_GPS:

View file

@ -23,7 +23,7 @@
#if defined(SIMU) #if defined(SIMU)
// not needed // not needed
#elif defined(PCBX10) #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) #elif defined(PCBX9E)
#if defined(HORUS_STICKS) #if defined(HORUS_STICKS)
const int8_t ana_direction[NUM_ANALOGS] = {1,-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, -1};

View file

@ -67,18 +67,14 @@ void backlightInit()
void backlightEnable(uint8_t dutyCycle) void backlightEnable(uint8_t dutyCycle)
{ {
if (dutyCycle < 5) {
dutyCycle = 5;
}
#if defined(PCBX12S) #if defined(PCBX12S)
if (IS_HORUS_PROD()) { if (IS_HORUS_PROD()) {
BL_TIMER->CCR4 = dutyCycle; BL_TIMER->CCR4 = dutyCycle;
} }
else { else {
BL_TIMER->CCR1 = (100 - dutyCycle); BL_TIMER->CCR1 = BACKLIGHT_LEVEL_MAX - dutyCycle;
} }
#elif defined(PCBX10) #elif defined(PCBX10)
BL_TIMER->CCR3 = (100 - dutyCycle); BL_TIMER->CCR3 = BACKLIGHT_LEVEL_MAX - dutyCycle;
#endif #endif
} }

View file

@ -445,8 +445,14 @@ void backlightInit(void);
#else #else
void backlightEnable(uint8_t dutyCycle); void backlightEnable(uint8_t dutyCycle);
#endif #endif
#define BACKLIGHT_ENABLE() backlightEnable(unexpectedShutdown ? 100 : 100-g_eeGeneral.backlightBright) #define BACKLIGHT_LEVEL_MAX 100
#define BACKLIGHT_DISABLE() backlightEnable(unexpectedShutdown ? 100 : g_eeGeneral.blOffBright) #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 #define isBacklightEnabled() true
#if !defined(SIMU) #if !defined(SIMU)

View file

@ -221,7 +221,7 @@
#define ADC_CHANNEL_POT1 ADC_Channel_10 // ADC3_IN10 #define ADC_CHANNEL_POT1 ADC_Channel_10 // ADC3_IN10
#define ADC_CHANNEL_POT2 ADC_Channel_11 // ADC3_IN11 #define ADC_CHANNEL_POT2 ADC_Channel_11 // ADC3_IN11
#define ADC_CHANNEL_POT3 ADC_Channel_12 // ADC3_IN12 #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_SLIDER2 ADC_Channel_13 // ADC3_IN13
#define ADC_CHANNEL_BATT ADC_Channel_5 // ADC3_IN5 #define ADC_CHANNEL_BATT ADC_Channel_5 // ADC3_IN5
#define ADC_CHANNEL_EXT1 ADC_Channel_6 // ADC3_IN6 #define ADC_CHANNEL_EXT1 ADC_Channel_6 // ADC3_IN6

View file

@ -129,7 +129,7 @@ void readKeysAndTrims()
case SW_S ## x ## 2: \ case SW_S ## x ## 2: \
xxx = ~SWITCHES_GPIO_REG_ ## x & SWITCHES_GPIO_PIN_ ## x ; \ xxx = ~SWITCHES_GPIO_REG_ ## x & SWITCHES_GPIO_PIN_ ## x ; \
break break
#define ADD_NEG_2POS_CASE(x) \ #define ADD_INV_2POS_CASE(x) \
case SW_S ## x ## 2: \ case SW_S ## x ## 2: \
xxx = SWITCHES_GPIO_REG_ ## x & SWITCHES_GPIO_PIN_ ## x ; \ xxx = SWITCHES_GPIO_REG_ ## x & SWITCHES_GPIO_PIN_ ## x ; \
break; \ break; \
@ -152,6 +152,22 @@ void readKeysAndTrims()
xxx = xxx && (SWITCHES_GPIO_REG_ ## x ## _L & SWITCHES_GPIO_PIN_ ## x ## _L); \ xxx = xxx && (SWITCHES_GPIO_REG_ ## x ## _L & SWITCHES_GPIO_PIN_ ## x ## _L); \
} \ } \
break 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) #if !defined(BOOT)
uint8_t keyState(uint8_t index) uint8_t keyState(uint8_t index)
@ -164,14 +180,25 @@ uint32_t switchState(uint8_t index)
uint32_t xxx = 0; uint32_t xxx = 0;
switch (index) { switch (index) {
#if defined(PBX12S)
ADD_3POS_CASE(A, 0); ADD_3POS_CASE(A, 0);
ADD_3POS_CASE(B, 1); ADD_3POS_CASE(B, 1);
ADD_3POS_CASE(C, 2); ADD_3POS_CASE(C, 2);
ADD_3POS_CASE(D, 3); ADD_3POS_CASE(D, 3);
ADD_3POS_CASE(E, 4); ADD_3POS_CASE(E, 4);
ADD_NEG_2POS_CASE(F); ADD_INV_2POS_CASE(F);
ADD_3POS_CASE(G, 6); ADD_3POS_CASE(G, 6);
ADD_2POS_CASE(H); 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: default:
break; break;
} }