[MOD]: Fault-tolerant

This commit is contained in:
but0n 2016-09-27 16:32:33 +08:00
parent e0b2b4e3fb
commit a19f70a5bb
3 changed files with 9 additions and 10 deletions

View File

@ -43,6 +43,8 @@ void delay(volatile unsigned int count);
#define G_X_OFFSET 4
#define A_Z_OFFSET 0
#define IMU_ADDRESS 0x68
#define IMU_CONNECTED (MPU_Sigle_Read(WHO_AM_I)==IMU_ADDRESS)
typedef struct{
float gX;

View File

@ -47,14 +47,13 @@ short MPU_GetData(unsigned char REG_Addr) {
void MPU_init() {
IIC_init();
//delay(500);
MPU_Sigle_Write(PWR_MGMT_1, 0x00);
MPU_Sigle_Write(SMPLRT_DIV, 0x07);
MPU_Sigle_Write(CONFIG, 0x06);
MPU_Sigle_Write(GYRO_CONFIG, 0x18);
MPU_Sigle_Write(ACCEL_CONFIG, 0x01);
//LED1 = MPU_Sigle_Read(WHO_AM_I) == 0x68?0:1;
do {
MPU_Sigle_Write(PWR_MGMT_1, 0x00);
MPU_Sigle_Write(SMPLRT_DIV, 0x07);
MPU_Sigle_Write(CONFIG, 0x06);
MPU_Sigle_Write(GYRO_CONFIG, 0x18);
MPU_Sigle_Write(ACCEL_CONFIG, 0x01);
} while(IMU_CONNECTED);
}
void MPU6050_getStructData(pSixAxis cache) {

View File

@ -5,7 +5,6 @@
#include "motor.h"
#include "uart.h"
#include "wifi.h"
#include "key.h"
#define Kp 100.0f //比例增益支配率(常量)
#define Ki 0.002f //积分增益支配率
@ -102,7 +101,6 @@ int main() {
#if defined (DEBUG_PID) || defined (DEBUG_MPU6050_EULER) || defined (DEBUG_MPU6050_SOURCEDATA) || defined (DEBUG_BLDC)
SixAxis sourceData;
#endif
initLED();
//Brushless motor auto init
#ifdef DEBUG_BLDC