Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2105 | - | 1 | #include "main.h" |
2 | |||
3 | serial_data_struct data_package_receive_kopter; //Data Package for Kopter Data |
||
4 | serial_data_struct data_package_receive_computer; //Data Package for Computer Data |
||
5 | serial_data_struct data_package_flow; //Data Package for Flow Data |
||
6 | |||
7 | int tmp = 0; |
||
8 | int main(void){ |
||
9 | gpio_init(); |
||
10 | uart_init(); |
||
11 | processing_init(); |
||
12 | timer_init(); |
||
13 | flightcontrol_init(); |
||
14 | //flowcam_init(); //Uncomment for use of Raspberry Camera Module |
||
15 | reset_reference_values(); |
||
16 | |||
17 | for (;;) |
||
18 | { |
||
19 | reset_timer(); |
||
20 | |||
21 | ////////////////////////////////////////////////////////////////////////// |
||
22 | // Request Data from Kopter, renew subscribtion every 2 Seconds |
||
23 | if(interval_in_sec(2)){ |
||
24 | request_to_kopter(GET_ANALOG_DATA); |
||
25 | //request_to_kopter(GET_3D_DATA); |
||
26 | } |
||
27 | |||
28 | ////////////////////////////////////////////////////////////////////////// |
||
29 | // Receive Data from Kopter and computer at 200Hz |
||
30 | if(interval_in_msec(5)){ |
||
31 | //receive_data_from_computer(&data_package_receive_computer, 0); |
||
32 | receive_data_from_kopter(&data_package_receive_kopter); |
||
33 | } |
||
34 | |||
35 | ////////////////////////////////////////////////////////////////////////// |
||
36 | // Receive Data from Flow Module and Perform Flight Correction at 200Hz |
||
37 | if(interval_in_msec(5)){ |
||
38 | receive_data_from_flow(&data_package_flow); |
||
39 | transmit_flight_data(); |
||
40 | } |
||
41 | |||
42 | //if(interval_in_sec(10)){reset_reference_values();} |
||
43 | //if(interval_in_msec(50)){get_distance();} |
||
44 | //if(interval_in_msec(5)){get_flowcam_values();} |
||
45 | } |
||
46 | } |