void read_waypoint(FILE *file) { uint32_t num_points; fscanf(file, "%d\n", &num_points); double s_dist = 0; int32_t prev_east, prev_north, cur_east, cur_north; for (int i = 0; i < num_points; ++i) { char cs[2]; uint32_t ns[6]; if (fscanf(file, "%c %d %d %d %c %d %d %d\n", &cs[0], &ns[0], &ns[1], &ns[2], &cs[1], &ns[3], &ns[4], &ns[5]) <= 0) { fprintf(stderr, "file cannot be read\n"); } prev_east = cur_east; prev_north = cur_north; cur_north = ns[0] * 60*60 + ns[1] * 60 + ns[2]; cur_east = ns[3] * 60*60 + ns[4] * 60 + ns[5]; if (cs[0] == 'S') { cur_north = -cur_north; } if (cs[1] == 'W') { cur_east = -cur_east; } if (i > 0) { straight_line(prev_east, prev_north, cur_east, cur_north, &s_dist); } } }
int print_it(t_ref *d_ref, t_mlx *d_mlx) { conv_point(d_ref); straight_line(d_ref->conv, d_mlx); del_lst(&(d_ref->conv)); mlx_put_image_to_window(d_mlx->mlx, d_mlx->win, d_mlx->img, 0, 0); return (1); }
void main(void){ //============================================================================== // Main Program // // Description: This function contains the while loop that runs continuously // to act for the operating system. It also calls all the functions to // initialize the system. // // Passed : no variables passed // Locals: no variables declared // Returned: no values returned // Globals: volatile unsigned int Time_Sequence; // volatile char one_time; // char* display_1 // char* display_2 // char* display_3 // char* display_4 // slow_input_down // control_state[CNTL_STATE_INDEX] // char big // char size_count; // char posL1 // char posL2 // char posL3 // char posL4 // // Author: David Pryor // Date: Feb 2016 // Compiler: Built with IAR Embedded Workbench Version: V4.10A/W32 (6.4.1) //============================================================================== Init_Ports(); // Initialize Ports Init_Clocks(); // Initialize Clock System Init_Conditions(); Time_Sequence = SWITCH_OFF; // Init_Timers(); // Initialize Timers Init_LEDs(); // Initialize LEDs Init_LCD(); // Initialize LCD //------------------------------------------------------------------------------ // Begining of the "While" Operating System //------------------------------------------------------------------------------ while(ALWAYS) { // Can the Operating system run if(do_this == TRUE){ Five_msec_Delay(FOR_ONE_SECOND); //pause display_2 = "FORWARD"; //change display posL2 = LINE_POS_1; Display_Process(); //push display straight_line(); //forward Five_msec_Delay(FOR_ONE_SECOND); //pause display_2 = "REVERSE"; //change display posL2 = LINE_POS_1; Display_Process(); //push display straight_line_reverse(); //reverse Five_msec_Delay(FOR_ONE_SECOND); display_2 = "FORWARD"; //change display posL2 = LINE_POS_1; Display_Process(); //push display straight_line(); //forward Five_msec_Delay(FOR_ONE_SECOND); display_2 = "CW-SPIN"; //change display posL2 = LINE_POS_1; Display_Process(); //push display clockwise_spin(); //forward Five_msec_Delay(FOR_ONE_SECOND); display_2 = "CCW-SPIN"; //change display posL2 = LINE_POS_1; Display_Process(); //push display counterclockwise_spin(); //forward Five_msec_Delay(FOR_ONE_SECOND); //pause display_2 = ""; //clear display posL2 = LINE_POS_1; Display_Process(); //push display do_this = FALSE; } } //------------------------------------------------------------------------------ }