From abaabb6e5cc7073a6c25d0d3763def0516e50f88 Mon Sep 17 00:00:00 2001 From: drowe67 Date: Fri, 19 Jun 2015 02:24:14 +0000 Subject: [PATCH] test frames working on FreeDV 1600 and 700 git-svn-id: https://svn.code.sf.net/p/freetel/code@2209 01035d8c-6547-0410-b346-abe4f91aad63 --- fdmdv2-dev/README.txt | 8 ++++++-- fdmdv2-dev/src/fdmdv2_main.cpp | 32 ++++++++++++++++++-------------- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/fdmdv2-dev/README.txt b/fdmdv2-dev/README.txt index c53e106a..d7faee3c 100644 --- a/fdmdv2-dev/README.txt +++ b/fdmdv2-dev/README.txt @@ -174,13 +174,16 @@ TODO [ ] test mode [ ] get error patterns working again, both 700 and 1600 [ ] how to plot error histogram - [ ] file sample replay at 7500Hz work OK? - [ ] interp 7500 to 8k for spectrum plotting + [X] file sample replay at 7500Hz work OK? + [X] interp 7500 to 8k for spectrum plotting + [X] rotation of scatter diagram on FreeDV 700 + [X] freq track plot [ ] FreeDV 700 improvements [ ] bpf filter after clipping to remove clicks [ ] tcohpsk first, measure PAPR, impl loss [ ] error masking + [ ] plotting other demod stats like ch ampl and phase ests [ ] win32 X-compile [ ] installer @@ -197,6 +200,7 @@ TODO [ ] Waterfall direction [ ] test mode on 1600 with freedv api + maybe calc stats, hist + [ ] documenttation or use, walk through,you tube, blog posts [ ] Web support for Presence/spotting hooks diff --git a/fdmdv2-dev/src/fdmdv2_main.cpp b/fdmdv2-dev/src/fdmdv2_main.cpp index a699b305..80713ef3 100644 --- a/fdmdv2-dev/src/fdmdv2_main.cpp +++ b/fdmdv2-dev/src/fdmdv2_main.cpp @@ -837,7 +837,7 @@ void MainFrame::OnTimer(wxTimerEvent &evt) short speechInPlotSamples[WAVEFORM_PLOT_BUF]; if (fifo_read(g_plotSpeechInFifo, speechInPlotSamples, WAVEFORM_PLOT_BUF)) { memset(speechInPlotSamples, 0, WAVEFORM_PLOT_BUF*sizeof(short)); - fprintf(stderr, "empty!\n"); + //fprintf(stderr, "empty!\n"); } m_panelSpeechIn->add_new_short_samples(0, speechInPlotSamples, WAVEFORM_PLOT_BUF, 32767); m_panelSpeechIn->Refresh(); @@ -1062,15 +1062,16 @@ void MainFrame::OnTimer(wxTimerEvent &evt) // Toggle test frame mode at run time - if (!g_testFrames && wxGetApp().m_testFrames) { + if (!g_pfreedv->test_frames && wxGetApp().m_testFrames) { // reset stats on check box off to on transition - g_test_frame_sync_state = 0; - g_total_bits = 0; - g_total_bit_errors = 0; + g_pfreedv->test_frames = 1; + g_pfreedv->test_frame_sync_state = 0; + g_pfreedv->total_bits = 0; + g_pfreedv->total_bit_errors = 0; } - g_testFrames = wxGetApp().m_testFrames; + g_pfreedv->test_frames = wxGetApp().m_testFrames; g_channel_noise = wxGetApp().m_channel_noise; if (g_State) { @@ -1078,11 +1079,12 @@ void MainFrame::OnTimer(wxTimerEvent &evt) // update stats on main page - sprintf(bits, "Bits: %d", (int)g_total_bits); wxString bits_string(bits); m_textBits->SetLabel(bits_string); - sprintf(errors, "Errs: %d", (int)g_total_bit_errors); wxString errors_string(errors); m_textErrors->SetLabel(errors_string); - float b = (float)g_total_bit_errors/(1E-6+g_total_bits); + sprintf(bits, "Bits: %d", (int)g_pfreedv->total_bits); wxString bits_string(bits); m_textBits->SetLabel(bits_string); + sprintf(errors, "Errs: %d", (int)g_pfreedv->total_bit_errors); wxString errors_string(errors); m_textErrors->SetLabel(errors_string); + float b = (float)g_pfreedv->total_bit_errors/(1E-6+g_pfreedv->total_bits); sprintf(ber, "BER: %4.3f", b); wxString ber_string(ber); m_textBER->SetLabel(ber_string); + #ifdef FIXME // update error plots short *error_pattern = new short[g_sz_error_pattern]; @@ -1098,6 +1100,7 @@ void MainFrame::OnTimer(wxTimerEvent &evt) } delete error_pattern; + #endif } // command from UDP thread that is best processed in main thread to avoid seg faults @@ -1388,8 +1391,8 @@ void MainFrame::OnCallSignReset(wxCommandEvent& event) void MainFrame::OnBerReset(wxCommandEvent& event) { - g_total_bits = 0; - g_total_bit_errors = 0; + g_pfreedv->total_bits = 0; + g_pfreedv->total_bit_errors = 0; } #ifdef ALC @@ -1643,13 +1646,13 @@ void MainFrame::OnRecFileFromRadio(wxCommandEvent& event) { sfInfo.format = SF_FORMAT_RAW | SF_FORMAT_PCM_16; sfInfo.channels = 1; - sfInfo.samplerate = FS; + sfInfo.samplerate = g_pfreedv->modem_sample_rate; } else if(extension == wxT("wav")) { sfInfo.format = SF_FORMAT_WAV | SF_FORMAT_PCM_16; sfInfo.channels = 1; - sfInfo.samplerate = FS; + sfInfo.samplerate = g_pfreedv->modem_sample_rate; } else { wxMessageBox(wxT("Invalid file format"), wxT("Record File From Radio"), wxOK); return; @@ -3180,7 +3183,8 @@ void per_frame_rx_processing( rx_fdm[i].imag = 0.0; } - if (g_channel_noise) { + // only implemented for FreeDV 1600 at this stage + if (g_channel_noise && FREEDV_MODE_1600) { fdmdv_simulate_channel(g_pfreedv->fdmdv, rx_fdm, nin, 2.0); } fdmdv_freq_shift(rx_fdm_offset, rx_fdm, g_RxFreqOffsetHz, &g_RxFreqOffsetPhaseRect, nin); -- 2.25.1