- X7S option removed (#5388)

- runtime detection of bluetooth chip
This commit is contained in:
3djc
2017-11-19 23:49:38 +01:00
committed by Bertrand Songis
parent d11618eb3f
commit d13fb8918f
8 changed files with 37 additions and 24 deletions
+3 -3
View File
@@ -1,7 +1,7 @@
include(CMakeForceCompiler) include(CMakeForceCompiler)
include(Bitmaps) include(Bitmaps)
set(PCB_TYPES X7 X7S X9D X9D+ X9E X10 X12S 9X 9XR 9X128 9XR128 9X2561 GRUVIN9X MEGA2560 SKY9X 9XRPRO AR9X) set(PCB_TYPES X7 X9D X9D+ X9E X10 X12S 9X 9XR 9X128 9XR128 9X2561 GRUVIN9X MEGA2560 SKY9X 9XRPRO AR9X)
set(GUI_LANGUAGES CZ DE EN ES FR IT PT SK SE PL HU NL) set(GUI_LANGUAGES CZ DE EN ES FR IT PT SK SE PL HU NL)
set(TTS_LANGUAGES CZ DE EN ES FR IT PT SK SE PL HU) set(TTS_LANGUAGES CZ DE EN ES FR IT PT SK SE PL HU)
@@ -83,7 +83,7 @@ set(FATFS_SRC
if(PCB STREQUAL X12S OR PCB STREQUAL X10) if(PCB STREQUAL X12S OR PCB STREQUAL X10)
include(targets/horus/CMakeLists.txt) include(targets/horus/CMakeLists.txt)
elseif(PCB STREQUAL X9E OR PCB STREQUAL X9D+ OR PCB STREQUAL X9D OR PCB STREQUAL X7 OR PCB STREQUAL X7S) elseif(PCB STREQUAL X9E OR PCB STREQUAL X9D+ OR PCB STREQUAL X9D OR PCB STREQUAL X7)
include(targets/taranis/CMakeLists.txt) include(targets/taranis/CMakeLists.txt)
elseif(PCB STREQUAL SKY9X OR PCB STREQUAL 9XRPRO OR PCB STREQUAL AR9X) elseif(PCB STREQUAL SKY9X OR PCB STREQUAL 9XRPRO OR PCB STREQUAL AR9X)
include(targets/sky9x/CMakeLists.txt) include(targets/sky9x/CMakeLists.txt)
@@ -491,7 +491,7 @@ if(NOT MSVC)
endif() endif()
if(PCB STREQUAL X9D OR PCB STREQUAL X9D+ OR PCB STREQUAL X9E OR PCB STREQUAL X7 OR PCB STREQUAL X7S) if(PCB STREQUAL X9D OR PCB STREQUAL X9D+ OR PCB STREQUAL X9E OR PCB STREQUAL X7)
add_subdirectory(targets/${TARGET_DIR}/bootloader) add_subdirectory(targets/${TARGET_DIR}/bootloader)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/targets/${TARGET_DIR}/bootloader) include_directories(${CMAKE_CURRENT_BINARY_DIR}/targets/${TARGET_DIR}/bootloader)
set(FIRMWARE_DEPENDENCIES ${FIRMWARE_DEPENDENCIES} bootloader) set(FIRMWARE_DEPENDENCIES ${FIRMWARE_DEPENDENCIES} bootloader)
+4
View File
@@ -44,6 +44,10 @@ enum BluetoothStates {
#define LEN_BLUETOOTH_ADDR 16 #define LEN_BLUETOOTH_ADDR 16
#if defined(PCBX7)
extern uint8_t btChipPresent;
#endif
extern volatile uint8_t bluetoothState; extern volatile uint8_t bluetoothState;
extern char bluetoothLocalAddr[LEN_BLUETOOTH_ADDR+1]; extern char bluetoothLocalAddr[LEN_BLUETOOTH_ADDR+1];
extern char bluetoothDistantAddr[LEN_BLUETOOTH_ADDR+1]; extern char bluetoothDistantAddr[LEN_BLUETOOTH_ADDR+1];
+6 -1
View File
@@ -124,7 +124,9 @@ enum MenuRadioHardwareItems {
#define POTS_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1 #define POTS_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1
#define SWITCHES_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1 #define SWITCHES_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1
#if defined(BLUETOOTH) #if defined(PCBX7)
#define BLUETOOTH_ROWS uint8_t(btChipPresent ? 0 : HIDDEN_ROW), uint8_t(g_eeGeneral.bluetoothMode == BLUETOOTH_OFF ? HIDDEN_ROW : -1), uint8_t(g_eeGeneral.bluetoothMode == BLUETOOTH_OFF ? HIDDEN_ROW : -1), uint8_t(g_eeGeneral.bluetoothMode == BLUETOOTH_OFF ? HIDDEN_ROW : 0),
#elif defined(BLUETOOTH)
#define BLUETOOTH_ROWS 0, uint8_t(g_eeGeneral.bluetoothMode == BLUETOOTH_OFF ? HIDDEN_ROW : -1), uint8_t(g_eeGeneral.bluetoothMode == BLUETOOTH_OFF ? HIDDEN_ROW : -1), uint8_t(g_eeGeneral.bluetoothMode == BLUETOOTH_OFF ? HIDDEN_ROW : 0), #define BLUETOOTH_ROWS 0, uint8_t(g_eeGeneral.bluetoothMode == BLUETOOTH_OFF ? HIDDEN_ROW : -1), uint8_t(g_eeGeneral.bluetoothMode == BLUETOOTH_OFF ? HIDDEN_ROW : -1), uint8_t(g_eeGeneral.bluetoothMode == BLUETOOTH_OFF ? HIDDEN_ROW : 0),
#else #else
#define BLUETOOTH_ROWS #define BLUETOOTH_ROWS
@@ -230,6 +232,9 @@ void menuRadioHardware(event_t event)
case ITEM_RADIO_HARDWARE_BLUETOOTH_MODE: case ITEM_RADIO_HARDWARE_BLUETOOTH_MODE:
lcdDrawTextAlignedLeft(y, STR_BLUETOOTH); lcdDrawTextAlignedLeft(y, STR_BLUETOOTH);
lcdDrawTextAtIndex(HW_SETTINGS_COLUMN2, y, STR_BLUETOOTH_MODES, g_eeGeneral.bluetoothMode, attr); lcdDrawTextAtIndex(HW_SETTINGS_COLUMN2, y, STR_BLUETOOTH_MODES, g_eeGeneral.bluetoothMode, attr);
if ((g_eeGeneral.bluetoothMode != BLUETOOTH_OFF) && !btChipPresent) {
g_eeGeneral.bluetoothMode = BLUETOOTH_OFF;
}
if (attr) { if (attr) {
g_eeGeneral.bluetoothMode = checkIncDecGen(event, g_eeGeneral.bluetoothMode, BLUETOOTH_OFF, BLUETOOTH_TRAINER); g_eeGeneral.bluetoothMode = checkIncDecGen(event, g_eeGeneral.bluetoothMode, BLUETOOTH_OFF, BLUETOOTH_TRAINER);
} }
+4
View File
@@ -117,6 +117,7 @@ void menuStatisticsView(event_t event)
#define MENU_DEBUG_COL2_OFS (17*FW) #define MENU_DEBUG_COL2_OFS (17*FW)
#define MENU_DEBUG_Y_CURRENT (1*FH) #define MENU_DEBUG_Y_CURRENT (1*FH)
#define MENU_DEBUG_ROW1 (1*FH+1) #define MENU_DEBUG_ROW1 (1*FH+1)
#define MENU_DEBUG_ROW2 (2*FH+1)
#define MENU_DEBUG_Y_MAH (2*FH) #define MENU_DEBUG_Y_MAH (2*FH)
#define MENU_DEBUG_Y_CPU_TEMP (3*FH) #define MENU_DEBUG_Y_CPU_TEMP (3*FH)
#define MENU_DEBUG_Y_COPROC (4*FH) #define MENU_DEBUG_Y_COPROC (4*FH)
@@ -308,6 +309,9 @@ void menuStatisticsDebug2(event_t event)
lcdDrawTextAlignedLeft(MENU_DEBUG_ROW1, "Tlm RX Err"); lcdDrawTextAlignedLeft(MENU_DEBUG_ROW1, "Tlm RX Err");
lcdDrawNumber(MENU_DEBUG_COL1_OFS, MENU_DEBUG_ROW1, telemetryErrors, RIGHT); lcdDrawNumber(MENU_DEBUG_COL1_OFS, MENU_DEBUG_ROW1, telemetryErrors, RIGHT);
lcdDrawTextAlignedLeft(MENU_DEBUG_ROW2, "BT status");
lcdDrawNumber(MENU_DEBUG_COL1_OFS, MENU_DEBUG_ROW2, btChipPresent, RIGHT);
lcdDrawText(4*FW, 7*FH+1, STR_MENUTORESET); lcdDrawText(4*FW, 7*FH+1, STR_MENUTORESET);
lcdInvertLastLine(); lcdInvertLastLine();
} }
+4
View File
@@ -2655,6 +2655,10 @@ int main()
boardInit(); boardInit();
#if defined(PCBX7)
bluetoothInit(BLUETOOTH_DEFAULT_BAUDRATE); //BT is turn on for a brief period to differentiate X7 and X7S
#endif
#if defined(GUI) && !defined(PCBTARANIS) && !defined(PCBFLAMENCO) && !defined(PCBHORUS) #if defined(GUI) && !defined(PCBTARANIS) && !defined(PCBFLAMENCO) && !defined(PCBHORUS)
// TODO remove this // TODO remove this
lcdInit(); lcdInit();
@@ -23,6 +23,10 @@
Fifo<uint8_t, 64> btTxFifo; Fifo<uint8_t, 64> btTxFifo;
Fifo<uint8_t, 64> btRxFifo; Fifo<uint8_t, 64> btRxFifo;
#if defined(PCBX7)
uint8_t btChipPresent = 0;
#endif
enum BluetoothWriteState enum BluetoothWriteState
{ {
BLUETOOTH_WRITE_IDLE, BLUETOOTH_WRITE_IDLE,
@@ -105,6 +109,12 @@ extern "C" void BT_USART_IRQHandler(void)
USART_ClearITPendingBit(BT_USART, USART_IT_RXNE); USART_ClearITPendingBit(BT_USART, USART_IT_RXNE);
uint8_t byte = USART_ReceiveData(BT_USART); uint8_t byte = USART_ReceiveData(BT_USART);
btRxFifo.push(byte); btRxFifo.push(byte);
#if defined(PCBX7)
if (!btChipPresent) { //This is to differentiate X7 and X7S
btChipPresent = 1;
bluetoothDone();
}
#endif
} }
if (USART_GetITStatus(BT_USART, USART_IT_TXE) != RESET) { if (USART_GetITStatus(BT_USART, USART_IT_TXE) != RESET) {
+4 -9
View File
@@ -55,19 +55,14 @@ elseif(PCB STREQUAL X9D)
set(LCD_DRIVER lcd_driver_aspi.cpp) set(LCD_DRIVER lcd_driver_aspi.cpp)
set(SERIAL2_DRIVER ../common/arm/stm32/serial2_driver.cpp) set(SERIAL2_DRIVER ../common/arm/stm32/serial2_driver.cpp)
set(GVAR_SCREEN model_gvars.cpp) set(GVAR_SCREEN model_gvars.cpp)
elseif(PCB STREQUAL X7 OR PCB STREQUAL X7S) elseif(PCB STREQUAL X7)
set(PWR_BUTTON "PRESS" CACHE STRING "Pwr button type (PRESS/SWITCH)") set(PWR_BUTTON "PRESS" CACHE STRING "Pwr button type (PRESS/SWITCH)")
set(CPU_TYPE STM32F2) set(CPU_TYPE STM32F2)
set(CPU_TYPE_FULL STM32F205xE) # for size report set(CPU_TYPE_FULL STM32F205xE) # for size report
set(LINKER_SCRIPT targets/taranis/stm32f2_flash.ld) set(LINKER_SCRIPT targets/taranis/stm32f2_flash.ld)
set(HAPTIC YES) set(HAPTIC YES)
set(LUA_EXPORT lua_export_x7) set(LUA_EXPORT lua_export_x7)
if(PCB STREQUAL X7S) set(FLAVOUR x7)
add_definitions(-DPCBX7S)
set(FLAVOUR x7s)
else()
set(FLAVOUR x7)
endif()
add_definitions(-DPCBX7 -DSOFTWARE_VOLUME) add_definitions(-DPCBX7 -DSOFTWARE_VOLUME)
add_definitions(-DEEPROM_VARIANT=0x4000) add_definitions(-DEEPROM_VARIANT=0x4000)
add_definitions(-DPWR_BUTTON_${PWR_BUTTON}) add_definitions(-DPWR_BUTTON_${PWR_BUTTON})
@@ -76,7 +71,7 @@ elseif(PCB STREQUAL X7 OR PCB STREQUAL X7S)
set(LCD_DRIVER lcd_driver_spi.cpp) set(LCD_DRIVER lcd_driver_spi.cpp)
endif() endif()
if(PCB STREQUAL X9E OR PCB STREQUAL X7S) if(PCB STREQUAL X9E OR PCB STREQUAL X7)
add_definitions(-DBLUETOOTH) add_definitions(-DBLUETOOTH)
set(TARGET_SRC set(TARGET_SRC
${TARGET_SRC} ${TARGET_SRC}
@@ -115,7 +110,7 @@ set(GUI_SRC ${GUI_SRC}
../screenshot.cpp ../screenshot.cpp
) )
if(PCB STREQUAL X7 OR PCB STREQUAL X7S) if(PCB STREQUAL X7)
set(LED_DRIVER led_driver.cpp) set(LED_DRIVER led_driver.cpp)
endif() endif()
+1 -10
View File
@@ -133,16 +133,7 @@ fi
if [[ " X7 ALL " =~ " ${FLAVOR} " ]] ; then if [[ " X7 ALL " =~ " ${FLAVOR} " ]] ; then
# OpenTX on X7 # OpenTX on X7
rm -rf * rm -rf *
cmake ${COMMON_OPTIONS} -DPCB=X7 -DHELI=YES ${SRCDIR} cmake ${COMMON_OPTIONS} -DPCB=X7 -DHELI=YES -DGVARS=YES ${SRCDIR}
make -j${CORES} ${FIRMARE_TARGET}
make -j${CORES} simu
make -j${CORES} gtests ; ./gtests ${TEST_OPTIONS}
fi
if [[ " X7S ALL " =~ " ${FLAVOR} " ]] ; then
# OpenTX on X7S
rm -rf *
cmake ${COMMON_OPTIONS} -DPCB=X7S -DHELI=YES -DLUA=YES -DGVARS=YES ${SRCDIR}
make -j${CORES} ${FIRMARE_TARGET} make -j${CORES} ${FIRMARE_TARGET}
make -j${CORES} simu make -j${CORES} simu
make -j${CORES} gtests ; ./gtests ${TEST_OPTIONS} make -j${CORES} gtests ; ./gtests ${TEST_OPTIONS}