[Taranis] It's now impossible to have Trainer input in the external module and a regular module enabled
This commit is contained in:
+74
-46
@@ -150,49 +150,53 @@ enum CurveType {
|
|||||||
#define MAX_POINTS 17
|
#define MAX_POINTS 17
|
||||||
|
|
||||||
#if defined(PCBHORUS)
|
#if defined(PCBHORUS)
|
||||||
#define LEN_MODEL_NAME 15
|
#define LEN_MODEL_NAME 15
|
||||||
#define LEN_TIMER_NAME 8
|
#define LEN_TIMER_NAME 8
|
||||||
#define LEN_FLIGHT_MODE_NAME 10
|
#define LEN_FLIGHT_MODE_NAME 10
|
||||||
#define LEN_BITMAP_NAME 10
|
#define LEN_BITMAP_NAME 10
|
||||||
#define LEN_EXPOMIX_NAME 6
|
#define LEN_EXPOMIX_NAME 6
|
||||||
#define LEN_CHANNEL_NAME 6
|
#define LEN_CHANNEL_NAME 6
|
||||||
#define LEN_INPUT_NAME 4
|
#define LEN_INPUT_NAME 4
|
||||||
#define LEN_CURVE_NAME 3
|
#define LEN_CURVE_NAME 3
|
||||||
#define MAX_CURVES 32
|
#define LEN_CFN_NAME 10
|
||||||
#define NUM_POINTS 512
|
#define MAX_CURVES 32
|
||||||
|
#define NUM_POINTS 512
|
||||||
#elif defined(PCBFLAMENCO)
|
#elif defined(PCBFLAMENCO)
|
||||||
#define LEN_MODEL_NAME 12
|
#define LEN_MODEL_NAME 12
|
||||||
#define LEN_TIMER_NAME 8
|
#define LEN_TIMER_NAME 8
|
||||||
#define LEN_FLIGHT_MODE_NAME 10
|
#define LEN_FLIGHT_MODE_NAME 10
|
||||||
#define LEN_EXPOMIX_NAME 6
|
#define LEN_EXPOMIX_NAME 6
|
||||||
#define LEN_CHANNEL_NAME 6
|
#define LEN_CHANNEL_NAME 6
|
||||||
#define LEN_INPUT_NAME 4
|
#define LEN_INPUT_NAME 4
|
||||||
#define LEN_CURVE_NAME 3
|
#define LEN_CURVE_NAME 3
|
||||||
#define MAX_CURVES 32
|
#define LEN_CFN_NAME 8
|
||||||
#define NUM_POINTS 512
|
#define MAX_CURVES 32
|
||||||
|
#define NUM_POINTS 512
|
||||||
#elif defined(PCBTARANIS)
|
#elif defined(PCBTARANIS)
|
||||||
#define LEN_MODEL_NAME 12
|
#define LEN_MODEL_NAME 12
|
||||||
#define LEN_TIMER_NAME 8
|
#define LEN_TIMER_NAME 8
|
||||||
#define LEN_FLIGHT_MODE_NAME 10
|
#define LEN_FLIGHT_MODE_NAME 10
|
||||||
#define LEN_BITMAP_NAME 10
|
#define LEN_BITMAP_NAME 10
|
||||||
#define LEN_EXPOMIX_NAME 8
|
#define LEN_EXPOMIX_NAME 8
|
||||||
#define LEN_CHANNEL_NAME 6
|
#define LEN_CHANNEL_NAME 6
|
||||||
#define LEN_INPUT_NAME 4
|
#define LEN_INPUT_NAME 4
|
||||||
#define LEN_CURVE_NAME 3
|
#define LEN_CURVE_NAME 3
|
||||||
#define MAX_CURVES 32
|
#define LEN_CFN_NAME 8
|
||||||
#define NUM_POINTS 512
|
#define MAX_CURVES 32
|
||||||
|
#define NUM_POINTS 512
|
||||||
#elif defined(CPUARM)
|
#elif defined(CPUARM)
|
||||||
#define LEN_MODEL_NAME 10
|
#define LEN_MODEL_NAME 10
|
||||||
#define LEN_TIMER_NAME 3
|
#define LEN_TIMER_NAME 3
|
||||||
#define LEN_FLIGHT_MODE_NAME 6
|
#define LEN_FLIGHT_MODE_NAME 6
|
||||||
#define LEN_EXPOMIX_NAME 6
|
#define LEN_EXPOMIX_NAME 6
|
||||||
#define MAX_CURVES 16
|
#define LEN_CFN_NAME 6
|
||||||
#define NUM_POINTS 512
|
#define MAX_CURVES 16
|
||||||
|
#define NUM_POINTS 512
|
||||||
#else
|
#else
|
||||||
#define LEN_MODEL_NAME 10
|
#define LEN_MODEL_NAME 10
|
||||||
#define LEN_FLIGHT_MODE_NAME 6
|
#define LEN_FLIGHT_MODE_NAME 6
|
||||||
#define MAX_CURVES 8
|
#define MAX_CURVES 8
|
||||||
#define NUM_POINTS (112-MAX_CURVES)
|
#define NUM_POINTS (112-MAX_CURVES)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBTARANIS) || defined(PCBSKY9X) || defined(PCBHORUS)
|
#if defined(PCBTARANIS) || defined(PCBSKY9X) || defined(PCBHORUS)
|
||||||
@@ -265,6 +269,36 @@ enum BeeperMode {
|
|||||||
e_mode_all
|
e_mode_all
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if defined(PCBFLAMENCO)
|
||||||
|
enum ModuleIndex {
|
||||||
|
EXTERNAL_MODULE,
|
||||||
|
TRAINER_MODULE,
|
||||||
|
};
|
||||||
|
enum TrainerMode {
|
||||||
|
TRAINER_MODE_MASTER,
|
||||||
|
TRAINER_MODE_SLAVE
|
||||||
|
};
|
||||||
|
#elif defined(PCBTARANIS) || defined(PCBHORUS)
|
||||||
|
enum ModuleIndex {
|
||||||
|
INTERNAL_MODULE,
|
||||||
|
EXTERNAL_MODULE,
|
||||||
|
TRAINER_MODULE
|
||||||
|
};
|
||||||
|
enum TrainerMode {
|
||||||
|
TRAINER_MODE_MASTER_TRAINER_JACK,
|
||||||
|
TRAINER_MODE_SLAVE,
|
||||||
|
TRAINER_MODE_MASTER_SBUS_EXTERNAL_MODULE,
|
||||||
|
TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE,
|
||||||
|
TRAINER_MODE_MASTER_BATTERY_COMPARTMENT,
|
||||||
|
};
|
||||||
|
#elif defined(PCBSKY9X)
|
||||||
|
enum ModuleIndex {
|
||||||
|
EXTERNAL_MODULE,
|
||||||
|
EXTRA_MODULE,
|
||||||
|
TRAINER_MODULE
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
enum UartModes {
|
enum UartModes {
|
||||||
#if defined(CLI) || defined(DEBUG)
|
#if defined(CLI) || defined(DEBUG)
|
||||||
UART_MODE_DEBUG,
|
UART_MODE_DEBUG,
|
||||||
@@ -498,7 +532,7 @@ enum PotsWarnMode {
|
|||||||
#define GVAR_MIN -GVAR_MAX
|
#define GVAR_MIN -GVAR_MAX
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define RESERVE_RANGE_FOR_GVARS 10
|
#define RESERVE_RANGE_FOR_GVARS 10
|
||||||
// even we do not spend space in EEPROM for 10 GVARS, we reserve the space inside the range of values, like offset, weight, etc.
|
// even we do not spend space in EEPROM for 10 GVARS, we reserve the space inside the range of values, like offset, weight, etc.
|
||||||
|
|
||||||
#if defined(PCBSTD) && defined(GVARS)
|
#if defined(PCBSTD) && defined(GVARS)
|
||||||
@@ -513,12 +547,6 @@ enum PotsWarnMode {
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBTARANIS)
|
|
||||||
#define LEN_CFN_NAME 8
|
|
||||||
#elif defined(CPUARM)
|
|
||||||
#define LEN_CFN_NAME 6
|
|
||||||
#endif
|
|
||||||
|
|
||||||
enum SwitchSources {
|
enum SwitchSources {
|
||||||
SWSRC_NONE = 0,
|
SWSRC_NONE = 0,
|
||||||
|
|
||||||
|
|||||||
@@ -470,6 +470,14 @@ bool isRfProtocolAvailable(int protocol)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
bool modelHasNotes()
|
bool modelHasNotes()
|
||||||
{
|
{
|
||||||
char filename[sizeof(MODELS_PATH)+1+sizeof(g_model.header.name)+sizeof(TEXT_EXT)] = MODELS_PATH "/";
|
char filename[sizeof(MODELS_PATH)+1+sizeof(g_model.header.name)+sizeof(TEXT_EXT)] = MODELS_PATH "/";
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ bool isSwitchAvailableInMixes(int swtch);
|
|||||||
bool isSwitchAvailableInTimers(int swtch);
|
bool isSwitchAvailableInTimers(int swtch);
|
||||||
bool isModuleAvailable(int module);
|
bool isModuleAvailable(int module);
|
||||||
bool isRfProtocolAvailable(int protocol);
|
bool isRfProtocolAvailable(int protocol);
|
||||||
|
bool isTrainerModeAvailable(int mode);
|
||||||
|
|
||||||
bool isSensorUnit(int sensor, uint8_t unit);
|
bool isSensorUnit(int sensor, uint8_t unit);
|
||||||
bool isCellsSensor(int sensor);
|
bool isCellsSensor(int sensor);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../../opentx.h"
|
#include "opentx.h"
|
||||||
|
|
||||||
uint8_t g_moduleIdx;
|
uint8_t g_moduleIdx;
|
||||||
void menuModelFailsafe(uint8_t event);
|
void menuModelFailsafe(uint8_t event);
|
||||||
@@ -649,7 +649,9 @@ void menuModelSetup(uint8_t event)
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case ITEM_MODEL_TRAINER_MODE:
|
case ITEM_MODEL_TRAINER_MODE:
|
||||||
g_model.trainerMode = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_MODE, STR_VTRAINERMODES, g_model.trainerMode, 0, HAS_WIRELESS_TRAINER_HARDWARE() ? TRAINER_MODE_MASTER_BATTERY_COMPARTMENT : TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE, attr, event);
|
lcd_putsLeft(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);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ITEM_MODEL_EXTERNAL_MODULE_LABEL:
|
case ITEM_MODEL_EXTERNAL_MODULE_LABEL:
|
||||||
@@ -666,7 +668,7 @@ void menuModelSetup(uint8_t event)
|
|||||||
if (attr && s_editMode>0) {
|
if (attr && s_editMode>0) {
|
||||||
switch (menuHorizontalPosition) {
|
switch (menuHorizontalPosition) {
|
||||||
case 0:
|
case 0:
|
||||||
g_model.moduleData[EXTERNAL_MODULE].type = checkIncDec(event, g_model.moduleData[EXTERNAL_MODULE].type, MODULE_TYPE_NONE, MODULE_TYPE_COUNT-1, EE_MODEL, isModuleAvailable);
|
g_model.moduleData[EXTERNAL_MODULE].type = checkIncDec(event, g_model.moduleData[EXTERNAL_MODULE].type, MODULE_TYPE_NONE, IS_TRAINER_EXTERNAL_MODULE() ? 0 : MODULE_TYPE_COUNT-1, EE_MODEL, isModuleAvailable);
|
||||||
if (checkIncDec_Ret) {
|
if (checkIncDec_Ret) {
|
||||||
g_model.moduleData[EXTERNAL_MODULE].rfProtocol = 0;
|
g_model.moduleData[EXTERNAL_MODULE].rfProtocol = 0;
|
||||||
g_model.moduleData[EXTERNAL_MODULE].channelsStart = 0;
|
g_model.moduleData[EXTERNAL_MODULE].channelsStart = 0;
|
||||||
@@ -875,8 +877,11 @@ void menuModelFailsafe(uint8_t event)
|
|||||||
|
|
||||||
#define COL_W (LCD_W/2)
|
#define COL_W (LCD_W/2)
|
||||||
const uint8_t SLIDER_W = 64;
|
const uint8_t SLIDER_W = 64;
|
||||||
// Column separator
|
|
||||||
lcdDrawSolidVerticalLine(LCD_W/2, FH, LCD_H-FH);
|
if (NUM_CHANNELS(g_moduleIdx) > 8) {
|
||||||
|
// Column separator
|
||||||
|
lcdDrawSolidVerticalLine(LCD_W/2, FH, LCD_H-FH);
|
||||||
|
}
|
||||||
|
|
||||||
lcd_putsCenter(0*FH, FAILSAFESET);
|
lcd_putsCenter(0*FH, FAILSAFESET);
|
||||||
lcdInvertLine(0);
|
lcdInvertLine(0);
|
||||||
|
|||||||
+2
-30
@@ -55,39 +55,11 @@
|
|||||||
|
|
||||||
#define SET_DEFAULT_PPM_FRAME_LENGTH(idx) g_model.moduleData[idx].ppmFrameLength = 4 * max((int8_t)0, g_model.moduleData[idx].channelsCount)
|
#define SET_DEFAULT_PPM_FRAME_LENGTH(idx) g_model.moduleData[idx].ppmFrameLength = 4 * max((int8_t)0, g_model.moduleData[idx].channelsCount)
|
||||||
|
|
||||||
#if defined(PCBFLAMENCO)
|
#if defined(PCBTARANIS) || defined(PCBHORUS)
|
||||||
enum ModuleIndex {
|
|
||||||
EXTERNAL_MODULE,
|
|
||||||
TRAINER_MODULE,
|
|
||||||
};
|
|
||||||
enum TrainerMode {
|
|
||||||
TRAINER_MODE_MASTER,
|
|
||||||
TRAINER_MODE_SLAVE
|
|
||||||
};
|
|
||||||
#elif defined(PCBTARANIS) || defined(PCBHORUS)
|
|
||||||
enum ModuleIndex {
|
|
||||||
INTERNAL_MODULE,
|
|
||||||
EXTERNAL_MODULE,
|
|
||||||
TRAINER_MODULE
|
|
||||||
};
|
|
||||||
enum TrainerMode {
|
|
||||||
TRAINER_MODE_MASTER_TRAINER_JACK,
|
|
||||||
TRAINER_MODE_SLAVE,
|
|
||||||
TRAINER_MODE_MASTER_SBUS_EXTERNAL_MODULE,
|
|
||||||
TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE,
|
|
||||||
TRAINER_MODE_MASTER_BATTERY_COMPARTMENT,
|
|
||||||
};
|
|
||||||
#define IS_TRAINER_EXTERNAL_MODULE() (g_model.trainerMode == TRAINER_MODE_MASTER_SBUS_EXTERNAL_MODULE || g_model.trainerMode == TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE)
|
#define IS_TRAINER_EXTERNAL_MODULE() (g_model.trainerMode == TRAINER_MODE_MASTER_SBUS_EXTERNAL_MODULE || g_model.trainerMode == TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE)
|
||||||
#define HAS_WIRELESS_TRAINER_HARDWARE() (g_eeGeneral.serial2Mode==UART_MODE_SBUS_TRAINER/* || g_eeGeneral.serial2Mode==UART_MODE_CPPM_TRAINER*/)
|
#define HAS_WIRELESS_TRAINER_HARDWARE() (g_eeGeneral.serial2Mode==UART_MODE_SBUS_TRAINER/* || g_eeGeneral.serial2Mode==UART_MODE_CPPM_TRAINER*/)
|
||||||
#elif defined(PCBSKY9X)
|
|
||||||
enum ModuleIndex {
|
|
||||||
EXTERNAL_MODULE,
|
|
||||||
EXTRA_MODULE,
|
|
||||||
TRAINER_MODULE
|
|
||||||
};
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if defined(VOICE)
|
#if defined(VOICE)
|
||||||
#define IS_PLAY_FUNC(func) ((func) >= FUNC_PLAY_SOUND && func <= FUNC_PLAY_VALUE)
|
#define IS_PLAY_FUNC(func) ((func) >= FUNC_PLAY_SOUND && func <= FUNC_PLAY_VALUE)
|
||||||
#else
|
#else
|
||||||
@@ -534,7 +506,7 @@ enum ModuleTypes {
|
|||||||
MODULE_TYPE_COUNT
|
MODULE_TYPE_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
#define IS_PULSES_EXTERNAL_MODULE() (g_model.moduleData[EXTERNAL_MODULE].type != MODULE_TYPE_NONE)
|
#define IS_EXTERNAL_MODULE_PRESENT() (g_model.moduleData[EXTERNAL_MODULE].type != MODULE_TYPE_NONE)
|
||||||
|
|
||||||
enum FailsafeModes {
|
enum FailsafeModes {
|
||||||
FAILSAFE_NOT_SET,
|
FAILSAFE_NOT_SET,
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ void stop_cppm_on_heartbeat_capture(void)
|
|||||||
TRAINER_TIMER->CR1 &= ~TIM_CR1_CEN; // Stop counter
|
TRAINER_TIMER->CR1 &= ~TIM_CR1_CEN; // Stop counter
|
||||||
NVIC_DisableIRQ(TRAINER_TIMER_IRQn); // Stop Interrupt
|
NVIC_DisableIRQ(TRAINER_TIMER_IRQn); // Stop Interrupt
|
||||||
|
|
||||||
if (!IS_PULSES_EXTERNAL_MODULE()) {
|
if (!IS_EXTERNAL_MODULE_PRESENT()) {
|
||||||
EXTERNAL_MODULE_OFF();
|
EXTERNAL_MODULE_OFF();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -221,7 +221,7 @@ void stop_sbus_on_heartbeat_capture(void)
|
|||||||
configure_pins(HEARTBEAT_GPIO_PIN, PIN_INPUT | PIN_PORTC);
|
configure_pins(HEARTBEAT_GPIO_PIN, PIN_INPUT | PIN_PORTC);
|
||||||
NVIC_DisableIRQ(HEARTBEAT_USART_IRQn);
|
NVIC_DisableIRQ(HEARTBEAT_USART_IRQn);
|
||||||
#endif
|
#endif
|
||||||
if (!IS_PULSES_EXTERNAL_MODULE()) {
|
if (!IS_EXTERNAL_MODULE_PRESENT()) {
|
||||||
EXTERNAL_MODULE_OFF();
|
EXTERNAL_MODULE_OFF();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ void stop_cppm_on_heartbeat_capture(void)
|
|||||||
TRAINER_TIMER->CR1 &= ~TIM_CR1_CEN; // Stop counter
|
TRAINER_TIMER->CR1 &= ~TIM_CR1_CEN; // Stop counter
|
||||||
NVIC_DisableIRQ(TRAINER_TIMER_IRQn); // Stop Interrupt
|
NVIC_DisableIRQ(TRAINER_TIMER_IRQn); // Stop Interrupt
|
||||||
|
|
||||||
if (!IS_PULSES_EXTERNAL_MODULE()) {
|
if (!IS_EXTERNAL_MODULE_PRESENT()) {
|
||||||
EXTERNAL_MODULE_OFF();
|
EXTERNAL_MODULE_OFF();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -236,7 +236,7 @@ void stop_sbus_on_heartbeat_capture(void)
|
|||||||
configure_pins(HEARTBEAT_GPIO_PIN, PIN_INPUT | PIN_PORTC);
|
configure_pins(HEARTBEAT_GPIO_PIN, PIN_INPUT | PIN_PORTC);
|
||||||
NVIC_DisableIRQ(HEARTBEAT_USART_IRQn);
|
NVIC_DisableIRQ(HEARTBEAT_USART_IRQn);
|
||||||
|
|
||||||
if (!IS_PULSES_EXTERNAL_MODULE()) {
|
if (!IS_EXTERNAL_MODULE_PRESENT()) {
|
||||||
EXTERNAL_MODULE_OFF();
|
EXTERNAL_MODULE_OFF();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user