1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-17 21:35:44 +03:00

Added Dshot commands for reversing the motors and beeper for blheli_s

This commit is contained in:
Bryce Johnson 2017-06-09 01:55:04 -05:00
parent 617d36a6a9
commit 13e21c969e
8 changed files with 62 additions and 10 deletions

View file

@ -41,6 +41,7 @@
#include "fc/config.h"
#include "fc/rc_controls.h"
#include "fc/runtime_config.h"
#include "fc/fc_core.h"
#include "flight/failsafe.h"
#include "flight/imu.h"
@ -119,7 +120,6 @@ PG_REGISTER_ARRAY(motorMixer_t, MAX_SUPPORTED_MOTORS, customMotorMixer, PG_MOTOR
#define TRICOPTER_ERROR_RATE_YAW_SATURATED 75 // rate at which tricopter yaw axis becomes saturated, determined experimentally by TriFlight
static uint8_t motorCount;
static float motorMixRange;
@ -576,11 +576,14 @@ void mixTable(pidProfile_t *pidProfile)
float motorMix[MAX_SUPPORTED_MOTORS];
float motorMixMax = 0, motorMixMin = 0;
const int yawDirection = GET_DIRECTION(mixerConfig()->yaw_motors_reversed);
int motorDirection = GET_DIRECTION(isMotorsReversed());
for (int i = 0; i < motorCount; i++) {
float mix =
scaledAxisPidRoll * currentMixer[i].roll +
scaledAxisPidPitch * currentMixer[i].pitch +
scaledAxisPidYaw * currentMixer[i].yaw * (-yawDirection);
scaledAxisPidRoll * currentMixer[i].roll * (motorDirection) +
scaledAxisPidPitch * currentMixer[i].pitch * (motorDirection) +
scaledAxisPidYaw * currentMixer[i].yaw * (-yawDirection) * (motorDirection);
if (vbatCompensationFactor > 1.0f) {
mix *= vbatCompensationFactor; // Add voltage compensation