From c57ec513973d7f444925d62f8ac3cd9bb4295c63 Mon Sep 17 00:00:00 2001 From: philsson Date: Fri, 28 Oct 2016 10:22:42 +0200 Subject: [PATCH] Temp fix for eeprom problem --- UAV-ControlSystem/inc/Flight/pid.h | 2 ++ UAV-ControlSystem/src/Flight/pid.c | 30 +++++++++++++++++++++++++----- UAV-ControlSystem/src/main.c | 4 +++- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/UAV-ControlSystem/inc/Flight/pid.h b/UAV-ControlSystem/inc/Flight/pid.h index dd9f80f..a19bd81 100644 --- a/UAV-ControlSystem/inc/Flight/pid.h +++ b/UAV-ControlSystem/inc/Flight/pid.h @@ -75,4 +75,6 @@ void pidInit(); **************************************************************************/ void pidRun(uint8_t ID); +void pidEproom(void); + #endif /* FLIGHT_PID_H_ */ diff --git a/UAV-ControlSystem/src/Flight/pid.c b/UAV-ControlSystem/src/Flight/pid.c index 335013a..b614907 100644 --- a/UAV-ControlSystem/src/Flight/pid.c +++ b/UAV-ControlSystem/src/Flight/pid.c @@ -498,9 +498,6 @@ void pidUAVInit(pidProfile_t *pidProfile, uint8_t ID) PidProfile[ID].PID_Out[PITCH] = 0; PidProfile[ID].PID_Out[YAW] = 0; - PidProfile[ID].PIDweight[ROLL] = 100; - PidProfile[ID].PIDweight[PITCH] = 100; - PidProfile[ID].PIDweight[YAW] = 100; PidProfile[ID].P[ROLL] = 10; PidProfile[ID].P[PITCH] = 10; @@ -510,6 +507,10 @@ void pidUAVInit(pidProfile_t *pidProfile, uint8_t ID) { case PID_ID_GYRO: + PidProfile[ID].PIDweight[ROLL] = 100; + PidProfile[ID].PIDweight[PITCH] = 100; + PidProfile[ID].PIDweight[YAW] = 100; + PidProfile[ID].pidEnabled = true; PidProfile[ID].dterm_lpf = 90; PidProfile[ID].pid_out_limit = 3000; @@ -517,20 +518,30 @@ void pidUAVInit(pidProfile_t *pidProfile, uint8_t ID) break; case PID_ID_ACCELEROMETER: + PidProfile[ID].PIDweight[ROLL] = 2; + PidProfile[ID].PIDweight[PITCH] = 2; + PidProfile[ID].PIDweight[YAW] = 100; + PidProfile[ID].pidEnabled = true; PidProfile[ID].dterm_lpf = 90; PidProfile[ID].pid_out_limit = 1000; - pidProfile[ID].PIDweight[ROLL] = 50; - pidProfile[ID].PIDweight[PITCH] = 50; break; case PID_ID_COMPASS: + PidProfile[ID].PIDweight[ROLL] = 100; + PidProfile[ID].PIDweight[PITCH] = 100; + PidProfile[ID].PIDweight[YAW] = 100; + PidProfile[ID].pidEnabled = false; break; case PID_ID_BAROMETER: + PidProfile[ID].PIDweight[ROLL] = 100; + PidProfile[ID].PIDweight[PITCH] = 100; + PidProfile[ID].PIDweight[YAW] = 100; + PidProfile[ID].pidEnabled = false; break; @@ -560,3 +571,12 @@ void pidInit() pidUAVInit(&PidProfile[PID_ID_BAROMETER], PID_ID_BAROMETER); pidUAVInit(&PidProfile[PID_ID_COMPASS], PID_ID_COMPASS); } + +void pidEproom(void) +{ + + PidProfile[PID_ID_ACCELEROMETER].PIDweight[ROLL] = 2; + PidProfile[PID_ID_ACCELEROMETER].PIDweight[PITCH] = 2; + PidProfile[PID_ID_ACCELEROMETER].PIDweight[YAW] = 100; + +} diff --git a/UAV-ControlSystem/src/main.c b/UAV-ControlSystem/src/main.c index b69cd1d..3edd170 100644 --- a/UAV-ControlSystem/src/main.c +++ b/UAV-ControlSystem/src/main.c @@ -51,8 +51,10 @@ void init_system() /* read saved variables from eeprom, in most cases eeprom should be read after a lot of the initializes */ readEEPROM(); + pidEproom(); + //initialize the CLI NOTE: Cant use the same usart as anything else or there will be some big trouble - cliInit(USART6); + cliInit(USART3); //init sbus, using USART1 sbus_init();