DWORD WINAPI update_stick(LPVOID p) { while(true) { update_ppm(); Sleep(20); } return 0; }
static void serial_handler( int fd, void * user_arg ) { char line[ 256 ]; int len; if (serial_fd==0) return; if( !read_char_line( serial_fd, line, sizeof(line) ) ) { perror( "read_char" ); return; } len = strlen( line ); line[len++] = '\n'; line[len] = '\0'; if (gui->pause_raw_output->value()!=1) { gui->raw_serial_output->insert(line); Fl_Text_Buffer *textBuffer = gui->raw_serial_output->buffer(); int numLines = textBuffer->count_lines(0, textBuffer->length()); gui->raw_serial_output->scroll(numLines, 0); // ugly way to keep the buffer from growing unchecked if (numLines > 1000) { textBuffer->remove(0, (textBuffer->length()-100)); } } if( strncmp( line, "$GPADC", 6 ) == 0 ) { imu_samples++; update_adc(line); } else if( strncmp( line, "$GPPPM", 6 ) == 0 ) { update_ppm(line); } else { // Ignore the line for now } }
void Timer1IntHandler(void) { if (motoresInicializados && init_control) { if (counter_measure_mpu6050 == 10000) { counter_measure_mpu6050 = 0; iniciaLeituraMPU6050(); //atualizaControle(); } counter_measure_mpu6050++; } if (motoresInicializados && init_control) { if (counter_measure_sonar == 100000) { counter_measure_sonar = 0; iniciaLeituraSonar(SONAR_BAIXO); } counter_measure_sonar++; } update_ppm(); }