diff --git a/example/sco_demo_util.c b/example/sco_demo_util.c index 4f51715e1..1d3b61dd2 100644 --- a/example/sco_demo_util.c +++ b/example/sco_demo_util.c @@ -57,6 +57,8 @@ #define SCO_DEMO_MODE_SINE 0 #define SCO_DEMO_MODE_ASCII 1 #define SCO_DEMO_MODE_COUNTER 2 +#define SCO_DEMO_MODE_55 3 +#define SCO_DEMO_MODE_00 4 // SCO demo configuration @@ -76,6 +78,7 @@ #define USE_PORTAUDIO #endif + #ifdef USE_PORTAUDIO #include #include "btstack_ring_buffer.h" @@ -105,12 +108,13 @@ static uint8_t ring_buffer_storage[2*MSBC_PREBUFFER_BYTES]; static btstack_ring_buffer_t ring_buffer; #endif - static int dump_data = 1; static int count_sent = 0; static int count_received = 0; static uint8_t negotiated_codec = 0; -static int num_audio_frames = 0; +#if SCO_DEMO_MODE != SCO_DEMO_MODE_55 +static int phase = 0; +#endif FILE * msbc_file_in; FILE * msbc_file_out; @@ -141,7 +145,6 @@ static const int16_t sine_int16[] = { -19260, -17557, -15786, -13952, -12062, -10126, -8149, -6140, -4107, -2057, }; -static int phase = 0; static void sco_demo_sine_wave_int8(int num_samples, int8_t * data){ int i; for (i=0; i 'z') phase = 'a'; -#else +#endif +#if SCO_DEMO_MODE == SCO_DEMO_MODE_COUNTER int j; for (j=0;j 100000){ + printf("Summary: data %07u, packets %04u, packet with crc errors %0u, byte errors %04u\n", data_received, packets, crc_errors, byte_errors); + crc_errors = 0; + byte_errors = 0; + data_received = 0; + packets = 0; + } #if SCO_DEMO_MODE == SCO_DEMO_MODE_SINE #ifdef SCO_WAV_FILENAME @@ -538,23 +581,59 @@ void sco_demo_receive(uint8_t * packet, uint16_t size){ #endif if (packet[1] & 0x30){ - printf("SCO CRC Error: %x - data: ", (packet[1] & 0x30) >> 4); - log_info("SCO CRC Error: %x - data: ", (packet[1] & 0x30) >> 4); - printf_hexdump(&packet[3], size-3); - + crc_errors++; + // printf("SCO CRC Error: %x - data: ", (packet[1] & 0x30) >> 4); + // printf_hexdump(&packet[3], size-3); return; } if (dump_data){ - printf("data: "); #if SCO_DEMO_MODE == SCO_DEMO_MODE_ASCII + printf("data: "); int i; for (i=3;i