Skip to content

Commit

Permalink
Fixed bug that if thrustlock is on (no zero thrust recevied) but a
Browse files Browse the repository at this point in the history
thrust greater then MAX_THRUST is recevied this will go though. Also
changed MIN_THRUST from 10000 to 1000.
  • Loading branch information
tobbeanton committed Mar 25, 2015
1 parent a3ecf78 commit d8c3d8f
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions modules/src/commander.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include "configblock.h"
#include "param.h"

#define MIN_THRUST 10000
#define MIN_THRUST 1000
#define MAX_THRUST 60000

struct CommanderCrtpValues
Expand Down Expand Up @@ -153,21 +153,25 @@ void commanderGetThrust(uint16_t* thrust)
int usedSide = side;
uint16_t rawThrust = targetVal[usedSide].thrust;

if (thrustLocked) {
*thrust = 0;
}
else if (rawThrust > MIN_THRUST)
{
*thrust = rawThrust;
}
else
if (thrustLocked)
{
*thrust = 0;
}

if (rawThrust > MAX_THRUST)
else
{
*thrust = MAX_THRUST;
if (rawThrust > MIN_THRUST)
{
*thrust = rawThrust;
}
else
{
*thrust = 0;
}

if (rawThrust > MAX_THRUST)
{
*thrust = MAX_THRUST;
}
}

commanderWatchdog();
Expand Down

0 comments on commit d8c3d8f

Please sign in to comment.