diff --git a/radio/src/CMakeLists.txt b/radio/src/CMakeLists.txt index 0d88f8f7d..a7cbe9122 100644 --- a/radio/src/CMakeLists.txt +++ b/radio/src/CMakeLists.txt @@ -814,6 +814,7 @@ if(CPU_FAMILY STREQUAL STM32) add_custom_target(flash COMMAND dfu-util --alt 0 --dfuse-address 0x08000000 -D firmware.bin DEPENDS firmware.bin + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} ) endif() diff --git a/radio/src/gui/horus/view_main.cpp b/radio/src/gui/horus/view_main.cpp index 654c0dada..c18c2f642 100644 --- a/radio/src/gui/horus/view_main.cpp +++ b/radio/src/gui/horus/view_main.cpp @@ -91,7 +91,7 @@ void drawVerticalStick(coord_t x, int val) else lcdDrawSolidHorizontalLine(x+2, 56+i, 9, TEXT_COLOR); } - drawVerticalTrimPosition(x, TRIM_V_Y+val*TRIM_LEN/RESX-6, val); + drawVerticalTrimPosition(x, TRIM_V_Y-val*TRIM_LEN/RESX-6, val); } void drawSticks() @@ -145,7 +145,7 @@ void drawTrims(uint8_t flightMode) drawHorizontalTrimPosition(xm-3, ym-2, val); if (g_model.displayTrims != DISPLAY_TRIMS_NEVER && trim != 0) { if (g_model.displayTrims == DISPLAY_TRIMS_ALWAYS || (trimsDisplayTimer > 0 && (trimsDisplayMask & (1<0 ? -20 : 50), ym+2, trim, TINSIZE); + lcdDrawNumber((stickIndex==0 ? TRIM_LH_X : TRIM_RH_X)+(trim>0 ? -20 : 50), ym+1, trim, TINSIZE); } } } diff --git a/radio/src/targets/horus/adc_driver.cpp b/radio/src/targets/horus/adc_driver.cpp index cf2eab5e0..e9d1c1518 100644 --- a/radio/src/targets/horus/adc_driver.cpp +++ b/radio/src/targets/horus/adc_driver.cpp @@ -1,23 +1,23 @@ -/* - * Copyright (C) OpenTX - * - * Based on code named - * th9x - http://code.google.com/p/th9x - * er9x - http://code.google.com/p/er9x - * gruvin9x - http://code.google.com/p/gruvin9x - * - * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - +/* + * Copyright (C) OpenTX + * + * Based on code named + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + #include "../../opentx.h" #define ADC_CS_HIGH() (ADC_SPI_GPIO->BSRRL = ADC_SPI_PIN_CS) @@ -150,8 +150,8 @@ const uint16_t adcCommands[MOUSE1+2] = MANUAL_MODE | ( SPI_POT3 << 7 ), MANUAL_MODE | ( SPI_SLIDER1 << 7 ), MANUAL_MODE | ( SPI_SLIDER2 << 7 ), - MANUAL_MODE | ( SPI_SLIDER3 << 7 ), MANUAL_MODE | ( SPI_SLIDER4 << 7 ), + MANUAL_MODE | ( SPI_SLIDER3 << 7 ), MANUAL_MODE | ( SPI_TX_VOLTAGE << 7 ), MANUAL_MODE | ( 0 << 7 ), MANUAL_MODE | ( 0 << 7 ) @@ -199,7 +199,12 @@ void adcRead() // On chip ADC read should have finished } -uint16_t getAnalogValue(uint32_t value) +const int8_t ana_direction[NUMBER_ANALOG] = {1,-1,1,-1, -1,1,-1, 1,1, -1,-1, 0,0,0}; + +uint16_t getAnalogValue(uint32_t index) { - return adcValues[value]; + if (ana_direction[index] < 0) + return 4096 - adcValues[index]; + else + return adcValues[index]; }