svoe
Dependencies: mbed mbed-STM32F103C8T6 MPU6050_1
Diff: realtime.h
- Revision:
- 19:2fe650d29823
- Parent:
- 17:bd6b6ac89e0e
- Child:
- 20:e73f49ba5001
--- a/realtime.h Sun Feb 10 12:05:16 2019 +0000 +++ b/realtime.h Sun Feb 24 11:02:56 2019 +0000 @@ -1,6 +1,7 @@ Ticker rt_ticker; bool realtime_flag; + void balance_coord(){ float delta_x = (target.x - current.x); if (delta_x == 0) delta_x = 0.0001; float delta_y = (target.y - current.y); @@ -50,11 +51,10 @@ } void realtime(){ - static int fall_timer; - time_sec += t_step; - fall_timer++; if(abs(ax)<1) fall_timer=0; if(fall_timer>50) fall_flag=1; else fall_flag=0; //fall check - realtime_flag = 1; } + fall_timer++; if(abs(ax)<3) fall_timer=0; if(fall_timer>50) fall_flag=1; else fall_flag=0; //fall check + realtime_flag = 1; + } void realtime_init(){ rt_ticker.attach(&realtime, t_step); }