Skip to content

Commit

Permalink
Changed some defaults for RACE_PRO (betaflight#13215)
Browse files Browse the repository at this point in the history
* Changed some defaults for RACE_PRO

* Update src/main/flight/imu.c

Co-authored-by: Mark Haslinghuis <[email protected]>

* Update src/main/osd/osd.c

Co-authored-by: Mark Haslinghuis <[email protected]>

* Update src/main/flight/failsafe.c

---------

Co-authored-by: Mark Haslinghuis <[email protected]>
  • Loading branch information
Ivan Efimov and haslinghuis authored Dec 12, 2023
1 parent 20b2e9c commit 477c980
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/main/config/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ if (systemConfig()->configurationState == CONFIGURATION_STATE_DEFAULTS_BARE) {

#ifdef USE_DSHOT
if (beeperConfig()->dshotBeaconOffFlags & ~DSHOT_BEACON_ALLOWED_MODES) {
beeperConfigMutable()->dshotBeaconOffFlags = 0;
beeperConfigMutable()->dshotBeaconOffFlags = DEFAULT_DSHOT_BEACON_OFF_FLAGS;
}

if (beeperConfig()->dshotBeaconTone < DSHOT_CMD_BEACON1
Expand Down
8 changes: 7 additions & 1 deletion src/main/flight/failsafe.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,20 @@ static failsafeState_t failsafeState;

PG_REGISTER_WITH_RESET_TEMPLATE(failsafeConfig_t, failsafeConfig, PG_FAILSAFE_CONFIG, 2);

#ifdef USE_RACE_PRO
#define DEFAULT_FAILSAFE_RECOVERY_DELAY 1 // 100ms of valid rx data needed to allow recovery from failsafe and arming block
#else
#define DEFAULT_FAILSAFE_RECOVERY_DELAY 5 // 500ms of valid rx data needed to allow recovery from failsafe and arming block
#endif

PG_RESET_TEMPLATE(failsafeConfig_t, failsafeConfig,
.failsafe_throttle = 1000, // default throttle off.
.failsafe_throttle_low_delay = 100, // default throttle low delay for "just disarm" on failsafe condition
.failsafe_delay = 15, // 1.5 sec stage 1 period, can regain control on signal recovery, at idle in drop mode
.failsafe_off_delay = 10, // 1 sec in landing phase, if enabled
.failsafe_switch_mode = FAILSAFE_SWITCH_MODE_STAGE1, // default failsafe switch action is identical to rc link loss
.failsafe_procedure = FAILSAFE_PROCEDURE_DROP_IT, // default full failsafe procedure is 0: auto-landing
.failsafe_recovery_delay = 5, // 500ms of valid rx data needed to allow recovery from failsafe and arming block
.failsafe_recovery_delay = DEFAULT_FAILSAFE_RECOVERY_DELAY,
.failsafe_stick_threshold = 30 // 30 percent of stick deflection to exit GPS Rescue procedure
);

Expand Down
8 changes: 7 additions & 1 deletion src/main/flight/imu.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,16 @@ attitudeEulerAngles_t attitude = EULER_INITIALIZE;

PG_REGISTER_WITH_RESET_TEMPLATE(imuConfig_t, imuConfig, PG_IMU_CONFIG, 3);

#ifdef USE_RACE_PRO
#define DEFAULT_SMALL_ANGLE 180
#else
#define DEFAULT_SMALL_ANGLE 25
#endif

PG_RESET_TEMPLATE(imuConfig_t, imuConfig,
.imu_dcm_kp = 2500, // 1.0 * 10000
.imu_dcm_ki = 0, // 0.003 * 10000
.small_angle = 25,
.small_angle = DEFAULT_SMALL_ANGLE,
.imu_process_denom = 2,
.mag_declination = 0
);
Expand Down
6 changes: 6 additions & 0 deletions src/main/io/beeper.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ typedef enum {
BEEPER_GET_FLAG(BEEPER_RX_LOST) \
| BEEPER_GET_FLAG(BEEPER_RX_SET) )

#ifdef USE_RACE_PRO
#define DEFAULT_DSHOT_BEACON_OFF_FLAGS BEEPER_GET_FLAG(BEEPER_RX_LOST)
#else
#define DEFAULT_DSHOT_BEACON_OFF_FLAGS DSHOT_BEACON_ALLOWED_MODES
#endif // USE_RACE_PRO

void beeper(beeperMode_e mode);
void beeperSilence(void);
void beeperUpdate(timeUs_t currentTimeUs);
Expand Down
18 changes: 12 additions & 6 deletions src/main/osd/osd.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,17 +332,23 @@ const uint16_t osdTimerDefault[OSD_TIMER_COUNT] = {
OSD_TIMER(OSD_TIMER_SRC_TOTAL_ARMED, OSD_TIMER_PREC_SECOND, 10)
};

#ifdef USE_RACE_PRO
#define RACE_PRO true
#else
#define RACE_PRO false
#endif

void pgResetFn_osdConfig(osdConfig_t *osdConfig)
{
// Enable the default stats
osdConfig->enabled_stats = 0; // reset all to off and enable only a few initially
osdStatSetState(OSD_STAT_MAX_SPEED, true);
osdStatSetState(OSD_STAT_MAX_SPEED, !RACE_PRO);
osdStatSetState(OSD_STAT_MIN_BATTERY, true);
osdStatSetState(OSD_STAT_MIN_RSSI, true);
osdStatSetState(OSD_STAT_MAX_CURRENT, true);
osdStatSetState(OSD_STAT_USED_MAH, true);
osdStatSetState(OSD_STAT_BLACKBOX, true);
osdStatSetState(OSD_STAT_BLACKBOX_NUMBER, true);
osdStatSetState(OSD_STAT_MIN_RSSI, !RACE_PRO);
osdStatSetState(OSD_STAT_MAX_CURRENT, !RACE_PRO);
osdStatSetState(OSD_STAT_USED_MAH, !RACE_PRO);
osdStatSetState(OSD_STAT_BLACKBOX, !RACE_PRO);
osdStatSetState(OSD_STAT_BLACKBOX_NUMBER, !RACE_PRO);
osdStatSetState(OSD_STAT_TIMER_2, true);

osdConfig->units = UNIT_METRIC;
Expand Down
2 changes: 1 addition & 1 deletion src/main/pg/beeper.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ PG_REGISTER_WITH_RESET_TEMPLATE(beeperConfig_t, beeperConfig, PG_BEEPER_CONFIG,

PG_RESET_TEMPLATE(beeperConfig_t, beeperConfig,
.dshotBeaconTone = 1,
.dshotBeaconOffFlags = DSHOT_BEACON_ALLOWED_MODES,
.dshotBeaconOffFlags = DEFAULT_DSHOT_BEACON_OFF_FLAGS,
);
#endif

0 comments on commit 477c980

Please sign in to comment.