public void UpdateAlexAntSelection(Band band, bool tx, bool alex_enabled, bool xvtr) { if (!alex_enabled) { NetworkIO.SetAntBits(0, 0, 0, false); return; } int rx_only_ant; int trx_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) { 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; // NetworkIO.SetAlexAntBits(rx_only_ant, trx_ant, xrx_out); // init_update = false; // Thread.Sleep(10); //} NetworkIO.SetAntBits(rx_only_ant, trx_ant, rx_out, tx); System.Console.WriteLine("Ant Rx Only {0} , Tx Ant {1}, Rx Out {2}", rx_only_ant.ToString(), trx_ant.ToString(), rx_out.ToString()); // 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; }