diff --git a/Source/main.cpp b/Source/main.cpp index ada59c8..331571a 100644 --- a/Source/main.cpp +++ b/Source/main.cpp @@ -118,7 +118,12 @@ void TimerUpdateMain() if(MainDrone.ExternMagInit) MagObj->GetAsync(DoneProcMag);*/ } -static bool control_update_flag = 0; +static bool control_update_flag = false; + +void TimerUpdateControl() +{ + control_update_flag = true; +} int main() { @@ -128,15 +133,17 @@ int main() TICK_Init(); TIM6_Init(TIM_PRIORITY, 500, TimerUpdateSensor, TimerUpdateMain); + TIM7_Init(TIM_PRIORITY, 200, TimerUpdateControl); IMUObj = TryFindIMU(MainDrone.IMUInit); TIM6_Enable(); + TIM7_Enable(); attitude_t attitude; rc_channels rx_chs_raw; rc_channels rx_chs_normalized; - control_channels_t ctrl_chs; + static control_channels_t ctrl_chs; attitude_init(&attitude); receiver_init(); @@ -149,7 +156,7 @@ int main() if (control_update_flag) { - control_update_flag = 0; + control_update_flag = false; Vector3 Gyro = Vector3(DataIMU.Gyr.X, DataIMU.Gyr.Y, DataIMU.Gyr.Z); diff --git a/drone.ewp b/drone.ewp index c8b1597..8aa4b53 100644 --- a/drone.ewp +++ b/drone.ewp @@ -356,12 +356,11 @@