private void chkEnable_CheckedChanged(object sender, System.EventArgs e)
        {
            //if(chkEnable.Checked) chkEnable.BackColor = console.ButtonSelectedColor;
            //else chkEnable.BackColor = SystemColors.Control;

            string buttonOffPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) +
                                   "\\FlexRadio Systems\\PowerSDR\\Skins\\" + console.CurrentSkin + "\\Console\\chkMON-0.png";

            string buttonOnPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) +
                                  "\\FlexRadio Systems\\PowerSDR\\Skins\\" + console.CurrentSkin + "\\Console\\chkMON-1.png";

            Bitmap buttonOffImage = new Bitmap(buttonOffPath);
            Bitmap buttonOnImage  = new Bitmap(buttonOnPath);

            if (chkEnable.Checked)
            {
                chkEnable.BackgroundImage = buttonOnImage;
            }
            else
            {
                chkEnable.BackgroundImage = buttonOffImage;
            }

            if (chkEnable.Checked)
            {
                if (!console.RX2Enabled)
                {
                    console.RX2Enabled = true;
                }
            }
            DttSP.SetDiversity(Convert.ToInt16(chkEnable.Checked));
        }
Beispiel #2
0
        public CWKeyer2(Console c)
        {
            console = c;
            if (console.CurrentModel == Model.SDR1000)
            {
                hw = console.Hdw;
            }
            siolisten = console.Siolisten;
            Thread.Sleep(50);
            DttSP.NewKeyer(600.0f, true, 0.0f, 3.0f, 25.0f, (float)Audio.SampleRate1);
            RadioDSP.KeyerIambicMode = 0;
            Thread.Sleep(50);

            threads_running = true;

            cw_tone_thread              = new Thread(new ThreadStart(DttSP.KeyerSoundThread));
            cw_tone_thread.Name         = "CW Sound Thread";
            cw_tone_thread.Priority     = ThreadPriority.Highest;
            cw_tone_thread.IsBackground = true;

            cw_tone_thread.Start();


            keyer_thread              = new Thread(new ThreadStart(KeyThread));
            keyer_thread.Name         = "CW KeyThread";
            keyer_thread.Priority     = ThreadPriority.Highest;
            keyer_thread.IsBackground = true;
            keyer_thread.Start();

            timer = new HiPerfTimer();
        }
Beispiel #3
0
        unsafe public CWKeyer2(Console c)
        {
            console   = c;
            siolisten = console.Siolisten;
            Thread.Sleep(50);
            DttSP.NewKeyer(600.0f, true, 0.0f, 3.0f, 25.0f, (float)Audio.SampleRate1);
            DttSP.SetKeyerMode(0);
            Thread.Sleep(50);


            CWTone              = new Thread(new ThreadStart(DttSP.KeyerSoundThread));
            CWTone.Name         = "CW Sound Thread";
            CWTone.Priority     = ThreadPriority.Highest;
            CWTone.IsBackground = true;
            CWTone.Start();

            Monitor              = new Thread(new ThreadStart(DttSP.KeyerMonitorThread));
            Monitor.Name         = "CW Monitor Thread";
            Monitor.Priority     = ThreadPriority.Highest;
            Monitor.IsBackground = true;
            Monitor.Start();

            Thread.Sleep(100);

            timer = new HiPerfTimer();
        }
 private void udMu_ValueChanged(object sender, System.EventArgs e)
 {
     if (chkMu.Checked)
     {
         DttSP.SetCorrectIQMu(0, 0, (double)udMu.Value);
     }
 }
Beispiel #5
0
        public CWKeyer2(Console c)
        {
            console   = c;
            hw        = console.Hdw;
            siolisten = console.Siolisten;
            Thread.Sleep(50);
            DttSP.NewKeyer(600.0f, true, 0.0f, 3.0f, 25.0f, (float)Audio.SampleRate1);
            RadioDSP.KeyerIambicMode = 0;
            Thread.Sleep(50);


            CWTone              = new Thread(new ThreadStart(DttSP.KeyerSoundThread));
            CWTone.Name         = "CW Sound Thread";
            CWTone.Priority     = ThreadPriority.Highest;
            CWTone.IsBackground = true;

            CWTone.Start();


            Keyer              = new Thread(new ThreadStart(KeyThread));
            Keyer.Name         = "CW KeyThread";
            Keyer.Priority     = ThreadPriority.Highest;
            Keyer.IsBackground = true;
            Keyer.Start();

            timer = new HiPerfTimer();
        }
Beispiel #6
0
		private void btnIQW_Click(object sender, System.EventArgs e)
		{
			float real, imag;
			DttSP.GetCorrectRXIQw(0, 0, &real, &imag, 0);
			txtIQWReal.Text = real.ToString("f6");
			txtIQWImag.Text = imag.ToString("f6");
		}
Beispiel #7
0
		private void btnSAMPLL_Click(object sender, System.EventArgs e)
		{
			float freq;
			DttSP.GetSAMFreq(0, 0, &freq);
			freq = (float)(freq*console.SampleRate1/(2*Math.PI));
			txtSAMPLL.Text = freq.ToString("f0");
		}
        private void UpdateDiversity()
        {
            DttSP.SetDiversityScalar((float)((r * 1.5) * Math.Cos(angle)), (float)((r * 1.5) * Math.Sin(angle)));

            int L = (int)Math.Min(picRadar.Width, picRadar.Height);

            p = new Point((int)(r * L / 2 * Math.Cos(angle)) + L / 2, -(int)(r * L / 2 * Math.Sin(angle)) + L / 2);
            picRadar.Invalidate();
        }
Beispiel #9
0
 private void chkTXEQ160Notch_CheckedChanged(object sender, System.EventArgs e)
 {
     if (chkTXEQ160Notch.Checked)
     {
         DttSP.SetNotch160(1);
     }
     else
     {
         DttSP.SetNotch160(0);
     }
 }
 private void checkBoxIQEnable_CheckedChanged(object sender, System.EventArgs e)
 {
     if (checkBoxIQEnable.Checked)
     {
         DttSP.SetCorrectIQEnable(0);
     }
     else
     {
         DttSP.SetCorrectIQEnable(1);
     }
 }
 private void checkBoxMNEnable_CheckedChanged(object sender, EventArgs e)
 {
     if (checkBoxMNEnable.Checked)
     {
         DttSP.SetRXManualNotchEnable(0, 0, 0, true);
     }
     else
     {
         DttSP.SetRXManualNotchEnable(0, 0, 0, false);
     }
 }
 private void chkMu_CheckedChanged(object sender, System.EventArgs e)
 {
     if (chkMu.Checked)
     {
         chkMu.BackColor = console.ButtonSelectedColor;
         DttSP.SetCorrectIQMu(0, 0, (double)udMu.Value);
     }
     else
     {
         chkMu.BackColor = SystemColors.Control;
         DttSP.SetCorrectIQMu(0, 0, 0.000);
     }
 }
Beispiel #13
0
 private void chkTXEQEnabled_CheckedChanged(object sender, System.EventArgs e)
 {
     if (chkTXEQEnabled.Checked)
     {
         DttSP.SetGrphTXEQcmd(1);
     }
     else
     {
         DttSP.SetGrphTXEQcmd(0);
     }
     picTXEQ.Invalidate();
     console.TXEQ = chkTXEQEnabled.Checked;
 }
Beispiel #14
0
 public static void SetStopBandFilter(int low, int high)
 {
     try
     {
         int i = 0;
         if (high - low >= 10)
         {
             i = DttSP.SetRXStopBandFilter(0, 0, low, high);
         }
     }
     catch (Exception ex)
     {
         Debug.Write(ex.ToString());
     }
 }
Beispiel #15
0
 public static void SetNotchFilter(int low, int high)
 {
     try
     {
         int i = 0;
         if (high - low >= 10)
         {
             i = DttSP.SetRXLowPassFilter(0, 0, Math.Abs(low));
             i = DttSP.SetRXHighPassFilter(0, 0, Math.Abs(high));
         }
     }
     catch (Exception ex)
     {
         Debug.Write(ex.ToString());
     }
 }
Beispiel #16
0
 private void chkEnable_CheckedChanged(object sender, System.EventArgs e)
 {
     if (chkEnable.Checked)
     {
         chkEnable.BackColor = console.ButtonSelectedColor;
     }
     else
     {
         chkEnable.BackColor = SystemColors.Control;
     }
     if (chkEnable.Checked)
     {
         if (!console.RX2Enabled)
         {
             console.RX2Enabled = true;
         }
     }
     DttSP.SetDiversity(Convert.ToInt16(chkEnable.Checked));
 }
        //private static int next_cpu = 1;

        public void ProcessSampleThread()
        {
            /*Thread.BeginThreadAffinity();
             * int id = AppDomain.GetCurrentThreadId();
             * int num_cpus = Environment.ProcessorCount;
             *
             * ProcessThreadCollection threads = Process.GetCurrentProcess().Threads;
             * for (int i = 0; i < threads.Count; i++)
             * {
             *  if (threads[i].Id == id)
             *  {
             *      threads[i].ProcessorAffinity = (IntPtr)next_cpu;
             *      Thread.EndThreadAffinity();
             *      //next_cpu++;
             *      //if (next_cpu > num_cpus)
             *      //    next_cpu = 1;
             *      break;
             *  }
             * }*/

            DttSP.ProcessSamplesThread(thread);
        }
Beispiel #18
0
        public static void SetFilterSubRX(int low, int high)
        {
            try
            {
                rx_filter_low_cut_subRX  = low;
                rx_filter_high_cut_subRX = high;
                if (not_pan)
                {
                    UpdateRXDisplayVars();
                }

                int i = 0;
                if (rx_filter_high_cut_subRX - rx_filter_low_cut_subRX >= 10)
                {
                    i = DttSP.SetRXFilter(0, 1, rx_filter_low_cut_subRX, rx_filter_high_cut_subRX);
                }
            }
            catch (Exception ex)
            {
                Debug.Write(ex.ToString());
            }
        }
Beispiel #19
0
        public static void SetFilter(int low, int high)     // changes yt7pwr
        {
            try
            {
                rx_filter_low_cut  = low;
                rx_filter_high_cut = high;
                if (not_pan)
                {
                    UpdateRXDisplayVars();
                }

                int i = 0;
                if (rx_filter_high_cut - rx_filter_low_cut >= 10)
                {
                    i = DttSP.SetRXFilter(0, 0, rx_filter_low_cut, rx_filter_high_cut);
                }

                if (CurrentMode == DSPMode.FMN)
                {
                    DttSP.FMreload(0, 0, low, high, high - low, 0);
                    DttSP.FMreload(0, 1, low, high, high - low, 0);
                }
                else if (CurrentMode == DSPMode.WFM)
                {
                    DttSP.FMreload(0, 0, low, high, (high - low), 1);
                    DttSP.FMreload(0, 1, low, high, (high - low), 1);
                }

                /*if (i != 0)
                 *  MessageBox.Show("Error in DttSP.SetRXFilters (SetFilter): " + i);*/
            }
            catch (Exception ex)
            {
                Debug.Write(ex.ToString());
            }
        }
 private void udMNFreq_ValueChanged(object sender, EventArgs e)
 {
     DttSP.SetRXManualNotchFreq(0, 0, 0, (double)udMNFreq.Value);
 }
		public void ProcessSampleThread()
		{
			DttSP.ProcessSamplesThread(thread);
		}
 private void checkBoxRXDCBlockEnable_CheckedChanged(object sender, EventArgs e)
 {
     DttSP.SetRXDCBlock(0, 0, checkBoxRXDCBlockEnable.Checked);
 }
 private void udDCBlock_ValueChanged(object sender, EventArgs e)
 {
     // do something to affect DC Block params here
     DttSP.SetRXDCBlockGain(0, 0, (float)udDCBlock.Value);
 }
Beispiel #24
0
        unsafe private void KeyThread() // changes yt7pwr
        {
            try
            {
                int[] tmp     = new int[1];
                bool  tune_CW = false;

                //do
                {
                    DttSP.KeyerStartedWait();

                    while (runKeyer)
                    {
                        timer.Start();
                        DttSP.PollTimerWait();
                        CWMonitorState = DttSP.KeyerPlaying();

                        if (tuneCW && !tune_CW)
                        {
                            tune_CW = true;
                            secondary_keyer_dash = false;
                            secondary_keyer_dot  = true;
                        }
                        else if (!tuneCW && tune_CW)
                        {
                            tune_CW = false;
                            secondary_keyer_dash = false;
                            secondary_keyer_dot  = false;
                        }
                        else if (memoryptt)
                        {
                            //console ptt on
                            keyprog             = true;
                            secondary_keyer_dot = secondary_keyer_dash = memorykey;

                            if (console.CWMonitorEnabled)
                            {
                                if (console.CurrentModel == Model.LimeSDR)
                                {
                                }
                            }
                        }
                        else if (!tune_CW)
                        {
                            secondary_keyer_dash = false;
                            secondary_keyer_dot  = false;
                            keyprog = false;
                        }

                        if (enabled_secondary_keyer && (secondary_keyer_mox || ptt_bit_bang_enabled))
                        {
                            keyprog = false;

                            switch (secondary_conn_port)
                            {
                            case "None":
                                break;

                            default:     // comm port
                                if (sp2.IsOpen)
                                {
                                    switch (secondary_dot_line)
                                    {
                                    case KeyerLine.DSR:
                                        secondary_keyer_dot = sp2.DsrHolding;
                                        break;

                                    case KeyerLine.CTS:
                                        secondary_keyer_dot = sp2.CtsHolding;
                                        break;

                                    case KeyerLine.DCD:
                                        secondary_keyer_dot = sp2.CDHolding;
                                        break;

                                    case KeyerLine.NONE:
                                        secondary_keyer_dot = false;
                                        break;
                                    }
                                    switch (secondary_dash_line)
                                    {
                                    case KeyerLine.DSR:
                                        secondary_keyer_dash = sp2.DsrHolding;
                                        break;

                                    case KeyerLine.CTS:
                                        secondary_keyer_dash = sp2.CtsHolding;
                                        break;

                                    case KeyerLine.DCD:
                                        secondary_keyer_dash = sp2.CDHolding;
                                        break;

                                    case KeyerLine.NONE:
                                        secondary_keyer_dash = false;
                                        break;
                                    }
                                }
                                break;
                            }
                        }

                        if (enabled_primary_keyer && !secondary_keyer_mox && !memoryptt)
                        {
                            switch (primary_conn_port)
                            {
                            case "USB":
                            {
                                switch (console.CurrentModel)
                                {
                                case Model.LimeSDR:
                                {
                                    if (console.limeSDR.device != null && console.limeSDR.connected)
                                    {
                                        uint key = console.limeSDR.device.ReadKeyer();
                                        key = key & 0xc0;
                                        //Debug.Write("Keyer: " + key.ToString() + " \n");

                                        if (key == 0x40)
                                        {
                                            primary_keyer_dash = true;
                                            primary_keyer_dot  = false;
                                        }
                                        else if (key == 0x80)
                                        {
                                            primary_keyer_dot  = true;
                                            primary_keyer_dash = false;
                                        }
                                        else
                                        {
                                            primary_keyer_dot  = false;
                                            primary_keyer_dash = false;
                                        }
                                    }
                                    else
                                    {
                                        primary_keyer_dot  = false;
                                        primary_keyer_dash = false;
                                    }
                                }
                                break;
                                }
                            }
                            break;

                            default:
                                if (sp.IsOpen)
                                {
                                    keyprog = false;

                                    keyprog            = false;
                                    primary_keyer_dash = sp.CtsHolding;
                                    primary_keyer_dot  = sp.DsrHolding;

                                    if (dtr_cw_monitor && console.CWMonitorEnabled)
                                    {
                                        if (CWMonitorState)
                                        {
                                            CW_monitor(true);
                                        }
                                        else
                                        {
                                            CW_monitor(false);
                                        }
                                    }
                                }
                                break;
                            }
                        }

                        timer.Stop();
                        msdel = (float)timer.DurationMsec;
                        //msdel = (float)DttSP.TimerRead();
                        //Debug.Write(msdel.ToString() + "\n");

                        if (keyprog || secondary_keyer_mox || tune_CW || ptt_bit_bang_enabled)
                        {
                            //keyprog = false;
                            DttSP.KeyValue(msdel, secondary_keyer_dash, secondary_keyer_dot, keyprog);
                            keyprog = false;
                        }
                        else if (primary_keyer_mox)
                        {
                            DttSP.KeyValue(msdel, primary_keyer_dash, primary_keyer_dot, keyprog);
                        }
                        else if (enabled_primary_keyer && !secondary_keyer_mox && !memoryptt)
                        {
                            DttSP.KeyValue(msdel, primary_keyer_dash, primary_keyer_dot, keyprog);
                        }
                        else
                        {
                            DttSP.KeyValue(msdel, false, false, false);
                            primary_keyer_mox   = false;
                            secondary_keyer_mox = false;
                            keyprog             = false;
                        }
                    }
                }// while (true);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error in KeyThread!\n" + ex.ToString());
            }
        }
Beispiel #25
0
 private void tbRXEQ_Scroll(object sender, System.EventArgs e)
 {
     int[] rxeq = RXEQ;
     DttSP.SetGrphRXEQ(rxeq);
     picRXEQ.Invalidate();
 }
Beispiel #26
0
 private void tbTXEQ_Scroll(object sender, System.EventArgs e)
 {
     int[] txeq = TXEQ;
     DttSP.SetGrphTXEQ(txeq);
     picTXEQ.Invalidate();
 }
Beispiel #27
0
        unsafe private void KeyThread() // changes yt7pwr
        {
            try
            {
                int[] tmp     = new int[1];
                bool  tune_CW = false;

                //do
                {
                    DttSP.KeyerStartedWait();

                    while (runKeyer)
                    {
                        timer.Start();
                        DttSP.PollTimerWait();
                        CWMonitorState = DttSP.KeyerPlaying();

                        if (tuneCW && !tune_CW)
                        {
                            tune_CW = true;
                            secondary_keyer_dash = false;
                            secondary_keyer_dot  = true;
                        }
                        else if (!tuneCW && tune_CW)
                        {
                            tune_CW = false;
                            secondary_keyer_dash = false;
                            secondary_keyer_dot  = false;
                        }
                        else if (memoryptt)
                        {
                            //console ptt on
                            keyprog             = true;
                            secondary_keyer_dot = secondary_keyer_dash = memorykey;

                            if (console.CWMonitorEnabled)
                            {
                                if (console.CurrentModel == Model.GENESIS_G6)
                                {
                                    if (memorykey)
                                    {
                                        if (!CW_monitor_on && cw_monitor_enabled)
                                        {
                                            console.g6.WriteToDevice(24, 1); // CW monitor on
                                            CW_monitor_off = false;
                                            CW_monitor_on  = true;
                                        }
                                    }
                                    else
                                    {
                                        if (!CW_monitor_off && cw_monitor_enabled)
                                        {
                                            console.g6.WriteToDevice(24, 0);  // CW monitor off
                                            CW_monitor_on  = false;
                                            CW_monitor_off = true;
                                        }
                                    }
                                }
                                else if (console.CurrentModel == Model.GENESIS_G59USB)
                                {
                                    if (memorykey)
                                    {
                                        if (!CW_monitor_on && cw_monitor_enabled)
                                        {
                                            console.g59.WriteToDevice(24, 1); // CW monitor on
                                            CW_monitor_off = false;
                                            CW_monitor_on  = true;
                                        }
                                    }
                                    else
                                    {
                                        if (!CW_monitor_off && cw_monitor_enabled)
                                        {
                                            console.g59.WriteToDevice(24, 0);  // CW monitor off
                                            CW_monitor_on  = false;
                                            CW_monitor_off = true;
                                        }
                                    }
                                }
                                else if (console.CurrentModel == Model.GENESIS_G59NET)
                                {
                                    if (memorykey)
                                    {
                                        if (!CW_monitor_on && cw_monitor_enabled)
                                        {
                                            console.net_device.WriteToDevice(24, 1); // CW monitor on
                                            CW_monitor_off = false;
                                            CW_monitor_on  = true;
                                        }
                                    }
                                    else
                                    {
                                        if (!CW_monitor_off && cw_monitor_enabled)
                                        {
                                            console.net_device.WriteToDevice(24, 0);  // CW monitor off
                                            CW_monitor_on  = false;
                                            CW_monitor_off = true;
                                        }
                                    }
                                }
                                else if (console.CurrentModel == Model.GENESIS_G11)
                                {
                                    if (memorykey)
                                    {
                                        if (!CW_monitor_on && cw_monitor_enabled)
                                        {
                                            console.g11.WriteToDevice(24, 1); // CW monitor on
                                            CW_monitor_off = false;
                                            CW_monitor_on  = true;
                                        }
                                    }
                                    else
                                    {
                                        if (!CW_monitor_off && cw_monitor_enabled)
                                        {
                                            console.g11.WriteToDevice(24, 0);  // CW monitor off
                                            CW_monitor_on  = false;
                                            CW_monitor_off = true;
                                        }
                                    }
                                }
                                else if (console.CurrentModel == Model.GENESIS_G160 ||
                                         console.CurrentModel == Model.GENESIS_G3020 ||
                                         console.CurrentModel == Model.GENESIS_G40 ||
                                         console.CurrentModel == Model.GENESIS_G80)
                                {
                                    if (memorykey)
                                    {
                                        if (!CW_monitor_on && cw_monitor_enabled)
                                        {
                                            CW_monitor(true);
                                            CW_monitor_off = false;
                                            CW_monitor_on  = true;
                                        }
                                    }
                                    else
                                    {
                                        if (!CW_monitor_off && cw_monitor_enabled)
                                        {
                                            CW_monitor(false);
                                            CW_monitor_on  = false;
                                            CW_monitor_off = true;
                                        }
                                    }
                                }
                            }
                        }
                        else if (!tune_CW)
                        {
                            secondary_keyer_dash = false;
                            secondary_keyer_dot  = false;
                            keyprog = false;
                        }

                        if (enabled_secondary_keyer && (secondary_keyer_mox || ptt_bit_bang_enabled))
                        {
                            keyprog = false;

                            switch (secondary_conn_port)
                            {
                            case "None":
                                break;

                            default:     // comm port
                                if (sp2.IsOpen)
                                {
                                    switch (secondary_dot_line)
                                    {
                                    case KeyerLine.DSR:
                                        secondary_keyer_dot = sp2.DsrHolding;
                                        break;

                                    case KeyerLine.CTS:
                                        secondary_keyer_dot = sp2.CtsHolding;
                                        break;

                                    case KeyerLine.DCD:
                                        secondary_keyer_dot = sp2.CDHolding;
                                        break;

                                    case KeyerLine.NONE:
                                        secondary_keyer_dot = false;
                                        break;
                                    }
                                    switch (secondary_dash_line)
                                    {
                                    case KeyerLine.DSR:
                                        secondary_keyer_dash = sp2.DsrHolding;
                                        break;

                                    case KeyerLine.CTS:
                                        secondary_keyer_dash = sp2.CtsHolding;
                                        break;

                                    case KeyerLine.DCD:
                                        secondary_keyer_dash = sp2.CDHolding;
                                        break;

                                    case KeyerLine.NONE:
                                        secondary_keyer_dash = false;
                                        break;
                                    }

                                    if (console.CWMonitorEnabled)
                                    {
                                        if (console.CurrentModel == Model.GENESIS_G59USB)
                                        {
                                            if (CWMonitorState)
                                            {
                                                if (!CW_monitor_on && cw_monitor_enabled)
                                                {
                                                    console.g59.WriteToDevice(24, 1);     // CW monitor on
                                                    CW_monitor_off = false;
                                                    CW_monitor_on  = true;
                                                }
                                            }
                                            else
                                            {
                                                if (!CW_monitor_off && cw_monitor_enabled)
                                                {
                                                    console.g59.WriteToDevice(24, 0);      // CW monitor off
                                                    CW_monitor_on  = false;
                                                    CW_monitor_off = true;
                                                }
                                            }
                                        }
                                        else if (console.CurrentModel == Model.GENESIS_G59NET)
                                        {
                                            if (CWMonitorState)
                                            {
                                                if (!CW_monitor_on && cw_monitor_enabled)
                                                {
                                                    console.net_device.WriteToDevice(24, 1);     // CW monitor on
                                                    CW_monitor_off = false;
                                                    CW_monitor_on  = true;
                                                }
                                            }
                                            else
                                            {
                                                if (!CW_monitor_off && cw_monitor_enabled)
                                                {
                                                    console.net_device.WriteToDevice(24, 0);      // CW monitor off
                                                    CW_monitor_on  = false;
                                                    CW_monitor_off = true;
                                                }
                                            }
                                        }
                                        else if (console.CurrentModel == Model.GENESIS_G11)
                                        {
                                            if (CWMonitorState)
                                            {
                                                if (!CW_monitor_on && cw_monitor_enabled)
                                                {
                                                    console.g11.WriteToDevice(24, 1);     // CW monitor on
                                                    CW_monitor_off = false;
                                                    CW_monitor_on  = true;
                                                }
                                            }
                                            else
                                            {
                                                if (!CW_monitor_off && cw_monitor_enabled)
                                                {
                                                    console.g11.WriteToDevice(24, 0);      // CW monitor off
                                                    CW_monitor_on  = false;
                                                    CW_monitor_off = true;
                                                }
                                            }
                                        }
                                        else if (console.CurrentModel == Model.GENESIS_G160 ||
                                                 console.CurrentModel == Model.GENESIS_G3020 ||
                                                 console.CurrentModel == Model.GENESIS_G40 ||
                                                 console.CurrentModel == Model.GENESIS_G80)
                                        {
                                            if (dtr_cw_monitor && cw_monitor_enabled)
                                            {
                                                if (CWMonitorState)
                                                {
                                                    CW_monitor(true);
                                                }
                                                else
                                                {
                                                    CW_monitor(false);
                                                }
                                            }
                                        }
                                    }
                                }
                                break;
                            }
                        }

                        if (enabled_primary_keyer && !secondary_keyer_mox && !memoryptt)
                        {
                            switch (primary_conn_port)
                            {
                            case "USB":
                            {
                                switch (console.CurrentModel)
                                {
                                case Model.GENESIS_G6:
                                {
                                    if (console.g6.Connected && console.g6.KeyerNewData)
                                    {
                                        keyprog           = false;
                                        primary_keyer_mox = true;

                                        switch (console.g6.KEYER)
                                        {
                                        case 0:                                                                // DASH ON command from USB
                                            primary_keyer_dash = true;
                                            break;

                                        case 1:                                                                // DOT ON command from USB
                                            primary_keyer_dot = true;
                                            break;

                                        case 2:                                                                // DASH OFF command from USB
                                            primary_keyer_dash = false;
                                            break;

                                        case 3:                                                                // DOT OFF command from USB
                                            primary_keyer_dot = false;
                                            break;

                                        case 0xaa:
                                            console.g6.KEYER   = 0xff;
                                            primary_keyer_dot  = false;
                                            primary_keyer_dash = false;
                                            break;

                                        case 0xcc:                                                              // TUN off
                                            console.g11.KEYER  = 0xff;
                                            primary_keyer_dot  = false;
                                            primary_keyer_dash = false;
                                            tuneCW             = false;
                                            break;

                                        default:
                                            primary_keyer_dash = false;
                                            primary_keyer_dot  = false;
                                            break;
                                        }
                                    }
                                }
                                break;

                                case Model.GENESIS_G59USB:
                                {
                                    if (console.g59.Connected && console.g59.KeyerNewData)
                                    {
                                        keyprog           = false;
                                        primary_keyer_mox = true;

                                        switch (console.g59.KEYER)
                                        {
                                        case 0:                                                                // DASH ON command from USB
                                            primary_keyer_dash = true;
                                            break;

                                        case 1:                                                                // DOT ON command from USB
                                            primary_keyer_dot = true;
                                            break;

                                        case 2:                                                                // DASH OFF command from USB
                                            primary_keyer_dash = false;
                                            break;

                                        case 3:                                                                // DOT OFF command from USB
                                            primary_keyer_dot = false;
                                            break;

                                        case 0xaa:
                                            console.g59.KEYER  = 0xff;
                                            primary_keyer_dot  = false;
                                            primary_keyer_dash = false;
                                            break;

                                        case 0xcc:                                                              // TUN off
                                            console.g11.KEYER  = 0xff;
                                            primary_keyer_dot  = false;
                                            primary_keyer_dash = false;
                                            tuneCW             = false;
                                            break;

                                        default:
                                            primary_keyer_dash = false;
                                            primary_keyer_dot  = false;
                                            break;
                                        }
                                    }
                                }
                                break;

                                case Model.GENESIS_G11:
                                {
                                    if (console.g11.Connected && console.g11.KeyerNewData)
                                    {
                                        keyprog           = false;
                                        primary_keyer_mox = true;

                                        switch (console.g11.KEYER)
                                        {
                                        case 0:                                                                // DASH ON command from USB
                                            primary_keyer_dash = true;
                                            break;

                                        case 1:                                                                // DOT ON command from USB
                                            primary_keyer_dot = true;
                                            break;

                                        case 2:                                                                // DASH OFF command from USB
                                            primary_keyer_dash = false;
                                            break;

                                        case 3:                                                                // DOT OFF command from USB
                                            primary_keyer_dot = false;
                                            break;

                                        case 0xaa:
                                            console.g11.KEYER  = 0xff;
                                            primary_keyer_dot  = false;
                                            primary_keyer_dash = false;
                                            break;

                                        case 0xcc:                                                              // TUN off
                                            console.g11.KEYER  = 0xff;
                                            primary_keyer_dot  = false;
                                            primary_keyer_dash = false;
                                            tuneCW             = false;
                                            break;

                                        default:
                                            primary_keyer_dash = false;
                                            primary_keyer_dot  = false;
                                            break;
                                        }
                                    }
                                }
                                break;
                                }
                            }
                            break;

                            case "NET":
                            {
                                if (console.net_device.Connected && console.net_device.KeyerNewData)
                                {
                                    keyprog           = false;
                                    primary_keyer_mox = true;

                                    switch (console.net_device.KEYER)
                                    {
                                    case 0:                                                        // DASH ON command from Network
                                        primary_keyer_dash = true;
                                        primary_keyer_dot  = false;
                                        break;

                                    case 1:                                                        // DOT ON command from Network
                                        primary_keyer_dot  = true;
                                        primary_keyer_dash = false;
                                        break;

                                    case 2:                                                        // DASH OFF command from Network
                                        primary_keyer_dash = false;
                                        break;

                                    case 3:                                                        // DOT OFF command from Network
                                        primary_keyer_dot = false;
                                        break;

                                    case 0xaa:
                                        console.net_device.KEYER = 0xff;
                                        primary_keyer_dot        = false;
                                        primary_keyer_dash       = false;
                                        break;

                                    default:
                                        primary_keyer_dash = false;
                                        primary_keyer_dot  = false;
                                        break;
                                    }
                                }
                            }
                            break;

                            case "QRP2000":
                            {
                                if (console.qrp2000.QRP2000Status())
                                {
                                    keyprog = false;

                                    if (console.MOX)
                                    {
                                        console.qrp2000.SetPTTGetCWInput(1, tmp);
                                    }
                                    else
                                    {
                                        console.qrp2000.SetPTTGetCWInput(0, tmp);
                                    }

                                    if (QRP2000CW1)
                                    {
                                        tmp[0] &= 0x20;
                                    }
                                    else if (QRP2000CW2)
                                    {
                                        tmp[0] &= 0x02;
                                    }

                                    if (tmp[0] == 0x00)
                                    {
                                        primary_keyer_dash = primary_keyer_dot = true;
                                    }
                                    else
                                    {
                                        primary_keyer_dash = primary_keyer_dot = false;
                                    }
                                }
                            }
                            break;

                            default:
                                if (sp.IsOpen)
                                {
                                    keyprog = false;

                                    keyprog            = false;
                                    primary_keyer_dash = sp.CtsHolding;
                                    primary_keyer_dot  = sp.DsrHolding;

                                    if (dtr_cw_monitor && console.CWMonitorEnabled)
                                    {
                                        if (CWMonitorState)
                                        {
                                            CW_monitor(true);
                                        }
                                        else
                                        {
                                            CW_monitor(false);
                                        }
                                    }
                                }
                                break;
                            }
                        }

                        timer.Stop();
                        msdel = (float)timer.DurationMsec;
                        //msdel = (float)DttSP.TimerRead();
                        //Debug.Write(msdel.ToString() + "\n");

                        if (keyprog || secondary_keyer_mox || tune_CW || ptt_bit_bang_enabled)
                        {
                            //keyprog = false;
                            DttSP.KeyValue(msdel, secondary_keyer_dash, secondary_keyer_dot, keyprog);
                            keyprog = false;
                        }
                        else if (primary_keyer_mox)
                        {
                            DttSP.KeyValue(msdel, primary_keyer_dash, primary_keyer_dot, keyprog);
                        }
                        else if (enabled_primary_keyer && !secondary_keyer_mox && !memoryptt)
                        {
                            DttSP.KeyValue(msdel, primary_keyer_dash, primary_keyer_dot, keyprog);
                        }
                        else
                        {
                            DttSP.KeyValue(msdel, false, false, false);
                            primary_keyer_mox   = false;
                            secondary_keyer_mox = false;
                            keyprog             = false;
                        }
                    }
                }// while (true);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error in KeyThread!\n" + ex.ToString());
            }
        }
Beispiel #28
0
        public static void SetTXFilters(int low, int high)
        {
            if (split_enable)
            {
                switch (CurrentModeSubRX)
                {
                case DSPMode.LSB:
                case DSPMode.CWL:
                case DSPMode.DIGL:
                    tx_filter_low_cut  = -high;
                    tx_filter_high_cut = -low;
                    break;

                case DSPMode.USB:
                case DSPMode.CWU:
                case DSPMode.DIGU:
                    tx_filter_low_cut  = low;
                    tx_filter_high_cut = high;
                    break;

                case DSPMode.DSB:
                    tx_filter_low_cut  = -high;
                    tx_filter_high_cut = high;
                    break;

                case DSPMode.AM:
                case DSPMode.SAM:
                    tx_filter_low_cut  = -high;
                    tx_filter_high_cut = high;
                    break;

                case DSPMode.FMN:
                    tx_filter_low_cut  = tx_fm_filter_low_cut;
                    tx_filter_high_cut = tx_fm_filter_high_cut;
                    break;
                }
            }
            else
            {
                switch (CurrentMode)
                {
                case DSPMode.LSB:
                case DSPMode.CWL:
                case DSPMode.DIGL:
                    tx_filter_low_cut  = -high;
                    tx_filter_high_cut = -low;
                    break;

                case DSPMode.USB:
                case DSPMode.CWU:
                case DSPMode.DIGU:
                    tx_filter_low_cut  = low;
                    tx_filter_high_cut = high;
                    break;

                case DSPMode.DSB:
                    tx_filter_low_cut  = -high;
                    tx_filter_high_cut = high;
                    break;

                case DSPMode.AM:
                case DSPMode.SAM:
                    tx_filter_low_cut  = -high;
                    tx_filter_high_cut = high;
                    break;

                case DSPMode.FMN:
                    tx_filter_low_cut  = tx_fm_filter_low_cut;
                    tx_filter_high_cut = tx_fm_filter_high_cut;
                    break;
                }
            }
            if (not_pan)
            {
                UpdateTXDisplayVars();
            }

            int i = DttSP.SetTXFilter(0, tx_filter_low_cut, tx_filter_high_cut);

            /*if (i != 0)
             *  MessageBox.Show("Error in DttSP.SetTXFilters (SetFilter): " + i);*/
        }
Beispiel #29
0
 private void tbPhase_Scroll(object sender, System.EventArgs e)
 {
     //Audio.HarmPhaseOffset = (tbPhase.Value / (double)tbPhase.Maximum)*Math.PI*2;
     DttSP.SetKeyerHarmonicRemove((double)udHarm.Value, (tbPhase.Value / (double)tbPhase.Maximum) * Math.PI * 2, (double)udAmp.Value);
 }
Beispiel #30
0
 private void udAmp_ValueChanged(object sender, System.EventArgs e)
 {
     //Audio.HarmAmp = (float)udAmp.Value;
     DttSP.SetKeyerHarmonicRemove((double)udHarm.Value, (tbPhase.Value / (double)tbPhase.Maximum) * Math.PI * 2, (double)udAmp.Value);
 }