Пример #1
0
        public void UpdateAlexAntSelection(Band band, bool tx, bool alex_enabled, bool xvtr)
        {
            if (!alex_enabled)
            {
                JanusAudio.SetAlexAntBits(0, 0, 0);
                return;
            }


            int rx_only_ant;
            int trx_ant;
            int rx_out;
            int xrx_out;

            int idx = (int)band - (int)Band.B160M;

            if (idx < 0 || idx > 11)
            {
                band = AntBandFromFreq();
                idx  = (int)band - (int)Band.B160M;
                if (idx < 0 || idx > 11)
                {
                    System.Console.WriteLine("No good ant!");
                    return;
                }
            }
            System.Console.WriteLine("Ant idx: " + idx);


            if (tx)
            {
                if (Ext2OutOnTx)
                {
                    rx_only_ant = 1;
                }
                else if (Ext1OutOnTx)
                {
                    rx_only_ant = 2;
                }
                else
                {
                    rx_only_ant = 0;
                }

                rx_out  = RxOutOnTx || Ext1OutOnTx || Ext2OutOnTx ? 1 : 0;
                trx_ant = TxAnt[idx];
            }
            else
            {
                rx_only_ant = RxOnlyAnt[idx];
                if (xvtr)
                {
                    if (rx_only_ant >= 3)
                    {
                        rx_only_ant = 3;
                    }
                    else
                    {
                        rx_only_ant = 0;
                    }
                }
                else
                {
                    if (rx_only_ant >= 3)
                    {
                        rx_only_ant -= 3;                   // do not use XVTR ant port if not using transverter
                    }
                }

                rx_out = rx_only_ant != 0 ? 1 : 0;
                if (TRxAnt)
                {
                    trx_ant = TxAnt[idx];
                }
                else
                {
                    trx_ant = RxAnt[idx];
                }
                if (RxAnt[idx] != TxAnt[idx])
                {
                    trx_ant_not_same = true;
                }
                else
                {
                    trx_ant_not_same = false;
                }
            }

            if (rx_out_override && rx_out == 1)
            {
                if (!tx)
                {
                    trx_ant = 4;
                }
                // rx_out = 0; // disable Rx_Bypass_Out relay
                if (tx) // override override
                {
                    rx_out = RxOutOnTx || Ext1OutOnTx || Ext2OutOnTx ? 1 : 0;
                }
                else
                {
                    rx_out = 0;  // disable Rx_Bypass_Out relay
                }
            }

            if (init_update)
            {
                if (rx_out == 0)
                {
                    xrx_out = 1;              // workaround for Hermes
                }
                else
                {
                    xrx_out = 0;
                }
                JanusAudio.SetAlexAntBits(rx_only_ant, trx_ant, xrx_out);
                init_update = false;
                Thread.Sleep(10);
            }
            JanusAudio.SetAlexAntBits(rx_only_ant, trx_ant, rx_out);

            // don't allow changing antenna selections when mox is activated

            /*	if ( tx )
             *      {
             *              AlexEnableSavedState = Console.getConsole().SetupForm.SetAlexAntEnabled(false);
             *              AlexEnableIsStateSaved = true;
             *      }
             *      else if ( AlexEnableIsStateSaved )
             *      {
             *              Console.getConsole().SetupForm.SetAlexAntEnabled(AlexEnableSavedState);
             *              AlexEnableIsStateSaved = false;
             *      } */

            // Console.getConsole().SetupForm.txtRXAnt.Text = rx_ant.ToString();
            //  Console.getConsole().SetupForm.txtRXOut.Text = rx_out.ToString();
            //  Console.getConsole().SetupForm.txtTXAnt.Text = tx_ant.ToString();
            // Console.getConsole().SetupForm.txtAlexBand.Text = band.ToString();
            //  Console.getConsole().SetupForm.txtAlexEnabled.Text = alex_enabled.ToString();
            //  Console.getConsole().SetupForm.txtAlexBits.Text = Convert.ToString(rc, 2);

            return;
        }
Пример #2
0
        public void UpdateAlexAntSelection(Band band, bool tx, bool alex_enabled)
        {
            if (!alex_enabled)
            {
                JanusAudio.SetAlexAntBits(0, 0, 0);
                return;
            }
            int rx_ant;
            int tx_ant;
            int rx_out;

            int idx = (int)band - (int)Band.B160M;

            if (idx < 0 || idx > 11)
            {
                band = AntBandFromFreq();
                idx  = (int)band - (int)Band.B160M;
                if (idx < 0 || idx > 11)
                {
                    System.Console.WriteLine("No good ant!");
                    return;
                }
            }
            System.Console.WriteLine("Ant idx: " + idx);


            if (tx)
            {
                rx_ant = 0;
                rx_out = RxOutOnTx ? 1 : 0;
                tx_ant = TxAnt[idx];
            }
            else
            {
                rx_ant = RxOnlyAnt[idx];
                rx_out = rx_ant != 0 ? 1 : 0;
                tx_ant = RxAnt[idx];
            }
            //  int rc = JanusAudio.SetAlexAntBits(rx_ant, tx_ant, 1);
            JanusAudio.SetAlexAntBits(rx_ant, tx_ant, rx_out);

            // don't allow changing antenna selections when mox is activated

            /*	if ( tx )
             *      {
             *              AlexEnableSavedState = Console.getConsole().SetupForm.SetAlexAntEnabled(false);
             *              AlexEnableIsStateSaved = true;
             *      }
             *      else if ( AlexEnableIsStateSaved )
             *      {
             *              Console.getConsole().SetupForm.SetAlexAntEnabled(AlexEnableSavedState);
             *              AlexEnableIsStateSaved = false;
             *      } */

            // Console.getConsole().SetupForm.txtRXAnt.Text = rx_ant.ToString();
            //  Console.getConsole().SetupForm.txtRXOut.Text = rx_out.ToString();
            //  Console.getConsole().SetupForm.txtTXAnt.Text = tx_ant.ToString();
            // Console.getConsole().SetupForm.txtAlexBand.Text = band.ToString();
            //  Console.getConsole().SetupForm.txtAlexEnabled.Text = alex_enabled.ToString();
            //  Console.getConsole().SetupForm.txtAlexBits.Text = Convert.ToString(rc, 2);

            return;
        }
Пример #3
0
        public void UpdateAlexAntSelection(Band band, bool tx, bool alex_enabled)
        {
            if (!alex_enabled)
            {
                JanusAudio.SetAlexAntBits(0, 0, 0);
                return;
            }
            int rx_ant;
            int tx_ant;
            int rx_out;

            int idx = (int)band - (int)Band.B160M;

            if (idx < 0 || idx > 11)
            {
                band = AntBandFromFreq();
                idx  = (int)band - (int)Band.B160M;
                if (idx < 0 || idx > 11)
                {
                    System.Console.WriteLine("No good ant!");
                    return;
                }
            }
            System.Console.WriteLine("Ant idx: " + idx);


            if (tx)
            {
                rx_ant = 0;
                rx_out = 0;
                tx_ant = TxAnt[idx];
            }
            else
            {
                rx_ant = RxOnlyAnt[idx];
                if (rx_ant != 0)
                {
                    rx_out = 1;
                }
                else
                {
                    rx_out = 0;
                }
                tx_ant = RxAnt[idx];
            }
            JanusAudio.SetAlexAntBits(rx_ant, tx_ant, rx_out);

            // don't allow changing antenna selections when nox is activated
            if (tx)
            {
                AlexEnableSavedState   = Console.getConsole().SetupForm.SetAlexAntEnabled(false);
                AlexEnableIsStateSaved = true;
            }
            else if (AlexEnableIsStateSaved)
            {
                Console.getConsole().SetupForm.SetAlexAntEnabled(AlexEnableSavedState);
                AlexEnableIsStateSaved = false;
            }

            return;
        }
Пример #4
0
        public void UpdateAlexAntSelection(Band band, bool tx, bool alex_enabled)
        {
            Console c = Console.getConsole();   //Vk4xv Need c.TXXVTRIndex & RXXVTRIndex

            if (c == null)
            {
                System.Console.WriteLine("no console");
                //return Band.LAST;
            }

            if (!alex_enabled)
            {
                JanusAudio.SetAlexAntBits(0, 0, 0);
                return;
            }
            int rx_ant;
            int tx_ant;
            int rx_out;

            int idx = (int)band - (int)Band.B160M;

            if (idx < 0 || idx > 11)
            {
                band = AntBandFromFreq();   // Sort Transv IF Freq
                if (idx == 12 || idx == -1) //WWV = 12 GEN = -1 Vk4xv
                {
                    idx = (int)band - (int)Band.B160M;
                }
                if (idx < 0 || idx > 26)
                {
                    System.Console.WriteLine("No good ant!");
                    return;
                }
            }
            System.Console.WriteLine("Ant idx: " + idx);


            if (tx)
            {
                if (c.TXXVTRIndex >= 0)      // VHF Bands so force Xvtr out on Tx Vk4xv
                {
                    rx_ant = 0;
                    rx_out = RxOutOnTx ? 1 : 0;
                    tx_ant = 0;
                }
                else
                {
                    rx_ant = 0;
                    rx_out = RxOutOnTx ? 1 : 0;
                    tx_ant = TxAnt[idx];
                }
            }
            else
            {
                if (c.RX1XVTRIndex >= 0)     // VHF Bands so force Xvtr on Rx Vk4xv
                {
                    rx_ant = 3;
                    rx_out = RxOutOnTx ? 1 : 0;
                    tx_ant = 0;
                }
                else
                {
                    rx_ant = RxOnlyAnt[idx];
                    rx_out = rx_ant != 0 ? 1 : 0;
                    tx_ant = RxAnt[idx];
                }
            }
            //  int rc = JanusAudio.SetAlexAntBits(rx_ant, tx_ant, 1);
            JanusAudio.SetAlexAntBits(rx_ant, tx_ant, rx_out);

            // don't allow changing antenna selections when mox is activated
            if (tx)
            {
                AlexEnableSavedState   = Console.getConsole().SetupForm.SetAlexAntEnabled(false);
                AlexEnableIsStateSaved = true;
            }
            else if (AlexEnableIsStateSaved)
            {
                Console.getConsole().SetupForm.SetAlexAntEnabled(AlexEnableSavedState);
                AlexEnableIsStateSaved = false;
            }

            // Console.getConsole().SetupForm.txtRXAnt.Text = rx_ant.ToString();
            //  Console.getConsole().SetupForm.txtRXOut.Text = rx_out.ToString();
            //  Console.getConsole().SetupForm.txtTXAnt.Text = tx_ant.ToString();
            // Console.getConsole().SetupForm.txtAlexBand.Text = band.ToString();
            //  Console.getConsole().SetupForm.txtAlexEnabled.Text = alex_enabled.ToString();
            //  Console.getConsole().SetupForm.txtAlexBits.Text = Convert.ToString(rc, 2);

            return;
        }