mirror of
https://github.com/opentx/opentx.git
synced 2025-07-23 16:25:16 +03:00
[Horus] First fixes on the real radio
This commit is contained in:
parent
bbe4e7d4c3
commit
a43271c7a6
3 changed files with 31 additions and 25 deletions
|
@ -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()
|
||||
|
||||
|
|
|
@ -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<<i)))) {
|
||||
lcdDrawNumber((stickIndex==0 ? TRIM_LH_X : TRIM_RH_X)+(trim>0 ? -20 : 50), ym+2, trim, TINSIZE);
|
||||
lcdDrawNumber((stickIndex==0 ? TRIM_LH_X : TRIM_RH_X)+(trim>0 ? -20 : 50), ym+1, trim, TINSIZE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue