From 716f345510bc58c3553d094bc18140de50d3ee20 Mon Sep 17 00:00:00 2001 From: w5wc Date: Mon, 29 Apr 2019 21:21:41 -0500 Subject: [PATCH] v2.6.7 --- .../Source/Console/HPSDR/NetworkIO.cs | 9 + Project Files/Source/Console/audio.cs | 220 +----------------- Project Files/Source/Console/console.cs | 5 +- Project Files/Source/Console/setup.cs | 9 + Project Files/Source/Console/titlebar.cs | 2 +- 5 files changed, 27 insertions(+), 218 deletions(-) diff --git a/Project Files/Source/Console/HPSDR/NetworkIO.cs b/Project Files/Source/Console/HPSDR/NetworkIO.cs index f59939d3..0248cede 100644 --- a/Project Files/Source/Console/HPSDR/NetworkIO.cs +++ b/Project Files/Source/Console/HPSDR/NetworkIO.cs @@ -387,6 +387,15 @@ public static int initRadio() EthernetHostPort = hpsdrd[chosenDevice].localPort; NumRxs = hpsdrd[chosenDevice].numRxs; + if (BoardID == HPSDRHW.HermesII) + { + if (FWCodeVersion < 103) + { + fwVersionMsg = "Invalid Firmware!\nRequires 10.3 or greater. "; + return -101; + } + } + rc = nativeInitMetis(HpSdrHwIpAddress, EthernetHostIPAddress, EthernetHostPort); return -rc; } diff --git a/Project Files/Source/Console/audio.cs b/Project Files/Source/Console/audio.cs index 91064a0e..7ea38b9b 100644 --- a/Project Files/Source/Console/audio.cs +++ b/Project Files/Source/Console/audio.cs @@ -3,7 +3,7 @@ //================================================================= // PowerSDR is a C# implementation of a Software Defined Radio. // Copyright (C) 2004-2009 FlexRadio Systems -// Copyright (C) 2010-2013 Doug Wigley +// Copyright (C) 2010-2019 Doug Wigley // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -27,13 +27,6 @@ // USA //================================================================= - -//#define VAC_DEBUG -//#define MINMAX -//#define TIMER -//#define INTERLEAVED -//#define SPLIT_INTERLEAVED - using System; using System.Collections; using System.Diagnostics; @@ -55,14 +48,6 @@ public enum AudioState { DTTSP = 0, CW, - /*SINL_COSR, - SINL_SINR, - SINL_NOR, - COSL_SINR, - NOL_SINR, - NOL_NOR, - PIPE,*/ - //SWITCH, } public enum SignalSource @@ -1360,7 +1345,6 @@ public static void EnableVAC1(bool enable) unsafe { int num_chan = 1; - // ehr add for multirate iq to vac int sample_rate = sample_rate2; int block_size = block_size_vac; double in_latency = vac1_latency_manual ? latency2 / 1000.0 : PA19.PA_GetDeviceInfo(input_dev2).defaultLowInputLatency; @@ -1373,7 +1357,6 @@ public static void EnableVAC1(bool enable) num_chan = 2; sample_rate = sample_rate1; block_size = block_size1; - //latency = 250; } else if (vac_stereo) num_chan = 2; VACRBReset = true; @@ -1400,7 +1383,6 @@ public static void EnableVAC1(bool enable) "VAC Audio Stream Startup Error", MessageBoxButtons.OK, MessageBoxIcon.Error); - //return false; } } else @@ -1419,7 +1401,6 @@ public static void EnableVAC2(bool enable) unsafe { int num_chan = 1; - // ehr add for multirate iq to vac int sample_rate = sample_rate3; int block_size = block_size_vac2; @@ -1433,10 +1414,9 @@ public static void EnableVAC2(bool enable) num_chan = 2; sample_rate = sample_rate_rx2; block_size = block_size_rx2; - //latency = 250; } else if (vac2_stereo) num_chan = 2; - // ehr end + VAC2RBReset = true; ivac.SetIVAChostAPIindex(1, host3); @@ -1462,7 +1442,6 @@ public static void EnableVAC2(bool enable) "VAC2 Audio Stream Startup Error", MessageBoxButtons.OK, MessageBoxIcon.Error); - // return false; } } else @@ -1480,17 +1459,9 @@ public static bool Start() phase_buf_l = new float[2048]; phase_buf_r = new float[2048]; - //unsafe - //{ - // retval = StartAudio(ref callback3port); //, - // // (uint)block_size1, - // // sample_rate1); - //} - rc = NetworkIO.initRadio(); if (rc != 0) { - //System.Console.WriteLine("JanusAudio.StartAudio failed w/ rc: " + rc); if (rc == -101) // firmware version error; { string fw_err = NetworkIO.getFWVersionErrorMsg(); @@ -1498,171 +1469,24 @@ public static bool Start() { fw_err = "Bad Firmware levels"; } - MessageBox.Show(fw_err, "HPSDR Error", + MessageBox.Show(fw_err, "Firmware Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } else { - MessageBox.Show("Error starting HPSDR hardware, is it connected and powered?", "HPSDR Error", + MessageBox.Show("Error starting SDR hardware, is it connected and powered?", "Network Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } } - int result = NetworkIO.StartAudioNative(callback3port); - if (result == 0) retval = true; - //if (!retval) return retval; - - //if (vac_enabled) - // unsafe - // { - // int num_chan = 1; - // // ehr add for multirate iq to vac - // int sample_rate = sample_rate2; - // int block_size = block_size_vac; - // double in_latency = vac1_latency_manual ? latency2/1000.0 : PA19.PA_GetDeviceInfo(input_dev2).defaultLowInputLatency; - // double out_latency = vac1_latency_manual_out ? latency2_out/1000.0 : PA19.PA_GetDeviceInfo(output_dev2).defaultLowOutputLatency; - // double pa_in_latency = vac1_latency_pa_in_manual ? latency_pa_in / 1000.0 : PA19.PA_GetDeviceInfo(input_dev2).defaultLowInputLatency; - // double pa_out_latency = vac1_latency_pa_out_manual ? latency_pa_out / 1000.0 : PA19.PA_GetDeviceInfo(output_dev2).defaultLowOutputLatency; - - // if (vac_output_iq) - // { - // num_chan = 2; - // sample_rate = sample_rate1; - // block_size = block_size1; - // //latency = 250; - // } - // else if (vac_stereo) num_chan = 2; - // vac_rb_reset = true; - - // ivac.SetIVAChostAPIindex(0, host2); - // ivac.SetIVACinputDEVindex(0, input_dev2); - // ivac.SetIVACoutputDEVindex(0, output_dev2); - // ivac.SetIVACnumChannels(0, num_chan); - // ivac.SetIVACInLatency(0, in_latency); - // ivac.SetIVACOutLatency(0, out_latency); - // ivac.SetIVACPAInLatency(0, pa_in_latency); - // ivac.SetIVACPAOutLatency(0, pa_out_latency); - - // try - // { - // retval = ivac.StartAudioIVAC(0) == 1; - // if (retval && console.PowerOn) - // ivac.SetIVACrun(0, 1); - // } - // catch (Exception) - // { - // MessageBox.Show("The program is having trouble starting the VAC audio streams.\n" + - // "Please examine the VAC related settings on the Setup Form -> Audio Tab and try again.", - // "VAC Audio Stream Startup Error", - // MessageBoxButtons.OK, - // MessageBoxIcon.Error); - // return false; - // } - // } - - // if (vac2_enabled) - // unsafe - // { - // int num_chan = 1; - // // ehr add for multirate iq to vac - // int sample_rate = sample_rate3; - // int block_size = block_size_vac2; - - // double in_latency = vac2_latency_manual ? latency3/1000.0 : PA19.PA_GetDeviceInfo(input_dev3).defaultLowInputLatency; - // double out_latency = vac2_latency_out_manual ? vac2_latency_out/1000.0 : PA19.PA_GetDeviceInfo(output_dev3).defaultLowOutputLatency; - // double pa_in_latency = vac2_latency_pa_in_manual ? vac2_latency_pa_in / 1000.0 : PA19.PA_GetDeviceInfo(input_dev3).defaultLowInputLatency; - // double pa_out_latency = vac2_latency_pa_out_manual ? vac2_latency_pa_out / 1000.0 : PA19.PA_GetDeviceInfo(output_dev3).defaultLowOutputLatency; - - // if (vac2_output_iq) - // { - // num_chan = 2; - // sample_rate = sample_rate_rx2; - // block_size = block_size_rx2; - // //latency = 250; - // } - // else if (vac2_stereo) num_chan = 2; - // // ehr end - // vac2_rb_reset = true; - - // ivac.SetIVAChostAPIindex(1, host3); - // ivac.SetIVACinputDEVindex(1, input_dev3); - // ivac.SetIVACoutputDEVindex(1, output_dev3); - // ivac.SetIVACnumChannels(1, num_chan); - // ivac.SetIVACInLatency(1, in_latency); - // ivac.SetIVACOutLatency(1, out_latency); - // ivac.SetIVACPAInLatency(1, pa_in_latency); - // ivac.SetIVACPAOutLatency(1, pa_out_latency); - - // try - // { - // retval = ivac.StartAudioIVAC(1) == 1; - // if (retval && console.PowerOn) - // ivac.SetIVACrun(1, 1); - - // } - // catch (Exception) - // { - // MessageBox.Show("The program is having trouble starting the VAC audio streams.\n" + - // "Please examine the VAC related settings on the Setup Form -> Audio Tab and try again.", - // "VAC2 Audio Stream Startup Error", - // MessageBoxButtons.OK, - // MessageBoxIcon.Error); - // return false; - // } - // } - - // return retval; - } - - public static unsafe bool StartAudio(ref PA19.PaStreamCallback callback) //, - // uint block_size, double sample_rate) - { - // System.Console.WriteLine("using Ozy/Janus callback"); - int rc; - // int no_send = 0; - // int sample_bits = 24; - //if (console.Force16bitIQ) - // { - // sample_bits = 16; - //} - //if (console.NoJanusSend) - //{ - // no_send = 1; - //} - rc = NetworkIO.StartAudio(/*(int)sample_rate, (int)block_size,*/ callback); //, sample_bits); - if (rc != 0) - { - //System.Console.WriteLine("JanusAudio.StartAudio failed w/ rc: " + rc); - if (rc == -101) // firmware version error; - { - string fw_err = NetworkIO.getFWVersionErrorMsg(); - if (fw_err == null) - { - fw_err = "Bad Firmware levels"; - } - MessageBox.Show(fw_err, "HPSDR Error", - MessageBoxButtons.OK, - MessageBoxIcon.Error); - return false; - } - else - { - MessageBox.Show("Error starting HPSDR hardware, is it connected and powered?", "HPSDR Error", - MessageBoxButtons.OK, - MessageBoxIcon.Error); - return false; - } - } - - return true; } private static void PortAudioErrorMessageBox(int error) @@ -1775,29 +1599,9 @@ unsafe public static void DoScope(float* buf, int frameCount) #region Scope2 Stuff - //private static int scope_samples_per_pixel = 512; - // public static int ScopeSamplesPerPixel - // { - // get { return scope_samples_per_pixel; } - // set { scope_samples_per_pixel = value; } - // } - - //private static int scope_display_width = 704; - //public static int ScopeDisplayWidth - // { - // get { return scope_display_width; } - // set { scope_display_width = value; } - // } - private static int scope2_sample_index; private static int scope2_pixel_index; - // private static float scope2_pixel_min = float.MaxValue; private static float scope2_pixel_max = float.MinValue; - // private static float[] scope2_min; - // public static float[] Scope2Min - // { - // set { scope2_min = value; } - // } public static float[] scope2_max; public static float[] Scope2Max @@ -1807,13 +1611,7 @@ public static float[] Scope2Max unsafe public static void DoScope2(float* buf, int frameCount) { - // if (scope2_min == null || scope2_min.Length < scope_display_width) - // { - // if (Display.Scope2Min == null || Display.Scope2Min.Length < scope_display_width) - // Display.Scope2Min = new float[scope_display_width]; - // scope2_min = Display.Scope2Min; - // } - if (scope2_max == null || scope2_max.Length < scope_display_width) + if (scope2_max == null || scope2_max.Length < scope_display_width) { if (Display.Scope2Max == null || Display.Scope2Max.Length < scope_display_width) Display.Scope2Max = new float[scope_display_width]; @@ -1822,21 +1620,13 @@ unsafe public static void DoScope2(float* buf, int frameCount) for (int i = 0; i < frameCount; i++) { - // if (buf[i] < scope2_pixel_min) scope2_pixel_min = buf[i]; - // if (buf[i] > scope2_pixel_max) scope2_pixel_max = buf[i]; - // scope2_pixel_min = buf[i]; scope2_pixel_max = buf[i]; - scope2_sample_index++; if (scope2_sample_index >= scope_samples_per_pixel) { scope2_sample_index = 0; - // scope2_min[scope2_pixel_index] = scope2_pixel_min; scope2_max[scope2_pixel_index] = scope2_pixel_max; - - // scope2_pixel_min = float.MaxValue; scope2_pixel_max = float.MinValue; - scope2_pixel_index++; if (scope2_pixel_index >= scope_display_width) scope2_pixel_index = 0; diff --git a/Project Files/Source/Console/console.cs b/Project Files/Source/Console/console.cs index e7614cd3..fa4d224a 100644 --- a/Project Files/Source/Console/console.cs +++ b/Project Files/Source/Console/console.cs @@ -505,10 +505,10 @@ public enum HPSDRHW { Atlas = 0, Hermes = 1, - HermesII = 2, // ANAN-10E ANAN-100B + HermesII = 2, // ANAN-10E ANAN-100B HeremesII Angelia = 3, // ANAN-100D Orion = 4, // ANAN-200D - OrionMKII = 5 // ANAN-8000DLE OrionMkII + OrionMKII = 5 // AMAM-7000DLE 7000DLEMkII ANAN-8000DLE OrionMkII } public enum DSPFilterType @@ -50125,6 +50125,7 @@ private void UpdateDSP() } UpdateRXSpectrumDisplayVars(); + UpdateTXSpectrumDisplayVars(); } diff --git a/Project Files/Source/Console/setup.cs b/Project Files/Source/Console/setup.cs index 37ebb2b2..eefca82a 100644 --- a/Project Files/Source/Console/setup.cs +++ b/Project Files/Source/Console/setup.cs @@ -18494,26 +18494,31 @@ private void chkDispNormalize_CheckedChanged(object sender, EventArgs e) private void comboTXDispPanDetector_SelectedIndexChanged(object sender, EventArgs e) { console.specRX.GetSpecRX(cmaster.inid(1, 0)).DetTypePan = comboTXDispPanDetector.SelectedIndex; + console.UpdateTXSpectrumDisplayVars(); } private void comboTXDispPanAveraging_SelectedIndexChanged(object sender, EventArgs e) { console.specRX.GetSpecRX(cmaster.inid(1, 0)).AverageMode = comboTXDispPanAveraging.SelectedIndex; + console.UpdateTXSpectrumDisplayVars(); } private void udTXDisplayAVGTime_ValueChanged(object sender, EventArgs e) { console.specRX.GetSpecRX(cmaster.inid(1, 0)).AvTau = 0.001 * (double)udTXDisplayAVGTime.Value; + console.UpdateTXSpectrumDisplayVars(); } private void chkDispTXNormalize_CheckedChanged(object sender, EventArgs e) { console.specRX.GetSpecRX(cmaster.inid(1, 0)).NormOneHzPan = chkDispTXNormalize.Checked; + console.UpdateTXSpectrumDisplayVars(); } private void tbTXDisplayFFTSize_Scroll(object sender, EventArgs e) { console.specRX.GetSpecRX(cmaster.inid(1, 0)).FFTSize = (int)(4096 * Math.Pow(2, Math.Floor((double)(tbTXDisplayFFTSize.Value)))); + console.UpdateTXSpectrumDisplayVars(); double bin_width = (double)console.specRX.GetSpecRX(cmaster.inid(1, 0)).SampleRate / (double)console.specRX.GetSpecRX(cmaster.inid(1, 0)).FFTSize; lblTXDispBinWidth.Text = bin_width.ToString("N3"); // Display.TXFFTSizeOffset = tbTXDisplayFFTSize.Value * 2; @@ -18522,21 +18527,25 @@ private void tbTXDisplayFFTSize_Scroll(object sender, EventArgs e) private void comboTXDispWinType_SelectedIndexChanged(object sender, EventArgs e) { console.specRX.GetSpecRX(cmaster.inid(1, 0)).WindowType = comboTXDispWinType.SelectedIndex; + console.UpdateTXSpectrumDisplayVars(); } private void comboTXDispWFDetector_SelectedIndexChanged(object sender, EventArgs e) { console.specRX.GetSpecRX(cmaster.inid(1, 0)).DetTypeWF = comboTXDispWFDetector.SelectedIndex; + console.UpdateTXSpectrumDisplayVars(); } private void comboTXDispWFAveraging_SelectedIndexChanged(object sender, EventArgs e) { console.specRX.GetSpecRX(cmaster.inid(1, 0)).AverageModeWF = comboTXDispWFAveraging.SelectedIndex; + console.UpdateTXSpectrumDisplayVars(); } private void udTXDisplayAVTime_ValueChanged(object sender, EventArgs e) { console.specRX.GetSpecRX(cmaster.inid(1, 0)).AvTauWF = 0.001 * (double)udTXDisplayAVTime.Value; + console.UpdateTXSpectrumDisplayVars(); } private void chkBPF2Gnd_CheckedChanged(object sender, EventArgs e) diff --git a/Project Files/Source/Console/titlebar.cs b/Project Files/Source/Console/titlebar.cs index a1498d5e..1f099f73 100644 --- a/Project Files/Source/Console/titlebar.cs +++ b/Project Files/Source/Console/titlebar.cs @@ -35,7 +35,7 @@ namespace Thetis class TitleBar { public const string BUILD_NAME = ""; - public const string BUILD_DATE = "(4/28/19)"; + public const string BUILD_DATE = "(4/29/19)"; public static string GetString() {