Skip to content

Commit

Permalink
Merge pull request #1136 from flapper-drones/bugfix_flapper_platform
Browse files Browse the repository at this point in the history
Bugfix flapper power distribution
  • Loading branch information
krichardsson authored Oct 13, 2022
2 parents a90aa33 + fb3bf91 commit 0281706
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions src/modules/src/power_distribution_flapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ static float pitch_ampl = 0.4f; // 1 = full servo stroke

#if CONFIG_POWER_DISTRIBUTION_FLAPPER_REVB
uint32_t idPitch = 1;
uint32_t idYaw = 4;
uint32_t idYaw = 2;
#else
uint32_t idPitch = 2;
uint32_t idYaw = 4;
uint32_t idPitch = 0;
uint32_t idYaw = 2;
#endif

static uint8_t limitServoNeutral(uint8_t value)
Expand Down Expand Up @@ -102,16 +102,27 @@ static int8_t limitRollBias(uint8_t value)

int powerDistributionMotorType(uint32_t id)
{
int type = 0;
if (id == (idPitch || idYaw)) type = 1;
int type = 1;
if (id == idPitch || id == idYaw)
{
type = 0;
}

return type;
}

uint16_t powerDistributionStopRatio(uint32_t id)
{
uint16_t stopRatio = 0;
if (id==idPitch) stopRatio = flapperConfig.pitchServoNeutral*act_max/100.0f;
else if (id==idYaw) stopRatio = flapperConfig.yawServoNeutral*act_max/100.0f;
if (id == idPitch)
{
stopRatio = flapperConfig.pitchServoNeutral*act_max/100.0f;
}
else if (id == idYaw)
{
stopRatio = flapperConfig.yawServoNeutral*act_max/100.0f;
}

return stopRatio;
}

Expand Down

0 comments on commit 0281706

Please sign in to comment.