1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-19 22:35:12 +03:00

Bsongis/x7 bluetooth (#5068)

* Trainer Bluetooth support added
X7S board added (X7 has no bluetooth while X7S has)
X10 HAL updated

* Bluetooth Telemetry

* En fix
Add all languages

* Temporary test for @bsongis

* Missing translations
This commit is contained in:
Bertrand Songis 2017-08-12 00:49:54 +02:00 committed by GitHub
parent 51be7b000e
commit 8d8fef23c9
51 changed files with 972 additions and 636 deletions

View file

@ -1234,7 +1234,7 @@ GeneralSettings::GeneralSettings()
speakerVolume = 12;
}
if (IS_TARANIS_X9E(board)) {
if (IS_HORUS(board) || IS_TARANIS_X9E(board) || IS_TARANIS_X7(board)) {
strcpy(bluetoothName, "Taranis");
}

View file

@ -3671,7 +3671,7 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, Board::Type
if (version < 218) internalField.Append(new UnsignedField<16>(this, generalData.mAhUsed));
internalField.Append(new UnsignedField<32>(this, generalData.globalTimer));
if (version < 218) internalField.Append(new SignedField<8>(this, generalData.temperatureCalib)); // TODO
internalField.Append(new UnsignedField<8>(this, generalData.btBaudrate)); // TODO
internalField.Append(new UnsignedField<8>(this, generalData.bluetoothBaudrate)); // TODO
if (version < 218) internalField.Append(new BoolField<8>(this, generalData.optrexDisplay)); //TODO
if (version < 218) internalField.Append(new UnsignedField<8>(this, generalData.sticksGain)); // TODO
}

View file

@ -1211,7 +1211,7 @@ class GeneralSettings {
unsigned int globalTimer;
bool bluetoothEnable;
char bluetoothName[10+1];
unsigned int btBaudrate;
unsigned int bluetoothBaudrate;
unsigned int sticksGain;
unsigned int rotarySteps;
unsigned int countryCode;

View file

@ -1,7 +1,7 @@
include(CMakeForceCompiler)
include(Bitmaps)
set(PCB_TYPES X7 X9D X9D+ X9E X10 X12S 9X 9XR 9X128 9XR128 9X2561 GRUVIN9X MEGA2560 SKY9X 9XRPRO AR9X)
set(PCB_TYPES X7 X7S 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(TTS_LANGUAGES CZ DE EN ES FR IT PT SK SE PL HU)
@ -86,7 +86,7 @@ set(FATFS_SRC
if(PCB STREQUAL X12S OR PCB STREQUAL X10)
include(targets/horus/CMakeLists.txt)
elseif(PCB STREQUAL X9E OR PCB STREQUAL X9D+ OR PCB STREQUAL X9D OR PCB STREQUAL X7)
elseif(PCB STREQUAL X9E OR PCB STREQUAL X9D+ OR PCB STREQUAL X9D OR PCB STREQUAL X7 OR PCB STREQUAL X7S)
include(targets/taranis/CMakeLists.txt)
elseif(PCB STREQUAL SKY9X OR PCB STREQUAL 9XRPRO OR PCB STREQUAL AR9X)
include(targets/sky9x/CMakeLists.txt)
@ -463,7 +463,7 @@ if(NOT MSVC)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --specs=rdimon.specs")
endif()
if(PCB STREQUAL X9D OR PCB STREQUAL X9D+ OR PCB STREQUAL X9E OR PCB STREQUAL X7)
if(PCB STREQUAL X9D OR PCB STREQUAL X9D+ OR PCB STREQUAL X9E OR PCB STREQUAL X7 OR PCB STREQUAL X7S)
add_subdirectory(targets/${TARGET_DIR}/bootloader)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/targets/${TARGET_DIR}/bootloader)
set(FIRMWARE_DEPENDENCIES ${FIRMWARE_DEPENDENCIES} bootloader)

View file

@ -147,7 +147,6 @@ struct Tone {
{};
};
struct AudioFragment {
uint8_t type;
uint8_t id;
@ -523,6 +522,7 @@ void codecsInit();
void audioEvent(unsigned int index);
void audioPlay(unsigned int index, uint8_t id=0);
void audioStart();
void audioTask(void * pdata);
#if defined(AUDIO) && defined(BUZZER)
#define AUDIO_BUZZER(a, b) do { a; b; } while(0)

319
radio/src/bluetooth.cpp Normal file
View file

@ -0,0 +1,319 @@
/*
* 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"
#if defined(PCBX7) || defined(PCBHORUS)
#define BLUETOOTH_COMMAND_NAME "AT+NAME"
#define BLUETOOTH_ANSWER_NAME "OK+"
#define BLUETOOTH_COMMAND_BAUD_115200 "AT+BAUD115200"
#else
#define BLUETOOTH_COMMAND_NAME "TTM:REN-"
#define BLUETOOTH_ANSWER_NAME "TTM:REN"
#define BLUETOOTH_COMMAND_BAUD_115200 "TTM:BPS-115200"
#endif
#define BLUETOOTH_PACKET_SIZE 14
#define BLUETOOTH_LINE_LENGTH 32
extern Fifo<uint8_t, 64> btTxFifo;
extern Fifo<uint8_t, 64> btRxFifo;
volatile uint8_t bluetoothState;
char bluetoothFriend[LEN_BLUETOOTH_FRIEND+1];
uint8_t bluetoothBuffer[BLUETOOTH_LINE_LENGTH+1];
uint8_t bluetoothBufferIndex = 0;
tmr10ms_t bluetoothWakeupTime = 0;
void bluetoothWrite(const uint8_t * data, uint8_t length)
{
for (int i=0; i<length; i++) {
TRACE_NOCRLF("%02X ", data[i]);
btTxFifo.push(data[i]);
}
}
void bluetoothWriteString(const char * str)
{
TRACE("BT> %s", str);
while (*str != 0) {
btTxFifo.push(*str++);
}
}
char * bluetoothReadline()
{
uint8_t byte;
while (1) {
if (!btRxFifo.pop(byte)) {
return NULL;
}
TRACE_NOCRLF("%02X ", byte);
if (byte == '\n') {
bluetoothBuffer[bluetoothBufferIndex] = '\0';
bluetoothBufferIndex = 0;
TRACE("BT< %s", bluetoothBuffer);
return (char *)bluetoothBuffer;
}
else if (byte != '\r') {
bluetoothBuffer[bluetoothBufferIndex++] = byte;
bluetoothBufferIndex &= (BLUETOOTH_LINE_LENGTH-1);
}
}
}
void bluetoothProcessTrainerFrame(const uint8_t * bluetoothBuffer)
{
TRACE("");
for (uint8_t channel=0, i=1; channel<8; channel+=2, i+=3) {
// +-500 != 512, but close enough.
ppmInput[channel] = bluetoothBuffer[i] + ((bluetoothBuffer[i+1] & 0xf0) << 4) - 1500;
ppmInput[channel+1] = ((bluetoothBuffer[i+1] & 0x0f) << 4) + ((bluetoothBuffer[i+2] & 0xf0) >> 4) + ((bluetoothBuffer[i+2] & 0x0f) << 8) - 1500;
}
ppmInputValidityTimer = PPM_IN_VALID_TIMEOUT;
}
void bluetoothProcessTrainerByte(uint8_t data)
{
static uint8_t dataState = STATE_DATA_IDLE;
switch (dataState) {
case STATE_DATA_START:
if (data == START_STOP) {
dataState = STATE_DATA_IN_FRAME ;
bluetoothBufferIndex = 0;
}
else {
if (bluetoothBufferIndex < BLUETOOTH_PACKET_SIZE) {
bluetoothBuffer[bluetoothBufferIndex++] = data;
}
if (data == '\n' && !strncmp((char *)bluetoothBuffer, "DisConnected", 12)) {
bluetoothState = BLUETOOTH_STATE_IDLE;
bluetoothBufferIndex = 0;
}
}
break;
case STATE_DATA_IN_FRAME:
if (data == BYTESTUFF) {
dataState = STATE_DATA_XOR; // XOR next byte
}
else if (data == START_STOP) {
dataState = STATE_DATA_IN_FRAME ;
bluetoothBufferIndex = 0;
}
else if (bluetoothBufferIndex < BLUETOOTH_PACKET_SIZE) {
bluetoothBuffer[bluetoothBufferIndex++] = data;
}
break;
case STATE_DATA_XOR:
if (telemetryRxBufferCount < BLUETOOTH_PACKET_SIZE) {
bluetoothBuffer[bluetoothBufferIndex++] = data ^ STUFF_MASK;
}
dataState = STATE_DATA_IN_FRAME;
break;
case STATE_DATA_IDLE:
if (data == START_STOP) {
bluetoothBufferIndex = 0;
dataState = STATE_DATA_START;
}
break;
}
if (bluetoothBufferIndex >= BLUETOOTH_PACKET_SIZE) {
uint8_t crc = 0x00;
for (int i=0; i<13; i++) {
crc ^= bluetoothBuffer[i];
}
if (crc == bluetoothBuffer[13]) {
if (bluetoothBuffer[0] == 0x80) {
bluetoothProcessTrainerFrame(bluetoothBuffer);
}
}
dataState = STATE_DATA_IDLE;
}
}
uint8_t bluetoothCrc;
void bluetoothPushByte(uint8_t byte)
{
bluetoothCrc ^= byte;
if (byte == START_STOP || byte == BYTESTUFF) {
bluetoothBuffer[bluetoothBufferIndex++] = 0x7d;
byte ^= STUFF_MASK;
}
bluetoothBuffer[bluetoothBufferIndex++] = byte;
}
void bluetoothSendTrainer()
{
int16_t PPM_range = g_model.extendedLimits ? 640*2 : 512*2;
int firstCh = g_model.moduleData[TRAINER_MODULE].channelsStart;
int lastCh = firstCh + 8;
uint8_t * cur = bluetoothBuffer;
bluetoothBufferIndex = 0;
bluetoothCrc = 0x00;
bluetoothBuffer[bluetoothBufferIndex++] = START_STOP; // start byte
bluetoothPushByte(0x80); // trainer frame type?
for (int channel=0; channel<lastCh; channel+=2, cur+=3) {
uint16_t channelValue1 = PPM_CH_CENTER(channel) + limit((int16_t)-PPM_range, channelOutputs[channel], (int16_t)PPM_range) / 2;
uint16_t channelValue2 = PPM_CH_CENTER(channel+1) + limit((int16_t)-PPM_range, channelOutputs[channel+1], (int16_t)PPM_range) / 2;
bluetoothPushByte(channelValue1 & 0x00ff);
bluetoothPushByte(((channelValue1 & 0x0f00) >> 4) + ((channelValue2 & 0x00f0) >> 4));
bluetoothPushByte(((channelValue2 & 0x000f) << 4) + ((channelValue2 & 0x0f00) >> 8));
}
bluetoothBuffer[bluetoothBufferIndex++] = bluetoothCrc;
bluetoothBuffer[bluetoothBufferIndex++] = START_STOP; // end byte
bluetoothWrite(bluetoothBuffer, bluetoothBufferIndex);
bluetoothBufferIndex = 0;
}
void bluetoothForwardTelemetry(uint8_t data)
{
bluetoothBuffer[bluetoothBufferIndex++] = data;
if (bluetoothBufferIndex == BLUETOOTH_LINE_LENGTH || (data == START_STOP && bluetoothBufferIndex > 2*FRSKY_SPORT_PACKET_SIZE)) {
bluetoothWrite(bluetoothBuffer, bluetoothBufferIndex);
bluetoothBufferIndex = 0;
}
}
void bluetoothReceiveTrainer()
{
uint8_t byte;
while (1) {
if (!btRxFifo.pop(byte)) {
return;
}
TRACE_NOCRLF("%02X ", byte);
bluetoothProcessTrainerByte(byte);
}
}
void bluetoothWakeup()
{
tmr10ms_t now = get_tmr10ms();
if (now < bluetoothWakeupTime)
return;
if (g_eeGeneral.bluetoothMode == BLUETOOTH_OFF || !IS_BLUETOOTH_TRAINER()) {
if (bluetoothState != BLUETOOTH_STATE_OFF) {
bluetoothDone();
bluetoothState = BLUETOOTH_STATE_OFF;
}
bluetoothWakeupTime = now + 10;
}
else {
bluetoothWakeupTime = now + 2;
bluetoothWriteWakeup();
if (bluetoothState == BLUETOOTH_STATE_CONNECTED) {
if (g_model.trainerMode == TRAINER_MODE_MASTER_BLUETOOTH) {
bluetoothReceiveTrainer();
}
else {
bluetoothSendTrainer();
char * line = bluetoothReadline();
if (!strcmp(line, "ERROR")) {
bluetoothState = BLUETOOTH_STATE_IDLE;
}
}
}
else {
char * line = bluetoothReadline();
if (bluetoothState == BLUETOOTH_STATE_OFF && IS_BLUETOOTH_TRAINER()) {
char command[32];
char * cur = strAppend(command, BLUETOOTH_COMMAND_NAME);
uint8_t len = ZLEN(g_eeGeneral.bluetoothName);
if (len > 0) {
for (int i = 0; i < len; i++) {
*cur++ = idx2char(g_eeGeneral.bluetoothName[i]);
}
}
else {
#if defined(PCBHORUS)
cur = strAppend(cur, "Horus");
#else
cur = strAppend(cur, "Taranis");
#endif
}
strAppend(cur, "\r\n");
bluetoothWriteString(command);
#if defined(PCBX9E)
bluetoothState = BLUETOOTH_STATE_CONNECTED;
#else
bluetoothState = BLUETOOTH_STATE_NAME_SENT;
#endif
}
else if (bluetoothState == BLUETOOTH_STATE_NAME_SENT && !strncmp(line, "OK+", 3)) {
bluetoothWriteString("AT+TXPW3\r\n");
bluetoothState = BLUETOOTH_STATE_POWER_SENT;
}
else if (bluetoothState == BLUETOOTH_STATE_POWER_SENT && (!strncmp(line, "Central:", 8) || !strncmp(line, "Peripheral:", 11))) {
if (g_model.trainerMode == TRAINER_MODE_MASTER_BLUETOOTH)
bluetoothWriteString("AT+ROLE1\r\n");
else
bluetoothWriteString("AT+ROLE0\r\n");
bluetoothState = BLUETOOTH_STATE_ROLE_SENT;
}
else if (bluetoothState == BLUETOOTH_STATE_ROLE_SENT && (!strncmp(line, "Central:", 8) || !strncmp(line, "Peripheral:", 11))) {
bluetoothState = BLUETOOTH_STATE_IDLE;
}
else if (bluetoothState == BLUETOOTH_STATE_DISCOVER_REQUESTED) {
bluetoothWriteString("AT+DISC?\r\n");
bluetoothState = BLUETOOTH_STATE_DISCOVER_SENT;
}
else if (bluetoothState == BLUETOOTH_STATE_DISCOVER_SENT && !strcmp(line, "OK+DISCS")) {
bluetoothState = BLUETOOTH_STATE_DISCOVER_START;
}
else if (bluetoothState == BLUETOOTH_STATE_DISCOVER_START && !strncmp(line, "OK+DISC:", 8)) {
TRACE("STOP");
strcpy(bluetoothFriend, &line[8]); // TODO quick & dirty
}
else if (bluetoothState == BLUETOOTH_STATE_DISCOVER_START && !strcmp(line, "OK+DISCE")) {
bluetoothState = BLUETOOTH_STATE_DISCOVER_END;
}
else if (bluetoothState == BLUETOOTH_STATE_BIND_REQUESTED) {
char command[32];
strAppend(strAppend(strAppend(command, "AT+CON"), bluetoothFriend), "\r\n");
bluetoothWriteString(command);
bluetoothState = BLUETOOTH_STATE_BIND_SENT;
}
else if ((bluetoothState == BLUETOOTH_STATE_IDLE || bluetoothState == BLUETOOTH_STATE_BIND_SENT) && !strncmp(line, "Connected:", 10)) {
strcpy(bluetoothFriend, &line[10]); // TODO quick & dirty
bluetoothState = BLUETOOTH_STATE_CONNECTED;
if (g_model.trainerMode == TRAINER_MODE_SLAVE_BLUETOOTH) {
bluetoothWakeupTime += 500; // it seems a 5s delay is needed before sending the 1st frame
}
}
}
}
}

43
radio/src/bluetooth.h Normal file
View file

@ -0,0 +1,43 @@
/*
* 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.
*/
enum BluetoothStates {
BLUETOOTH_STATE_OFF,
BLUETOOTH_STATE_NAME_SENT,
BLUETOOTH_STATE_POWER_SENT,
BLUETOOTH_STATE_ROLE_SENT,
BLUETOOTH_STATE_IDLE,
BLUETOOTH_STATE_DISCOVER_REQUESTED,
BLUETOOTH_STATE_DISCOVER_SENT,
BLUETOOTH_STATE_DISCOVER_START,
BLUETOOTH_STATE_DISCOVER_END,
BLUETOOTH_STATE_BIND_REQUESTED,
BLUETOOTH_STATE_BIND_SENT,
BLUETOOTH_STATE_CONNECTED
};
#define LEN_BLUETOOTH_FRIEND 16
extern volatile uint8_t bluetoothState;
extern char bluetoothFriend[LEN_BLUETOOTH_FRIEND+1];
void bluetoothWriteString(const char * command);
void bluetoothForwardTelemetry(uint8_t data);
void bluetoothWakeup();

View file

@ -858,11 +858,6 @@ void printTaskSwitchLog()
else if (audioTaskId == n) {
serialPrint("%d: audio", n);
}
#if defined(BLUETOOTH)
else if (btTaskId == n) {
serialPrint("%d: BT", n);
}
#endif
}
serialCrlf();
@ -1206,23 +1201,10 @@ int cliGps(const char ** argv)
int cliBlueTooth(const char ** argv)
{
int baudrate = 0;
if (argv[1][0] == '$') {
// send command to GPS
bluetoothWriteString(argv[1] + 1);
bluetoothWriteString("\r\n");
serialPrint("bt sent: %s", argv[1] + 1);
CoTickDelay(100); // 200ms
char buff[100];
int len = bluetoothRead(buff, 100);
buff[len] = 0;
serialPrint("bt read: %s", buff);
}
else if (!strcmp(argv[1], "read")) {
char buff[100];
int len = bluetoothRead(buff, 100);
buff[len] = 0;
serialPrint("bt read: %s", buff);
if (!strncmp(argv[1], "AT", 2) || !strncmp(argv[1], "TTM", 3)) {
char command[32];
strAppend(strAppend(command, argv[1]), "\r\n");
bluetoothWriteString(command);
}
else if (toInt(argv, 1, &baudrate) > 0) {
if (baudrate > 0) {
@ -1239,7 +1221,7 @@ int cliBlueTooth(const char ** argv)
}
return 0;
}
#endif // #if defined(PCBX9E) || defined(PCBHORUS)
#endif
const CliCommand cliCommands[] = {
{ "beep", cliBeep, "[<frequency>] [<duration>]" },
@ -1270,7 +1252,7 @@ const CliCommand cliCommands[] = {
{ "gps", cliGps, "<baudrate>|$<command>|trace" },
#endif
#if defined(BLUETOOTH)
{ "bt", cliBlueTooth, "<baudrate>|$<command>|read" },
{ "bt", cliBlueTooth, "<baudrate>|<command>" },
#endif
{ NULL, NULL, NULL } /* sentinel */
};

View file

@ -287,6 +287,10 @@ enum BeeperMode {
TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE,
#endif
TRAINER_MODE_MASTER_BATTERY_COMPARTMENT,
#if defined(BLUETOOTH)
TRAINER_MODE_MASTER_BLUETOOTH,
TRAINER_MODE_SLAVE_BLUETOOTH,
#endif
};
#elif defined(PCBSKY9X)
enum ModuleIndex {
@ -296,6 +300,14 @@ enum BeeperMode {
};
#endif
#if defined(BLUETOOTH)
#define TRAINER_MODE_MAX() TRAINER_MODE_SLAVE_BLUETOOTH
#elif defined(PCBX7)
#define TRAINER_MODE_MAX() TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE
#else
#define TRAINER_MODE_MAX() HAS_WIRELESS_TRAINER_HARDWARE() ? TRAINER_MODE_MASTER_BATTERY_COMPARTMENT : TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE
#endif
#if defined(PCBTARANIS) || defined(PCBHORUS)
#if defined(TARANIS_INTERNAL_PPM)
#define IS_INTERNAL_MODULE_ENABLED() (!(g_model.moduleData[INTERNAL_MODULE].rfProtocol == RF_PROTO_OFF && g_model.moduleData[INTERNAL_MODULE].type == MODULE_TYPE_XJT) && (g_model.moduleData[INTERNAL_MODULE].type != MODULE_TYPE_NONE))
@ -1054,4 +1066,10 @@ enum AdjustGvarFunctionParam {
FUNC_ADJUST_GVAR_INCDEC,
};
enum BluetoothModes {
BLUETOOTH_OFF,
BLUETOOTH_TELEMETRY,
BLUETOOTH_TRAINER,
};
#endif // _DATACONSTANTS_H_

View file

@ -891,7 +891,8 @@ PACK(struct TrainerData {
#define EXTRA_GENERAL_FIELDS_ARM \
NOBACKUP(uint8_t backlightBright); \
NOBACKUP(uint32_t globalTimer); \
NOBACKUP(uint8_t btBaudrate); \
NOBACKUP(uint8_t bluetoothBaudrate:4); \
NOBACKUP(uint8_t bluetoothMode:4); \
NOBACKUP(uint8_t countryCode); \
NOBACKUP(uint8_t imperial:1); \
NOBACKUP(uint8_t jitterFilter:1); /* 0 - active */\
@ -918,7 +919,7 @@ PACK(struct TrainerData {
NOBACKUP(char switchNames[NUM_SWITCHES][LEN_SWITCH_NAME]); \
NOBACKUP(char anaNames[NUM_STICKS+NUM_POTS+NUM_SLIDERS+NUM_DUMMY_ANAS][LEN_ANA_NAME]); \
NOBACKUP(char currModelFilename[LEN_MODEL_FILENAME+1]); \
NOBACKUP(uint8_t bluetoothEnable:1); \
NOBACKUP(uint8_t spare:1); \
NOBACKUP(uint8_t blOffBright:7); \
NOBACKUP(char bluetoothName[LEN_BLUETOOTH_NAME]);
#elif defined(PCBFLAMENCO)
@ -933,7 +934,7 @@ PACK(struct TrainerData {
#elif defined(PCBTARANIS)
#if defined(PCBX9E) || defined(PCBX7)
#define BLUETOOTH_FIELDS \
uint8_t bluetoothEnable; \
uint8_t spare; \
char bluetoothName[LEN_BLUETOOTH_NAME];
#else
#define BLUETOOTH_FIELDS

View file

@ -95,8 +95,8 @@ enum MenuModelSetupItems {
#if defined(PCBX7)
ITEM_MODEL_TRAINER_LABEL,
ITEM_MODEL_TRAINER_MODE,
ITEM_MODEL_TRAINER_CHANNELS,
ITEM_MODEL_TRAINER_SETTINGS,
ITEM_MODEL_TRAINER_LINE1,
ITEM_MODEL_TRAINER_LINE2,
#endif
ITEM_MODEL_SETUP_MAX
};
@ -157,10 +157,16 @@ enum MenuModelSetupItems {
#endif
#if defined(PCBX7)
#define TRAINER_CHANNELS_ROWS() IF_TRAINER_ON(1)
#define TRAINER_MODULE_ROWS LABEL(Trainer), 0, TRAINER_CHANNELS_ROWS(), IF_TRAINER_ON(2)
#if defined(BLUETOOTH)
#define TRAINER_LINE1_BLUETOOTH_M_ROWS ((bluetoothFriend[0] == 0 || bluetoothState == BLUETOOTH_STATE_CONNECTED) ? (uint8_t)0 : (uint8_t)1)
#define TRAINER_LINE1_ROWS (g_model.trainerMode == TRAINER_MODE_SLAVE ? (uint8_t)1 : (g_model.trainerMode == TRAINER_MODE_MASTER_BLUETOOTH ? TRAINER_LINE1_BLUETOOTH_M_ROWS : (g_model.trainerMode == TRAINER_MODE_SLAVE_BLUETOOTH ? (uint8_t)1 : HIDDEN_ROW)))
#else
#define TRAINER_MODULE_ROWS
#define TRAINER_LINE1_ROWS (g_model.trainerMode == TRAINER_MODE_SLAVE ? (uint8_t)1 : HIDDEN_ROW)
#endif
#define TRAINER_LINE2_ROWS (g_model.trainerMode == TRAINER_MODE_SLAVE ? (uint8_t)2 : HIDDEN_ROW)
#define TRAINER_ROWS LABEL(Trainer), 0, TRAINER_LINE1_ROWS, TRAINER_LINE2_ROWS
#else
#define TRAINER_ROWS
#endif
#elif defined(CPUM64)
@ -219,7 +225,7 @@ void menuModelSetup(event_t event)
MULTIMODULE_MODULE_ROWS
EXTERNAL_MODULE_POWER_ROW,
EXTRA_MODULE_ROWS
TRAINER_MODULE_ROWS });
TRAINER_ROWS });
#elif defined(CPUARM)
MENU_TAB({ HEADER_LINE_COLUMNS 0, TIMER_ROWS, TIMER_ROWS, TIMER_ROWS, 0, 1, 0, 0, 0, 0, 0, CASE_CPUARM(LABEL(PreflightCheck)) CASE_CPUARM(0) 0, NUM_SWITCHES-1, NUM_STICKS+NUM_POTS+NUM_SLIDERS+NUM_ROTARY_ENCODERS-1, 0,
LABEL(ExternalModule),
@ -234,7 +240,7 @@ void menuModelSetup(event_t event)
MULTIMODULE_MODULE_ROWS
EXTERNAL_MODULE_POWER_ROW,
EXTRA_MODULE_ROWS
TRAINER_MODULE_ROWS });
TRAINER_ROWS });
#elif defined(CPUM64)
uint8_t protocol = g_model.protocol;
MENU_TAB({ HEADER_LINE_COLUMNS 0, 2, CASE_PERSISTENT_TIMERS(0) 0, 0, 2, CASE_PERSISTENT_TIMERS(0) 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, NUM_STICKS+NUM_POTS+NUM_SLIDERS+NUM_ROTARY_ENCODERS-1, FIELD_PROTOCOL_MAX, 2 });
@ -795,13 +801,63 @@ void menuModelSetup(event_t event)
case ITEM_MODEL_TRAINER_MODE:
lcdDrawTextAlignedLeft(y, STR_MODE);
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_VTRAINERMODES, g_model.trainerMode, attr);
if (attr) g_model.trainerMode = checkIncDec(event, g_model.trainerMode, 0, HAS_WIRELESS_TRAINER_HARDWARE() ? TRAINER_MODE_MASTER_BATTERY_COMPARTMENT : TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE, EE_MODEL, isTrainerModeAvailable);
if (attr) {
g_model.trainerMode = checkIncDec(event, g_model.trainerMode, 0, TRAINER_MODE_MAX(), EE_MODEL, isTrainerModeAvailable);
#if defined(BLUETOOTH)
if (checkIncDec_Ret) {
bluetoothState = BLUETOOTH_STATE_OFF;
bluetoothFriend[0] = 0;
}
#endif
}
break;
#endif
#if defined(PCBX7)
case ITEM_MODEL_TRAINER_LINE1:
#if defined(BLUETOOTH)
if (g_model.trainerMode == TRAINER_MODE_MASTER_BLUETOOTH) {
if (attr) {
s_editMode = 0;
}
if (bluetoothFriend[0]) {
lcdDrawText(INDENT_WIDTH, y+1, bluetoothFriend, TINSIZE);
if (bluetoothState != BLUETOOTH_STATE_CONNECTED) {
lcdDrawText(MODEL_SETUP_2ND_COLUMN, y, BUTTON("Bind"), menuHorizontalPosition == 0 ? attr : 0);
lcdDrawText(MODEL_SETUP_2ND_COLUMN+5*FW, y, BUTTON("Clear"), menuHorizontalPosition == 1 ? attr : 0);
}
else {
lcdDrawText(MODEL_SETUP_2ND_COLUMN, y, BUTTON("Clear"), attr);
}
if (attr && event == EVT_KEY_FIRST(KEY_ENTER)) {
if (bluetoothState == BLUETOOTH_STATE_CONNECTED || menuHorizontalPosition == 1) {
bluetoothState = BLUETOOTH_STATE_OFF;
bluetoothFriend[0] = 0;
}
else {
bluetoothState = BLUETOOTH_STATE_BIND_REQUESTED;
}
}
}
else {
lcdDrawText(INDENT_WIDTH, y, "---");
if (bluetoothState < BLUETOOTH_STATE_IDLE)
lcdDrawText(MODEL_SETUP_2ND_COLUMN, y, BUTTON("Init"), attr);
else
lcdDrawText(MODEL_SETUP_2ND_COLUMN, y, BUTTON("Discover"), attr);
if (attr && event == EVT_KEY_FIRST(KEY_ENTER)) {
if (bluetoothState < BLUETOOTH_STATE_IDLE)
bluetoothState = BLUETOOTH_STATE_OFF;
else
bluetoothState = BLUETOOTH_STATE_DISCOVER_REQUESTED;
}
}
break;
}
// no break
#endif
case ITEM_MODEL_INTERNAL_MODULE_CHANNELS:
case ITEM_MODEL_TRAINER_CHANNELS:
#endif
#if defined(PCBSKY9X)
case ITEM_MODEL_EXTRA_MODULE_CHANNELS:
@ -836,7 +892,7 @@ void menuModelSetup(event_t event)
#endif
#if defined(PCBX7)
case ITEM_MODEL_TRAINER_SETTINGS:
case ITEM_MODEL_TRAINER_LINE2:
case ITEM_MODEL_INTERNAL_MODULE_BIND:
#endif
#if defined(PCBSKY9X)
@ -931,20 +987,25 @@ void menuModelSetup(event_t event)
else if (l_posHorz == 2) {
newFlag = MODULE_RANGECHECK;
}
}
}
#else
if (attr && l_posHorz>0 && s_editMode>0) {
if (l_posHorz == 1)
newFlag = MODULE_BIND;
else if (l_posHorz == 2) {
else if (l_posHorz == 2)
newFlag = MODULE_RANGECHECK;
}
#endif
}
}
moduleFlag[moduleIdx] = newFlag;
#if defined(MULTIMODULE)
if (newFlag == MODULE_BIND)
if (newFlag == MODULE_BIND) {
multiBindStatus = MULTI_BIND_INITIATED;
}
#endif
}
}
break;
@ -970,12 +1031,9 @@ void menuModelSetup(event_t event)
ModuleData &moduleData = g_model.moduleData[moduleIdx];
if (IS_MODULE_PXX(moduleIdx)) {
lcdDrawTextAlignedLeft(y, STR_FAILSAFE);
lcdDrawTextAlignedLeft(y, TR_FAILSAFE);
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_VFAILSAFE, moduleData.failsafeMode, menuHorizontalPosition == 0
? attr : 0);
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_VFAILSAFE, moduleData.failsafeMode, menuHorizontalPosition == 0 ? attr : 0);
if (moduleData.failsafeMode == FAILSAFE_CUSTOM)
lcdDrawText(MODEL_SETUP_2ND_COLUMN + MODEL_SETUP_SET_FAILSAFE_OFS, y, STR_SET, menuHorizontalPosition == 1
? attr : 0);
lcdDrawText(MODEL_SETUP_2ND_COLUMN + MODEL_SETUP_SET_FAILSAFE_OFS, y, STR_SET, menuHorizontalPosition == 1 ? attr : 0);
if (attr) {
if (moduleData.failsafeMode != FAILSAFE_CUSTOM)
menuHorizontalPosition = 0;

View file

@ -83,7 +83,7 @@ void menuRadioHardware(event_t event)
#if defined(BLUETOOTH)
case ITEM_RADIO_HARDWARE_BT_BAUDRATE:
g_eeGeneral.btBaudrate = editChoice(HW_SETTINGS_COLUMN, y, STR_BAUDRATE, PSTR("\005115k 9600 19200"), g_eeGeneral.btBaudrate, 0, 2, attr, event);
g_eeGeneral.bluetoothBaudrate = editChoice(HW_SETTINGS_COLUMN, y, STR_BAUDRATE, PSTR("\005115k 9600 19200"), g_eeGeneral.bluetoothBaudrate, 0, 2, attr, event);
if (attr && checkIncDec_Ret) {
btInit();
}
@ -111,18 +111,28 @@ enum MenuRadioHardwareItems {
ITEM_RADIO_HARDWARE_SD,
ITEM_RADIO_HARDWARE_SF,
ITEM_RADIO_HARDWARE_SH,
#if defined(BLUETOOTH)
ITEM_RADIO_HARDWARE_BLUETOOTH_MODE,
ITEM_RADIO_HARDWARE_BLUETOOTH_NAME,
#endif
ITEM_RADIO_HARDWARE_JITTER_FILTER,
ITEM_RADIO_HARDWARE_MAX
};
#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
#if defined(BLUETOOTH)
#define BLUETOOTH_ROWS 0, uint8_t(g_eeGeneral.bluetoothMode == BLUETOOTH_OFF ? -1 : 0),
#else
#define BLUETOOTH_ROWS
#endif
#define SWITCH_TYPE_MAX(sw) ((MIXSRC_SF-MIXSRC_FIRST_SWITCH == sw || MIXSRC_SH-MIXSRC_FIRST_SWITCH == sw) ? SWITCH_2POS : SWITCH_3POS)
#define HW_SETTINGS_COLUMN 30
#define HW_SETTINGS_COLUMN1 30
#define HW_SETTINGS_COLUMN2 (30 + 5*FW)
void menuRadioHardware(event_t event)
{
MENU(STR_HARDWARE, menuTabGeneral, MENU_RADIO_HARDWARE, ITEM_RADIO_HARDWARE_MAX, { LABEL(Sticks), 0, 0, 0, 0, LABEL(Pots), POTS_ROWS, LABEL(Switches), SWITCHES_ROWS, 0 });
MENU(STR_HARDWARE, menuTabGeneral, MENU_RADIO_HARDWARE, ITEM_RADIO_HARDWARE_MAX, { LABEL(Sticks), 0, 0, 0, 0, LABEL(Pots), POTS_ROWS, LABEL(Switches), SWITCHES_ROWS, BLUETOOTH_ROWS 0 });
uint8_t sub = menuVerticalPosition;
@ -144,12 +154,13 @@ void menuRadioHardware(event_t event)
case ITEM_RADIO_HARDWARE_STICK2:
case ITEM_RADIO_HARDWARE_STICK3:
case ITEM_RADIO_HARDWARE_STICK4:
editStickHardwareSettings(HW_SETTINGS_COLUMN, y, k - ITEM_RADIO_HARDWARE_STICK1, event, attr);
editStickHardwareSettings(HW_SETTINGS_COLUMN1, y, k - ITEM_RADIO_HARDWARE_STICK1, event, attr);
break;
case ITEM_RADIO_HARDWARE_LABEL_POTS:
lcdDrawTextAlignedLeft(y, STR_POTS);
break;
case ITEM_RADIO_HARDWARE_POT1:
case ITEM_RADIO_HARDWARE_POT2:
{
@ -158,11 +169,11 @@ void menuRadioHardware(event_t event)
uint8_t mask = (0x03 << shift);
lcdDrawTextAtIndex(INDENT_WIDTH, y, STR_VSRCRAW, NUM_STICKS+idx+1, menuHorizontalPosition < 0 ? attr : 0);
if (ZEXIST(g_eeGeneral.anaNames[NUM_STICKS+idx]) || (attr && s_editMode > 0 && menuHorizontalPosition == 0))
editName(HW_SETTINGS_COLUMN, y, g_eeGeneral.anaNames[NUM_STICKS+idx], LEN_ANA_NAME, event, attr && menuHorizontalPosition == 0);
editName(HW_SETTINGS_COLUMN1, y, g_eeGeneral.anaNames[NUM_STICKS+idx], LEN_ANA_NAME, event, attr && menuHorizontalPosition == 0);
else
lcdDrawMMM(HW_SETTINGS_COLUMN, y, menuHorizontalPosition==0 ? attr : 0);
lcdDrawMMM(HW_SETTINGS_COLUMN1, y, menuHorizontalPosition==0 ? attr : 0);
uint8_t potType = (g_eeGeneral.potsConfig & mask) >> shift;
potType = editChoice(HW_SETTINGS_COLUMN+5*FW, y, "", STR_POTTYPES, potType, POT_NONE, POT_WITHOUT_DETENT, menuHorizontalPosition == 1 ? attr : 0, event);
potType = editChoice(HW_SETTINGS_COLUMN2, y, "", STR_POTTYPES, potType, POT_NONE, POT_WITHOUT_DETENT, menuHorizontalPosition == 1 ? attr : 0, event);
g_eeGeneral.potsConfig &= ~mask;
g_eeGeneral.potsConfig |= (potType << shift);
break;
@ -171,6 +182,7 @@ void menuRadioHardware(event_t event)
case ITEM_RADIO_HARDWARE_LABEL_SWITCHES:
lcdDrawTextAlignedLeft(y, STR_SWITCHES);
break;
case ITEM_RADIO_HARDWARE_SA:
case ITEM_RADIO_HARDWARE_SB:
case ITEM_RADIO_HARDWARE_SC:
@ -182,10 +194,10 @@ void menuRadioHardware(event_t event)
int config = SWITCH_CONFIG(index);
lcdDrawTextAtIndex(INDENT_WIDTH, y, STR_VSRCRAW, MIXSRC_FIRST_SWITCH-MIXSRC_Rud+index+1, menuHorizontalPosition < 0 ? attr : 0);
if (ZEXIST(g_eeGeneral.switchNames[index]) || (attr && s_editMode > 0 && menuHorizontalPosition == 0))
editName(HW_SETTINGS_COLUMN, y, g_eeGeneral.switchNames[index], LEN_SWITCH_NAME, event, menuHorizontalPosition == 0 ? attr : 0);
editName(HW_SETTINGS_COLUMN1, y, g_eeGeneral.switchNames[index], LEN_SWITCH_NAME, event, menuHorizontalPosition == 0 ? attr : 0);
else
lcdDrawMMM(HW_SETTINGS_COLUMN, y, menuHorizontalPosition == 0 ? attr : 0);
config = editChoice(HW_SETTINGS_COLUMN+5*FW, y, "", STR_SWTYPES, config, SWITCH_NONE, SWITCH_TYPE_MAX(index), menuHorizontalPosition == 1 ? attr : 0, event);
lcdDrawMMM(HW_SETTINGS_COLUMN1, y, menuHorizontalPosition == 0 ? attr : 0);
config = editChoice(HW_SETTINGS_COLUMN2, y, "", STR_SWTYPES, config, SWITCH_NONE, SWITCH_TYPE_MAX(index), menuHorizontalPosition == 1 ? attr : 0, event);
if (attr && checkIncDec_Ret) {
swconfig_t mask = (swconfig_t)0x03 << (2*index);
g_eeGeneral.switchConfig = (g_eeGeneral.switchConfig & ~mask) | ((swconfig_t(config) & 0x03) << (2*index));
@ -193,10 +205,25 @@ void menuRadioHardware(event_t event)
break;
}
#if defined(BLUETOOTH)
case ITEM_RADIO_HARDWARE_BLUETOOTH_MODE:
lcdDrawTextAlignedLeft(y, STR_BLUETOOTH);
lcdDrawTextAtIndex(HW_SETTINGS_COLUMN2, y, STR_BLUETOOTH_MODES, g_eeGeneral.bluetoothMode, attr);
if (attr) {
g_eeGeneral.bluetoothMode = checkIncDecGen(event, g_eeGeneral.bluetoothMode, BLUETOOTH_OFF, BLUETOOTH_TRAINER);
}
break;
case ITEM_RADIO_HARDWARE_BLUETOOTH_NAME:
lcdDrawText(INDENT_WIDTH, y, STR_NAME);
editName(HW_SETTINGS_COLUMN2, y, g_eeGeneral.bluetoothName, LEN_BLUETOOTH_NAME, event, attr);
break;
#endif
case ITEM_RADIO_HARDWARE_JITTER_FILTER:
{
uint8_t b = 1-g_eeGeneral.jitterFilter;
g_eeGeneral.jitterFilter = 1 - editCheckBox(b, HW_SETTINGS_COLUMN+5*FW, y, STR_JITTER_FILTER, attr, event);
g_eeGeneral.jitterFilter = 1 - editCheckBox(b, HW_SETTINGS_COLUMN2, y, STR_JITTER_FILTER, attr, event);
break;
}
}

View file

@ -89,8 +89,8 @@ enum MenuModelSetupItems {
ITEM_MODEL_EXTERNAL_MODULE_POWER,
ITEM_MODEL_TRAINER_LABEL,
ITEM_MODEL_TRAINER_MODE,
ITEM_MODEL_TRAINER_CHANNELS,
ITEM_MODEL_TRAINER_SETTINGS,
ITEM_MODEL_TRAINER_LINE1,
ITEM_MODEL_TRAINER_LINE2,
ITEM_MODEL_SETUP_MAX
};
@ -240,9 +240,16 @@ int getSwitchWarningsCount()
#endif
#define IF_EXTERNAL_MODULE_ON(x) (g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_NONE ? HIDDEN_ROW : (uint8_t)(x))
#define INTERNAL_MODULE_CHANNELS_ROWS IF_INTERNAL_MODULE_ON(1)
#define TRAINER_CHANNELS_ROWS() IF_TRAINER_ON(1)
#define PORT_CHANNELS_ROWS(x) (x==INTERNAL_MODULE ? INTERNAL_MODULE_CHANNELS_ROWS : (x==EXTERNAL_MODULE ? EXTERNAL_MODULE_CHANNELS_ROWS : TRAINER_CHANNELS_ROWS()))
#define PORT_CHANNELS_ROWS(x) (x==INTERNAL_MODULE ? INTERNAL_MODULE_CHANNELS_ROWS : (x==EXTERNAL_MODULE ? EXTERNAL_MODULE_CHANNELS_ROWS : 1))
#if defined(BLUETOOTH)
#define TRAINER_LINE1_BLUETOOTH_M_ROWS ((bluetoothFriend[0] == 0 || bluetoothState == BLUETOOTH_STATE_CONNECTED) ? (uint8_t)0 : (uint8_t)1)
#define TRAINER_LINE1_ROWS (g_model.trainerMode == TRAINER_MODE_SLAVE ? (uint8_t)1 : (g_model.trainerMode == TRAINER_MODE_MASTER_BLUETOOTH ? TRAINER_LINE1_BLUETOOTH_M_ROWS : (g_model.trainerMode == TRAINER_MODE_SLAVE_BLUETOOTH ? (uint8_t)1 : HIDDEN_ROW)))
#define TRAINER_LINE2_ROWS (g_model.trainerMode == TRAINER_MODE_SLAVE ? (uint8_t)2 : HIDDEN_ROW)
#else
#define TRAINER_LINE1_ROWS (g_model.trainerMode == TRAINER_MODE_SLAVE ? (uint8_t)1 : HIDDEN_ROW)
#define TRAINER_LINE2_ROWS (g_model.trainerMode == TRAINER_MODE_SLAVE ? (uint8_t)2 : HIDDEN_ROW)
#endif
#define TIMER_ROWS(x) 2|NAVIGATION_LINE_BY_LINE, 0, 0, 0, g_model.timers[x].countdownBeep != COUNTDOWN_SILENT ? (uint8_t) 1 : (uint8_t)0
@ -285,7 +292,7 @@ void menuModelSetup(event_t event)
EXTERNAL_MODULE_CHANNELS_ROWS,
(IS_MODULE_XJT(EXTERNAL_MODULE) && !HAS_RF_PROTOCOL_FAILSAFE(g_model.moduleData[EXTERNAL_MODULE].rfProtocol)) ? (uint8_t)1 : (IS_MODULE_PPM(EXTERNAL_MODULE) || IS_MODULE_XJT(EXTERNAL_MODULE) || IS_MODULE_DSM2(EXTERNAL_MODULE) || IS_MODULE_MULTIMODULE(EXTERNAL_MODULE)) ? (uint8_t)2 : HIDDEN_ROW,
FAILSAFE_ROWS(EXTERNAL_MODULE), EXTERNAL_MODULE_OPTION_ROW, MULTIMODULE_MODULE_ROWS EXTERNAL_MODULE_POWER_ROW,
LABEL(Trainer), 0, TRAINER_CHANNELS_ROWS(), IF_TRAINER_ON(2)});
LABEL(Trainer), 0, TRAINER_LINE1_ROWS, TRAINER_LINE2_ROWS});
#else
MENU_TAB({ 0, 0, TIMERS_ROWS, TOPLCD_ROWS 0, 1, 0, 0,
LABEL(Throttle), 0, 0, 0,
@ -301,7 +308,7 @@ void menuModelSetup(event_t event)
EXTERNAL_MODULE_CHANNELS_ROWS,
(IS_MODULE_XJT(EXTERNAL_MODULE) && !HAS_RF_PROTOCOL_FAILSAFE(g_model.moduleData[EXTERNAL_MODULE].rfProtocol)) ? (uint8_t)1 : (IS_MODULE_PPM(EXTERNAL_MODULE) || IS_MODULE_PXX(EXTERNAL_MODULE) || IS_MODULE_DSM2(EXTERNAL_MODULE) || IS_MODULE_MULTIMODULE(EXTERNAL_MODULE)) ? (uint8_t)2 : HIDDEN_ROW,
FAILSAFE_ROWS(EXTERNAL_MODULE), EXTERNAL_MODULE_OPTION_ROW, MULTIMODULE_MODULE_ROWS EXTERNAL_MODULE_POWER_ROW,
LABEL(Trainer), 0, TRAINER_CHANNELS_ROWS(), IF_TRAINER_ON(2)});
LABEL(Trainer), 0, TRAINER_LINE1_ROWS, TRAINER_LINE2_ROWS});
#endif
MENU_CHECK(STR_MENUSETUP, menuTabModel, MENU_MODEL_SETUP, ITEM_MODEL_SETUP_MAX);
@ -709,7 +716,15 @@ void menuModelSetup(event_t event)
case ITEM_MODEL_TRAINER_MODE:
lcdDrawTextAlignedLeft(y, STR_MODE);
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_VTRAINERMODES, g_model.trainerMode, attr);
if (attr) g_model.trainerMode = checkIncDec(event, g_model.trainerMode, 0, HAS_WIRELESS_TRAINER_HARDWARE() ? TRAINER_MODE_MASTER_BATTERY_COMPARTMENT : TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE, EE_MODEL, isTrainerModeAvailable);
if (attr) {
g_model.trainerMode = checkIncDec(event, g_model.trainerMode, 0, TRAINER_MODE_MAX(), EE_MODEL, isTrainerModeAvailable);
}
#if defined(BLUETOOTH)
if (attr && checkIncDec_Ret) {
bluetoothState = BLUETOOTH_STATE_OFF;
bluetoothFriend[0] = 0;
}
#endif
break;
case ITEM_MODEL_EXTERNAL_MODULE_LABEL:
@ -806,9 +821,52 @@ void menuModelSetup(event_t event)
lcdDrawTextAlignedLeft(y, STR_TRAINER);
break;
#if defined(BLUETOOTH)
case ITEM_MODEL_TRAINER_LINE1:
if (g_model.trainerMode == TRAINER_MODE_MASTER_BLUETOOTH) {
if (attr) {
s_editMode = 0;
}
if (bluetoothFriend[0]) {
lcdDrawText(INDENT_WIDTH, y+1, bluetoothFriend, TINSIZE);
if (bluetoothState != BLUETOOTH_STATE_CONNECTED) {
lcdDrawText(MODEL_SETUP_2ND_COLUMN, y, BUTTON("Bind"), menuHorizontalPosition == 0 ? attr : 0);
lcdDrawText(MODEL_SETUP_2ND_COLUMN+5*FW, y, BUTTON("Clear"), menuHorizontalPosition == 1 ? attr : 0);
}
else {
lcdDrawText(MODEL_SETUP_2ND_COLUMN, y, BUTTON("Clear"), attr);
}
if (attr && event == EVT_KEY_FIRST(KEY_ENTER)) {
if (bluetoothState == BLUETOOTH_STATE_CONNECTED || menuHorizontalPosition == 1) {
bluetoothState = BLUETOOTH_STATE_OFF;
bluetoothFriend[0] = 0;
}
else {
bluetoothState = BLUETOOTH_STATE_BIND_REQUESTED;
}
}
}
else {
lcdDrawText(INDENT_WIDTH, y, "---");
if (bluetoothState < BLUETOOTH_STATE_IDLE)
lcdDrawText(MODEL_SETUP_2ND_COLUMN, y, BUTTON("Init"), attr);
else
lcdDrawText(MODEL_SETUP_2ND_COLUMN, y, BUTTON("Discover"), attr);
if (attr && event == EVT_KEY_FIRST(KEY_ENTER)) {
if (bluetoothState < BLUETOOTH_STATE_IDLE)
bluetoothState = BLUETOOTH_STATE_OFF;
else
bluetoothState = BLUETOOTH_STATE_DISCOVER_REQUESTED;
}
}
break;
}
// no break
#else
case ITEM_MODEL_TRAINER_LINE1:
#endif
case ITEM_MODEL_INTERNAL_MODULE_CHANNELS:
case ITEM_MODEL_EXTERNAL_MODULE_CHANNELS:
case ITEM_MODEL_TRAINER_CHANNELS:
{
uint8_t moduleIdx = CURRENT_MODULE_EDITED(k);
ModuleData & moduleData = g_model.moduleData[moduleIdx];
@ -832,11 +890,11 @@ void menuModelSetup(event_t event)
case 1:
CHECK_INCDEC_MODELVAR(event, moduleData.channelsCount, -4, min<int8_t>(MAX_CHANNELS(moduleIdx), 32-8-moduleData.channelsStart));
#if defined(TARANIS_INTERNAL_PPM)
if ((k == ITEM_MODEL_EXTERNAL_MODULE_CHANNELS && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM) || (k == ITEM_MODEL_INTERNAL_MODULE_CHANNELS && g_model.moduleData[INTERNAL_MODULE].type == MODULE_TYPE_PPM) || (k == ITEM_MODEL_TRAINER_CHANNELS)) {
if ((k == ITEM_MODEL_EXTERNAL_MODULE_CHANNELS && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM) || (k == ITEM_MODEL_INTERNAL_MODULE_CHANNELS && g_model.moduleData[INTERNAL_MODULE].type == MODULE_TYPE_PPM) || (k == ITEM_MODEL_TRAINER_LINE1)) {
SET_DEFAULT_PPM_FRAME_LENGTH(moduleIdx);
}
#else
if ((k == ITEM_MODEL_EXTERNAL_MODULE_CHANNELS && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM) || (k == ITEM_MODEL_TRAINER_CHANNELS)) {
if ((k == ITEM_MODEL_EXTERNAL_MODULE_CHANNELS && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM) || (k == ITEM_MODEL_TRAINER_LINE1)) {
SET_DEFAULT_PPM_FRAME_LENGTH(moduleIdx);
}
#endif
@ -849,7 +907,7 @@ void menuModelSetup(event_t event)
case ITEM_MODEL_INTERNAL_MODULE_BIND:
case ITEM_MODEL_EXTERNAL_MODULE_BIND:
case ITEM_MODEL_TRAINER_SETTINGS:
case ITEM_MODEL_TRAINER_LINE2:
{
uint8_t moduleIdx = CURRENT_MODULE_EDITED(k);
ModuleData & moduleData = g_model.moduleData[moduleIdx];

View file

@ -54,7 +54,8 @@ enum menuRadioHwItems {
CASE_PCBX9E(ITEM_RADIO_HARDWARE_SP)
CASE_PCBX9E(ITEM_RADIO_HARDWARE_SQ)
CASE_PCBX9E(ITEM_RADIO_HARDWARE_SR)
CASE_PCBX9E(ITEM_RADIO_HARDWARE_BLUETOOTH)
CASE_BLUETOOTH(ITEM_RADIO_HARDWARE_BLUETOOTH_MODE)
CASE_BLUETOOTH(ITEM_RADIO_HARDWARE_BLUETOOTH_NAME)
ITEM_RADIO_HARDWARE_UART3_MODE,
ITEM_RADIO_HARDWARE_JITTER_FILTER,
ITEM_RADIO_HARDWARE_MAX
@ -72,9 +73,13 @@ enum menuRadioHwItems {
#if defined(PCBX9E)
#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, 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, 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 BLUETOOTH_ROWS 1,
#else
#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, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1
#endif
#if defined(BLUETOOTH)
#define BLUETOOTH_ROWS 0, uint8_t(g_eeGeneral.bluetoothMode == BLUETOOTH_OFF ? -1 : 0),
#else
#define BLUETOOTH_ROWS
#endif
@ -153,6 +158,7 @@ void menuRadioHardware(event_t event)
g_eeGeneral.potsConfig |= (potType << shift);
break;
}
case ITEM_RADIO_HARDWARE_LABEL_SWITCHES:
lcdDrawTextAlignedLeft(y, STR_SWITCHES);
break;
@ -191,22 +197,29 @@ void menuRadioHardware(event_t event)
}
break;
}
#if defined(PCBX9E)
case ITEM_RADIO_HARDWARE_BLUETOOTH:
lcdDrawTextAlignedLeft(y, "Bluetooth");
drawCheckBox(HW_SETTINGS_COLUMN, y, g_eeGeneral.bluetoothEnable, menuHorizontalPosition == 0 ? attr : 0);
if (attr && menuHorizontalPosition == 0) {
g_eeGeneral.bluetoothEnable = checkIncDecGen(event, g_eeGeneral.bluetoothEnable, 0, 1);
#if defined(BLUETOOTH)
case ITEM_RADIO_HARDWARE_BLUETOOTH_MODE:
lcdDrawText(INDENT_WIDTH, y, STR_BLUETOOTH);
lcdDrawTextAtIndex(HW_SETTINGS_COLUMN, y, STR_BLUETOOTH_MODES, g_eeGeneral.bluetoothMode, attr);
if (attr) {
g_eeGeneral.bluetoothMode = checkIncDecGen(event, g_eeGeneral.bluetoothMode, BLUETOOTH_OFF, BLUETOOTH_TRAINER);
}
editName(HW_SETTINGS_COLUMN+5*FW, y, g_eeGeneral.bluetoothName, LEN_BLUETOOTH_NAME, event, menuHorizontalPosition == 1 ? attr : 0);
break;
case ITEM_RADIO_HARDWARE_BLUETOOTH_NAME:
lcdDrawText(INDENT_WIDTH, y, STR_NAME);
editName(HW_SETTINGS_COLUMN, y, g_eeGeneral.bluetoothName, LEN_BLUETOOTH_NAME, event, attr);
break;
#endif
case ITEM_RADIO_HARDWARE_UART3_MODE:
g_eeGeneral.serial2Mode = editChoice(HW_SETTINGS_COLUMN, y, STR_UART3MODE, STR_UART3MODES, g_eeGeneral.serial2Mode, 0, UART_MODE_MAX, attr, event);
if (attr && checkIncDec_Ret) {
serial2Init(g_eeGeneral.serial2Mode, modelTelemetryProtocol());
}
break;
case ITEM_RADIO_HARDWARE_JITTER_FILTER:
{
uint8_t b = 1-g_eeGeneral.jitterFilter;

View file

@ -82,8 +82,8 @@ enum MenuModelSetupItems {
ITEM_MODEL_EXTERNAL_MODULE_POWER,
ITEM_MODEL_TRAINER_LABEL,
ITEM_MODEL_TRAINER_MODE,
ITEM_MODEL_TRAINER_CHANNELS,
ITEM_MODEL_TRAINER_SETTINGS,
ITEM_MODEL_TRAINER_LINE1,
ITEM_MODEL_TRAINER_LINE2,
ITEM_MODEL_SETUP_MAX
};
@ -214,12 +214,10 @@ int getSwitchWarningsCount()
#define INTERNAL_MODULE_MODE_ROWS (uint8_t)0
#define INTERNAL_MODULE_CHANNELS_ROWS IF_INTERNAL_MODULE_ON(1)
#define TRAINER_CHANNELS_ROWS() IF_TRAINER_ON(1)
#define PORT_CHANNELS_ROWS(x) (x==INTERNAL_MODULE ? INTERNAL_MODULE_CHANNELS_ROWS : (x==EXTERNAL_MODULE ? EXTERNAL_MODULE_CHANNELS_ROWS : TRAINER_CHANNELS_ROWS()))
#define PORT_CHANNELS_ROWS(x) (x==INTERNAL_MODULE ? INTERNAL_MODULE_CHANNELS_ROWS : (x==EXTERNAL_MODULE ? EXTERNAL_MODULE_CHANNELS_ROWS : 1))
#define TIMER_ROWS(x) NAVIGATION_LINE_BY_LINE|1, 0, 0, 0, g_model.timers[x].countdownBeep != COUNTDOWN_SILENT ? (uint8_t)1 : (uint8_t)0
#define EXTERNAL_MODULE_MODE_ROWS (IS_MODULE_XJT(EXTERNAL_MODULE) || IS_MODULE_DSM2(EXTERNAL_MODULE)) ? (uint8_t)1 : IS_MODULE_MULTIMODULE(EXTERNAL_MODULE) ? MULTIMODULE_MODE_ROWS(EXTERNAL_MODULE) : (uint8_t)0
#if TIMERS == 1
@ -235,6 +233,10 @@ int getSwitchWarningsCount()
#define POT_WARN_ITEMS() ((g_model.potsWarnMode) ? uint8_t(NAVIGATION_LINE_BY_LINE|(NUM_POTS-1)) : (uint8_t)0)
#define SLIDER_WARN_ITEMS() ((g_model.potsWarnMode) ? uint8_t(NAVIGATION_LINE_BY_LINE|(NUM_SLIDERS-1)) : (uint8_t)0)
#define TRAINER_LINE1_BLUETOOTH_M_ROWS ((bluetoothFriend[0] == 0 || bluetoothState == BLUETOOTH_STATE_CONNECTED) ? (uint8_t)0 : (uint8_t)1)
#define TRAINER_LINE1_ROWS (g_model.trainerMode == TRAINER_MODE_SLAVE ? (uint8_t)1 : (g_model.trainerMode == TRAINER_MODE_MASTER_BLUETOOTH ? TRAINER_LINE1_BLUETOOTH_M_ROWS : (g_model.trainerMode == TRAINER_MODE_SLAVE_BLUETOOTH ? (uint8_t)1 : HIDDEN_ROW)))
#define TRAINER_LINE2_ROWS (g_model.trainerMode == TRAINER_MODE_SLAVE ? (uint8_t)2 : HIDDEN_ROW)
bool menuModelSetup(event_t event)
{
bool CURSOR_ON_CELL = (menuHorizontalPosition >= 0);
@ -262,7 +264,7 @@ bool menuModelSetup(event_t event)
EXTERNAL_MODULE_CHANNELS_ROWS,
(IS_MODULE_XJT(EXTERNAL_MODULE) && !HAS_RF_PROTOCOL_MODELINDEX(g_model.moduleData[EXTERNAL_MODULE].rfProtocol)) ? (uint8_t)1 : (IS_MODULE_PPM(EXTERNAL_MODULE) || IS_MODULE_XJT(EXTERNAL_MODULE) || IS_MODULE_DSM2(EXTERNAL_MODULE) || IS_MODULE_MULTIMODULE(EXTERNAL_MODULE)) ? (uint8_t)2 : HIDDEN_ROW,
FAILSAFE_ROWS(EXTERNAL_MODULE), EXTERNAL_MODULE_OPTION_ROW, MULTIMODULE_MODULE_ROWS EXTERNAL_MODULE_POWER_ROW,
LABEL(Trainer), 0, TRAINER_CHANNELS_ROWS(), IF_TRAINER_ON(2) });
LABEL(Trainer), 0, TRAINER_LINE1_ROWS, TRAINER_LINE2_ROWS });
if (menuEvent) {
moduleFlag[0] = 0;
@ -641,7 +643,11 @@ bool menuModelSetup(event_t event)
case ITEM_MODEL_TRAINER_MODE:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_MODE);
g_model.trainerMode = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_VTRAINERMODES, g_model.trainerMode, 0, HAS_WIRELESS_TRAINER_HARDWARE() ? TRAINER_MODE_MASTER_BATTERY_COMPARTMENT : TRAINER_MODE_SLAVE, attr, event);
g_model.trainerMode = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_VTRAINERMODES, g_model.trainerMode, 0, TRAINER_MODE_MAX(), attr, event);
if (attr && checkIncDec_Ret) {
bluetoothState = BLUETOOTH_STATE_OFF;
bluetoothFriend[0] = 0;
}
break;
case ITEM_MODEL_EXTERNAL_MODULE_LABEL:
@ -736,9 +742,49 @@ bool menuModelSetup(event_t event)
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_TRAINER);
break;
case ITEM_MODEL_TRAINER_LINE1:
if (g_model.trainerMode == TRAINER_MODE_MASTER_BLUETOOTH) {
if (attr) {
s_editMode = 0;
}
if (bluetoothFriend[0]) {
lcdDrawText(MENUS_MARGIN_LEFT + INDENT_WIDTH, y, bluetoothFriend);
if (bluetoothState != BLUETOOTH_STATE_CONNECTED) {
drawButton(MODEL_SETUP_2ND_COLUMN, y, "Bind", menuHorizontalPosition == 0 ? attr : 0);
drawButton(MODEL_SETUP_2ND_COLUMN+60, y, "Clear", menuHorizontalPosition == 1 ? attr : 0);
}
else {
drawButton(MODEL_SETUP_2ND_COLUMN, y, "Clear", attr);
}
if (attr && event == EVT_KEY_FIRST(KEY_ENTER)) {
if (bluetoothState == BLUETOOTH_STATE_CONNECTED || menuHorizontalPosition == 1) {
bluetoothState = BLUETOOTH_STATE_OFF;
bluetoothFriend[0] = 0;
}
else {
bluetoothState = BLUETOOTH_STATE_BIND_REQUESTED;
}
}
}
else {
lcdDrawText(MENUS_MARGIN_LEFT + INDENT_WIDTH, y, "---");
if (bluetoothState < BLUETOOTH_STATE_IDLE)
drawButton(MODEL_SETUP_2ND_COLUMN, y, "Init", attr);
else
drawButton(MODEL_SETUP_2ND_COLUMN, y, "Discover", attr);
if (attr && event == EVT_KEY_FIRST(KEY_ENTER)) {
if (bluetoothState < BLUETOOTH_STATE_IDLE)
bluetoothState = BLUETOOTH_STATE_OFF;
else
bluetoothState = BLUETOOTH_STATE_DISCOVER_REQUESTED;
}
}
break;
}
// no break
case ITEM_MODEL_INTERNAL_MODULE_CHANNELS:
case ITEM_MODEL_EXTERNAL_MODULE_CHANNELS:
case ITEM_MODEL_TRAINER_CHANNELS:
{
uint8_t moduleIdx = CURRENT_MODULE_EDITED(k);
ModuleData & moduleData = g_model.moduleData[moduleIdx];
@ -761,7 +807,7 @@ bool menuModelSetup(event_t event)
case 1:
CHECK_INCDEC_MODELVAR(event, moduleData.channelsCount, -4, min<int8_t>(MAX_CHANNELS(moduleIdx), 32-8-moduleData.channelsStart));
if ((k == ITEM_MODEL_EXTERNAL_MODULE_CHANNELS && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM)
|| (k == ITEM_MODEL_TRAINER_CHANNELS)
|| (k == ITEM_MODEL_TRAINER_LINE1)
)
SET_DEFAULT_PPM_FRAME_LENGTH(moduleIdx);
break;
@ -773,7 +819,7 @@ bool menuModelSetup(event_t event)
case ITEM_MODEL_INTERNAL_MODULE_BIND:
case ITEM_MODEL_EXTERNAL_MODULE_BIND:
case ITEM_MODEL_TRAINER_SETTINGS:
case ITEM_MODEL_TRAINER_LINE2:
{
uint8_t moduleIdx = CURRENT_MODULE_EDITED(k);
ModuleData & moduleData = g_model.moduleData[moduleIdx];

View file

@ -46,7 +46,8 @@ enum MenuRadioHardwareItems {
ITEM_RADIO_HARDWARE_SF,
ITEM_RADIO_HARDWARE_SG,
ITEM_RADIO_HARDWARE_SH,
ITEM_RADIO_HARDWARE_BLUETOOTH,
ITEM_RADIO_HARDWARE_BLUETOOTH_MODE,
ITEM_RADIO_HARDWARE_BLUETOOTH_NAME,
#if defined(SERIAL2) && defined(DEBUG)
ITEM_RADIO_HARDWARE_UART3_MODE,
#endif
@ -62,12 +63,12 @@ enum MenuRadioHardwareItems {
#define POTS_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, NAVIGATION_LINE_BY_LINE|1
#endif
#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, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1
#define BLUETOOTH_ROWS 1,
#define BLUETOOTH_ROWS 0, uint8_t(g_eeGeneral.bluetoothMode == BLUETOOTH_OFF ? -1 : 0)
#define SWITCH_TYPE_MAX(sw) ((MIXSRC_SF-MIXSRC_FIRST_SWITCH == sw || MIXSRC_SH-MIXSRC_FIRST_SWITCH == sw) ? SWITCH_2POS : SWITCH_3POS)
bool menuRadioHardware(event_t event)
{
MENU(STR_HARDWARE, RADIO_ICONS, menuTabGeneral, MENU_RADIO_HARDWARE, ITEM_RADIO_HARDWARE_MAX, { 0, LABEL(Sticks), 0, 0, 0, 0, LABEL(Pots), POTS_ROWS, LABEL(Switches), SWITCHES_ROWS, BLUETOOTH_ROWS 0, 0, 0 });
MENU(STR_HARDWARE, RADIO_ICONS, menuTabGeneral, MENU_RADIO_HARDWARE, ITEM_RADIO_HARDWARE_MAX, { 0, LABEL(Sticks), 0, 0, 0, 0, LABEL(Pots), POTS_ROWS, LABEL(Switches), SWITCHES_ROWS, BLUETOOTH_ROWS, 0, 0, 0 });
uint8_t sub = menuVerticalPosition;
@ -167,13 +168,14 @@ bool menuRadioHardware(event_t event)
break;
}
case ITEM_RADIO_HARDWARE_BLUETOOTH:
lcdDrawText(MENUS_MARGIN_LEFT, y, "Bluetooth");
drawCheckBox(HW_SETTINGS_COLUMN, y, g_eeGeneral.bluetoothEnable, menuHorizontalPosition == 0 ? attr : 0);
if (attr && menuHorizontalPosition == 0) {
g_eeGeneral.bluetoothEnable = checkIncDecGen(event, g_eeGeneral.bluetoothEnable, 0, 1);
}
editName(HW_SETTINGS_COLUMN+50, y, g_eeGeneral.bluetoothName, LEN_BLUETOOTH_NAME, event, menuHorizontalPosition == 1 ? attr : 0);
case ITEM_RADIO_HARDWARE_BLUETOOTH_MODE:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_BLUETOOTH);
g_eeGeneral.bluetoothMode = editChoice(HW_SETTINGS_COLUMN+50, y, STR_BLUETOOTH_MODES, g_eeGeneral.bluetoothMode, BLUETOOTH_OFF, BLUETOOTH_TRAINER, attr, event);
break;
case ITEM_RADIO_HARDWARE_BLUETOOTH_NAME:
lcdDrawText(INDENT_WIDTH, y, STR_NAME);
editName(HW_SETTINGS_COLUMN+50, y, g_eeGeneral.bluetoothName, LEN_BLUETOOTH_NAME, event, attr);
break;
#if defined(SERIAL2) && defined(DEBUG)

View file

@ -154,7 +154,6 @@ const mm_protocol_definition *getMultiProtocolDefinition (uint8_t protocol);
#define MAX_RX_NUM(x) (IS_MODULE_DSM2(x) ? 20 : IS_MODULE_MULTIMODULE(x) ? MULTI_MAX_RX_NUM(x) : 63)
#define IS_D8_RX(x) (g_model.moduleData[x].rfProtocol == RF_PROTO_D8)
#define IF_TRAINER_ON(x) (g_model.trainerMode == TRAINER_MODE_SLAVE ? (uint8_t)(x) : HIDDEN_ROW)
#define IS_R9M_OR_XJTD16(x) ((IS_MODULE_XJT(x) && g_model.moduleData[x].rfProtocol== RF_PROTO_X16) || IS_MODULE_R9M(x))
#define FAILSAFE_ROWS(x) ((IS_MODULE_XJT(x) && HAS_RF_PROTOCOL_FAILSAFE(g_model.moduleData[x].rfProtocol)) || MULTIMODULE_HASFAILSAFE(x) || IS_MODULE_R9M(x)) ? (g_model.moduleData[x].failsafeMode==FAILSAFE_CUSTOM ? (uint8_t)1 : (uint8_t)0) : HIDDEN_ROW

View file

@ -560,11 +560,29 @@ bool isTrainerModeAvailable(int mode)
{
return true;
}
#elif defined(PCBTARANIS)
#elif defined(PCBX9E)
bool isTrainerModeAvailable(int mode)
{
if (IS_EXTERNAL_MODULE_PRESENT() && (mode == TRAINER_MODE_MASTER_SBUS_EXTERNAL_MODULE || mode == TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE))
return false;
else if (mode == TRAINER_MODE_MASTER_BLUETOOTH || mode == TRAINER_MODE_MASTER_BATTERY_COMPARTMENT)
return false;
else
return true;
}
#elif defined(PCBX9)
bool isTrainerModeAvailable(int mode)
{
if (IS_EXTERNAL_MODULE_PRESENT() && (mode == TRAINER_MODE_MASTER_SBUS_EXTERNAL_MODULE || mode == TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE))
return false;
else
return true;
}
#elif defined(PCBX7)
bool isTrainerModeAvailable(int mode)
{
if (mode == TRAINER_MODE_MASTER_SBUS_EXTERNAL_MODULE || mode == TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE || mode == TRAINER_MODE_MASTER_BATTERY_COMPARTMENT)
return false;
else
return true;
}

View file

@ -455,10 +455,6 @@ void perMain()
toplcdRefreshEnd();
#endif
#if defined(BLUETOOTH) && !defined(SIMU)
bluetoothWakeup();
#endif
#if defined(INTERNAL_GPS)
gpsWakeup();
#endif

View file

@ -194,6 +194,12 @@
#define CASE_PCBX9E(x)
#endif
#if defined(BLUETOOTH)
#define CASE_BLUETOOTH(x) x,
#else
#define CASE_BLUETOOTH(x)
#endif
#if defined(PCBSKY9X) && !defined(AR9X) && !defined(REVA)
#define TX_CAPACITY_MEASUREMENT
#define CASE_CAPACITY(x) x,
@ -218,6 +224,16 @@
#define IS_FAI_FORBIDDEN(idx) (IS_FAI_ENABLED() && idx >= MIXSRC_FIRST_TELEM)
#if defined(BLUETOOTH)
#if defined(X9E)
#define IS_BLUETOOTH_TRAINER() (g_model.trainerMode == TRAINER_MODE_SLAVE_BLUETOOTH)
#else
#define IS_BLUETOOTH_TRAINER() (g_model.trainerMode == TRAINER_MODE_MASTER_BLUETOOTH || g_model.trainerMode == TRAINER_MODE_SLAVE_BLUETOOTH)
#endif
#else
#define IS_BLUETOOTH_TRAINER() false
#endif
#if defined(CPUARM)
#define MASTER_VOLUME
#endif
@ -1698,4 +1714,8 @@ extern JitterMeter<uint16_t> avgJitter[NUM_ANALOGS];
#include "gps.h"
#endif
#if defined(BLUETOOTH)
#include "bluetooth.h"
#endif
#endif // _OPENTX_H_

View file

@ -752,7 +752,7 @@ PACK(typedef struct {
uint16_t mAhUsed;
uint32_t globalTimer;
int8_t temperatureCalib;
uint8_t btBaudrate;
uint8_t bluetoothBaudrate;
uint8_t optrexDisplay;
uint8_t sticksGain;
uint8_t rotarySteps;
@ -823,7 +823,7 @@ void ConvertRadioData_217_to_218(RadioData & settings)
settings.vBatMax = settings_v217.vBatMax;
settings.backlightBright = settings_v217.backlightBright;
settings.globalTimer = settings_v217.globalTimer;
settings.btBaudrate = settings_v217.btBaudrate;
settings.bluetoothBaudrate = settings_v217.bluetoothBaudrate;
settings.countryCode = settings_v217.countryCode;
settings.imperial = settings_v217.imperial;
settings.ttsLanguage[0] = settings_v217.ttsLanguage[0];
@ -849,7 +849,6 @@ void ConvertRadioData_217_to_218(RadioData & settings)
#endif
#if defined(PCBX9E)
settings.bluetoothEnable = settings_v217.bluetoothEnable;
memcpy(settings.bluetoothName, settings_v217.bluetoothName, sizeof(settings.bluetoothName));
#endif

View file

@ -23,14 +23,6 @@
Fifo<uint8_t, 64> btTxFifo;
Fifo<uint8_t, 64> btRxFifo;
enum BluetoothState
{
BLUETOOTH_INIT,
BLUETOOTH_WAIT_TTM,
BLUETOOTH_WAIT_BAUDRATE_CHANGE,
BLUETOOTH_OK,
};
enum BluetoothWriteState
{
BLUETOOTH_WRITE_IDLE,
@ -39,7 +31,6 @@ enum BluetoothWriteState
BLUETOOTH_WRITE_DONE
};
volatile uint8_t bluetoothState = BLUETOOTH_INIT;
volatile uint8_t bluetoothWriteState = BLUETOOTH_WRITE_IDLE;
void bluetoothInit(uint32_t baudrate)
@ -49,9 +40,6 @@ void bluetoothInit(uint32_t baudrate)
USART_DeInit(BT_USART);
RCC_AHB1PeriphClockCmd(BT_RCC_AHB1Periph, ENABLE);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART6, ENABLE);
GPIO_InitStructure.GPIO_Pin = BT_EN_GPIO_PIN;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
@ -106,7 +94,7 @@ void bluetoothDone()
GPIO_SetBits(BT_EN_GPIO, BT_EN_GPIO_PIN); // close bluetooth
}
extern "C" void USART6_IRQHandler(void)
extern "C" void BT_USART_IRQHandler(void)
{
DEBUG_INTERRUPT(INT_BLUETOOTH);
if (USART_GetITStatus(BT_USART, USART_IT_RXNE) != RESET) {
@ -128,21 +116,6 @@ extern "C" void USART6_IRQHandler(void)
}
}
void bluetoothWrite(const void * buffer, int len)
{
uint8_t * data = (uint8_t *)buffer;
for (int i=0; i<len; ++i) {
btTxFifo.push(data[i]);
}
}
void bluetoothWriteString(const char * str)
{
while (*str != 0) {
btTxFifo.push(*str++);
}
}
void bluetoothWriteWakeup(void)
{
if (bluetoothWriteState == BLUETOOTH_WRITE_IDLE) {
@ -164,86 +137,3 @@ void bluetoothWriteWakeup(void)
#endif
}
}
void bluetoothWakeup(void)
{
if (!g_eeGeneral.bluetoothEnable) {
if (bluetoothState != BLUETOOTH_INIT) {
bluetoothDone();
bluetoothState = BLUETOOTH_INIT;
}
}
else {
if (bluetoothState != BLUETOOTH_OK) {
static tmr10ms_t waitEnd = 0;
if (bluetoothState == BLUETOOTH_INIT) {
bluetoothInit(BLUETOOTH_DEFAULT_BAUDRATE);
const char btMessage[] = "TTM:REN-";
bluetoothWriteString(btMessage);
uint8_t len = ZLEN(g_eeGeneral.bluetoothName);
for (int i=0; i<len; i++) {
btTxFifo.push(idx2char(g_eeGeneral.bluetoothName[i]));
}
bluetoothState = BLUETOOTH_WAIT_TTM;
waitEnd = get_tmr10ms() + 25; // 250ms
}
else if (bluetoothState == BLUETOOTH_WAIT_TTM) {
if (get_tmr10ms() > waitEnd) {
char ttm[] = "TTM:REN";
int index = 0;
uint8_t c;
bool found = false;
while (btRxFifo.pop(c)) {
if (c == ttm[index]) {
index++;
if (index == sizeof(ttm)-1) {
found = true;
break;
}
}
else {
index = 0;
}
}
if (found) {
bluetoothState = BLUETOOTH_OK;
}
else {
bluetoothInit(BLUETOOTH_FACTORY_BAUDRATE);
const char btMessage[] = "TTM:BPS-115200";
bluetoothWriteString(btMessage);
bluetoothState = BLUETOOTH_WAIT_BAUDRATE_CHANGE;
waitEnd = get_tmr10ms() + 250; // 2.5s
}
}
}
else if (bluetoothState == BLUETOOTH_WAIT_BAUDRATE_CHANGE) {
if (get_tmr10ms() > waitEnd) {
bluetoothState = BLUETOOTH_INIT;
}
}
}
bluetoothWriteWakeup();
}
}
uint8_t bluetoothReady()
{
return (bluetoothState == BLUETOOTH_OK);
}
int bluetoothRead(void * buffer, int len)
{
int result = 0;
uint8_t * data = (uint8_t *)buffer;
while (result < len) {
uint8_t byte;
if (!btRxFifo.pop(byte)) {
break;
}
data[result++] = byte;
}
return result;
}

View file

@ -1,5 +1,4 @@
option(DISK_CACHE "Enable SD card disk cache" YES)
option(BLUETOOTH_CLI_PASSTHROUGH "Enable direct communicaton with Bluetooth module from CLI" NO)
option(UNEXPECTED_SHUTDOWN "Enable the Unexpected Shutdown screen" YES)
set(PWR_BUTTON "PRESS" CACHE STRING "Pwr button type (PRESS/SWITCH)")
@ -103,14 +102,19 @@ if(INTERNAL_GPS)
add_definitions(-DINTERNAL_GPS)
message("Horus: Internal GPS enabled")
endif()
set(SERIAL2_DRIVER ../common/arm/stm32/serial2_driver.cpp)
set(GVAR_SCREEN model_gvars.cpp)
set(TARGET_SRC
${TARGET_SRC}
board.cpp
led_driver.cpp
extmodule_driver.cpp
../common/arm/stm32/bluetooth_driver.cpp
)
set(FIRMWARE_TARGET_SRC
${FIRMWARE_TARGET_SRC}
sdio_sd.c
@ -120,17 +124,14 @@ set(FIRMWARE_TARGET_SRC
sdram_driver.c
startup_stm32f42_43xxx.s
)
if(PCB STREQUAL X12S)
set(FIRMWARE_TARGET_SRC
${FIRMWARE_TARGET_SRC}
bluetooth_driver.cpp
)
add_definitions(-DBLUETOOTH)
endif()
if(BLUETOOTH_CLI_PASSTHROUGH)
add_definitions(-DBLUETOOTH_CLI_PASSTHROUGH)
message("Horus: Bluetooth pass-trough enabled")
endif()
set(SRC
${SRC}
bluetooth.cpp
)
set(STM32LIB_SRC
STM32F4xx_StdPeriph_Driver/src/stm32f4xx_sdio.c
STM32F4xx_StdPeriph_Driver/src/stm32f4xx_fmc.c

View file

@ -1,261 +0,0 @@
/*
* 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"
Fifo<uint8_t, 64> btTxFifo;
Fifo<uint8_t, 64> btRxFifo;
enum BluetoothState
{
BLUETOOTH_INIT,
BLUETOOTH_WAIT_TTM,
BLUETOOTH_WAIT_BAUDRATE_CHANGE,
BLUETOOTH_OK,
};
enum BluetoothWriteState
{
BLUETOOTH_WRITE_IDLE,
BLUETOOTH_WRITE_INIT,
BLUETOOTH_WRITING,
BLUETOOTH_WRITE_DONE
};
volatile uint8_t bluetoothState = BLUETOOTH_INIT;
volatile uint8_t bluetoothWriteState = BLUETOOTH_WRITE_IDLE;
void bluetoothInit(uint32_t baudrate)
{
GPIO_InitTypeDef GPIO_InitStructure;
USART_InitTypeDef USART_InitStructure;
USART_DeInit(BT_USART);
RCC_AHB1PeriphClockCmd(BT_RCC_AHB1Periph, ENABLE);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART6, ENABLE);
GPIO_InitStructure.GPIO_Pin = BT_EN_GPIO_PIN;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(BT_EN_GPIO, &GPIO_InitStructure);
#if defined(BT_BRTS_GPIO_PIN)
GPIO_InitStructure.GPIO_Pin = BT_BRTS_GPIO_PIN;
GPIO_Init(BT_BRTS_GPIO, &GPIO_InitStructure);
GPIO_SetBits(BT_BRTS_GPIO, BT_BRTS_GPIO_PIN);
#endif
#if defined(BT_BCTS_GPIO_PIN)
GPIO_InitStructure.GPIO_Pin = BT_BCTS_GPIO_PIN;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
GPIO_Init(BT_BCTS_GPIO, &GPIO_InitStructure);
#endif
GPIO_InitStructure.GPIO_Pin = BT_TX_GPIO_PIN|BT_RX_GPIO_PIN;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_Init(BT_GPIO_TXRX, &GPIO_InitStructure);
GPIO_PinAFConfig(BT_GPIO_TXRX, BT_TX_GPIO_PinSource, BT_GPIO_AF);
GPIO_PinAFConfig(BT_GPIO_TXRX, BT_RX_GPIO_PinSource, BT_GPIO_AF);
USART_DeInit(BT_USART);
USART_InitStructure.USART_BaudRate = baudrate;
USART_InitStructure.USART_Parity = USART_Parity_No;
USART_InitStructure.USART_StopBits = USART_StopBits_1;
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
USART_Init(BT_USART, &USART_InitStructure);
USART_Cmd(BT_USART, ENABLE);
USART_ITConfig(BT_USART, USART_IT_RXNE, ENABLE);
NVIC_InitTypeDef NVIC_InitStructure;
NVIC_InitStructure.NVIC_IRQChannel = BT_USART_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 8;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
GPIO_ResetBits(BT_EN_GPIO, BT_EN_GPIO_PIN); // open bluetooth
}
void bluetoothDone()
{
GPIO_SetBits(BT_EN_GPIO, BT_EN_GPIO_PIN); // close bluetooth
}
extern "C" void USART6_IRQHandler(void)
{
DEBUG_INTERRUPT(INT_BLUETOOTH);
if (USART_GetITStatus(BT_USART, USART_IT_RXNE) != RESET) {
USART_ClearITPendingBit(BT_USART, USART_IT_RXNE);
uint8_t byte = USART_ReceiveData(BT_USART);
btRxFifo.push(byte);
}
if (USART_GetITStatus(BT_USART, USART_IT_TXE) != RESET) {
uint8_t byte;
bool result = btTxFifo.pop(byte);
if (result) {
USART_SendData(BT_USART, byte);
}
else {
USART_ITConfig(BT_USART, USART_IT_TXE, DISABLE);
bluetoothWriteState = BLUETOOTH_WRITE_DONE;
}
}
}
void bluetoothWrite(const void * buffer, int len)
{
uint8_t * data = (uint8_t *)buffer;
for (int i=0; i<len; ++i) {
btTxFifo.push(data[i]);
}
}
void bluetoothWriteString(const char * str)
{
while (*str != 0) {
btTxFifo.push(*str++);
}
}
void bluetoothWriteWakeup(void)
{
if (bluetoothWriteState == BLUETOOTH_WRITE_IDLE) {
if (!btTxFifo.isEmpty()) {
bluetoothWriteState = BLUETOOTH_WRITE_INIT;
#if defined(BT_BRTS_GPIO_PIN)
GPIO_ResetBits(BT_BRTS_GPIO, BT_BRTS_GPIO_PIN);
#endif
}
}
else if (bluetoothWriteState == BLUETOOTH_WRITE_INIT) {
bluetoothWriteState = BLUETOOTH_WRITING;
USART_ITConfig(BT_USART, USART_IT_TXE, ENABLE);
}
else if (bluetoothWriteState == BLUETOOTH_WRITE_DONE) {
bluetoothWriteState = BLUETOOTH_WRITE_IDLE;
#if defined(BT_BRTS_GPIO_PIN)
GPIO_SetBits(BT_BRTS_GPIO, BT_BRTS_GPIO_PIN);
#endif
}
}
void bluetoothWakeup(void)
{
#if defined(BLUETOOTH_CLI_PASSTHROUGH)
bluetoothWriteWakeup();
return;
#else // #if defined(BLUETOOTH_CLI_PASSTHROUGH)
// NOTICE: code below doesn't work on Horus beta!
if (!g_eeGeneral.bluetoothEnable) {
if (bluetoothState != BLUETOOTH_INIT) {
bluetoothDone();
bluetoothState = BLUETOOTH_INIT;
}
}
else {
if (bluetoothState != BLUETOOTH_OK) {
static tmr10ms_t waitEnd = 0;
if (bluetoothState == BLUETOOTH_INIT) {
TRACE("BLUETOOTH_INIT");
bluetoothInit(BLUETOOTH_DEFAULT_BAUDRATE);
const char btMessage[] = "TTM:REN-";
bluetoothWriteString(btMessage);
uint8_t len = ZLEN(g_eeGeneral.bluetoothName);
for (int i=0; i<len; i++) {
btTxFifo.push(idx2char(g_eeGeneral.bluetoothName[i]));
}
bluetoothState = BLUETOOTH_WAIT_TTM;
waitEnd = get_tmr10ms() + 25; // 250ms
}
else if (bluetoothState == BLUETOOTH_WAIT_TTM) {
if (get_tmr10ms() > waitEnd) {
TRACE("bt rename");
char ttm[] = "TTM:REN";
int index = 0;
uint8_t c;
bool found = false;
while (btRxFifo.pop(c)) {
if (c == ttm[index]) {
index++;
if (index == sizeof(ttm)-1) {
found = true;
break;
}
}
else {
index = 0;
}
}
if (found) {
TRACE("bt OK");
bluetoothState = BLUETOOTH_OK;
}
else {
TRACE("bt failure");
bluetoothInit(BLUETOOTH_FACTORY_BAUDRATE);
const char btMessage[] = "TTM:BPS-115200";
bluetoothWriteString(btMessage);
bluetoothState = BLUETOOTH_WAIT_BAUDRATE_CHANGE;
waitEnd = get_tmr10ms() + 250; // 2.5s
}
}
}
else if (bluetoothState == BLUETOOTH_WAIT_BAUDRATE_CHANGE) {
if (get_tmr10ms() > waitEnd) {
bluetoothState = BLUETOOTH_INIT;
}
}
}
bluetoothWriteWakeup();
}
#endif // #if defined(BLUETOOTH_CLI_PASSTHROUGH)
}
uint8_t bluetoothReady()
{
return (bluetoothState == BLUETOOTH_OK);
}
int bluetoothRead(void * buffer, int len)
{
int result = 0;
uint8_t * data = (uint8_t *)buffer;
while (result < len) {
uint8_t byte;
if (!btRxFifo.pop(byte)) {
break;
}
data[result++] = byte;
}
return result;
}

View file

@ -119,6 +119,7 @@ void boardInit()
SERIAL_RCC_AHB1Periph |
TELEMETRY_RCC_AHB1Periph |
TRAINER_RCC_AHB1Periph |
BT_RCC_AHB1Periph |
AUDIO_RCC_AHB1Periph |
HAPTIC_RCC_AHB1Periph |
INTMODULE_RCC_AHB1Periph |
@ -145,6 +146,7 @@ void boardInit()
HAPTIC_RCC_APB2Periph |
INTMODULE_RCC_APB2Periph |
EXTMODULE_RCC_APB2Periph |
BT_RCC_APB2Periph |
BL_RCC_APB2Periph,
ENABLE);
@ -180,10 +182,10 @@ void boardInit()
hapticInit();
#if defined(BLUETOOTH)
bluetoothInit(BLUETOOTH_FACTORY_BAUDRATE);
bluetoothInit(BLUETOOTH_DEFAULT_BAUDRATE);
#endif
#if defined(PCBX12S)
#if defined(INTERNAL_GPS)
gpsInit(GPS_USART_BAUDRATE);
#endif

View file

@ -527,13 +527,8 @@ int sbusGetByte(uint8_t * byte);
// BT driver
#define BLUETOOTH_DEFAULT_BAUDRATE 115200
#define BLUETOOTH_FACTORY_BAUDRATE 9600
uint8_t bluetoothReady(void);
void bluetoothInit(uint32_t baudrate);
void bluetoothWrite(const void * buffer, int len);
void bluetoothWriteString(const char * str);
int bluetoothRead(void * buffer, int len);
void bluetoothWakeup(void);
void bluetoothWriteWakeup(void);
void bluetoothDone(void);
extern uint8_t currentTrainerMode;

View file

@ -39,16 +39,20 @@
#define KEYS_GPIO_REG_RIGHT GPIOC->IDR
#define KEYS_GPIO_PIN_RIGHT GPIO_Pin_4 // PC.04
#elif defined(PCBX10)
#define KEYS_GPIO_REG_PGDN GPIOI->IDR
#define KEYS_GPIO_PIN_PGDN GPIO_Pin_11 // PI.11
#define KEYS_GPIO_REG_LEFT GPIOI->IDR
#define KEYS_GPIO_PIN_LEFT GPIO_Pin_7 // PI.07
#define KEYS_GPIO_REG_PGUP GPIOH->IDR
#define KEYS_GPIO_PIN_PGUP GPIO_Pin_14 // PH.14
#define KEYS_GPIO_REG_PGDN GPIOH->IDR
#define KEYS_GPIO_PIN_PGDN GPIO_Pin_15 // PH.15
#define KEYS_GPIO_REG_ENTER GPIOI->IDR
#define KEYS_GPIO_PIN_ENTER GPIO_Pin_8 // PI.08
#define KEYS_GPIO_PIN_ENTER GPIO_Pin_11 // PI.11
#define KEYS_GPIO_REG_PUSH GPIOI->IDR
#define KEYS_GPIO_PIN_PUSH GPIO_Pin_8 // PI.08
#define KEYS_GPIO_REG_UP GPIOI->IDR
#define KEYS_GPIO_PIN_UP GPIO_Pin_4 // PI.04
#define KEYS_GPIO_REG_DOWN GPIOI->IDR
#define KEYS_GPIO_PIN_DOWN GPIO_Pin_6 // PI.06
#define KEYS_GPIO_REG_LEFT GPIOI->IDR
#define KEYS_GPIO_PIN_LEFT GPIO_Pin_7 // PI.07
#define KEYS_GPIO_REG_RIGHT GPIOI->IDR
#define KEYS_GPIO_PIN_RIGHT GPIO_Pin_5 // PI.05
#endif
@ -471,13 +475,13 @@
#define HAPTIC_GPIO_AF GPIO_AF_TIM9
#define HAPTIC_GPIO_PinSource GPIO_PinSource2
#elif defined(PCBX10)
#define HAPTIC_RCC_AHB1Periph RCC_AHB1Periph_GPIOB
#define HAPTIC_RCC_APB2Periph RCC_APB2ENR_TIM8EN
#define HAPTIC_GPIO GPIOB
#define HAPTIC_GPIO_PIN GPIO_Pin_0 // PB.00
#define HAPTIC_GPIO_TIMER TIM8
#define HAPTIC_GPIO_AF GPIO_AF_TIM8
#define HAPTIC_GPIO_PinSource GPIO_PinSource0
#define HAPTIC_RCC_AHB1Periph RCC_AHB1Periph_GPIOE
#define HAPTIC_RCC_APB2Periph RCC_APB2ENR_TIM9EN
#define HAPTIC_GPIO GPIOE
#define HAPTIC_GPIO_PIN GPIO_Pin_6 // PE.06
#define HAPTIC_GPIO_TIMER TIM9
#define HAPTIC_GPIO_AF GPIO_AF_TIM9
#define HAPTIC_GPIO_PinSource GPIO_PinSource6
#endif
// Internal Module
@ -498,6 +502,13 @@
#define INTMODULE_DMA_STREAM_IRQHandler DMA2_Stream7_IRQHandler
#define INTMODULE_DMA_FLAG_TC DMA_IT_TCIF7
#define INTMODULE_DMA_CHANNEL DMA_Channel_4
#if defined(PCBX12S)
#define INTMODULE_BOOT_GPIO GPIOI
#define INTMODULE_BOOT_GPIO_PIN GPIO_PIN_9 // PC.02
#elif defined(PCBX10)
#define INTMODULE_BOOT_GPIO GPIOI
#define INTMODULE_BOOT_GPIO_PIN GPIO_PIN_9 // PI.09
#endif
#if PCBREV >= 13
#define INTMODULE_RCC_APB1Periph RCC_APB1Periph_TIM2
#define INTMODULE_RCC_APB2Periph RCC_APB2Periph_USART1
@ -553,6 +564,11 @@
#define EXTMODULE_DMA_FLAG_TC DMA_IT_TCIF7
#endif
// Heartbeat (not used)
#define HEARTBEAT_RCC_AHB1Periph RCC_AHB1Periph_GPIOD
#define HEARTBEAT_GPIO GPIOD
#define HEARTBEAT_GPIO_PIN GPIO_Pin_12 // PD.12
// Trainer Port
#define TRAINER_RCC_AHB1Periph (RCC_AHB1Periph_GPIOB | RCC_AHB1Periph_GPIOC | RCC_AHB1Periph_DMA1)
#define TRAINER_RCC_APB1Periph RCC_APB1Periph_TIM3
@ -586,7 +602,6 @@
#define TIMER_2MHz_TIMER TIM7
// Bluetooth
#if defined(PCBX12S)
#define BT_RCC_APB2Periph RCC_APB2Periph_USART6
#define BT_USART USART6
#define BT_GPIO_AF GPIO_AF_USART6
@ -594,6 +609,10 @@
#define BT_GPIO_TXRX GPIOG
#define BT_TX_GPIO_PIN GPIO_Pin_14 // PG.14
#define BT_RX_GPIO_PIN GPIO_Pin_9 // PG.09
#define BT_TX_GPIO_PinSource GPIO_PinSource14
#define BT_RX_GPIO_PinSource GPIO_PinSource9
#define BT_USART_IRQHandler USART6_IRQHandler
#if defined(PCBX12S)
#if PCBREV >= 13
#define BT_RCC_AHB1Periph (RCC_AHB1Periph_GPIOI | RCC_AHB1Periph_GPIOG)
#define BT_EN_GPIO GPIOI
@ -607,11 +626,14 @@
#define BT_BRTS_GPIO_PIN GPIO_Pin_10 // PG.10
#define BT_BCTS_GPIO GPIOG
#define BT_BCTS_GPIO_PIN GPIO_Pin_11 // PG.11
#define BT_TX_GPIO_PinSource GPIO_PinSource14
#define BT_RX_GPIO_PinSource GPIO_PinSource9
#elif defined(PCBX10)
#define BT_RCC_AHB1Periph RCC_AHB1Periph_GPIOG
#define BT_EN_GPIO GPIOG
#define BT_EN_GPIO_PIN GPIO_Pin_10 // PG.10
#endif
// GPS
#if defined(PCBX12S)
#define GPS_RCC_AHB1Periph RCC_AHB1Periph_GPIOA
#define GPS_RCC_APB1Periph RCC_APB1Periph_UART4
#define GPS_USART UART4
@ -623,5 +645,9 @@
#define GPS_RX_GPIO_PIN GPIO_Pin_1 // PA.01
#define GPS_TX_GPIO_PinSource GPIO_PinSource0
#define GPS_RX_GPIO_PinSource GPIO_PinSource1
#else
#define GPS_RCC_AHB1Periph 0
#define GPS_RCC_APB1Periph 0
#endif
#endif // _HAL_H_

View file

@ -28,7 +28,7 @@ void btSetBaudrate(uint32_t index)
void btInit()
{
btSetBaudrate(g_eeGeneral.btBaudrate);
btSetBaudrate(g_eeGeneral.bluetoothBaudrate);
}
OS_FlagID btFlag;
@ -207,7 +207,7 @@ Or maybe just AT and get OK back
uint32_t btStatus;
void btTask(void* pdata)
void bluetoothTask(void * pdata)
{
uint8_t byte;
@ -218,7 +218,7 @@ void btTask(void* pdata)
// Already initialised to g_eeGeneral.bt_baudrate
// 0 : 115200, 1 : 9600, 2 : 19200
uint32_t x = g_eeGeneral.btBaudrate;
uint32_t x = g_eeGeneral.bluetoothBaudrate;
btStatus = btPollDevice() ; // Do we get a response?
@ -236,8 +236,8 @@ void btTask(void* pdata)
if (btStatus) {
btStatus = x + 1 ;
if ( x != g_eeGeneral.btBaudrate ) {
x = g_eeGeneral.btBaudrate ;
if ( x != g_eeGeneral.bluetoothBaudrate ) {
x = g_eeGeneral.bluetoothBaudrate ;
// Need to change Bt Baudrate
btChangeBaudrate( x ) ;
btStatus += (x+1) * 10 ;

View file

@ -369,7 +369,7 @@ void hapticOn(uint32_t pwmPercent);
// BlueTooth driver
#if defined(BLUETOOTH)
void btInit();
void btTask(void* pdata);
void bluetoothTask(void * pdata);
void btPushByte(uint8_t data);
#endif

View file

@ -11,14 +11,12 @@ if(PCB STREQUAL X9E)
set(HAPTIC YES)
set(LUA_EXPORT lua_export_x9e)
set(FLAVOUR x9e)
add_definitions(-DSTM32F40_41xxx -DPCBX9E)
add_definitions(-DSTM32F40_41xxx -DPCBX9E -DPCBX9)
add_definitions(-DEEPROM_VARIANT=0x8000)
add_definitions(-DBLUETOOTH)
add_definitions(-DPWR_BUTTON_${PWR_BUTTON})
set(FIRMWARE_TARGET_SRC
${FIRMWARE_TARGET_SRC}
top_lcd_driver.cpp
bluetooth_driver.cpp
startup_stm32f40_41xxx.s
)
set(SERIAL2_DRIVER ../common/arm/stm32/serial2_driver.cpp)
@ -36,7 +34,7 @@ elseif(PCB STREQUAL X9D+)
set(HAPTIC YES)
set(LUA_EXPORT lua_export_x9d)
set(FLAVOUR x9d+)
add_definitions(-DPCBX9DP)
add_definitions(-DPCBX9DP -DPCBX9)
add_definitions(-DEEPROM_VARIANT=0)
set(GUI_DIR 212x64)
set(BITMAPS_TARGET taranis_bitmaps)
@ -50,33 +48,46 @@ elseif(PCB STREQUAL X9D)
option(HAPTIC "Haptic support" OFF)
set(LUA_EXPORT lua_export_x9d)
set(FLAVOUR x9d)
add_definitions(-DPCBX9D)
add_definitions(-DPCBX9D -DPCBX9)
add_definitions(-DEEPROM_VARIANT=0)
set(GUI_DIR 212x64)
set(BITMAPS_TARGET taranis_bitmaps)
set(LCD_DRIVER lcd_driver_aspi.cpp)
set(SERIAL2_DRIVER ../common/arm/stm32/serial2_driver.cpp)
set(GVAR_SCREEN model_gvars.cpp)
elseif(PCB STREQUAL X7)
elseif(PCB STREQUAL X7 OR PCB STREQUAL X7S)
set(PWR_BUTTON "PRESS" CACHE STRING "Pwr button type (PRESS/SWITCH)")
set(CPU_TYPE STM32F2)
set(CPU_TYPE_FULL STM32F205xE) # for size report
set(LINKER_SCRIPT targets/taranis/stm32f2_flash.ld)
set(HAPTIC YES)
set(LUA_EXPORT lua_export_x7)
if(PCB STREQUAL X7S)
add_definitions(-DPCBX7S)
set(FLAVOUR x7s)
else()
set(FLAVOUR x7)
endif()
add_definitions(-DPCBX7 -DSOFTWARE_VOLUME)
add_definitions(-DEEPROM_VARIANT=0x4000)
add_definitions(-DPWR_BUTTON_${PWR_BUTTON})
set(FIRMWARE_TARGET_SRC
${FIRMWARE_TARGET_SRC}
bluetooth_driver.cpp
)
set(GUI_DIR 128x64)
set(BITMAPS_TARGET 9x_bitmaps)
set(LCD_DRIVER lcd_driver_spi.cpp)
endif()
if(PCB STREQUAL X9E OR PCB STREQUAL X7S)
add_definitions(-DBLUETOOTH)
set(TARGET_SRC
${TARGET_SRC}
../common/arm/stm32/bluetooth_driver.cpp
)
set(SRC
${SRC}
bluetooth.cpp
)
endif()
set(HSE_VALUE 12000000)
set(SDCARD YES)
set(EEPROM EEPROM_RLC)
@ -104,7 +115,7 @@ set(GUI_SRC ${GUI_SRC}
../screenshot.cpp
)
if(PCB STREQUAL X7)
if(PCB STREQUAL X7 OR PCB STREQUAL X7S)
set(LED_DRIVER led_driver.cpp)
endif()

View file

@ -146,9 +146,9 @@ void sportUpdatePowerOff()
void boardInit()
{
#if !defined(SIMU)
RCC_AHB1PeriphClockCmd(PWR_RCC_AHB1Periph | PCBREV_RCC_AHB1Periph | KEYS_RCC_AHB1Periph | LCD_RCC_AHB1Periph | AUDIO_RCC_AHB1Periph | BACKLIGHT_RCC_AHB1Periph | ADC_RCC_AHB1Periph | I2C_RCC_AHB1Periph | SD_RCC_AHB1Periph | HAPTIC_RCC_AHB1Periph | INTMODULE_RCC_AHB1Periph | EXTMODULE_RCC_AHB1Periph | TELEMETRY_RCC_AHB1Periph | SPORT_UPDATE_RCC_AHB1Periph | SERIAL_RCC_AHB1Periph | TRAINER_RCC_AHB1Periph | HEARTBEAT_RCC_AHB1Periph, ENABLE);
RCC_APB1PeriphClockCmd(LCD_RCC_APB1Periph | AUDIO_RCC_APB1Periph | BACKLIGHT_RCC_APB1Periph | INTERRUPT_5MS_APB1Periph | TIMER_2MHz_APB1Periph | I2C_RCC_APB1Periph | SD_RCC_APB1Periph | TRAINER_RCC_APB1Periph | TELEMETRY_RCC_APB1Periph | SERIAL_RCC_APB1Periph, ENABLE);
RCC_APB2PeriphClockCmd(BACKLIGHT_RCC_APB2Periph | ADC_RCC_APB2Periph | HAPTIC_RCC_APB2Periph | INTMODULE_RCC_APB2Periph | EXTMODULE_RCC_APB2Periph | HEARTBEAT_RCC_APB2Periph, ENABLE);
RCC_AHB1PeriphClockCmd(PWR_RCC_AHB1Periph | PCBREV_RCC_AHB1Periph | KEYS_RCC_AHB1Periph | LCD_RCC_AHB1Periph | AUDIO_RCC_AHB1Periph | BACKLIGHT_RCC_AHB1Periph | ADC_RCC_AHB1Periph | I2C_RCC_AHB1Periph | SD_RCC_AHB1Periph | HAPTIC_RCC_AHB1Periph | INTMODULE_RCC_AHB1Periph | EXTMODULE_RCC_AHB1Periph | TELEMETRY_RCC_AHB1Periph | SPORT_UPDATE_RCC_AHB1Periph | SERIAL_RCC_AHB1Periph | TRAINER_RCC_AHB1Periph | HEARTBEAT_RCC_AHB1Periph | BT_RCC_AHB1Periph, ENABLE);
RCC_APB1PeriphClockCmd(LCD_RCC_APB1Periph | AUDIO_RCC_APB1Periph | BACKLIGHT_RCC_APB1Periph | INTERRUPT_5MS_APB1Periph | TIMER_2MHz_APB1Periph | I2C_RCC_APB1Periph | SD_RCC_APB1Periph | TRAINER_RCC_APB1Periph | TELEMETRY_RCC_APB1Periph | SERIAL_RCC_APB1Periph | BT_RCC_APB1Periph, ENABLE);
RCC_APB2PeriphClockCmd(BACKLIGHT_RCC_APB2Periph | ADC_RCC_APB2Periph | HAPTIC_RCC_APB2Periph | INTMODULE_RCC_APB2Periph | EXTMODULE_RCC_APB2Periph | HEARTBEAT_RCC_APB2Periph | BT_RCC_APB2Periph, ENABLE);
#if !defined(PCBX9E)
// some X9E boards need that the pwrInit() is moved a little bit later
@ -180,7 +180,7 @@ void boardInit()
hapticInit();
#endif
#if defined(PCBX9E) || defined(PCBX7)
#if defined(BLUETOOTH)
bluetoothInit(BLUETOOTH_DEFAULT_BAUDRATE);
#endif
@ -298,7 +298,7 @@ void checkTrainerSettings()
case TRAINER_MODE_MASTER_SBUS_EXTERNAL_MODULE:
stop_sbus_on_heartbeat_capture() ;
break;
#if defined(SERIAL2)
#if !defined(PCBX7) && !defined(PCBX9E)
case TRAINER_MODE_MASTER_BATTERY_COMPARTMENT:
serial2Stop();
#endif
@ -315,7 +315,7 @@ void checkTrainerSettings()
case TRAINER_MODE_MASTER_SBUS_EXTERNAL_MODULE:
init_sbus_on_heartbeat_capture() ;
break;
#if defined(SERIAL2)
#if !defined(PCBX7) && !defined(PCBX9E)
case TRAINER_MODE_MASTER_BATTERY_COMPARTMENT:
if (g_eeGeneral.serial2Mode == UART_MODE_SBUS_TRAINER) {
serial2SbusInit();

View file

@ -549,13 +549,8 @@ void serial2Stop(void);
// BT driver
#define BLUETOOTH_DEFAULT_BAUDRATE 115200
#define BLUETOOTH_FACTORY_BAUDRATE 9600
uint8_t bluetoothReady(void);
void bluetoothInit(uint32_t baudrate);
void bluetoothWrite(const void * buffer, int len);
void bluetoothWriteString(const char * str);
int bluetoothRead(void * buffer, int len);
void bluetoothWakeup(void);
void bluetoothWriteWakeup(void);
void bluetoothDone(void);
// LED driver

View file

@ -790,7 +790,9 @@
#define BT_USART USART6
#define BT_GPIO_AF GPIO_AF_USART6
#define BT_USART_IRQn USART6_IRQn
#define BT_RCC_AHB1Periph (RCC_AHB1Periph_GPIOG | RCC_AHB1Periph_GPIOD | RCC_AHB1Periph_GPIOB)
#define BT_RCC_AHB1Periph (RCC_AHB1Periph_GPIOD | RCC_AHB1Periph_GPIOE | RCC_AHB1Periph_GPIOG)
#define BT_RCC_APB1Periph 0
#define BT_RCC_APB2Periph RCC_APB2Periph_USART6
#define BT_GPIO_TXRX GPIOG
#define BT_TX_GPIO_PIN GPIO_Pin_14 // PG.14
#define BT_RX_GPIO_PIN GPIO_Pin_9 // PG.09
@ -802,9 +804,11 @@
#define BT_BCTS_GPIO_PIN GPIO_Pin_6 // PG.06
#define BT_TX_GPIO_PinSource GPIO_PinSource14
#define BT_RX_GPIO_PinSource GPIO_PinSource9
#define BT_USART_IRQHandler USART6_IRQHandler
#elif defined(PCBX7)
#define BT_RCC_AHB1Periph (RCC_AHB1Periph_GPIOB | RCC_AHB1Periph_GPIOE | RCC_AHB1Periph_DMA1)
#define BT_RCC_APB1Periph RCC_APB1Periph_USART3
#define BT_RCC_APB2Periph 0
#define BT_EN_GPIO GPIOE
#define BT_EN_GPIO_PIN GPIO_Pin_12 // PE.12
#define BT_GPIO_TXRX GPIOB
@ -818,6 +822,10 @@
#define BT_USART_IRQn USART3_IRQn
#define BT_DMA_Stream_RX DMA1_Stream1
#define BT_DMA_Channel_RX DMA_Channel_4
#else
#define BT_RCC_AHB1Periph 0
#define BT_RCC_APB1Periph 0
#define BT_RCC_APB2Periph 0
#endif
// 5ms Interrupt

View file

@ -265,7 +265,7 @@ int sbusGetByte(uint8_t * byte)
switch (currentTrainerMode) {
case TRAINER_MODE_MASTER_SBUS_EXTERNAL_MODULE:
return heartbeatFifo.pop(*byte);
#if defined(SERIAL2)
#if !defined(PCBX7) && !defined(PCBX9E)
case TRAINER_MODE_MASTER_BATTERY_COMPARTMENT:
return serial2RxFifo.pop(*byte);
#endif

View file

@ -30,11 +30,6 @@ TaskStack<MIXER_STACK_SIZE> mixerStack;
OS_TID audioTaskId;
TaskStack<AUDIO_STACK_SIZE> audioStack;
#if defined(BLUETOOTH)
OS_TID btTaskId;
TaskStack<BLUETOOTH_STACK_SIZE> bluetoothStack;
#endif
OS_MutexID audioMutex;
OS_MutexID mixerMutex;
@ -185,6 +180,10 @@ void mixerTask(void * pdata)
DEBUG_TIMER_STOP(debugTimerTelemetryWakeup);
#endif
#if defined(BLUETOOTH)
bluetoothWakeup();
#endif
if (heartbeat == HEART_WDT_CHECK) {
wdt_reset();
heartbeat = 0;
@ -266,8 +265,6 @@ void menusTask(void * pdata)
boardOff(); // Only turn power off if necessary
}
extern void audioTask(void* pdata);
void tasksStart()
{
CoInitOS();
@ -276,16 +273,14 @@ void tasksStart()
cliStart();
#endif
#if defined(BLUETOOTH) && defined(PCBSKY9X)
btTaskId = CoCreateTask(btTask, NULL, 15, &bluetoothStack.stack[BLUETOOTH_STACK_SIZE-1], BLUETOOTH_STACK_SIZE);
#endif
mixerTaskId = CoCreateTask(mixerTask, NULL, 5, &mixerStack.stack[MIXER_STACK_SIZE-1], MIXER_STACK_SIZE);
menusTaskId = CoCreateTask(menusTask, NULL, 10, &menusStack.stack[MENUS_STACK_SIZE-1], MENUS_STACK_SIZE);
#if !defined(SIMU)
// TODO move the SIMU audio in this task
audioTaskId = CoCreateTask(audioTask, NULL, 7, &audioStack.stack[AUDIO_STACK_SIZE-1], AUDIO_STACK_SIZE);
#endif
audioMutex = CoCreateMutex();
mixerMutex = CoCreateMutex();

View file

@ -71,11 +71,6 @@ extern TaskStack<MIXER_STACK_SIZE> mixerStack;
extern OS_TID audioTaskId;
extern TaskStack<AUDIO_STACK_SIZE> audioStack;
#if defined(BLUETOOTH)
extern OS_TID btTaskId;
extern TaskStack<BLUETOOTH_STACK_SIZE> bluetoothStack;
#endif
void tasksStart();
#endif // _TASKS_ARM_H_

View file

@ -36,18 +36,6 @@ extern uint8_t TrotCount;
extern uint8_t TezRotary;
#endif
// Receive buffer state machine state enum
enum FrSkyDataState {
STATE_DATA_IDLE,
STATE_DATA_START,
STATE_DATA_IN_FRAME,
STATE_DATA_XOR,
#if defined(TELEMETREZ)
STATE_DATA_PRIVATE_LEN,
STATE_DATA_PRIVATE_VALUE
#endif
};
NOINLINE void processFrskyTelemetryData(uint8_t data)
{
static uint8_t dataState = STATE_DATA_IDLE;
@ -63,16 +51,9 @@ NOINLINE void processFrskyTelemetryData(uint8_t data)
}
#endif
#if defined(PCBX9E) && !defined(SIMU) && !defined(BLUETOOTH_CLI_PASSTHROUGH)
#define BLUETOOTH_BUFFER_LENGTH 20
static uint8_t bluetoothBuffer[BLUETOOTH_BUFFER_LENGTH];
static uint8_t bluetoothIndex = 0;
bluetoothBuffer[bluetoothIndex++] = data;
if (bluetoothIndex == BLUETOOTH_BUFFER_LENGTH) {
if (bluetoothReady()) {
bluetoothWrite(bluetoothBuffer, BLUETOOTH_BUFFER_LENGTH);
}
bluetoothIndex = 0;
#if defined(BLUETOOTH)
if (g_eeGeneral.bluetoothMode == BLUETOOTH_TELEMETRY) {
bluetoothForwardTelemetry(data);
}
#endif

View file

@ -24,6 +24,18 @@
#include "../definitions.h"
#include "telemetry_holders.h"
// Receive buffer state machine state enum
enum FrSkyDataState {
STATE_DATA_IDLE,
STATE_DATA_START,
STATE_DATA_IN_FRAME,
STATE_DATA_XOR,
#if defined(TELEMETREZ)
STATE_DATA_PRIVATE_LEN,
STATE_DATA_PRIVATE_VALUE
#endif
};
#define FRSKY_SPORT_BAUDRATE 57600
#define FRSKY_D_BAUDRATE 9600

View file

@ -119,6 +119,9 @@ const pm_char STR_OPEN9X[] PROGMEM =
ISTR(VFORMULAS)
ISTR(VPREC)
ISTR(VCELLINDEX)
#if defined(BLUETOOTH)
ISTR(BLUETOOTH_MODES)
#endif
ISTR(VANTENNATYPES)
#endif
#if defined(TELEMETRY_MAVLINK)
@ -720,6 +723,10 @@ const pm_char STR_BLCOLOR[] PROGMEM = TR_BLCOLOR;
const pm_char STR_MODULE_RANGE[] PROGMEM = TR_MODULE_RANGE;
#endif
#if defined(BLUETOOTH)
const pm_char STR_BLUETOOTH[] PROGMEM = TR_BLUETOOTH;
#endif
#if defined(TELEMETRY_MAVLINK)
const pm_char STR_MAVLINK_RC_RSSI_SCALE_LABEL[] PROGMEM = TR_MAVLINK_RC_RSSI_SCALE_LABEL;
const pm_char STR_MAVLINK_PC_RSSI_EN_LABEL[] PROGMEM = TR_MAVLINK_PC_RSSI_EN_LABEL;

View file

@ -85,7 +85,11 @@
#endif
#if defined(PCBHORUS)
#define TR_VTRAINERMODES TR_VTRAINER_MASTER_JACK TR_VTRAINER_SLAVE_JACK TR_VTRAINER_MASTER_BATTERY
#define TR_VTRAINERMODES TR_VTRAINER_MASTER_JACK TR_VTRAINER_SLAVE_JACK TR_VTRAINER_MASTER_BATTERY TR_VTRAINER_BLUETOOTH
#elif defined(PCBX9E)
#define TR_VTRAINERMODES TR_VTRAINER_MASTER_JACK TR_VTRAINER_SLAVE_JACK TR_VTRAINER_MASTER_SBUS_MODULE TR_VTRAINER_MASTER_CPPM_MODULE TR_VTRAINER_MASTER_BATTERY TR_VTRAINER_BLUETOOTH
#elif defined(PCBTARANIS) && defined(BLUETOOTH)
#define TR_VTRAINERMODES TR_VTRAINER_MASTER_JACK TR_VTRAINER_SLAVE_JACK TR_VTRAINER_MASTER_SBUS_MODULE TR_VTRAINER_MASTER_CPPM_MODULE TR_VTRAINER_MASTER_BATTERY TR_VTRAINER_BLUETOOTH
#elif defined(PCBTARANIS)
#define TR_VTRAINERMODES TR_VTRAINER_MASTER_JACK TR_VTRAINER_SLAVE_JACK TR_VTRAINER_MASTER_SBUS_MODULE TR_VTRAINER_MASTER_CPPM_MODULE TR_VTRAINER_MASTER_BATTERY
#elif defined(CPUARM)
@ -229,7 +233,12 @@ extern const pm_char STR_OPEN9X[];
#define OFS_VFORMULAS (OFS_VSENSORTYPES + sizeof(TR_VSENSORTYPES))
#define OFS_VPREC (OFS_VFORMULAS + sizeof(TR_VFORMULAS))
#define OFS_VCELLINDEX (OFS_VPREC + sizeof(TR_VPREC))
#if defined(BLUETOOTH)
#define OFS_BLUETOOTH_MODES (OFS_VCELLINDEX + sizeof(TR_VCELLINDEX))
#define OFS_VANTENNATYPES (OFS_BLUETOOTH_MODES + sizeof(TR_BLUETOOTH_MODES))
#else
#define OFS_VANTENNATYPES (OFS_VCELLINDEX + sizeof(TR_VCELLINDEX))
#endif
#define OFS_MAVLINK_BAUDS (OFS_VANTENNATYPES + sizeof(TR_VANTENNATYPES))
#else
#define OFS_MAVLINK_BAUDS (OFS_VTRAINERMODES)
@ -351,6 +360,11 @@ extern const pm_char STR_OPEN9X[];
#define STR_VANTENNATYPES (STR_OPEN9X + OFS_VANTENNATYPES)
#endif
#if defined(BLUETOOTH)
extern const pm_char STR_BLUETOOTH[];
#define STR_BLUETOOTH_MODES (STR_OPEN9X + OFS_BLUETOOTH_MODES)
#endif
#if defined(TELEMETRY_MAVLINK)
#define STR_MAVLINK_BAUDS (STR_OPEN9X + OFS_MAVLINK_BAUDS)
#define STR_MAVLINK_AC_MODES (STR_OPEN9X + OFS_MAVLINK_AC_MODES)

View file

@ -552,6 +552,7 @@
#define TR_VTRAINER_MASTER_SBUS_MODULE "Učitel/SBUS Modul\0"
#define TR_VTRAINER_MASTER_CPPM_MODULE "Učitel/CPPM Modul\0"
#define TR_VTRAINER_MASTER_BATTERY "Učitel/Bat. slot\0 "
#define TR_VTRAINER_BLUETOOTH TR("Master/BT\0 ""Slave/BT\0", "Master/Bluetooth\0 ""Slave/Bluetooth\0 ")
#define LEN_VFAILSAFE "\012"
#define TR_VFAILSAFE "Nenastaven""Držet\0 ""Vlastní\0 ""Bez pulzů\0""Přijímač\0"
@ -955,7 +956,12 @@
#define TR_FORMATTING "Formátovaní.."
#define TR_TEMP_CALIB " +=\006Teplota"
#define TR_TIME "Čas"
#define TR_BLUETOOTH "Bluetooth"
#define TR_BAUDRATE "BT Baudrate"
#define LEN_BLUETOOTH_MODES "\011"
#define TR_BLUETOOTH_MODES "---\0 ""Telemetry""Trainer\0"
#define TR_SD_INFO_TITLE "SD INFO"
#define TR_SD_TYPE "Typ:"
#define TR_SD_SPEED "Rychlost:"

View file

@ -577,6 +577,7 @@
#define TR_VTRAINER_MASTER_SBUS_MODULE "Lehrer/SBUS Modul\0"
#define TR_VTRAINER_MASTER_CPPM_MODULE "Lehrer/CPPM Modul\0"
#define TR_VTRAINER_MASTER_BATTERY "Lehrer/Batterie\0 "
#define TR_VTRAINER_BLUETOOTH TR("Master/BT\0 ""Slave/BT\0", "Master/Bluetooth\0 ""Slave/Bluetooth\0 ")
#define LEN_VFAILSAFE "\015" // "\013" original
#define TR_VFAILSAFE "Kein Failsafe""Halte Pos.\0 ""Kanäle\0 ""Kein Signal\0 ""Empfänger\0 "
@ -976,7 +977,13 @@
#define TR_FORMATTING "Formatierung..."
#define TR_TEMP_CALIB "Temp. abgl."
#define TR_TIME "Uhrzeit:"
#define TR_BLUETOOTH "Bluetooth"
#define TR_BAUDRATE "BT Baudrate"
#define LEN_BLUETOOTH_MODES "\011"
#define TR_BLUETOOTH_MODES "---\0 ""Telemetry""Trainer\0"
#define TR_SD_INFO_TITLE "SD-INFO"
#define TR_SD_TYPE "Typ:"
#define TR_SD_SPEED "Geschw:"

View file

@ -560,6 +560,7 @@
#define TR_VTRAINER_MASTER_SBUS_MODULE "Master/SBUS Module"
#define TR_VTRAINER_MASTER_CPPM_MODULE "Master/CPPM Module"
#define TR_VTRAINER_MASTER_BATTERY "Master/Battery\0 "
#define TR_VTRAINER_BLUETOOTH TR("Master/BT\0 ""Slave/BT\0", "Master/Bluetooth\0 ""Slave/Bluetooth\0 ")
#define LEN_VFAILSAFE "\011"
#define TR_VFAILSAFE "Not set\0 ""Hold\0 ""Custom\0 ""No pulses""Receiver\0"
@ -959,7 +960,12 @@
#define TR_FORMATTING "Formatting..."
#define TR_TEMP_CALIB "Temp. Calib"
#define TR_TIME "Time"
#define TR_BLUETOOTH "Bluetooth"
#define TR_BAUDRATE "BT Baudrate"
#define LEN_BLUETOOTH_MODES "\011"
#define TR_BLUETOOTH_MODES "---\0 ""Telemetry""Trainer\0"
#define TR_SD_INFO_TITLE "SD INFO"
#define TR_SD_TYPE "Type:"
#define TR_SD_SPEED "Speed:"
@ -1022,7 +1028,7 @@
#define TR_MODULE_RANGE BUTTON(TR("Rng", "Range"))
#define TR_RESET_BTN BUTTON("Reset")
#define TR_SET BUTTON("Set")
#define TR_TRAINER "Trainer port"
#define TR_TRAINER "Trainer"
#define TR_ANTENNAPROBLEM CENTER "TX antenna problem!"
#define TR_MODELIDUSED TR("ID already used", "Model ID already used")
#define TR_MODULE INDENT "Module"

View file

@ -548,6 +548,7 @@
#define TR_VTRAINER_MASTER_SBUS_MODULE "Master/SBUS Module"
#define TR_VTRAINER_MASTER_CPPM_MODULE "Master/CPPM Module"
#define TR_VTRAINER_MASTER_BATTERY "Master/Battery\0 "
#define TR_VTRAINER_BLUETOOTH TR("Master/BT\0 ""Slave/BT\0", "Master/Bluetooth\0 ""Slave/Bluetooth\0 ")
#define LEN_VFAILSAFE "\011"
#define TR_VFAILSAFE "Not set\0 ""Guardar\0 ""Adaptar\0 ""Sin pulso""Receiver\0"
@ -935,7 +936,12 @@
#define TR_FORMATTING "Formateando.."
#define TR_TEMP_CALIB "Temp. Calib"
#define TR_TIME "Hora"
#define TR_BLUETOOTH "Bluetooth"
#define TR_BAUDRATE "BT Baudrate"
#define LEN_BLUETOOTH_MODES "\011"
#define TR_BLUETOOTH_MODES "---\0 ""Telemetry""Trainer\0"
#define TR_SD_INFO_TITLE "SD INFO"
#define TR_SD_TYPE "Tipo:"
#define TR_SD_SPEED "Velocidad:"

View file

@ -552,6 +552,7 @@
#define TR_VTRAINER_MASTER_SBUS_MODULE "Master/SBUS Module"
#define TR_VTRAINER_MASTER_CPPM_MODULE "Master/CPPM Module"
#define TR_VTRAINER_MASTER_BATTERY "Master/Battery\0 "
#define TR_VTRAINER_BLUETOOTH TR("Master/BT\0 ""Slave/BT\0", "Master/Bluetooth\0 ""Slave/Bluetooth\0 ")
#define LEN_VFAILSAFE "\011"
#define TR_VFAILSAFE "Not set\0 ""Hold\0 ""Custom\0 ""No pulses""Receiver\0"
@ -931,7 +932,12 @@
#define TR_FORMATTING "Formatting..."
#define TR_TEMP_CALIB "Temp. Calib"
#define TR_TIME "Time"
#define TR_BLUETOOTH "Bluetooth"
#define TR_BAUDRATE "BT Baudrate"
#define LEN_BLUETOOTH_MODES "\011"
#define TR_BLUETOOTH_MODES "---\0 ""Telemetry""Trainer\0"
#define TR_SD_INFO_TITLE "SD INFO"
#define TR_SD_TYPE "Type:"
#define TR_SD_SPEED "Speed:"

View file

@ -565,6 +565,7 @@
#define TR_VTRAINER_MASTER_SBUS_MODULE "Maître/SBUS Module"
#define TR_VTRAINER_MASTER_CPPM_MODULE "Maître/CPPM Module"
#define TR_VTRAINER_MASTER_BATTERY "Maître/Batterie\0 "
#define TR_VTRAINER_BLUETOOTH TR("Maître/BT\0 ""Elève/BT\0", "Maître/Bluetooth\0 ""Elève/Bluetooth\0 ")
#define LEN_VFAILSAFE "\011"
#define TR_VFAILSAFE TR("Pas déf.\0""Maintien\0""Prédéf.\0 ""Pas d'imp""Récepteur", "Pas déf.\0""Maintien\0""Prédéfini""Pas d'imp""Récepteur")
@ -932,7 +933,7 @@
#define TR_WRONG_PCBREV "PCB incorrect détecté"
#define TR_EMERGENCY_MODE "MODE SECOURS"
#define TR_PCBREV_ERROR "Erreur PCB"
#define TR_NO_FAILSAFE "Failsafe pas déf."
#define TR_NO_FAILSAFE TR3("Failsafe pas déf.", "Failsafe pas déf.", "Failsafe pas défini")
#define TR_KEYSTUCK "Touche bloquée"
#define TR_INVERT_THR "Inverser gaz?"
#define TR_SPEAKER_VOLUME INDENT "Volume"
@ -974,7 +975,10 @@
#define TR_FORMATTING "Formatage..."
#define TR_TEMP_CALIB "Calib. temp"
#define TR_TIME "Heure"
#define TR_BLUETOOTH "Bluetooth"
#define TR_BAUDRATE "Baudrate BT"
#define LEN_BLUETOOTH_MODES "\012"
#define TR_BLUETOOTH_MODES "---\0 ""Télémétrie""Ecolage\0"
#define TR_SD_INFO_TITLE "INFO SD"
#define TR_SD_TYPE "Type:"
#define TR_SD_SPEED "Vitesse:"

View file

@ -559,6 +559,7 @@
#define TR_VTRAINER_MASTER_SBUS_MODULE "Master/Modulo SBUS"
#define TR_VTRAINER_MASTER_CPPM_MODULE "Master/Modulo CPPM"
#define TR_VTRAINER_MASTER_BATTERY "Master/Batteria\0 "
#define TR_VTRAINER_BLUETOOTH TR("Master/BT\0 ""Slave/BT\0", "Master/Bluetooth\0 ""Slave/Bluetooth\0 ")
#define LEN_VFAILSAFE "\013"
#define TR_VFAILSAFE "Non settato""Mantieni\0 ""Personali\0 ""No impulsi\0""Ricevente\0 "
@ -960,7 +961,12 @@
#define TR_FORMATTING "Formattazione."
#define TR_TEMP_CALIB "Temp. Calib"
#define TR_TIME "Ora"
#define TR_BLUETOOTH "Bluetooth"
#define TR_BAUDRATE "BT Baudrate"
#define LEN_BLUETOOTH_MODES "\011"
#define TR_BLUETOOTH_MODES "---\0 ""Telemetry""Trainer\0"
#define TR_SD_INFO_TITLE "SD INFO"
#define TR_SD_TYPE "Tipo:"
#define TR_SD_SPEED "Veloc.:"

View file

@ -548,6 +548,7 @@
#define TR_VTRAINER_MASTER_SBUS_MODULE "Master/SBUS Module"
#define TR_VTRAINER_MASTER_CPPM_MODULE "Master/CPPM Module"
#define TR_VTRAINER_MASTER_BATTERY "Master/Battery\0 "
#define TR_VTRAINER_BLUETOOTH TR("Master/BT\0 ""Slave/BT\0", "Master/Bluetooth\0 ""Slave/Bluetooth\0 ")
#define LEN_VFAILSAFE TR("\013","\011")
#define TR_VFAILSAFE TR("Niet Gezet\0""Vasthouden\0""Custom\0 ""Geen Pulsen""Ontvanger\0 ","Not Set\0 ""Hold\0 ""Custom\0 ""No Pulses""Receiver\0")
@ -955,7 +956,12 @@
#define TR_FORMATTING "Formatteren..."
#define TR_TEMP_CALIB "Temp. Calib."
#define TR_TIME "Tijd:"
#define TR_BLUETOOTH "Bluetooth"
#define TR_BAUDRATE "BT Baudrate"
#define LEN_BLUETOOTH_MODES "\011"
#define TR_BLUETOOTH_MODES "---\0 ""Telemetry""Trainer\0"
#define TR_SD_INFO_TITLE "SD-INFO"
#define TR_SD_TYPE "Type:"
#define TR_SD_SPEED "Snelheid:"

View file

@ -561,6 +561,7 @@
#define TR_VTRAINER_MASTER_SBUS_MODULE "Trener/SBUS Moduł "
#define TR_VTRAINER_MASTER_CPPM_MODULE "Trener/CPPM Moduł "
#define TR_VTRAINER_MASTER_BATTERY "Trener/Bateria\0 "
#define TR_VTRAINER_BLUETOOTH TR("Master/BT\0 ""Slave/BT\0", "Master/Bluetooth\0 ""Slave/Bluetooth\0 ")
#define LEN_VFAILSAFE "\011" /*9 decimal*/
#define TR_VFAILSAFE "Brak \0 ""Utrzymuj\0""Własne \0""0 sygnału""Odbiornik"
@ -961,7 +962,13 @@
#define TR_FORMATTING "Formatowanie.."
#define TR_TEMP_CALIB "Temp. kalibracji"
#define TR_TIME "Czas"
#define TR_BLUETOOTH "Bluetooth"
#define TR_BAUDRATE "Prędkość BT"
#define LEN_BLUETOOTH_MODES "\011"
#define TR_BLUETOOTH_MODES "---\0 ""Telemetry""Trainer\0"
#define TR_SD_INFO_TITLE "SD INFO"
#define TR_SD_TYPE "Typ:"
#define TR_SD_SPEED "Prędkość:"

View file

@ -549,6 +549,7 @@
#define TR_VTRAINER_MASTER_SBUS_MODULE "Master/SBUS Module"
#define TR_VTRAINER_MASTER_CPPM_MODULE "Master/CPPM Module"
#define TR_VTRAINER_MASTER_BATTERY "Master/Battery\0 "
#define TR_VTRAINER_BLUETOOTH TR("Master/BT\0 ""Slave/BT\0", "Master/Bluetooth\0 ""Slave/Bluetooth\0 ")
#define LEN_VFAILSAFE "\011"
#define TR_VFAILSAFE "Not set\0 ""Hold\0 ""Custom\0 ""No pulses""Receiver\0"
@ -936,7 +937,12 @@
#define TR_FORMATTING "Formatando..."
#define TR_TEMP_CALIB "Temp. Calib"
#define TR_TIME "Time"
#define TR_BLUETOOTH "Bluetooth"
#define TR_BAUDRATE "BT Baudrate"
#define LEN_BLUETOOTH_MODES "\011"
#define TR_BLUETOOTH_MODES "---\0 ""Telemetry""Trainer\0"
#define TR_SD_INFO_TITLE "SD INFO"
#define TR_SD_TYPE "Tipe"
#define TR_SD_SPEED "Velocidade"

View file

@ -570,6 +570,7 @@
#define TR_VTRAINER_MASTER_SBUS_MODULE "Lärare/SBUS-Modul\0"
#define TR_VTRAINER_MASTER_CPPM_MODULE "Lärare/CPPM-Modul\0"
#define TR_VTRAINER_MASTER_BATTERY "Lärare/Batteri\0 "
#define TR_VTRAINER_BLUETOOTH TR("Master/BT\0 ""Slave/BT\0", "Master/Bluetooth\0 ""Slave/Bluetooth\0 ")
#define LEN_VFAILSAFE "\011"
#define TR_VFAILSAFE "Ej givet\0""Lås Servo""Anpassat\0""Pulsfritt""Mottagare"
@ -974,7 +975,12 @@
#define TR_FORMATTING "Formaterar..."
#define TR_TEMP_CALIB "Temp. kalib."
#define TR_TIME "Tid "
#define TR_BLUETOOTH "Bluetooth"
#define TR_BAUDRATE "BT Baudrate"
#define LEN_BLUETOOTH_MODES "\011"
#define TR_BLUETOOTH_MODES "---\0 ""Telemetry""Trainer\0"
#define TR_SD_INFO_TITLE "SD INFO"
#define TR_SD_TYPE "Typ: "
#define TR_SD_SPEED "Hastighet:"