Update main.c fix add process

beta-adc
Alan Johnston 2 years ago committed by GitHub
parent dfcc69dddf
commit 53a4ad03e6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -2273,16 +2273,19 @@ void read_adc_process(int sig_num)
{ {
// fprintf(stderr,"read_adc_process starting\n"); // fprintf(stderr,"read_adc_process starting\n");
// if(sig_num == SIGALRM) if(sig_num == SIGALRM)
{ {
// read ADC // read ADC
// printf("read_adc_process\n"); // printf("read_adc_process\n");
if (wav_position > (BUFFER_SIZE - 1)) { if (wav_position > (BUFFER_SIZE - 1)) {
// set pwm level wav_position++;
// allow the pwm value to repeat for 8 cycles this is >>3 } else {
adc_buffer[wav_position] = 0; // reset to start
if(read(adc_file, data, 1) != 1) wav_position = 0;
{ }
adc_buffer[wav_position] = 0;
if(read(adc_file, data, 1) != 1)
{
fprintf(stderr,"Error: ADC Input/output Erorr \n"); fprintf(stderr,"Error: ADC Input/output Erorr \n");
} }
else else
@ -2293,12 +2296,7 @@ void read_adc_process(int sig_num)
// Output data to screen // Output data to screen
fprintf(stderr, "Digital value of analog input: %d in %d us\n", data[0], micros() - time_start); // millis() - time_start); fprintf(stderr, "Digital value of analog input: %d in %d us\n", data[0], micros() - time_start); // millis() - time_start);
} }
wav_position++;
} else {
// reset to start
wav_position = 0;
}
} }
} }

Loading…
Cancel
Save

Powered by TurnKey Linux.