public static void test()
        {
#if (!NO_NEW_ATU)
            ATUClass obj = new ATUClass();
            obj.DllExists();
#endif
        }
Exemplo n.º 2
0
        public static void test()
        {
#if(!NO_NEW_ATU)
            ATUClass obj = new ATUClass();
            obj.DllExists();
#endif
        }
Exemplo n.º 3
0
        private void udHighSWR_ValueChanged(object sender, EventArgs e)
        {
            try
            {
#if(!NO_NEW_ATU)
                ATUClass obj = new ATUClass();
                obj.Init(console.getVersion(), ref currentProfileName, false, ref high_swr, ref high_swr_no_limit,
                        ref swr_thresh, ref swr_retune_target);
#endif
                high_swr = (double)udHighSWR.Value;
#if(!NO_NEW_ATU)
                obj.Exit(deletedProfileList, ref currentProfileName, high_swr, high_swr_no_limit, swr_thresh, swr_retune_target);
#endif

            }
            catch (Exception)
            {

            }
        }
Exemplo n.º 4
0
        private void control_swr_thresh_ValueChanged(object sender, EventArgs e)
        {
            try
            {
#if(!NO_NEW_ATU)
                ATUClass obj = new ATUClass();
                obj.Init(console.getVersion(), ref currentProfileName, false, ref high_swr, ref high_swr_no_limit,
                ref swr_thresh, ref swr_retune_target);
                retuneSWRupdown.Minimum = swrTargetUpDown.Value;
                swr_thresh = (double)swrTargetUpDown.Value;
                obj.Exit(deletedProfileList, ref currentProfileName, high_swr, high_swr_no_limit, swr_thresh, swr_retune_target);
#endif
            }
            catch (Exception)
            {

            }
        }
Exemplo n.º 5
0
        private void resetATUdatabase_Click(object sender, EventArgs e)
        {
            try
            {
#if(!NO_NEW_ATU)
                ATUClass obj = new ATUClass();
                if (obj.resetATUdatabase(console.getVersion()))
                {
                    comboAntProfileName.Items.Clear();
                    currentProfileName = "Default Profile";
                    comboAntProfileName.Items.Add(currentProfileName);
                    comboAntProfileName.SelectedItem = currentProfileName;
                    //obj.Init(console.getVersion(), ref currentProfileName, true);
                }
#endif
            }
            catch (Exception)
            {

            }
        }
Exemplo n.º 6
0
        private void btnAntProfileDelete_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("Are you sure you want to delete the '" + comboAntProfileName.Text + "' antenna profile?",
                                    "Delete Profile?",
                                    MessageBoxButtons.YesNo,
                                    MessageBoxIcon.Warning);

            if (dr == DialogResult.No)
                return;


            int index = comboAntProfileName.SelectedIndex;
            deletedProfileList.Add(comboAntProfileName.Text);
            try
            {
#if(!NO_NEW_ATU)
                ATUClass obj = new ATUClass();
                profileList = obj.Init(console.getVersion(), ref currentProfileName, false, ref high_swr, ref high_swr_no_limit,
                                       ref swr_thresh, ref swr_retune_target);
                obj.Exit(deletedProfileList, ref currentProfileName, high_swr, high_swr_no_limit, swr_thresh, swr_retune_target);
                comboAntProfileName.Items.Remove(comboAntProfileName.Text);
                if (comboAntProfileName.Items.Count > 0)
                {
                    if (index > comboAntProfileName.Items.Count - 1)
                        index = comboAntProfileName.Items.Count - 1;
                    comboAntProfileName.SelectedIndex = index;
                }

                currentProfileName = comboAntProfileName.Text;
#endif
            }
            catch (Exception)
            {

            }
        }
Exemplo n.º 7
0
        private void btnAntProfileSave_Click(object sender, EventArgs e)
        {
            try
            {
#if(!NO_NEW_ATU)
                ATUClass obj = new ATUClass();
                string name = InputBox.Show("Rename Profile", "Please enter a profile name:",
                comboAntProfileName.Text);

                string oldName = comboAntProfileName.Text;
                string newName = name;

                comboAntProfileName.Items.Remove(comboAntProfileName.Text);
                comboAntProfileName.Items.Add(name);
                comboAntProfileName.SelectedItem = name;
                currentProfileName = name;
                obj.Init(console.getVersion(), ref currentProfileName, false, ref high_swr, ref high_swr_no_limit,
                         ref swr_thresh, ref swr_retune_target);
                obj.Rename(oldName, newName, ref currentProfileName);
#endif
            }
            catch (Exception)
            {

            }

        }
Exemplo n.º 8
0
        private void btnAntProfileAdd_Click(object sender, EventArgs e)
        {
            string name = InputBox.Show("Create Profile", "Please enter a profile name:",
            "AntennaProfile1");

            if (name == "" || name == null)
            {
                MessageBox.Show("Profile Save cancelled",
                    "Antenna Profile",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information);
                return;
            }


            if (comboAntProfileName.Items.Contains(name))
            {
                DialogResult result = MessageBox.Show(
                    "The profile " + name + " already exists.  Would you like to overwrite it? ",
                    "Overwrite Profile?",
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Question);

                if (result == DialogResult.No)
                    return;
            }

            if (!comboAntProfileName.Items.Contains(name))
            {
                comboAntProfileName.Items.Add(name);

                //profileList.Add(name);
                //comboAntProfileName.DataSource = profileList;
                //comboAntProfileName.Text = name;
                //comboAntProfileName.SelectedItem = name;
                currentProfileName = name;
                comboAntProfileName.SelectedItem = name;
#if(!NO_NEW_ATU)
                ATUClass obj = new ATUClass();
                obj.Init(console.getVersion(), ref currentProfileName, false, ref high_swr, ref high_swr_no_limit,
                         ref swr_thresh, ref swr_retune_target);
#endif


            }
        }
Exemplo n.º 9
0
        private void antennaProfileName_SelectedIndexChanged(object sender, EventArgs e)
        {
#if(!NO_NEW_ATU)
            if (comboAntProfileName.SelectedIndex < 0)
                return;
            ATUClass obj = new ATUClass();
            currentProfileName = comboAntProfileName.Text;

            obj.Init(console.getVersion(), ref currentProfileName, false, ref high_swr, ref high_swr_no_limit,
                 ref swr_thresh, ref swr_retune_target);
#endif

        }
Exemplo n.º 10
0
        private void FLEX3000ATUForm_Load(object sender, EventArgs e)
        {
            if (console.oldATU)
            {

            }
            try
            {
#if(!NO_NEW_ATU)
                ATUClass obj = new ATUClass();
                string version = console.getVersion();
                MemoryTune.Hide();
                ////////////
                if (comboAntProfileName.Items.Count == 0)
                {
                    profileList = obj.Init(version, ref currentProfileName, true, ref high_swr,
                                  ref  high_swr_no_limit, ref  swr_thresh, ref  swr_retune_target);
                }
                else
                {
                    profileList = obj.Init(version, ref currentProfileName, false, ref high_swr, ref high_swr_no_limit,
                                           ref swr_thresh, ref swr_retune_target);
                }
                if (profileList.Count == 0 && comboAntProfileName.Items.Count == 0)
                {
                    currentProfileName = "Default Profile";
                    comboAntProfileName.Items.Add(currentProfileName);
                    comboAntProfileName.SelectedItem = currentProfileName;
                }
                else
                {
                    foreach (string s in profileList)
                    {
                        if (!comboAntProfileName.Items.Contains(s))
                        {
                            comboAntProfileName.Items.Add(s);
                        }
                    }
                    comboAntProfileName.SelectedItem = currentProfileName;  //last saved profile (from database)
                }
                ///////

                obj.Init(version, ref currentProfileName, true, ref high_swr, ref high_swr_no_limit,
                         ref swr_thresh, ref swr_retune_target);
#endif
                swrTargetUpDown.Maximum = retuneSWRupdown.Value;
                //swr_thresh = (double)swrTargetUpDown.Value;
                //swr_retune_target = (double)retuneSWRupdown.Value;
                //high_swr = (double)udHighSWR.Value;
                //high_swr_no_limit = checkBox1.Checked;
                swrTargetUpDown.Value = (decimal)swr_thresh;
                retuneSWRupdown.Value = (decimal)swr_retune_target;
                udHighSWR.Value = (decimal)high_swr;

#if(!NO_NEW_ATU)
                profileList = obj.Init(version, ref currentProfileName, false, ref high_swr, ref high_swr_no_limit,
                                        ref swr_thresh, ref swr_retune_target);
#endif
                if (profileList.Count == 0 && comboAntProfileName.Items.Count == 0)
                {
                    currentProfileName = "Default Profile";
                    comboAntProfileName.Items.Add(currentProfileName);
                    comboAntProfileName.SelectedItem = currentProfileName;
                }
                else
                {
                    foreach (string s in profileList)
                    {
                        comboAntProfileName.Items.Add(s);
                    }
                    comboAntProfileName.SelectedItem = currentProfileName;  //last saved profile (from database)
                }


                txtFwdPow.Focus();
                //button1.PerformClick();
                //button1.Focus();
                //button1.Visible = false;

                //this.AcceptButton = button1;
                //comboAntProfileName.DataSource = profileList;
            }
            catch (Exception)
            {

            }
        }
Exemplo n.º 11
0
        private void TuneATU()
        {
            //console.FWCATUTuned();
            Debug.WriteLine("***Entering TuneATU()*****");
            HiPerfTimer t1 = new HiPerfTimer();
            t1.Start();

            Thread t2 = new Thread(new ThreadStart(progressBarTuning));
            t2.Name = "ATU Progress Bar Thread";
            t2.IsBackground = true;
            t2.Priority = ThreadPriority.Normal;
            t2.Start();

            double start_swr = 99;
            int SLEEP_TIME = (int)udSleepTime.Value;
            int OFF_SLEEP = (int)udOffSleep.Value;
            int TUN_LVL = (int)udTunPower.Value;
            int old_power = console.TunePower;
            if (abort)
            {
                last_tune_result = TuneResult.TuneAborted;
                goto end;
            }

            string last_tune_result_string = last_tune_result.ToString();
            string version = console.getVersion();
            button1.Focus();


            try
            {
#if(!NO_NEW_ATU)

                ATUClass obj = new ATUClass();
                MemoryTune.Hide();
                console.TunePower = 10;
                //Thread.Sleep(OFF_SLEEP);
                // Audio_RadioVolumeSaved = Audio.RadioVolume;

                version = console.getVersion();
                ////////////***load atu profiles if ATU button is pressed first
                if (comboAntProfileName.Items.Count == 0)
                {
                    profileList = obj.Init(version, ref currentProfileName, true, ref high_swr,
                                  ref  high_swr_no_limit, ref  swr_thresh, ref  swr_retune_target);
                }
                else
                {
                    profileList = obj.Init(version, ref currentProfileName, false, ref high_swr, ref high_swr_no_limit,
                                           ref swr_thresh, ref swr_retune_target);
                }
                if (profileList.Count == 0 && comboAntProfileName.Items.Count == 0)
                {
                    currentProfileName = "Default Profile";
                    comboAntProfileName.Items.Add(currentProfileName);
                    comboAntProfileName.SelectedItem = currentProfileName;
                }
                else
                {
                    foreach (string s in profileList)
                    {
                        if (!comboAntProfileName.Items.Contains(s))
                        {
                            comboAntProfileName.Items.Add(s);
                        }
                    }
                    comboAntProfileName.SelectedItem = currentProfileName;  //last saved profile (from database)
                }
                ///////***


                obj.DoWork( (int)console.RX1Band,
                           autoMode,
                           ref high_swr,
                           ref high_swr_no_limit,
                           ref swr_retune_target,
                           ref swr_thresh,
                           force_retune,
                           ref currentProfileName,
                           ref deletedProfileList,
                           ref start_swr,
                           console.atu_tuning,
                           ref version,
                           ref SLEEP_TIME,
                           ref OFF_SLEEP,
                           ref TUN_LVL,
                           ref byp_swr,
                           ref tun_swr,
                           ref byp_fwd_pow,
                           ref tun_fwd_pow,
                           ref byp_ref_pow,
                           ref tun_ref_pow,
                           ref abort,
                           ref tuning,
                           console.VFOAFreq,
                           ref last_tune_result_string,
                           FWC.SetATUEnable,
                           FWC.SetHiZ,
                           SetL,
                           SetC,
                           getSWR,
                           console_TunePower,
                    //console_TunePower, 
                           Audio_RadioVolume,
                           ref Audio_RadioVolumeSaved,
                           console_TUN,
                           console_TUN,
                           rdBypass_Checked,
                           rdBypass_Checked,
                           rdTune_Checked,
                           rdTune_Checked,
                           setlblHiZ_Visible);

                //autoMode = false;
                if (start_swr == 99 && !rdBypass.Checked)
                {
                    MemoryTune.Show();
                }
#endif
            }

            catch (Exception)
            {

            }

            if (last_tune_result_string == "TuneSuccessful")
                last_tune_result = TuneResult.TuneSuccessful;
            else if (last_tune_result_string == "TuneOK")
                last_tune_result = TuneResult.TuneOK;
            else if (last_tune_result_string == "TuneFailedHighSWR")
                last_tune_result = TuneResult.TuneFailedHighSWR;
            else if (last_tune_result_string == "TuneAborted")
                last_tune_result = TuneResult.TuneAborted;
            else if (last_tune_result_string == "TunerNotNeeded")
                last_tune_result = TuneResult.TunerNotNeeded;
            else if (last_tune_result_string == "TuneFailedNoRF")
                last_tune_result = TuneResult.TuneFailedNoRF;
            else if (last_tune_result_string == "TuneAutoModeTune")
                last_tune_result = TuneResult.TuneAutoModeTune;
            else if (last_tune_result_string == "TuneAutoModeBypass")
                last_tune_result = TuneResult.TuneAutoModeBypass;

        end:

            t1.Stop();
            Debug.WriteLine("The SWR has been reduced to " + tun_swr + " from " + byp_swr + "(" + start_swr + ") in " + t1.Duration.ToString("f1") + " seconds");
            LogMessageToFile("****The SWR at " + console.VFOAFreq + " MHz has been reduced to " + tun_swr + " from " + byp_swr + "(" + start_swr + ") in " + t1.Duration.ToString("f1") + " seconds***");
            tuning = false;
            console.TUN = false;
            console.TunePower = old_power;
            rdTune.Checked = false;
            console.atu_tuning = false;
            abort = false;

            lblTime.Text = "Time: " + t1.Duration.ToString("f1");
            UpdateFeedbackNew();
            tuningDLL = false;
            autoMode = false;


        }