Exemple #1
0
        public static void ReadRXLevel(float[][] table)
        {
            Band[] bands = { Band.B160M, Band.B80M, Band.B60M, Band.B40M, Band.B30M, Band.B20M,
                             Band.B17M,  Band.B15M, Band.B12M, Band.B10M, Band.B6M };

            ushort offset;

            FWC.ReadTRXEEPROMUshort(0x48, out offset);
            Thread.Sleep(40);
            if (offset == 0 || offset == 0xFFFF)
            {
                return;
            }

            uint data;

            FWC.ReadTRXEEPROMUint(offset, out data);
            Thread.Sleep(40);
            if (data == 0xFFFFFFFF)
            {
                return;
            }

            for (int i = 0; i < bands.Length; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    float f;
                    FWC.ReadTRXEEPROMFloat((uint)(offset + i * 12 + j * 4), out f);
                    Thread.Sleep(40);
                    table[(int)bands[i]][j] = f;
                }
            }
        }
Exemple #2
0
 private void chkVURXURX2_CheckedChanged(object sender, EventArgs e)
 {
     if (sendToHardware)
     {
         FWC.SetVU_RXURX2(chkVURXURX2.Checked);
     }
 }
Exemple #3
0
 private void chkVURX2V_CheckedChanged(object sender, EventArgs e)
 {
     if (sendToHardware)
     {
         FWC.SetVU_RX2V(chkVURX2V.Checked);  //rx2u to rx2v
     }
 }
Exemple #4
0
 private void chkFanHigh_CheckedChanged(object sender, EventArgs e)
 {
     if (sendToHardware)
     {
         FWC.SetVU_FanHigh(chkVUFanHigh.Checked);
     }
 }
        public static void FullTune()
        {
            byte cmd, b2, b3;
            byte b4    = 1;
            int  count = 0;

            FlushBuffer(false);

            Debug.WriteLine("fulltune start");
            FWC.ATUSendCmd((byte)ATURequest.REQ_FULLTUNE, 0, 0);


            do
            {
                FWC.ATUGetResult(out cmd, out b2, out b3, out b4, 200);
                ParseResult(cmd, b2, b3);
                Thread.Sleep(10);
            } while (cmd != 6 && cmd != 10 && count++ < 900);      //6 = CMD_SWR (tune success), 10 = CMD_TUNEFAIL

            if (tune_pass)
            {
                Debug.WriteLine("fwd: " + fwd_pwr.ToString("f2") + " ref: " + rev_pwr.ToString("f2") + " swr: " + swr.ToString("f2") + ":1-------------------------------");
            }
            else
            {
                Debug.WriteLine("Tune Failed: " + ((ATUTuneFail)tune_fail).ToString());
            }

            FlushBuffer(false);
        }
Exemple #6
0
 private void chkVUK14_CheckedChanged(object sender, EventArgs e)
 {
     if (sendToHardware)
     {
         FWC.SetVU_K14(chkVUK14.Checked);  //15 to 14
     }
 }
Exemple #7
0
 private void chkVUmodeTXV60W_CheckedChanged(object sender, EventArgs e)
 {
     FWC.SetVU_modeTXV60W(chkVUmodeTXV60W.Checked);
     if (chkVUmodeTXV60W.Checked)
     {
         chkVUFanHigh.Checked = true;
         chkVUK15.Checked     = false;
         chkVUTXV.Checked     = true;
         chkVUTXV.Checked     = false;
         chkVUK14.Checked     = false;
         chkVULPwrV.Checked   = false;
         chkVUDrvU.Checked    = false;
         chkVUDrvV.Checked    = true;
         chkVUTXIFU.Checked   = false;
         chkVUKeyV.Checked    = true;
         chkVUKeyVU.Checked   = true;
     }
     else
     {
         chkVUFanHigh.Checked = false;
         chkVUK15.Checked     = false;
         chkVUTXV.Checked     = false;
         chkVUTXV.Checked     = false;
         chkVUK14.Checked     = false;
         chkVULPwrV.Checked   = false;
         chkVUDrvU.Checked    = false;
         chkVUDrvV.Checked    = false;
         chkVUTXIFU.Checked   = false;
         chkVUKeyV.Checked    = false;
         chkVUKeyVU.Checked   = false;
     }
 }
Exemple #8
0
 private void chkVUUIFHG1_CheckedChanged(object sender, EventArgs e)
 {
     if (sendToHardware)
     {
         FWC.SetVU_UIFHG1(chkVUUIFHG1.Checked);
     }
 }
Exemple #9
0
 private void chkVURXIFV_CheckedChanged(object sender, EventArgs e)
 {
     if (sendToHardware)
     {
         FWC.SetVU_VIFHG2(chkVURXIFV.Checked);
     }
 }
Exemple #10
0
 private void chkVUK15_CheckedChanged(object sender, EventArgs e)
 {
     if (sendToHardware)
     {
         FWC.SetVU_K15(chkVUK15.Checked);  //13 to 15
     }
 }
Exemple #11
0
 private void chkVULPwrV_CheckedChanged(object sender, EventArgs e)
 {
     if (sendToHardware)
     {
         FWC.SetVU_LPwrV(chkVULPwrV.Checked);
     }
 }
Exemple #12
0
 private void chkVUK18_CheckedChanged(object sender, EventArgs e)
 {
     if (sendToHardware)
     {
         FWC.SetVU_K18(chkVUK18.Checked); //12 to 18
     }
 }
Exemple #13
0
 private void chkVUK17_CheckedChanged(object sender, EventArgs e)
 {
     if (sendToHardware)
     {
         FWC.SetVU_K17(chkVUK17.Checked); //16 to 17
     }
 }
Exemple #14
0
 private void chkVUK16_CheckedChanged(object sender, EventArgs e)
 {
     if (sendToHardware)
     {
         FWC.SetVU_K16(chkVUK16.Checked); //18 to 16
     }
 }
Exemple #15
0
        public static void Init()
        {
            FWC.GetSerialNum(out serial_number);             // get serial number
            Thread.Sleep(40);
            FWC.GetTRXOK(out trx_ok);
            Thread.Sleep(40);
            FWC.GetTRXSN(out trx_serial);
            Thread.Sleep(40);
            FWC.GetPAOK(out pa_ok);
            Thread.Sleep(40);
            FWC.GetPASN(out pa_serial);
            Thread.Sleep(40);
            FWC.GetPARev(out pa_rev);
            Thread.Sleep(40);
            FWC.GetRFIOOK(out rfio_ok);
            Thread.Sleep(40);
            FWC.GetRFIOSN(out rfio_serial);
            Thread.Sleep(40);
            FWC.GetATUOK(out atu_ok);
            Thread.Sleep(40);
            FWC.GetRX2OK(out rx2_ok);
            Thread.Sleep(40);

            uint data;             // get last cal date/time

            FWC.ReadTRXEEPROMUint(0x40, out data);
            Thread.Sleep(40);
            last_cal_date_time = (long)data << 32;
            FWC.ReadTRXEEPROMUint(0x44, out data);
            Thread.Sleep(40);
            last_cal_date_time += data;
        }
Exemple #16
0
        private void chkVUmodeVLG1_CheckedChanged(object sender, EventArgs e)
        {
            if (chkVUmodeVLG1.Checked)
            {
                FWC.SetVU_modeVLG1(chkVUmodeVLG1.Checked);
                chkVUKeyVU.Checked = false;
                chkVUKeyV.Checked  = false;
                chkVUKeyU.Checked  = false;
                chkVUTXV.Checked   = false;
                chkVUTXU.Checked   = false;

                chkVUK15.Checked    = true;
                chkVURXIFV.Checked  = true;
                chkVURXV.Checked    = true;
                chkVUVIFHG2.Checked = true;
                chkVUVIFHG1.Checked = false;
            }
            else
            {
                FWC.SetVU_modeVLG1(chkVUmodeVLG1.Checked);
                chkVUK15.Checked    = false;
                chkVURXIFV.Checked  = false;
                chkVURXV.Checked    = false;
                chkVUVIFHG2.Checked = false;
                chkVUVIFHG1.Checked = false;
            }
        }
Exemple #17
0
 private void tbLineInDB9_Scroll(object sender, System.EventArgs e)
 {
     if (chkLineInDB9Sel.Checked && !chkInputMuteAll.Checked)
     {
         FWC.WriteCodecReg(0x11, InputSliderToRegVal(tbLineInDB9.Value));
     }
 }
Exemple #18
0
 private void chkVUKeyU_CheckedChanged(object sender, EventArgs e)
 {
     if (sendToHardware)
     {
         FWC.SetVU_KeyU(chkVUKeyU.Checked);
     }
 }
        public static void SetSWRThreshold(double swr_thresh)
        {
            byte cmd = 0;

            if (swr_thresh == 1.1)
            {
                cmd = (byte)ATURequest.REQ_SWR11;
            }
            else if (swr_thresh == 1.3)
            {
                cmd = (byte)ATURequest.REQ_SWR13;
            }
            else if (swr_thresh == 1.5)
            {
                cmd = (byte)ATURequest.REQ_SWR15;
            }
            else if (swr_thresh == 1.7)
            {
                cmd = (byte)ATURequest.REQ_SWR17;
            }
            else if (swr_thresh == 2.0)
            {
                cmd = (byte)ATURequest.REQ_SWR20;
            }
            else if (swr_thresh == 2.5)
            {
                cmd = (byte)ATURequest.REQ_SWR25;
            }
            else if (swr_thresh == 3.0)
            {
                cmd = (byte)ATURequest.REQ_SWR30;
            }
            FWC.ATUSendCmd(cmd, 0, 0);
            FlushBuffer(true);
        }
Exemple #20
0
        public static void ReadTXCarrier(int[][] table)
        {
            Band[] bands = { Band.B160M, Band.B80M, Band.B60M, Band.B40M, Band.B30M, Band.B20M,
                             Band.B17M,  Band.B15M, Band.B12M, Band.B10M, Band.B6M };

            ushort offset;

            FWC.ReadTRXEEPROMUshort(0x52, out offset);
            Thread.Sleep(40);
            if (offset == 0 || offset == 0xFFFF)
            {
                return;
            }

            uint data;

            FWC.ReadTRXEEPROMUint(offset, out data);
            Thread.Sleep(40);
            if (data == 0xFFFFFFFF)
            {
                return;
            }

            for (int i = 0; i < bands.Length; i++)
            {
                FWC.ReadTRXEEPROMUint((uint)(offset + i * 4), out data);
                Thread.Sleep(40);
                for (int j = 0; j < 4; j++)
                {
                    table[(int)bands[i]][j] = (byte)(data >> (j * 8));
                }
            }
        }
        public static void FlushBuffer(bool waitForFeedback)
        {
            bool feedback = false;
            int  count    = 0;
            uint timeout  = 200;

            if (!waitForFeedback)
            {
                timeout = 0;
            }
            byte b1, b2, b3, b4;

            do
            {
                count++;
                FWC.ATUGetResult(out b1, out b2, out b3, out b4, timeout);
                if (b1 != 255 && b2 != 255 && b3 != 255)
                {
                    feedback = true;
                }
                if ((waitForFeedback && !feedback))
                {
                    Thread.Sleep((int)timeout);
                }
            } while (b4 > 0 || (waitForFeedback && !feedback) && count < 20);
        }
        private void radModeBypass_CheckedChanged(object sender, System.EventArgs e)
        {
            if (!console.fwc_init || console.CurrentModel != Model.FLEX5000)
            {
                return;
            }
            if (radModeBypass.Checked)
            {
                if (FWCATU.AutoStatus == 1)
                {
                    FWCATU.AutoTuning(false);
                }
                if (FWCATU.Active)
                {
                    FWCATU.Activate(false);
                }

                if (FWC.old_atu == true)
                {
                    FWC.ATUSendCmd(9, 0, 0);   //prevent
                    Thread.Sleep(200);
                }
                else
                {
                    //Debug.WriteLine("setting antenna 1...");
                    FWCATU.SelectAntenna1();
                }
                current_tune_mode = FWCATUMode.Bypass;
                console.FWCATUBypass();
            }
            grpTune.Enabled = !radModeBypass.Checked;
        }
Exemple #23
0
 private void chkInputMuteAll_CheckedChanged(object sender, System.EventArgs e)
 {
     if (chkInputMuteAll.Checked)
     {
         chkInputMuteAll.BackColor = console.ButtonSelectedColor;
         for (int i = 0x13; i <= 0x16; i++)
         {
             FWC.WriteCodecReg(i, 0x80);
         }
     }
     else
     {
         chkInputMuteAll.BackColor = SystemColors.Control;
         if (chkMicSel.Checked)
         {
             tbMic_Scroll(this, EventArgs.Empty);
         }
         if (chkLineInRCASel.Checked)
         {
             tbLineInRCA_Scroll(this, EventArgs.Empty);
         }
         if (chkLineInPhonoSel.Checked)
         {
             tbLineInPhono_Scroll(this, EventArgs.Empty);
         }
         if (chkLineInDB9Sel.Checked)
         {
             tbLineInDB9_Scroll(this, EventArgs.Empty);
         }
     }
 }
Exemple #24
0
 private void tbMic_Scroll(object sender, System.EventArgs e)
 {
     if (chkMicSel.Checked && !chkInputMuteAll.Checked)
     {
         FWC.WriteCodecReg(0x12, InputSliderToRegVal(tbMic.Value));
     }
 }
Exemple #25
0
        private static void WriteCalDateTime()
        {
            long l = DateTime.Now.ToFileTimeUtc();

            FWC.WriteTRXEEPROMUint(0x40, (uint)(l >> 32));
            FWC.WriteTRXEEPROMUint(0x44, (uint)l);
            last_cal_date_time = l;
        }
 private void radRX2Bypass_CheckedChanged(object sender, System.EventArgs e)
 {
     if (radRX2Bypass.Checked)
     {
         FWC.SetManualRX2Filter(false);
         FWC.BypassRX2Filter(true);
     }
 }
Exemple #27
0
        private void UpdatePreSel()
        {
            byte reg0 = 0, reg1 = 0;

            if (radBandA.Checked)
            {
                reg0 += (1 << 4); // Port 04
            }
            else if (radBandB.Checked)
            {
                reg0 += (1 << 1); // Port 01
            }
            else if (radBandC.Checked)
            {
                reg0 += (1 << 0); // Port 00
            }
            else if (radBandD.Checked)
            {
                reg0 += (1 << 2); // Port 02
            }
            else if (radBandE.Checked)
            {
                reg0 += (1 << 3); // Port 03
            }
            if (radAntRXOnly.Checked)
            {
                reg0 += (1 << 5); // Port 05
            }
            if (radAnt1.Checked)
            {
                reg0 += (1 << 6); // Port 06
            }
            if (mox && !chkBypassTR.Checked)
            {
                reg0 += (1 << 7); // Port 07
            }
            reg1 = ReverseBits((byte)tbTune.Value);
            //Debug.WriteLine("Presel slider: " + ((byte)tbTune.Value).ToString("X") + "  reg1: " + reg1.ToString("X"));

            switch (console.CurrentModel)
            {
            case Model.FLEX5000:
            case Model.FLEX3000:
                if (console.fwc_init)
                {
                    FWC.FlexWire_Write2Value(0x40, reg0, reg1);
                }
                break;

            case Model.FLEX1500:
                if (console.hid_init)
                {
                    USBHID.FlexWire_Write2Value(0x40, reg0, reg1);
                }
                break;
            }
        }
Exemple #28
0
        private void PollADC()
        {
            int chan = 0;

            switch (console.CurrentModel)
            {
            case Model.FLEX5000:
                chan = 4;
                break;

            case Model.FLEX3000:
                chan = 3;
                break;
            }

            while (!closing)
            {
                int val;
                if (FWC.ReadPAADC(2, out val) == 0)
                {
                    break;
                }
                float volts = (float)val / 4096 * 2.5f * 11;
                //if(volts < 13.0 || volts > 15.0) txtVolts.BackColor = Color.Red;
                //else txtVolts.BackColor = SystemColors.Control;
                if (!closing)
                {
                    txtVolts.Text = "Voltage: " + volts.ToString("f1");
                }
                Thread.Sleep(1000);

                if (FWC.ReadPAADC(chan, out val) == 0)
                {
                    break;
                }
                volts = (float)val / 4096 * 2.5f;
                double temp_c = 301 - volts * 1000 / 2.2;
                //if(temp_c >= 70 && temp_c < 80) txtTemp.BackColor = Color.Yellow;
                //else if(temp_c >= 80 && temp_c < 90) txtTemp.BackColor = Color.Orange;
                //else if(temp_c >= 90) txtTemp.BackColor = Color.Red;
                //else txtTemp.BackColor = Color.Green;
                if (!closing)
                {
                    switch (temp_format)
                    {
                    case TempFormat.Celsius:
                        txtTemp.Text = "Temp: " + temp_c.ToString("f0") + "° C";
                        break;

                    case TempFormat.Fahrenheit:
                        txtTemp.Text = "Temp: " + ((temp_c * 1.8) + 32).ToString("f0") + "° F";
                        break;
                    }
                }
                Thread.Sleep(1000);
            }
        }
 private void radRX1B10_CheckedChanged(object sender, System.EventArgs e)
 {
     if (radRX1B10.Checked)
     {
         FWC.SetManualRX1Filter(true);
         FWC.BypassRX1Filter(false);
         FWC.SetRX1Filter(28.4f);
     }
 }
Exemple #30
0
        public static void ReadRXImage(float[] gain_table, float[] phase_table)
        {
            Band[] bands = { Band.B160M, Band.B80M, Band.B60M, Band.B40M, Band.B30M, Band.B20M,
                             Band.B17M,  Band.B15M, Band.B12M, Band.B10M, Band.B6M };

            ushort gain_offset;

            FWC.ReadTRXEEPROMUshort(0x4A, out gain_offset);
            Thread.Sleep(40);
            if (gain_offset == 0 || gain_offset == 0xFFFF)
            {
                return;
            }

            ushort phase_offset;

            FWC.ReadTRXEEPROMUshort(0x4C, out phase_offset);
            Thread.Sleep(40);
            if (phase_offset == 0 || phase_offset == 0xFFFF)
            {
                return;
            }

            uint data;

            FWC.ReadTRXEEPROMUint(gain_offset, out data);
            Thread.Sleep(40);
            if (data == 0xFFFFFFFF)
            {
                return;
            }

            for (uint i = 0; i < bands.Length; i++)
            {
                float f;
                FWC.ReadTRXEEPROMFloat((uint)(gain_offset + i * 4), out f);
                Thread.Sleep(40);
                if (f > 500.0f || f < -500.0f)
                {
                    MessageBox.Show("Bad data detected in EEPROM.\n" +
                                    "RX Image Gain (" + bands[i].ToString() + " = " + f.ToString("f2") + ")");
                    f = 0.0f;
                }
                gain_table[(int)bands[i]] = f;
                FWC.ReadTRXEEPROMFloat((uint)(phase_offset + i * 4), out f);
                Thread.Sleep(40);
                if (f > 400.0f || f < -400.0f)
                {
                    MessageBox.Show("Bad data detected in EEPROM.\n" +
                                    "RX Image Phase (" + bands[i].ToString() + " = " + f.ToString("f2") + ")");
                    f = 0.0f;
                }
                phase_table[(int)bands[i]] = f;
            }
        }
Exemple #31
0
        public static float SendGetMessageFloat(FWC.Opcode opcode, uint data1, uint data2)
        {
            ushort id = msgID++;
            byte[] msg = new byte[37];
            msg[0] = 0xF0; // start byte
            msg[1] = 0x00; // mfc highest byte
            msg[2] = 0x00; // mfc high byte
            msg[3] = 0x41;	// mfc low byte

            byte[] guts = new byte[16];
            byte[] temp = new byte[32];

            byte[] temp2 = BitConverter.GetBytes(id);
            temp2.CopyTo(guts, 0);

            temp2 = BitConverter.GetBytes((uint)opcode);
            temp2.CopyTo(guts, 4);

            temp2 = BitConverter.GetBytes(data1);
            temp2.CopyTo(guts, 8);

            temp2 = BitConverter.GetBytes(data2);
            temp2.CopyTo(guts, 12);

            EncodeBytes(temp, guts);

            temp.CopyTo(msg, 4);
            //DebugByte(guts);

            /*DecodeBytes(guts, temp);
            DebugByte(guts);*/

            msg[36] = 0xF7;
            //DebugByte(msg);

            lock(out_lock_obj)
                if(Midi.SendLongMessage(midi_out_handle, msg) != 0)
                    Debug.WriteLine("Error in SendLongMessage");

            int counter = 0;
            while(counter++ < 100)
            {
                if(midi_in_table.ContainsKey(id))
                {
                    byte[] buf = (byte[])midi_in_table[id];
                    midi_in_table.Remove(id);
                    return BitConverter.ToSingle(buf, 2);
                }
                Thread.Sleep(10);
            }

            Debug.WriteLine("Timeout waiting on return Midi message.");
            /*Midi.MidiInStop(midi_in_handle);
            Midi.MidiInReset(midi_in_handle);
            Midi.AddSysExBuffer(midi_in_handle);
            Midi.MidiInStart(midi_in_handle);*/
            return 0;
        }
Exemple #32
0
        public static void SendSetMessage(FWC.Opcode opcode, uint data1, float data2)
        {
            ushort id = msgID++;
            byte[] msg = new byte[37];
            msg[0] = 0xF0; // start byte
            msg[1] = 0x00; // mfc highest byte
            msg[2] = 0x00; // mfc high byte
            msg[3] = 0x41;	// mfc low byte

            byte[] guts = new byte[16];
            byte[] temp = new byte[32];

            byte[] temp2 = BitConverter.GetBytes(id);
            temp2.CopyTo(guts, 0);

            temp2 = BitConverter.GetBytes((uint)opcode);
            temp2.CopyTo(guts, 4);

            temp2 = BitConverter.GetBytes(data1);
            temp2.CopyTo(guts, 8);

            temp2 = BitConverter.GetBytes(data2);
            temp2.CopyTo(guts, 12);

            EncodeBytes(temp, guts);

            temp.CopyTo(msg, 4);
            //DebugByte(guts);

            /*DecodeBytes(guts, temp);
            DebugByte(guts);*/

            msg[36] = 0xF7;
            //DebugByte(msg);

            lock(out_lock_obj)
                if(Midi.SendLongMessage(midi_out_handle, msg) != 0)
                    Debug.WriteLine("Error in SendLongMessage");
        }
Exemple #33
0
		public static int WriteOp(FWC.Opcode opcode, float data1, uint data2)
        {
            return -1;
        }
Exemple #34
0
		public static int ReadOp(FWC.Opcode opcode, uint data1, uint data2, out float rtn)
        {
            rtn = 0;
            return -1;
        }
Exemple #35
0
		public static extern int WriteOp(FWC.Opcode opcode, float data1, uint data2);
Exemple #36
0
		public static extern int ReadOp(FWC.Opcode opcode, uint data1, uint data2, out float rtn);