Compare commits
3 commits
Author | SHA1 | Date | |
---|---|---|---|
Michael Hope | 0aceee00fc | ||
Michael Hope | 14869d0a99 | ||
Michael Hope | b90ccf4c1a |
|
@ -21,6 +21,8 @@
|
||||||
|
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
|
|
||||||
|
#include "common/utils.h"
|
||||||
|
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "gpio.h"
|
#include "gpio.h"
|
||||||
|
|
||||||
|
@ -56,7 +58,7 @@ void ledInit(void)
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
uint8_t gpio_count = sizeof(gpio_setup) / sizeof(gpio_setup[0]);
|
uint8_t gpio_count = ARRAYLEN(gpio_setup);
|
||||||
|
|
||||||
#ifdef LED0
|
#ifdef LED0
|
||||||
RCC_APB2PeriphClockCmd(LED0_PERIPHERAL, ENABLE);
|
RCC_APB2PeriphClockCmd(LED0_PERIPHERAL, ENABLE);
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
|
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
|
|
||||||
|
#include "common/utils.h"
|
||||||
|
|
||||||
#include "gpio.h"
|
#include "gpio.h"
|
||||||
|
|
||||||
#include "light_led.h"
|
#include "light_led.h"
|
||||||
|
@ -47,7 +49,7 @@ void ledInit(void)
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
uint8_t gpio_count = sizeof(gpio_setup) / sizeof(gpio_setup[0]);
|
uint8_t gpio_count = ARRAYLEN(gpio_setup);
|
||||||
|
|
||||||
#ifdef LED0
|
#ifdef LED0
|
||||||
RCC_AHBPeriphClockCmd(LED0_PERIPHERAL, ENABLE);
|
RCC_AHBPeriphClockCmd(LED0_PERIPHERAL, ENABLE);
|
||||||
|
|
|
@ -756,26 +756,26 @@ static void pidRewrite(pidProfile_t *pidProfile, controlRateConfig_t *controlRat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void pidSetController(int type)
|
void pidSetController(pidControllerType_e type)
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 0:
|
case PID_CONTROLLER_MULTI_WII:
|
||||||
default:
|
default:
|
||||||
pid_controller = pidMultiWii;
|
pid_controller = pidMultiWii;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case PID_CONTROLLER_REWRITE:
|
||||||
pid_controller = pidRewrite;
|
pid_controller = pidRewrite;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case PID_CONTROLLER_LUX_FLOAT:
|
||||||
pid_controller = pidLuxFloat;
|
pid_controller = pidLuxFloat;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case PID_CONTROLLER_MULTI_WII_23:
|
||||||
pid_controller = pidMultiWii23;
|
pid_controller = pidMultiWii23;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case PID_CONTROLLER_MULTI_WII_HYBRID:
|
||||||
pid_controller = pidMultiWiiHybrid;
|
pid_controller = pidMultiWiiHybrid;
|
||||||
break;
|
break;
|
||||||
case 5:
|
case PID_CONTROLLER_HARAKIRI:
|
||||||
pid_controller = pidHarakiri;
|
pid_controller = pidHarakiri;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,15 @@ typedef enum {
|
||||||
PID_ITEM_COUNT
|
PID_ITEM_COUNT
|
||||||
} pidIndex_e;
|
} 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)
|
#define IS_PID_CONTROLLER_FP_BASED(pidController) (pidController == 2)
|
||||||
|
|
||||||
typedef struct pidProfile_s {
|
typedef struct pidProfile_s {
|
||||||
|
@ -63,7 +72,7 @@ typedef struct pidProfile_s {
|
||||||
extern int16_t axisPID[XYZ_AXIS_COUNT];
|
extern int16_t axisPID[XYZ_AXIS_COUNT];
|
||||||
extern int32_t axisPID_P[3], axisPID_I[3], axisPID_D[3];
|
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 pidResetErrorAngle(void);
|
||||||
void pidResetErrorGyro(void);
|
void pidResetErrorGyro(void);
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
#include "common/maths.h"
|
#include "common/maths.h"
|
||||||
#include "common/axis.h"
|
#include "common/axis.h"
|
||||||
|
#include "common/utils.h"
|
||||||
|
|
||||||
#include "drivers/system.h"
|
#include "drivers/system.h"
|
||||||
#include "drivers/serial.h"
|
#include "drivers/serial.h"
|
||||||
|
@ -169,14 +170,14 @@ static const ubloxSbas_t ubloxSbas[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
enum {
|
typedef enum {
|
||||||
GPS_UNKNOWN,
|
GPS_UNKNOWN,
|
||||||
GPS_INITIALIZING,
|
GPS_INITIALIZING,
|
||||||
GPS_CHANGE_BAUD,
|
GPS_CHANGE_BAUD,
|
||||||
GPS_CONFIGURE,
|
GPS_CONFIGURE,
|
||||||
GPS_RECEIVING_DATA,
|
GPS_RECEIVING_DATA,
|
||||||
GPS_LOST_COMMUNICATION,
|
GPS_LOST_COMMUNICATION,
|
||||||
};
|
} gpsState_e;
|
||||||
|
|
||||||
gpsData_t gpsData;
|
gpsData_t gpsData;
|
||||||
|
|
||||||
|
@ -185,7 +186,7 @@ static void shiftPacketLog(void)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
|
||||||
for (i = sizeof(gpsPacketLog) - 1; i > 0 ; i--) {
|
for (i = ARRAYLEN(gpsPacketLog) - 1; i > 0 ; i--) {
|
||||||
gpsPacketLog[i] = gpsPacketLog[i-1];
|
gpsPacketLog[i] = gpsPacketLog[i-1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -194,7 +195,7 @@ static void gpsNewData(uint16_t c);
|
||||||
static bool gpsNewFrameNMEA(char c);
|
static bool gpsNewFrameNMEA(char c);
|
||||||
static bool gpsNewFrameUBLOX(uint8_t data);
|
static bool gpsNewFrameUBLOX(uint8_t data);
|
||||||
|
|
||||||
static void gpsSetState(uint8_t state)
|
static void gpsSetState(gpsState_e state)
|
||||||
{
|
{
|
||||||
gpsData.state = state;
|
gpsData.state = state;
|
||||||
gpsData.state_position = 0;
|
gpsData.state_position = 0;
|
||||||
|
|
Loading…
Reference in a new issue