Blame |
Last modification |
View Log
| RSS feed
#include "main.h"
serial_data_struct data_package_receive_kopter; //Data Package for Kopter Data
serial_data_struct data_package_receive_computer; //Data Package for Computer Data
serial_data_struct data_package_flow; //Data Package for Flow Data
int tmp = 0;
int main(void){
gpio_init();
uart_init();
processing_init();
timer_init();
flightcontrol_init();
//flowcam_init(); //Uncomment for use of Raspberry Camera Module
reset_reference_values();
for (;;)
{
reset_timer();
//////////////////////////////////////////////////////////////////////////
// Request Data from Kopter, renew subscribtion every 2 Seconds
if(interval_in_sec(2)){
request_to_kopter(GET_ANALOG_DATA);
//request_to_kopter(GET_3D_DATA);
}
//////////////////////////////////////////////////////////////////////////
// Receive Data from Kopter and computer at 200Hz
if(interval_in_msec(5)){
//receive_data_from_computer(&data_package_receive_computer, 0);
receive_data_from_kopter(&data_package_receive_kopter);
}
//////////////////////////////////////////////////////////////////////////
// Receive Data from Flow Module and Perform Flight Correction at 200Hz
if(interval_in_msec(5)){
receive_data_from_flow(&data_package_flow);
transmit_flight_data();
}
//if(interval_in_sec(10)){reset_reference_values();}
//if(interval_in_msec(50)){get_distance();}
//if(interval_in_msec(5)){get_flowcam_values();}
}
}