From c163e2513be1a025225dd14f47b2bf941e81d7dc Mon Sep 17 00:00:00 2001 From: "rob@marotori.com" Date: Fri, 20 Sep 2013 14:34:09 +0000 Subject: [PATCH] Update to stick position driver to use ADC system --- src/opentx.cpp | 27 --------------------------- src/targets/sky9x/adc_driver.cpp | 14 +++++++++++++- src/targets/sky9x/board_sky9x.h | 28 +++++++++++++++++++++++++++- 3 files changed, 40 insertions(+), 29 deletions(-) diff --git a/src/opentx.cpp b/src/opentx.cpp index 41dd36de3..40eb6da47 100644 --- a/src/opentx.cpp +++ b/src/opentx.cpp @@ -2265,35 +2265,8 @@ BeepANACenter evalSticks(uint8_t mode) v = -v; #endif - -#if defined(STICK_THR_REV) - v = -v; - if (g_model.throttleReversed && ch==THR_STICK) - v = +v; -#else - //normal stick operation but reveresed in model config if (g_model.throttleReversed && ch==THR_STICK) v = -v; -#endif - -#if defined(STICK_AIL_REV) - if (ch==AIL_STICK) - v = -v; -#endif - -#if defined(STICK_ELE_REV) - if (ch==ELE_STICK) - v = -v; -#endif - -#if defined(STICK_RUD_REV) - if (ch==RUD_STICK) - v = -v; -#endif - - - - /* end rob hack */ #if defined(EXTRA_3POS) diff --git a/src/targets/sky9x/adc_driver.cpp b/src/targets/sky9x/adc_driver.cpp index 204c9c968..6cc07ecb2 100644 --- a/src/targets/sky9x/adc_driver.cpp +++ b/src/targets/sky9x/adc_driver.cpp @@ -36,7 +36,10 @@ #include "../opentx.h" -uint16_t Analog_values[NUMBER_ANALOG]; +volatile uint16_t Analog_values[NUMBER_ANALOG]; +const char ana_direction[NUMBER_ANALOG] = {'STICK_AIL_DIR', 'STICK_RUD_DIR', 0, 'STICK_ELE_DIR' ,0 , 'STICK_THR_DIR',0}; + + // Settings for mode register ADC_MR // USEQ off - silicon problem, doesn't work @@ -111,4 +114,13 @@ void adcRead() if (get_tmr10ms() >= 100 && temperature > maxTemperature) { maxTemperature = temperature; } + + // adc direction correct + uint32_t i ; + for (i=0; i