commit
2b58d39311
|
@ -20,7 +20,7 @@
|
|||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#define EEPROM_CONF_VERSION 155
|
||||
#define EEPROM_CONF_VERSION 156
|
||||
|
||||
bool isEEPROMContentValid(void);
|
||||
bool loadEEPROM(void);
|
||||
|
|
|
@ -71,6 +71,7 @@
|
|||
#define servoConfig(x) (&masterConfig.servoConfig)
|
||||
#define servoMixerConfig(x) (&masterConfig.servoMixerConfig)
|
||||
#define gimbalConfig(x) (&masterConfig.gimbalConfig)
|
||||
#define channelForwardingConfig(x) (&masterConfig.channelForwardingConfig)
|
||||
#define boardAlignment(x) (&masterConfig.boardAlignment)
|
||||
#define imuConfig(x) (&masterConfig.imuConfig)
|
||||
#define gyroConfig(x) (&masterConfig.gyroConfig)
|
||||
|
@ -193,6 +194,8 @@ typedef struct master_s {
|
|||
servoProfile_t servoProfile;
|
||||
// gimbal-related configuration
|
||||
gimbalConfig_t gimbalConfig;
|
||||
// Channel forwarding start channel
|
||||
channelForwardingConfig_t channelForwardingConfig;
|
||||
#endif
|
||||
|
||||
boardAlignment_t boardAlignment;
|
||||
|
|
|
@ -664,6 +664,7 @@ static const clivalue_t valueTable[] = {
|
|||
{ "servo_lowpass", VAR_INT8 | MASTER_VALUE | MODE_LOOKUP, &servoMixerConfig()->servo_lowpass_enable, .config.lookup = { TABLE_OFF_ON } },
|
||||
{ "servo_pwm_rate", VAR_UINT16 | MASTER_VALUE, &servoConfig()->servoPwmRate, .config.minmax = { 50, 498 } },
|
||||
{ "gimbal_mode", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, &gimbalConfig()->mode, .config.lookup = { TABLE_GIMBAL_MODE } },
|
||||
{ "channel_forwarding_start", VAR_UINT8 | MASTER_VALUE, &channelForwardingConfig()->startChannel, .config.minmax = { AUX1, MAX_SUPPORTED_RC_CHANNEL_COUNT } },
|
||||
#endif
|
||||
|
||||
{ "rc_rate", VAR_UINT8 | PROFILE_RATE_VALUE, &masterConfig.profile[0].controlRateProfile[0].rcRate8, .config.minmax = { 0, 255 } },
|
||||
|
|
|
@ -800,6 +800,9 @@ void createDefaultConfig(master_t *config)
|
|||
|
||||
// gimbal
|
||||
config->gimbalConfig.mode = GIMBAL_MODE_NORMAL;
|
||||
|
||||
// Channel forwarding;
|
||||
config->channelForwardingConfig.startChannel = AUX1;
|
||||
#endif
|
||||
|
||||
#ifdef GPS
|
||||
|
@ -903,10 +906,9 @@ void activateConfig(void)
|
|||
mixerUseConfigs(&masterConfig.airplaneConfig);
|
||||
|
||||
#ifdef USE_SERVOS
|
||||
servoUseConfigs(&masterConfig.servoMixerConfig, masterConfig.servoProfile.servoConf, &masterConfig.gimbalConfig);
|
||||
servoUseConfigs(&masterConfig.servoMixerConfig, masterConfig.servoProfile.servoConf, &masterConfig.gimbalConfig, &masterConfig.channelForwardingConfig);
|
||||
#endif
|
||||
|
||||
|
||||
imuConfigure(
|
||||
&masterConfig.imuConfig,
|
||||
¤tProfile->pidProfile,
|
||||
|
@ -1179,6 +1181,7 @@ void changeControlRateProfile(uint8_t profileIndex)
|
|||
profileIndex = MAX_RATEPROFILES - 1;
|
||||
}
|
||||
setControlRateProfile(profileIndex);
|
||||
generateThrottleCurve();
|
||||
}
|
||||
|
||||
void beeperOffSet(uint32_t mask)
|
||||
|
|
|
@ -296,7 +296,7 @@ void updateRcCommands(void)
|
|||
tmp = (uint32_t)(tmp - rxConfig()->mincheck) * PWM_RANGE_MIN / (PWM_RANGE_MAX - rxConfig()->mincheck);
|
||||
}
|
||||
|
||||
rcLookupThrottle(tmp);
|
||||
rcCommand[THROTTLE] = rcLookupThrottle(tmp);
|
||||
|
||||
if (feature(FEATURE_3D) && IS_RC_MODE_ACTIVE(BOX3DDISABLESWITCH) && !failsafeIsActive()) {
|
||||
fix12_t throttleScaler = qConstruct(rcCommand[THROTTLE] - 1000, 1000);
|
||||
|
|
|
@ -83,7 +83,7 @@ static void applyMultirotorAltHold(void)
|
|||
AltHold = EstAlt;
|
||||
isAltHoldChanged = 0;
|
||||
}
|
||||
rcCommand[THROTTLE] = constrain(initialThrottleHold + altHoldThrottleAdjustment, motorConfig()->minthrottle, motorConfig()->maxthrottle);
|
||||
rcCommand[THROTTLE] = constrain(initialThrottleHold + altHoldThrottleAdjustment, PWM_RANGE_MIN, PWM_RANGE_MAX);
|
||||
}
|
||||
} else {
|
||||
// slow alt changes, mostly used for aerial photography
|
||||
|
@ -97,7 +97,7 @@ static void applyMultirotorAltHold(void)
|
|||
velocityControl = 0;
|
||||
isAltHoldChanged = 0;
|
||||
}
|
||||
rcCommand[THROTTLE] = constrain(initialThrottleHold + altHoldThrottleAdjustment, motorConfig()->minthrottle, motorConfig()->maxthrottle);
|
||||
rcCommand[THROTTLE] = constrain(initialThrottleHold + altHoldThrottleAdjustment, PWM_RANGE_MIN, PWM_RANGE_MAX);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@ static gimbalConfig_t *gimbalConfig;
|
|||
int16_t servo[MAX_SUPPORTED_SERVOS];
|
||||
static int useServo;
|
||||
static servoParam_t *servoConf;
|
||||
static channelForwardingConfig_t *channelForwardingConfig;
|
||||
|
||||
|
||||
#define COUNT_SERVO_RULES(rules) (sizeof(rules) / sizeof(servoMixer_t))
|
||||
|
@ -144,11 +145,12 @@ const mixerRules_t servoMixers[] = {
|
|||
|
||||
static servoMixer_t *customServoMixers;
|
||||
|
||||
void servoUseConfigs(servoMixerConfig_t *servoMixerConfigToUse, servoParam_t *servoParamsToUse, struct gimbalConfig_s *gimbalConfigToUse)
|
||||
void servoUseConfigs(servoMixerConfig_t *servoMixerConfigToUse, servoParam_t *servoParamsToUse, struct gimbalConfig_s *gimbalConfigToUse, struct channelForwardingConfig_s *channelForwardingConfigToUse)
|
||||
{
|
||||
servoMixerConfig = servoMixerConfigToUse;
|
||||
servoConf = servoParamsToUse;
|
||||
gimbalConfig = gimbalConfigToUse;
|
||||
channelForwardingConfig = channelForwardingConfigToUse;
|
||||
}
|
||||
|
||||
int16_t determineServoMiddleOrForwardFromChannel(servoIndex_e servoIndex)
|
||||
|
@ -252,7 +254,7 @@ void servoMixerLoadMix(int index, servoMixer_t *customServoMixers)
|
|||
STATIC_UNIT_TESTED void forwardAuxChannelsToServos(uint8_t firstServoIndex)
|
||||
{
|
||||
// start forwarding from this channel
|
||||
uint8_t channelOffset = AUX1;
|
||||
uint8_t channelOffset = channelForwardingConfig->startChannel;
|
||||
|
||||
uint8_t servoOffset;
|
||||
for (servoOffset = 0; servoOffset < MAX_AUX_CHANNEL_COUNT && channelOffset < MAX_SUPPORTED_RC_CHANNEL_COUNT; servoOffset++) {
|
||||
|
|
|
@ -122,6 +122,10 @@ typedef struct servoProfile_s {
|
|||
servoParam_t servoConf[MAX_SUPPORTED_SERVOS];
|
||||
} servoProfile_t;
|
||||
|
||||
typedef struct channelForwardingConfig_s {
|
||||
uint8_t startChannel;
|
||||
} channelForwardingConfig_t;
|
||||
|
||||
extern int16_t servo[MAX_SUPPORTED_SERVOS];
|
||||
|
||||
void servoTable(void);
|
||||
|
@ -131,7 +135,7 @@ void filterServos(void);
|
|||
|
||||
void servoMixerInit(servoMixer_t *customServoMixers);
|
||||
struct gimbalConfig_s;
|
||||
void servoUseConfigs(servoMixerConfig_t *servoConfigToUse, servoParam_t *servoParamsToUse, struct gimbalConfig_s *gimbalConfigToUse);
|
||||
void servoUseConfigs(servoMixerConfig_t *servoConfigToUse, servoParam_t *servoParamsToUse, struct gimbalConfig_s *gimbalConfigToUse, struct channelForwardingConfig_s *channelForwardingConfigToUse);
|
||||
void servoMixerLoadMix(int index, servoMixer_t *customServoMixers);
|
||||
void loadCustomServoMixer(void);
|
||||
void servoConfigureOutput(void);
|
||||
|
|
|
@ -950,8 +950,14 @@ else
|
|||
saCmsPitFMode = 0;
|
||||
|
||||
saCmsStatusString[0] = "-FR"[saCmsOpmodel];
|
||||
|
||||
if (saCmsFselMode == 0) {
|
||||
saCmsStatusString[2] = "ABEFR"[saDevice.chan / 8];
|
||||
saCmsStatusString[3] = '1' + (saDevice.chan % 8);
|
||||
} else {
|
||||
saCmsStatusString[2] = 'U';
|
||||
saCmsStatusString[3] = 'F';
|
||||
}
|
||||
|
||||
if ((saDevice.mode & SA_MODE_GET_PITMODE)
|
||||
&& (saDevice.mode & SA_MODE_GET_OUT_RANGE_PITMODE))
|
||||
|
@ -1067,6 +1073,8 @@ static long saCmsConfigPitFModeByGvar(displayPort_t *pDisp, const void *self)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static long saCmsConfigFreqModeByGvar(displayPort_t *pDisp, const void *self); // Forward
|
||||
|
||||
static long saCmsConfigOpmodelByGvar(displayPort_t *pDisp, const void *self)
|
||||
{
|
||||
UNUSED(pDisp);
|
||||
|
@ -1086,6 +1094,10 @@ static long saCmsConfigOpmodelByGvar(displayPort_t *pDisp, const void *self)
|
|||
// out-range receivers from getting blinded.
|
||||
saCmsPitFMode = 0;
|
||||
saCmsConfigPitFModeByGvar(pDisp, self);
|
||||
|
||||
// Direct frequency mode is not available in RACE opmodel
|
||||
saCmsFselMode = 0;
|
||||
saCmsConfigFreqModeByGvar(pDisp, self);
|
||||
} else {
|
||||
// Trying to go back to unknown state; bounce back
|
||||
saCmsOpmodel = SACMS_OPMODEL_UNDEF + 1;
|
||||
|
@ -1194,7 +1206,6 @@ static long saCmsCommence(displayPort_t *pDisp, const void *self)
|
|||
// Setup band, freq and power.
|
||||
|
||||
saSetBandChan(saCmsBand - 1, saCmsChan - 1);
|
||||
saSetPowerByIndex(saCmsPower - 1);
|
||||
|
||||
// If in pit mode, cancel it.
|
||||
|
||||
|
@ -1211,6 +1222,8 @@ static long saCmsCommence(displayPort_t *pDisp, const void *self)
|
|||
saSetFreq(saCmsUserFreq);
|
||||
}
|
||||
|
||||
saSetPowerByIndex(saCmsPower - 1);
|
||||
|
||||
return MENU_CHAIN_BACK;
|
||||
}
|
||||
|
||||
|
@ -1256,15 +1269,15 @@ static long saCmsSetUserFreqOnEnter(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static long saCmsSetUserFreq(displayPort_t *pDisp, const void *self)
|
||||
static long saCmsConfigUserFreq(displayPort_t *pDisp, const void *self)
|
||||
{
|
||||
UNUSED(pDisp);
|
||||
UNUSED(self);
|
||||
|
||||
saCmsUserFreq = saCmsUserFreqNew;
|
||||
saSetFreq(saCmsUserFreq);
|
||||
//saSetFreq(saCmsUserFreq);
|
||||
|
||||
return 0;
|
||||
return MENU_CHAIN_BACK;
|
||||
}
|
||||
|
||||
static OSD_Entry saCmsMenuPORFreqEntries[] = {
|
||||
|
@ -1293,7 +1306,7 @@ static OSD_Entry saCmsMenuUserFreqEntries[] = {
|
|||
|
||||
{ "CUR FREQ", OME_UINT16, NULL, &(OSD_UINT16_t){ &saCmsUserFreq, 5000, 5900, 0 }, DYNAMIC },
|
||||
{ "NEW FREQ", OME_UINT16, NULL, &(OSD_UINT16_t){ &saCmsUserFreqNew, 5000, 5900, 1 }, 0 },
|
||||
{ "SET", OME_Funcall, saCmsSetUserFreq, NULL, 0 },
|
||||
{ "SET", OME_Funcall, saCmsConfigUserFreq, NULL, 0 },
|
||||
|
||||
{ "BACK", OME_Back, NULL, NULL, 0 },
|
||||
{ NULL, OME_END, NULL, NULL, 0 }
|
||||
|
@ -1314,8 +1327,8 @@ static OSD_TAB_t saCmsEntFselMode = { &saCmsFselMode, 1, saCmsFselModeNames };
|
|||
static OSD_Entry saCmsMenuConfigEntries[] = {
|
||||
{ "- SA CONFIG -", OME_Label, NULL, NULL, 0 },
|
||||
|
||||
{ "OP MODEL", OME_TAB, saCmsConfigOpmodelByGvar, &(OSD_TAB_t){ &saCmsOpmodel, 2, saCmsOpmodelNames }, 0 },
|
||||
{ "FSEL MODE", OME_TAB, saCmsConfigFreqModeByGvar, &saCmsEntFselMode, 0 },
|
||||
{ "OP MODEL", OME_TAB, saCmsConfigOpmodelByGvar, &(OSD_TAB_t){ &saCmsOpmodel, 2, saCmsOpmodelNames }, DYNAMIC },
|
||||
{ "FSEL MODE", OME_TAB, saCmsConfigFreqModeByGvar, &saCmsEntFselMode, DYNAMIC },
|
||||
{ "PIT FMODE", OME_TAB, saCmsConfigPitFModeByGvar, &saCmsEntPitFMode, 0 },
|
||||
{ "POR FREQ", OME_Submenu, (CMSEntryFuncPtr)saCmsORFreqGetString, &saCmsMenuPORFreq, OPTSTRING },
|
||||
{ "STATX", OME_Submenu, cmsMenuChange, &saCmsMenuStats, 0 },
|
||||
|
|
|
@ -53,10 +53,12 @@ const char * const vtx58ChannelNames[] = {
|
|||
|
||||
bool vtx58_Freq2Bandchan(uint16_t freq, uint8_t *pBand, uint8_t *pChan)
|
||||
{
|
||||
uint8_t band;
|
||||
int8_t band;
|
||||
uint8_t chan;
|
||||
|
||||
for (band = 0 ; band < 5 ; band++) {
|
||||
// Use reverse lookup order so that 5880Mhz
|
||||
// get Raceband 7 instead of Fatshark 8.
|
||||
for (band = 4 ; band >= 0 ; band--) {
|
||||
for (chan = 0 ; chan < 8 ; chan++) {
|
||||
if (vtx58FreqTable[band][chan] == freq) {
|
||||
*pBand = band + 1;
|
||||
|
|
|
@ -134,6 +134,8 @@ void trampCmdU16(uint8_t cmd, uint16_t param)
|
|||
void trampSetFreq(uint16_t freq)
|
||||
{
|
||||
trampConfFreq = freq;
|
||||
if(trampConfFreq != trampCurFreq)
|
||||
trampFreqRetries = TRAMP_MAX_RETRIES;
|
||||
}
|
||||
|
||||
void trampSendFreq(uint16_t freq)
|
||||
|
@ -149,6 +151,8 @@ void trampSetBandChan(uint8_t band, uint8_t chan)
|
|||
void trampSetRFPower(uint16_t level)
|
||||
{
|
||||
trampConfPower = level;
|
||||
if(trampConfPower != trampCurPower)
|
||||
trampPowerRetries = TRAMP_MAX_RETRIES;
|
||||
}
|
||||
|
||||
void trampSendRFPower(uint16_t level)
|
||||
|
@ -163,13 +167,6 @@ bool trampCommitChanges()
|
|||
return false;
|
||||
|
||||
trampStatus = TRAMP_STATUS_SET_FREQ_PW;
|
||||
|
||||
if(trampConfFreq != trampCurFreq)
|
||||
trampFreqRetries = TRAMP_MAX_RETRIES;
|
||||
|
||||
if(trampConfPower != trampCurPower)
|
||||
trampPowerRetries = TRAMP_MAX_RETRIES;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -511,6 +508,18 @@ static long trampCmsConfigChan(displayPort_t *pDisp, const void *self)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static long trampCmsConfigPower(displayPort_t *pDisp, const void *self)
|
||||
{
|
||||
UNUSED(pDisp);
|
||||
UNUSED(self);
|
||||
|
||||
if (trampCmsPower == 0)
|
||||
// Bounce back
|
||||
trampCmsPower = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static OSD_INT16_t trampCmsEntTemp = { &trampCurTemp, -100, 300, 0 };
|
||||
|
||||
static const char * const trampCmsPitmodeNames[] = {
|
||||
|
@ -598,7 +607,7 @@ static OSD_Entry trampMenuEntries[] =
|
|||
{ "BAND", OME_TAB, trampCmsConfigBand, &trampCmsEntBand, 0 },
|
||||
{ "CHAN", OME_TAB, trampCmsConfigChan, &trampCmsEntChan, 0 },
|
||||
{ "(FREQ)", OME_UINT16, NULL, &trampCmsEntFreqRef, DYNAMIC },
|
||||
{ "POWER", OME_TAB, NULL, &trampCmsEntPower, 0 },
|
||||
{ "POWER", OME_TAB, trampCmsConfigPower, &trampCmsEntPower, 0 },
|
||||
{ "T(C)", OME_INT16, NULL, &trampCmsEntTemp, DYNAMIC },
|
||||
{ "SET", OME_Submenu, cmsMenuChange, &trampCmsMenuCommence, 0 },
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ const timerHardware_t timerHardware[USABLE_TIMER_CHANNEL_COUNT] = {
|
|||
DEF_TIM(TIM8, CH2, PB8, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED), // PWM3 - PB8
|
||||
DEF_TIM(TIM17,CH1, PB9, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED), // PWM4 - PB9
|
||||
DEF_TIM(TIM3, CH3, PB0, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED), // PWM5 - PB0 - *TIM3_CH3
|
||||
DEF_TIM(TIM3, CH4, PB1, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED), // PWM6 - PB1 - *TIM3_CH4
|
||||
DEF_TIM(TIM8,CH3N, PB1, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED | TIMER_OUTPUT_INVERTED),// PWM6 - PB1 - *TIM3_CH4
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue