Merge pull request #1703 from betaflight/digital_offset
Convert digital offset to percentage
This commit is contained in:
commit
b4ecb527b7
|
@ -17,7 +17,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#define EEPROM_CONF_VERSION 146
|
||||
#define EEPROM_CONF_VERSION 147
|
||||
|
||||
void initEEPROM(void);
|
||||
void writeEEPROM();
|
||||
|
|
|
@ -287,7 +287,7 @@ void resetMotorConfig(motorConfig_t *motorConfig)
|
|||
#endif
|
||||
motorConfig->maxthrottle = 2000;
|
||||
motorConfig->mincommand = 1000;
|
||||
motorConfig->digitalIdleOffset = 40;
|
||||
motorConfig->digitalIdleOffsetPercent = 3.0f;
|
||||
|
||||
int motorIndex = 0;
|
||||
for (int i = 0; i < USABLE_TIMER_CHANNEL_COUNT && motorIndex < MAX_SUPPORTED_MOTORS; i++) {
|
||||
|
|
|
@ -257,10 +257,10 @@ void initEscEndpoints(void) {
|
|||
#ifdef USE_DSHOT
|
||||
if (isMotorProtocolDshot()) {
|
||||
disarmMotorOutput = DSHOT_DISARM_COMMAND;
|
||||
minMotorOutputNormal = DSHOT_MIN_THROTTLE + motorConfig->digitalIdleOffset;
|
||||
minMotorOutputNormal = DSHOT_MIN_THROTTLE + lrintf(((DSHOT_MAX_THROTTLE - DSHOT_MIN_THROTTLE) / 100.0f) * motorConfig->digitalIdleOffsetPercent);
|
||||
maxMotorOutputNormal = DSHOT_MAX_THROTTLE;
|
||||
deadbandMotor3dHigh = DSHOT_3D_MIN_NEGATIVE; // TODO - Not working yet !! Mixer requires some throttle rescaling changes
|
||||
deadbandMotor3dLow = DSHOT_3D_MAX_POSITIVE; // TODO - Not working yet !! Mixer requires some throttle rescaling changes
|
||||
deadbandMotor3dHigh = DSHOT_3D_DEADBAND_HIGH + lrintf(((DSHOT_MAX_THROTTLE - DSHOT_3D_DEADBAND_HIGH) / 100.0f) * motorConfig->digitalIdleOffsetPercent); // TODO - Not working yet !! Mixer requires some throttle rescaling changes
|
||||
deadbandMotor3dLow = DSHOT_3D_DEADBAND_LOW;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
|
|
|
@ -43,8 +43,8 @@
|
|||
#define DSHOT_DISARM_COMMAND 0
|
||||
#define DSHOT_MIN_THROTTLE 48
|
||||
#define DSHOT_MAX_THROTTLE 2047
|
||||
#define DSHOT_3D_MAX_POSITIVE 1047 // TODO - Not working yet!! Mixer requires some throttle rescaling changes
|
||||
#define DSHOT_3D_MIN_NEGATIVE 1048// TODO - Not working yet!! Mixer requires some throttle rescaling changes
|
||||
#define DSHOT_3D_DEADBAND_LOW 1047 // TODO - Not working yet!! Mixer requires some throttle rescaling changes
|
||||
#define DSHOT_3D_DEADBAND_HIGH 1048// TODO - Not working yet!! Mixer requires some throttle rescaling changes
|
||||
|
||||
// Note: this is called MultiType/MULTITYPE_* in baseflight.
|
||||
typedef enum mixerMode
|
||||
|
|
|
@ -28,6 +28,6 @@ typedef struct motorConfig_s {
|
|||
uint16_t motorPwmRate; // The update rate of motor outputs (50-498Hz)
|
||||
uint8_t motorPwmProtocol; // Pwm Protocol
|
||||
uint8_t useUnsyncedPwm;
|
||||
uint8_t digitalIdleOffset;
|
||||
float digitalIdleOffsetPercent;
|
||||
ioTag_t ioTags[MAX_SUPPORTED_MOTORS];
|
||||
} motorConfig_t;
|
||||
|
|
|
@ -703,7 +703,7 @@ const clivalue_t valueTable[] = {
|
|||
{ "max_throttle", VAR_UINT16 | MASTER_VALUE, &masterConfig.motorConfig.maxthrottle, .config.minmax = { PWM_RANGE_ZERO, PWM_RANGE_MAX } },
|
||||
{ "min_command", VAR_UINT16 | MASTER_VALUE, &masterConfig.motorConfig.mincommand, .config.minmax = { PWM_RANGE_ZERO, PWM_RANGE_MAX } },
|
||||
#ifdef USE_DSHOT
|
||||
{ "digital_idle_offset", VAR_UINT8 | MASTER_VALUE, &masterConfig.motorConfig.digitalIdleOffset, .config.minmax = { 0, 255} },
|
||||
{ "digital_idle_percent", VAR_FLOAT | MASTER_VALUE, &masterConfig.motorConfig.digitalIdleOffsetPercent, .config.minmax = { 0, 20} },
|
||||
#endif
|
||||
{ "max_esc_throttle_jump", VAR_UINT16 | MASTER_VALUE, &masterConfig.motorConfig.maxEscThrottleJumpMs, .config.minmax = { 0, 1000 } },
|
||||
|
||||
|
|
Loading…
Reference in New Issue