Skip to content

Commit

Permalink
Reduce RF_PROTO_OFF logic, disable R9M Sport out when internal teleme…
Browse files Browse the repository at this point in the history
…try is on (opentx#5159)

* Remove most of the special logic associated with RF_PROTO_OFF

This simplifies code in many areas since the internal module does not require special handling and also fixes a few bugs with INTERNAL_PPM

* Disable R9M sport option if internal module has telemetry

* Fix X12s build

* Use macros instead of direct comparisions

* Fix sport bit sent the wrong way. Rename S.port out to Telemetry

* Compile fix
  • Loading branch information
schwabe authored and bsongis committed Aug 16, 2017
1 parent 8e84724 commit e16b48d
Show file tree
Hide file tree
Showing 29 changed files with 87 additions and 60 deletions.
8 changes: 3 additions & 5 deletions radio/src/dataconstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -309,14 +309,12 @@ enum BeeperMode {
#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))
#else
#define IS_INTERNAL_MODULE_ENABLED() (g_model.moduleData[INTERNAL_MODULE].rfProtocol != RF_PROTO_OFF)
#endif
#define IS_INTERNAL_MODULE_ENABLED() (g_model.moduleData[INTERNAL_MODULE].type != MODULE_TYPE_NONE)
#elif defined(PCBSKY9X)
#define IS_INTERNAL_MODULE_ENABLED() (false)
#endif
#define IS_EXTERNAL_MODULE_ENABLED() (g_model.moduleData[EXTERNAL_MODULE].type != MODULE_TYPE_NONE)


enum UartModes {
#if defined(CLI) || defined(DEBUG)
Expand Down
19 changes: 11 additions & 8 deletions radio/src/gui/128x64/model_setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,8 @@ enum MenuModelSetupItems {
#else
#define INTERNAL_MODULE_MODE_ROWS (IS_MODULE_XJT(INTERNAL_MODULE) ? (uint8_t)1 : (uint8_t)0) // Module type + RF protocols
#endif
#if defined(TARANIS_INTERNAL_PPM)
#define IF_INTERNAL_MODULE_ON(x) (g_model.moduleData[INTERNAL_MODULE].type == MODULE_TYPE_NONE ? HIDDEN_ROW : (uint8_t)(x))
#else
#define IF_INTERNAL_MODULE_ON(x) (g_model.moduleData[INTERNAL_MODULE].rfProtocol == RF_PROTO_OFF ? HIDDEN_ROW : (uint8_t)(x))
#endif

#define IF_EXTERNAL_MODULE_ON(x) (g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_NONE ? HIDDEN_ROW : (uint8_t)(x))
#define IF_INTERNAL_MODULE_ON(x) (IS_INTERNAL_MODULE_ENABLED()? (uint8_t)(x) : HIDDEN_ROW )
#define IF_EXTERNAL_MODULE_ON(x) (IS_EXTERNAL_MODULE_ENABLED()? (uint8_t)(x) : HIDDEN_ROW)
#define INTERNAL_MODULE_CHANNELS_ROWS IF_INTERNAL_MODULE_ON(1)
#define EXTERNAL_MODULE_BIND_ROWS() (IS_MODULE_XJT(EXTERNAL_MODULE) && IS_D8_RX(EXTERNAL_MODULE)) ? (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

Expand Down Expand Up @@ -684,6 +679,8 @@ void menuModelSetup(event_t event)
g_model.moduleData[0].type = MODULE_TYPE_XJT;
g_model.moduleData[0].channelsStart = 0;
g_model.moduleData[0].channelsCount = DEFAULT_CHANNELS(INTERNAL_MODULE);
if (g_model.moduleData[INTERNAL_MODULE].rfProtocol == RF_PROTO_OFF)
g_model.moduleData[INTERNAL_MODULE].type = MODULE_TYPE_NONE;
}
}
break;
Expand Down Expand Up @@ -1082,7 +1079,13 @@ void menuModelSetup(event_t event)
}
#endif
if (IS_MODULE_R9M(moduleIdx)) {
g_model.moduleData[moduleIdx].pxx.sport_out = editCheckBox(g_model.moduleData[EXTERNAL_MODULE].pxx.sport_out, MODEL_SETUP_2ND_COLUMN, y, STR_SPORT_OUT, attr, event);
if (IS_TELEMETRY_INTERNAL_MODULE) {
lcdDrawTextAlignedLeft(y, STR_SPORT_OUT);
lcdDrawText(MODEL_SETUP_2ND_COLUMN, y, STR_DISABLE_INTERNAL);
}
else {
g_model.moduleData[moduleIdx].pxx.sport_out = editCheckBox(g_model.moduleData[EXTERNAL_MODULE].pxx.sport_out, MODEL_SETUP_2ND_COLUMN, y, STR_SPORT_OUT, attr, event);
}
}
break;
}
Expand Down
2 changes: 1 addition & 1 deletion radio/src/gui/128x64/model_telemetry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ enum MenuModelTelemetryFrskyItems {


#if defined (PCBTARANIS)
#define TELEMETRY_TYPE_SHOW_TELEMETRY (g_model.moduleData[INTERNAL_MODULE].rfProtocol == RF_PROTO_OFF && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM) ? (uint8_t)0 : HIDDEN_ROW
#define TELEMETRY_TYPE_SHOW_TELEMETRY (! IS_INTERNAL_MODULE_ENABLED() && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM) ? (uint8_t)0 : HIDDEN_ROW
#elif defined (CPUARM)
#define TELEMETRY_TYPE_SHOW_TELEMETRY (g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM) ? (uint8_t)0 : HIDDEN_ROW
#endif
Expand Down
18 changes: 13 additions & 5 deletions radio/src/gui/212x64/model_setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,14 +231,13 @@ int getSwitchWarningsCount()
return count;
}

#define IF_INTERNAL_MODULE_ON(x) (IS_INTERNAL_MODULE_ENABLED() ? (uint8_t)(x) : HIDDEN_ROW)
#if defined(TARANIS_INTERNAL_PPM)
#define IF_INTERNAL_MODULE_ON(x) (g_model.moduleData[INTERNAL_MODULE].type == MODULE_TYPE_NONE ? HIDDEN_ROW : (uint8_t)(x))
#define INTERNAL_MODULE_MODE_ROWS (IS_MODULE_XJT(INTERNAL_MODULE) ? (uint8_t)1 : (uint8_t)0) // Module type + RF protocols
#else
#define IF_INTERNAL_MODULE_ON(x) (g_model.moduleData[INTERNAL_MODULE].rfProtocol == RF_PROTO_OFF ? HIDDEN_ROW : (uint8_t)(x))
#define INTERNAL_MODULE_MODE_ROWS 0 // (OFF / RF protocols)
#endif
#define IF_EXTERNAL_MODULE_ON(x) (g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_NONE ? HIDDEN_ROW : (uint8_t)(x))
#define IF_EXTERNAL_MODULE_ON(x) (IS_EXTERNAL_MODULE_ENABLED() ? (uint8_t)(x) : HIDDEN_ROW)
#define INTERNAL_MODULE_CHANNELS_ROWS IF_INTERNAL_MODULE_ON(1)
#define PORT_CHANNELS_ROWS(x) (x==INTERNAL_MODULE ? INTERNAL_MODULE_CHANNELS_ROWS : (x==EXTERNAL_MODULE ? EXTERNAL_MODULE_CHANNELS_ROWS : 1))

Expand Down Expand Up @@ -704,11 +703,14 @@ void menuModelSetup(event_t event)
lcdDrawTextAlignedLeft(y, STR_MODE);
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_XJT_PROTOCOLS, 1+g_model.moduleData[0].rfProtocol, attr);
if (attr) {
g_model.moduleData[INTERNAL_MODULE].rfProtocol = checkIncDec(event, g_model.moduleData[INTERNAL_MODULE].rfProtocol, RF_PROTO_OFF, RF_PROTO_LAST, EE_MODEL, isRfProtocolAvailable);
g_model.moduleData[INTERNAL_MODULE].rfProtocol = checkIncDec(event, g_model.moduleData[INTERNAL_MODULE].rfProtocol, -1, RF_PROTO_LAST, EE_MODEL, isRfProtocolAvailable);

if (checkIncDec_Ret) {
g_model.moduleData[INTERNAL_MODULE].type = MODULE_TYPE_XJT;
g_model.moduleData[INTERNAL_MODULE].channelsStart = 0;
g_model.moduleData[INTERNAL_MODULE].channelsCount = DEFAULT_CHANNELS(INTERNAL_MODULE);
if (g_model.moduleData[INTERNAL_MODULE].rfProtocol == RF_PROTO_OFF)
g_model.moduleData[INTERNAL_MODULE].type = MODULE_TYPE_NONE;
}
}
break;
Expand Down Expand Up @@ -1079,7 +1081,13 @@ void menuModelSetup(event_t event)
}
#endif
if (IS_MODULE_R9M(moduleIdx)) {
g_model.moduleData[moduleIdx].pxx.sport_out = editCheckBox(g_model.moduleData[EXTERNAL_MODULE].pxx.sport_out, MODEL_SETUP_2ND_COLUMN, y, STR_SPORT_OUT, attr, event);
if (IS_TELEMETRY_INTERNAL_MODULE) {
lcdDrawTextAlignedLeft(y, STR_SPORT_OUT);
lcdDrawText(MODEL_SETUP_2ND_COLUMN, y, STR_DISABLE_INTERNAL);
}
else {
g_model.moduleData[moduleIdx].pxx.sport_out = editCheckBox(g_model.moduleData[EXTERNAL_MODULE].pxx.sport_out, MODEL_SETUP_2ND_COLUMN, y, STR_SPORT_OUT, attr, event);
}
}
}
break;
Expand Down
4 changes: 2 additions & 2 deletions radio/src/gui/212x64/model_telemetry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ enum MenuModelTelemetryFrskyItems {
#endif
#define RSSI_ROWS LABEL(RSSI), 0, 0, 0,
#define VARIO_RANGE_ROWS 3
#define TELEMETRY_TYPE_ROWS (g_model.moduleData[INTERNAL_MODULE].rfProtocol == RF_PROTO_OFF && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM) ? (uint8_t)0 : HIDDEN_ROW,
#define TELEMETRY_TYPE_ROWS (!IS_INTERNAL_MODULE_ENABLED() && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM) ? (uint8_t)0 : HIDDEN_ROW,

enum SensorFields {
SENSOR_FIELD_NAME,
Expand Down Expand Up @@ -516,7 +516,7 @@ void menuModelTelemetryFrsky(event_t event)

case ITEM_TELEMETRY_RSSI_LABEL:
#if defined(MULTIMODULE)
if (g_model.moduleData[INTERNAL_MODULE].rfProtocol == RF_PROTO_OFF &&
if (g_model.moduleData[INTERNAL_MODULE].type != MODULE_TYPE_XJT &&
g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_MULTIMODULE &&
g_model.moduleData[EXTERNAL_MODULE].getMultiProtocol(false) == MM_RF_PROTO_FS_AFHDS2A)
lcdDrawTextAlignedLeft(y, PSTR("RSNR"));
Expand Down
14 changes: 11 additions & 3 deletions radio/src/gui/480x272/model_setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ int getSwitchWarningsCount()
return count;
}

#define IF_INTERNAL_MODULE_ON(x) (g_model.moduleData[INTERNAL_MODULE].rfProtocol == RF_PROTO_OFF ? HIDDEN_ROW : (uint8_t)(x))
#define IF_EXTERNAL_MODULE_ON(x) (g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_NONE ? HIDDEN_ROW : (uint8_t)(x))
#define IF_INTERNAL_MODULE_ON(x) (IS_INTERNAL_MODULE_ENABLED() ? (uint8_t)(x) : HIDDEN_ROW)
#define IF_EXTERNAL_MODULE_ON(x) (IS_EXTERNAL_MODULE_ENABLED() ? (uint8_t)(x) : HIDDEN_ROW)

#define INTERNAL_MODULE_MODE_ROWS (uint8_t)0
#define INTERNAL_MODULE_CHANNELS_ROWS IF_INTERNAL_MODULE_ON(1)
Expand Down Expand Up @@ -624,7 +624,10 @@ bool menuModelSetup(event_t event)
g_model.moduleData[0].type = MODULE_TYPE_XJT;
g_model.moduleData[0].channelsStart = 0;
g_model.moduleData[0].channelsCount = DEFAULT_CHANNELS(INTERNAL_MODULE);
if (g_model.moduleData[INTERNAL_MODULE].rfProtocol == RF_PROTO_OFF)
g_model.moduleData[INTERNAL_MODULE].type = MODULE_TYPE_NONE;
}

}
break;

Expand Down Expand Up @@ -978,8 +981,13 @@ bool menuModelSetup(event_t event)
#endif
if (IS_MODULE_R9M(moduleIdx)) {
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_SPORT_OUT);
g_model.moduleData[moduleIdx].pxx.sport_out = editCheckBox(g_model.moduleData[EXTERNAL_MODULE].pxx.sport_out, MODEL_SETUP_2ND_COLUMN, y, attr, event);
if (IS_TELEMETRY_INTERNAL_MODULE) {
lcdDrawText(MODEL_SETUP_2ND_COLUMN, y, STR_DISABLE_INTERNAL);
}
else {
g_model.moduleData[moduleIdx].pxx.sport_out = editCheckBox(g_model.moduleData[EXTERNAL_MODULE].pxx.sport_out, MODEL_SETUP_2ND_COLUMN, y, attr, event);
}
}
}
break;
case ITEM_MODEL_EXTERNAL_MODULE_POWER: {
Expand Down
3 changes: 2 additions & 1 deletion radio/src/gui/gui_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ const mm_protocol_definition *getMultiProtocolDefinition (uint8_t protocol);
#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
#define EXTERNAL_MODULE_OPTION_ROW (IS_MODULE_R9M(EXTERNAL_MODULE) ? (uint8_t) 0 : MULTIMODULE_OPTIONS_ROW)
#define R9M_OPTION_ROW (IS_TELEMETRY_INTERNAL_MODULE ? TITLE_ROW : (uint8_t) 0)
#define EXTERNAL_MODULE_OPTION_ROW (IS_MODULE_R9M(EXTERNAL_MODULE) ? R9M_OPTION_ROW : MULTIMODULE_OPTIONS_ROW)
#define EXTERNAL_MODULE_POWER_ROW (IS_MODULE_MULTIMODULE(EXTERNAL_MODULE) || IS_MODULE_R9M(EXTERNAL_MODULE)) ? (uint8_t) 0 : HIDDEN_ROW

void editStickHardwareSettings(coord_t x, coord_t y, int idx, event_t event, LcdFlags flags);
Expand Down
6 changes: 3 additions & 3 deletions radio/src/gui/gui_common_arm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ bool isSourceAvailableInResetSpecialFunction(int index)
bool isModuleAvailable(int module)
{
#if defined(CROSSFIRE) && !defined(PCBFLAMENCO)
if (module == MODULE_TYPE_CROSSFIRE && g_model.moduleData[INTERNAL_MODULE].rfProtocol != RF_PROTO_OFF) {
if (module == MODULE_TYPE_CROSSFIRE && g_model.moduleData[INTERNAL_MODULE].type != MODULE_TYPE_NONE) {
return false;
}
#else
Expand Down Expand Up @@ -563,7 +563,7 @@ bool isTrainerModeAvailable(int mode)
#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))
if (IS_EXTERNAL_MODULE_ENABLED() && (mode == TRAINER_MODE_MASTER_SBUS_EXTERNAL_MODULE || mode == TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE))
return false;
#if defined(DEBUG)
else if (mode == TRAINER_MODE_MASTER_BLUETOOTH || mode == TRAINER_MODE_MASTER_BATTERY_COMPARTMENT)
Expand All @@ -577,7 +577,7 @@ bool isTrainerModeAvailable(int mode)
#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))
if (IS_EXTERNAL_MODULE_ENABLED() && (mode == TRAINER_MODE_MASTER_SBUS_EXTERNAL_MODULE || mode == TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE))
return false;
else
return true;
Expand Down
4 changes: 1 addition & 3 deletions radio/src/myeeprom.h
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ enum Protocols {
PROTO_NONE
};

enum RFProtocols {
enum XJTRFProtocols {
RF_PROTO_OFF = -1,
RF_PROTO_X16,
RF_PROTO_D8,
Expand Down Expand Up @@ -578,8 +578,6 @@ enum AntennaTypes {
XJT_EXTERNAL_ANTENNA
};

#define IS_EXTERNAL_MODULE_PRESENT() (g_model.moduleData[EXTERNAL_MODULE].type != MODULE_TYPE_NONE)

enum FailsafeModes {
FAILSAFE_NOT_SET,
FAILSAFE_HOLD,
Expand Down
3 changes: 1 addition & 2 deletions radio/src/opentx.h
Original file line number Diff line number Diff line change
Expand Up @@ -404,11 +404,10 @@ void memswap(void * a, void * b, uint8_t size);
#if defined(PCBTARANIS) || defined(PCBHORUS)
#if defined(TARANIS_INTERNAL_PPM)
#define IS_MODULE_PPM(idx) (idx==TRAINER_MODULE || (idx==INTERNAL_MODULE && g_model.moduleData[INTERNAL_MODULE].type==MODULE_TYPE_PPM)|| (idx==EXTERNAL_MODULE && g_model.moduleData[EXTERNAL_MODULE].type==MODULE_TYPE_PPM))
#define IS_MODULE_XJT(idx) (((idx==INTERNAL_MODULE && g_model.moduleData[INTERNAL_MODULE].type==MODULE_TYPE_XJT)|| (idx==EXTERNAL_MODULE && g_model.moduleData[EXTERNAL_MODULE].type==MODULE_TYPE_XJT)) && (g_model.moduleData[idx].rfProtocol != RF_PROTO_OFF))
#else
#define IS_MODULE_PPM(idx) (idx==TRAINER_MODULE || (idx==EXTERNAL_MODULE && g_model.moduleData[EXTERNAL_MODULE].type==MODULE_TYPE_PPM))
#define IS_MODULE_XJT(idx) ((idx==INTERNAL_MODULE || g_model.moduleData[EXTERNAL_MODULE].type==MODULE_TYPE_XJT) && (g_model.moduleData[idx].rfProtocol != RF_PROTO_OFF))
#endif
#define IS_MODULE_XJT(idx) (g_model.moduleData[idx].type==MODULE_TYPE_XJT)
#if defined(DSM2)
#define IS_MODULE_DSM2(idx) (idx==EXTERNAL_MODULE && g_model.moduleData[EXTERNAL_MODULE].type==MODULE_TYPE_DSM2)
#else
Expand Down
6 changes: 2 additions & 4 deletions radio/src/pulses/pulses_arm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,19 @@ uint8_t getRequiredProtocol(uint8_t port)
switch (port) {
#if defined(PCBTARANIS) || defined(PCBHORUS)
case INTERNAL_MODULE:
#if defined(TARANIS_INTERNAL_PPM)
switch (g_model.moduleData[INTERNAL_MODULE].type) {
#if defined(TARANIS_INTERNAL_PPM)
case MODULE_TYPE_PPM:
required_protocol = PROTO_PPM;
break;
#endif
case MODULE_TYPE_XJT:
required_protocol = PROTO_PXX;
break;
default:
required_protocol = PROTO_NONE;
break;
}
#else
required_protocol = g_model.moduleData[INTERNAL_MODULE].rfProtocol == RF_PROTO_OFF ? PROTO_NONE : PROTO_PXX;
#endif
break;
#endif

Expand Down
4 changes: 3 additions & 1 deletion radio/src/pulses/pxx_arm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,9 @@ void setupPulsesPXX(uint8_t port)
#endif
if (IS_MODULE_R9M(port)) {
extra_flags |= g_model.moduleData[port].pxx.power << 3;
extra_flags |= g_model.moduleData[port].pxx.sport_out << 5;
// Disable s.port if internal module is active
if (IS_TELEMETRY_INTERNAL_MODULE || !g_model.moduleData[port].pxx.sport_out)
extra_flags |= (1<< 5);
}

putPcmByte(port, extra_flags);
Expand Down
12 changes: 12 additions & 0 deletions radio/src/storage/storage_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,20 @@ void preModelLoad()

pauseMixerCalculations();
}
#if defined(PCBTARANIS) || defined(PCBHORUS)
static void fixUpModel()
{
// Ensure that when rfProtocol is RF_PROTO_OFF the type of the module is MODULE_TYPE_NONE
if (g_model.moduleData[INTERNAL_MODULE].type == MODULE_TYPE_XJT && g_model.moduleData[INTERNAL_MODULE].rfProtocol == RF_PROTO_OFF)
g_model.moduleData[INTERNAL_MODULE].type = MODULE_TYPE_NONE;
}
#endif

void postModelLoad(bool alarms)
{
#if defined(PCBTARANIS) || defined(PCBHORUS)
fixUpModel();
#endif
AUDIO_FLUSH();
flightReset(false);

Expand All @@ -70,6 +81,7 @@ void postModelLoad(bool alarms)
resumePulses();
}


customFunctionsReset();

restoreTimers();
Expand Down
4 changes: 2 additions & 2 deletions radio/src/targets/taranis/trainer_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ void stop_cppm_on_heartbeat_capture()
TRAINER_TIMER->CR1 &= ~TIM_CR1_CEN; // Stop counter
NVIC_DisableIRQ(TRAINER_TIMER_IRQn); // Stop Interrupt

if (!IS_EXTERNAL_MODULE_PRESENT()) {
if (!IS_EXTERNAL_MODULE_ENABLED()) {
EXTERNAL_MODULE_OFF();
}
}
Expand Down Expand Up @@ -255,7 +255,7 @@ void stop_sbus_on_heartbeat_capture()
DMA_DeInit(HEARTBEAT_DMA_Stream);
NVIC_DisableIRQ(HEARTBEAT_USART_IRQn);

if (!IS_EXTERNAL_MODULE_PRESENT()) {
if (!IS_EXTERNAL_MODULE_ENABLED()) {
EXTERNAL_MODULE_OFF();
}
}
Expand Down
8 changes: 1 addition & 7 deletions radio/src/telemetry/telemetry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,6 @@ lcdint_t applyChannelRatio(source_t channel, lcdint_t val)
}
#endif

#if defined(STM32)
#define IS_TELEMETRY_INTERNAL_MODULE (g_model.moduleData[INTERNAL_MODULE].rfProtocol != RF_PROTO_OFF)
#else
#define IS_TELEMETRY_INTERNAL_MODULE (false)
#endif

void processTelemetryData(uint8_t data)
{
#if defined(CROSSFIRE)
Expand Down Expand Up @@ -179,7 +173,7 @@ void telemetryWakeup()
}

#if defined(PCBTARANIS) || defined(PCBHORUS)
if ((g_model.moduleData[INTERNAL_MODULE].rfProtocol != RF_PROTO_OFF || IS_MODULE_PXX(EXTERNAL_MODULE)) && FRSKY_BAD_ANTENNA()) {
if ((IS_MODULE_PXX(INTERNAL_MODULE) || IS_MODULE_PXX(EXTERNAL_MODULE)) && FRSKY_BAD_ANTENNA()) {
AUDIO_SWR_RED();
POPUP_WARNING(STR_WARNING);
const char * w = STR_ANTENNAPROBLEM;
Expand Down
6 changes: 6 additions & 0 deletions radio/src/telemetry/telemetry.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,4 +197,10 @@ inline void telemetryOutputSetTrigger(uint8_t byte)
extern Fifo<uint8_t, LUA_TELEMETRY_INPUT_FIFO_SIZE> * luaInputTelemetryFifo;
#endif

#if defined(STM32)
#define IS_TELEMETRY_INTERNAL_MODULE (g_model.moduleData[INTERNAL_MODULE].type == MODULE_TYPE_XJT)
#else
#define IS_TELEMETRY_INTERNAL_MODULE (false)
#endif

#endif // _TELEMETRY_H_
2 changes: 1 addition & 1 deletion radio/src/translations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ const pm_char STR_HOLD[] PROGMEM = TR_HOLD;
const pm_char STR_NONE[] PROGMEM = TR_NONE;
const pm_char STR_MENUSENSOR[] PROGMEM = TR_MENUSENSOR;
const pm_char STR_SENSOR[] PROGMEM = TR_SENSOR;
const pm_char STR_DISABLE_INTERNAL[] PROGMEM = TR_DISABLE_INTERNAL;
#endif

const pm_char STR_INVERT_THR[] PROGMEM = TR_INVERT_THR;
Expand Down Expand Up @@ -470,7 +471,6 @@ const pm_char STR_MULTI_OPTION[] PROGMEM = TR_MULTI_OPTION;
const pm_char STR_MULTI_AUTOBIND[] PROGMEM = TR_MULTI_AUTOBIND;
const pm_char STR_MULTI_DSM_AUTODTECT[] PROGMEM = TR_MULTI_DSM_AUTODTECT;
const pm_char STR_MULTI_LOWPOWER[] PROGMEM = TR_MULTI_LOWPOWER;
const pm_char STR_DISABLE_INTERNAL[] PROGMEM = TR_DISABLE_INTERNAL;
const pm_char STR_MODULE_NO_SERIAL_MODE[] PROGMEM = TR_MODULE_NO_SERIAL_MODE;
const pm_char STR_MODULE_NO_INPUT[] PROGMEM = TR_MODULE_NO_INPUT;
const pm_char STR_MODULE_NO_TELEMETRY[] PROGMEM = TR_MODULE_NO_TELEMETRY;
Expand Down
2 changes: 1 addition & 1 deletion radio/src/translations.h
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,6 @@ extern const pm_char STR_MULTI_TELEMETRY[];
extern const pm_char STR_MULTI_AUTOBIND[];
extern const pm_char STR_MULTI_DSM_AUTODTECT[];
extern const pm_char STR_MULTI_LOWPOWER[];
extern const pm_char STR_DISABLE_INTERNAL[];
extern const pm_char STR_MODULE_NO_SERIAL_MODE[];
extern const pm_char STR_MODULE_NO_INPUT[];
extern const pm_char STR_MODULE_NO_TELEMETRY[];
Expand Down Expand Up @@ -633,6 +632,7 @@ extern const pm_char STR_NONE[];
extern const pm_char STR_MENUSENSOR[];
extern const pm_char STR_SENSOR[];
extern const pm_char STR_COUNTRYCODE[];
extern const pm_char STR_DISABLE_INTERNAL[];
#endif

#if defined(TELEMETRY_FRSKY)
Expand Down
2 changes: 1 addition & 1 deletion radio/src/translations/cz.h.txt
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@
#define TR_MULTI_AUTOBIND TR(INDENT "Autobind",INDENT "Bind on powerup")
#define TR_MULTI_DSM_AUTODTECT TR(INDENT "Autodetect", INDENT "Autodetect format")
#define TR_MULTI_LOWPOWER TR(INDENT "Low power", INDENT "Low power mode")
#define TR_SPORT_OUT INDENT "S.port out"
#define TR_SPORT_OUT INDENT "Telemetry"
#define TR_DISABLE_INTERNAL TR("Disable int.", "Disable internal RF")
#define TR_MODULE_NO_SERIAL_MODE TR("!serial mode", "Not in serial mode")
#define TR_MODULE_NO_INPUT TR("No input", "No serial input")
Expand Down
Loading

0 comments on commit e16b48d

Please sign in to comment.