various: use enums to make the code easier to read.
Signed-off-by: Michael Hope <mlhx@google.com>
This commit is contained in:
parent
f0152a19ab
commit
34262c17cf
3 changed files with 20 additions and 11 deletions
|
@ -756,26 +756,26 @@ static void pidRewrite(pidProfile_t *pidProfile, controlRateConfig_t *controlRat
|
|||
}
|
||||
}
|
||||
|
||||
void pidSetController(int type)
|
||||
void pidSetController(pidControllerType_e type)
|
||||
{
|
||||
switch (type) {
|
||||
case 0:
|
||||
case PID_CONTROLLER_MULTI_WII:
|
||||
default:
|
||||
pid_controller = pidMultiWii;
|
||||
break;
|
||||
case 1:
|
||||
case PID_CONTROLLER_REWRITE:
|
||||
pid_controller = pidRewrite;
|
||||
break;
|
||||
case 2:
|
||||
case PID_CONTROLLER_LUX_FLOAT:
|
||||
pid_controller = pidLuxFloat;
|
||||
break;
|
||||
case 3:
|
||||
case PID_CONTROLLER_MULTI_WII_23:
|
||||
pid_controller = pidMultiWii23;
|
||||
break;
|
||||
case 4:
|
||||
case PID_CONTROLLER_MULTI_WII_HYBRID:
|
||||
pid_controller = pidMultiWiiHybrid;
|
||||
break;
|
||||
case 5:
|
||||
case PID_CONTROLLER_HARAKIRI:
|
||||
pid_controller = pidHarakiri;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,15 @@ typedef enum {
|
|||
PID_ITEM_COUNT
|
||||
} pidIndex_e;
|
||||
|
||||
typedef enum {
|
||||
PID_CONTROLLER_MULTI_WII,
|
||||
PID_CONTROLLER_REWRITE,
|
||||
PID_CONTROLLER_LUX_FLOAT,
|
||||
PID_CONTROLLER_MULTI_WII_23,
|
||||
PID_CONTROLLER_MULTI_WII_HYBRID,
|
||||
PID_CONTROLLER_HARAKIRI,
|
||||
} pidControllerType_e;
|
||||
|
||||
#define IS_PID_CONTROLLER_FP_BASED(pidController) (pidController == 2)
|
||||
|
||||
typedef struct pidProfile_s {
|
||||
|
@ -63,7 +72,7 @@ typedef struct pidProfile_s {
|
|||
extern int16_t axisPID[XYZ_AXIS_COUNT];
|
||||
extern int32_t axisPID_P[3], axisPID_I[3], axisPID_D[3];
|
||||
|
||||
void pidSetController(int type);
|
||||
void pidSetController(pidControllerType_e type);
|
||||
void pidResetErrorAngle(void);
|
||||
void pidResetErrorGyro(void);
|
||||
|
||||
|
|
|
@ -170,14 +170,14 @@ static const ubloxSbas_t ubloxSbas[] = {
|
|||
};
|
||||
|
||||
|
||||
enum {
|
||||
typedef enum {
|
||||
GPS_UNKNOWN,
|
||||
GPS_INITIALIZING,
|
||||
GPS_CHANGE_BAUD,
|
||||
GPS_CONFIGURE,
|
||||
GPS_RECEIVING_DATA,
|
||||
GPS_LOST_COMMUNICATION,
|
||||
};
|
||||
} gpsState_e;
|
||||
|
||||
gpsData_t gpsData;
|
||||
|
||||
|
@ -195,7 +195,7 @@ static void gpsNewData(uint16_t c);
|
|||
static bool gpsNewFrameNMEA(char c);
|
||||
static bool gpsNewFrameUBLOX(uint8_t data);
|
||||
|
||||
static void gpsSetState(uint8_t state)
|
||||
static void gpsSetState(gpsState_e state)
|
||||
{
|
||||
gpsData.state = state;
|
||||
gpsData.state_position = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue