当前位置: 首页>>代码示例>>C#>>正文


C# Progress.Hide方法代码示例

本文整理汇总了C#中Progress.Hide方法的典型用法代码示例。如果您正苦于以下问题:C# Progress.Hide方法的具体用法?C# Progress.Hide怎么用?C# Progress.Hide使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Progress的用法示例。


在下文中一共展示了Progress.Hide方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: progressBarTuning

        private void progressBarTuning()
        {
            float maxTuningTime_ms = 25000;
            float offset = 0;
            float multiplier = 1;
            bool slowDown = false;
            float percent = 0;
            HiPerfTimer t3 = new HiPerfTimer();
            t3.Start();

            Progress p = new Progress("ATU Tuning Progress");
            p.SetPercent(0.0f);
            console.Invoke(new MethodInvoker(p.Show));

            while (tuningDLL)// && t3.DurationMsec< maxTuningTime_ms*2)
            {
                t3.Stop();
                if (t3.DurationMsec > maxTuningTime_ms / 2 && slowDown == false)
                {
                    t3.Start();
                    offset = 0.5f;
                    multiplier = 2;
                    slowDown = true;
                }
                percent = offset + (float)t3.DurationMsec / (maxTuningTime_ms * multiplier);
                if (percent < .98)
                {
                    p.SetPercent(percent);
                }
                else
                {
                    p.SetPercent(.98f);
                }
                if (!p.Visible)
                {
                    abort = true;
                }
                Thread.Sleep(400);

            }
            p.SetPercent(1);
            Thread.Sleep(500);
            p.Hide();


        }
开发者ID:wa1gon,项目名称:PowerSDR,代码行数:46,代码来源:FLEX3000ATUForm.cs

示例2: CalibrateRX2Image


//.........这里部分代码省略.........
                                phase_dir *= -1;
                                Debug.WriteLine("phase exit thresh - phase_step:"+phase_step.ToString("f4")+"  distance:"+(global_min_value-noise_floor).ToString("f1"));
                                break;
                            }
                        }
                    }

                    if(!progress.Visible) goto end;
                    else
                    {
                        t1.Stop();
                        if(t1.Duration > 90.0)
                        {
                            /*MessageBox.Show("RX Image Reject Calibration Failed.  Values have been returned to previous settings.\n"+
                                DateTime.Now.ToShortTimeString(),
                                "RX Image Failed",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);*/
                            goto end;
                        }
                        else progress.SetPercent((float)(t1.Duration/90.0));
                    }
                }

                t2.Stop();
                Debug.WriteLine("t2 phase("+phase_count+++"): "+t2.Duration);

                if(phase_count < 6)
                {
                    phase_string += (index_string+"\n");
                    phase_string += (val_string+"\n\n");
                }

                radio.GetDSPRX(1, 0).RXCorrectIQPhase = global_min_phase;			//set phase slider to min found

                if(!progressing) break;
            }

            // Finish the algorithm and reset the values
            ret_val = true;
            end:
                StreamWriter writer = new StreamWriter(Application.StartupPath+"\\rx_image.csv");
            writer.Write(gain_string+"\n");
            writer.Write(phase_string);
            writer.Close();
            if(!progress.Visible) progress.Text = "";
            else
            {
                rx2_image_gain_table[(int)rx2_band] = (float)radio.GetDSPRX(1, 0).RXCorrectIQGain;
                rx2_image_phase_table[(int)rx2_band] = (float)radio.GetDSPRX(1, 0).RXCorrectIQPhase;
            }
            progress.Hide();
            calibration_running = false;

            rx_image_rejection[(int)rx2_band] = worst_image - global_min_value;
            rx_image_from_floor[(int)rx2_band] = global_min_value - noise_floor;

            FWC.SetTest(false);
            Thread.Sleep(50);
            FWC.SetGen(false);
            Thread.Sleep(50);
            FWC.SetSig(false);
            Thread.Sleep(50);

            EnableAllFilters();
            EnableAllModes();
            VFOLock = false;
            //FullDuplex = duplex;
            FWC.SetRX2Preamp(false);
            Thread.Sleep(50);
            comboDisplayMode.Enabled = true;

            chkSR.Checked = spur_red;							// restore spur reduction setting
            chkRX2SR.Checked = rx2_sr;
            //RX1PreampMode = preamp;							// restore preamp mode
            comboDisplayMode.Text = display_mode;				// restore display mode
            //SetupForm.RXOnly = rx_only;						// restore RX Only setting
            RX1DSPMode = dsp_mode;							// restore dsp mode
            RX2DSPMode = dsp2_mode;							// restore dsp mode
            RX1Filter = filter1;								// restore filter
            if(filter1 == Filter.VAR1 || filter1 == Filter.VAR2)
                UpdateRX1Filters(filt1_low, filt1_high);
            RX2Filter = filter2;
            if(filter2 == Filter.VAR1 || filter2 == Filter.VAR2)
                UpdateRX2Filters(filt2_low, filt2_high);

            VFOAFreq = vfoa;								// restore frequency
            txtVFOAFreq_LostFocus(this, EventArgs.Empty);
            VFOBFreq = vfob;
            RX2Enabled = rx2;
            RX2Ant = rx2_antenna;
            chkDisplayAVG.Checked = avg;						// restore average state
            SetupForm.DSPPhoneRXBuffer = dsp_buf_size;				// restore DSP Buffer Size
            SetupForm.Polyphase = polyphase;					// restore polyphase

            t1.Stop();
            //MessageBox.Show(t1.Duration.ToString());
            Debug.WriteLine("timer: "+t1.Duration);
            return ret_val;
        }
开发者ID:ae6jl-mdd,项目名称:powersdr-iq,代码行数:101,代码来源:console.cs

示例3: Thread


//.........这里部分代码省略.........
            {
                calibration_mutex.WaitOne();
                fixed(float* ptr = &a[0])
                    DttSP.GetSpectrum(2, ptr);		// read again to clear out changed DSP
                calibration_mutex.ReleaseMutex();

                //max = float.MinValue;						// find the max spectrum value
                //		for(int j=0; j<Display.BUFFER_SIZE; j++)
                //			if(a[j] > max) max = a[j];

                //num2 += max;
                num2 += a[max_index];
                Thread.Sleep(100);

                if(!progress.Visible)
                    goto end2;
                else progress.SetPercent((float)((float)++counter/120));
            }
            avg2 = num2 / 20.0f;

            // calculate the difference between the current value and the correct multimeter value
            float diff = level - (avg + rx2_meter_cal_offset);
            rx2_meter_cal_offset = diff;

            // calculate the difference between the current value and the correct spectrum value
            diff = level - (avg2 + RX2DisplayCalOffset);
            RX2DisplayCalOffset = diff;

            UpdateDisplayOffsets();

            rx2_level_table[(int)rx2_band][0] = rx2_display_cal_offset;
            rx2_level_table[(int)rx2_band][1] = -fwc_preamp_offset;
            rx2_level_table[(int)rx2_band][2] = rx2_meter_cal_offset;

            ret_val = true;

            end2:
                if(!progress.Visible) progress.Text = "";
            progress.Hide();
            EnableAllFilters();
            EnableAllModes();
            VFOLock = false;

            FullDuplex = duplex;
            Thread.Sleep(50);
            FWC.SetGen(false);
            Thread.Sleep(50);
            FWC.SetTest(false);
            Thread.Sleep(50);
            FWC.SetSig(false);
            Thread.Sleep(50);

            chkRX1Preamp.Enabled = true;
            chkRX2Preamp.Enabled = true;
            comboDisplayMode.Enabled = true;
            comboMeterRXMode.Enabled = true;
            comboRX2MeterMode.Enabled = true;

            if(ret_val == false)
            {
                rx2_meter_cal_offset = old_multimeter_cal;
                rx2_display_cal_offset = old_display_cal;
            }

            SpurReduction = rx1_sr;
            RX2SpurReduction = rx2_sr;
            RX2Enabled = rx2;
            RX2Ant = rx2_antenna;
            comboDisplayMode.Text = display;
            chkRIT.Checked = rit_on;							// restore RIT on
            udRIT.Value = rit_val;								// restore RIT value
            //SetupForm.RXOnly = rx_only;						// restore RX Only
            DisplayAVG = display_avg;							// restore AVG value
            chkRX1Preamp.Checked = rx1_preamp;					// restore preamp value
            chkRX2Preamp.Checked = rx2_preamp;
            RX1Filter = rx1_filter;							// restore AM filter
            RX1DSPMode = dsp_mode;							// restore DSP mode
            RX2DSPMode = dsp2_mode;							// restore DSP mode
            RX1Filter = filter;								// restore filter
            if(dsp_buf_size != 4096)
                chkPower.Checked = false;						// go to standby
            SetupForm.DSPPhoneRXBuffer = dsp_buf_size;				// restore DSP Buffer Size
            VFOAFreq = vfoa;									// restore vfo frequency
            if(dsp_buf_size != 4096)
            {
                Thread.Sleep(100);
                chkPower.Checked = true;
            }
            CurrentMeterRXMode = rx_meter;						// restore RX Meter mode
            RX2MeterMode = rx2_meter;
            SetupForm.Polyphase = polyphase;					// restore polyphase

            //			Debug.WriteLine("rx1_meter_cal_offset: "+rx1_meter_cal_offset);
            //			Debug.WriteLine("display_cal_offset: "+display_cal_offset);
            //			MessageBox.Show("rx1_meter_cal_offset: "+rx1_meter_cal_offset.ToString()+"\n"+
            //				"display_cal_offset: "+display_cal_offset.ToString());

            calibration_running = false;
            return ret_val;
        }
开发者ID:ae6jl-mdd,项目名称:powersdr-iq,代码行数:101,代码来源:console.cs

示例4: CalibratePAGain


//.........这里部分代码省略.........

                                        SetupForm.PAGain20 = (float)Math.Max(38.0, SetupForm.PAGain20-2.0);
                                    }
                                    else SetupForm.PAGain20 += diff_dBm;
                                    break;
                                case 6:
                                    if(SetupForm.PAGain17 + diff_dBm < 38.0)
                                    {
                                        if(++error_count > 6)
                                            goto error;

                                        SetupForm.PAGain17 = (float)Math.Max(38.0, SetupForm.PAGain17-2.0);
                                    }
                                    else SetupForm.PAGain17 += diff_dBm;
                                    break;
                                case 7:
                                    if(SetupForm.PAGain15 + diff_dBm < 38.0)
                                    {
                                        if(++error_count > 6)
                                            goto error;

                                        SetupForm.PAGain15 = (float)Math.Max(38.0, SetupForm.PAGain15-2.0);
                                    }
                                    else SetupForm.PAGain15 += diff_dBm;
                                    break;
                                case 8:
                                    if(SetupForm.PAGain12 + diff_dBm < 38.0)
                                    {
                                        if(++error_count > 6)
                                            goto error;

                                        SetupForm.PAGain12 = (float)Math.Max(38.0, SetupForm.PAGain12-2.0);
                                    }
                                    else SetupForm.PAGain12 += diff_dBm;
                                    break;
                                case 9:
                                    if(SetupForm.PAGain10 + diff_dBm < 38.0)
                                    {
                                        if(++error_count > 6)
                                            goto error;

                                        SetupForm.PAGain10 = (float)Math.Max(38.0, SetupForm.PAGain10-2.0);
                                    }
                                    else SetupForm.PAGain10 += diff_dBm;
                                    break;
                            }
                        }
                        else good_result = true;
                        for(int j=0; j < off_time/100; j++)
                        {
                            Thread.Sleep(100);
                            if(!progress.Visible)
                                goto end;
                        }
                    }
                }
                progress.SetPercent((float)((float)(i+1)/10));
            }

            ret_val = true;

            end:
                if(!progress.Visible) progress.Text = "";
            progress.Hide();

            EnableAllFilters();
            EnableAllModes();
            VFOLock = false;
            comboPreamp.Enabled = true;
            comboDisplayMode.Enabled = true;

            chkTXEQ.Checked = tx_eq;
            chkDX.Checked = dx;
            chkCPDR.Checked = cpdr;

            chkMOX.Checked = false;
            tuning = false;
            //Audio.SwitchCount = 4;
            Audio.TXInputSignal = Audio.SignalSource.RADIO;
            Audio.TXOutputSignal = Audio.SignalSource.RADIO;

            RX1DSPMode = dsp_mode;							// restore dsp mode
            VFOAFreq = vfo_freq;								// restore frequency
            txtVFOAFreq_LostFocus(this, EventArgs.Empty);
            udPWR.Value = pwr;									// restore pwr level

            calibrating = false;

            //t1.Stop();
            //MessageBox.Show(t1.Duration.ToString());
            return ret_val;

            error:
                MessageBox.Show("Calculated gain is invalid.  Please double check connections and try again.\n" +
                    "If this problem persists, contact [email protected] for support.",
                    "Invalid Gain Found",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
            goto end;
        }
开发者ID:ae6jl-mdd,项目名称:powersdr-iq,代码行数:101,代码来源:console.cs

示例5: CalibratePAGain2


//.........这里部分代码省略.........
                                            next_volts = power_table[i+1][j-1];
                                        }
                                        last_volts = Audio.RadioVolume;
                                        Audio.RadioVolume = next_volts / audio_volts1;
                                        //double v_ratio = Math.Sqrt(target) / Math.Sqrt(Math.Max(1, watts));
                                        //Audio.RadioVolume *= v_ratio;
                                        if(fwc_init && current_model == Model.FLEX5000)
                                        {
                                            Audio.RadioVolume = Math.Min(0.5, Audio.RadioVolume); // 0.5 cap where 0.83 is max before overloading QSE
                                        }
                                    }
                                    else
                                    {
                                        Audio.RadioVolume *= Math.Sqrt(target/watts);
                                    }
                                }

                                last_watts = watts;

                                // check for error conditions
                                if(count++ == 12) // poop out
                                {
                                    found_power = true;
                                    //if(double.IsNaN(Audio.RadioVolume)) Audio.RadioVolume = power_table[i+1][Math.Max(0, j-1)];
                                    //double final_value = Math.Min(power_table[i+1][Math.Max(0, j-1)], Audio.RadioVolume * 0.945); // 0.945 ~= down 0.5 dB
                                    double final_value = (j == 0 ? 0.0 : power_table[i+1][j-1]);
                                    for(int k=j; k<power_table[i].Length; k++)
                                        power_table[i+1][k] = (float)final_value;
                                    j = power_table.Length; // end loop for this band
                                    Audio.TXInputSignal = Audio.SignalSource.RADIO;
                                    Audio.TXOutputSignal = Audio.SignalSource.RADIO;
                                    chkMOX.Checked = false;
                                    //if(!suppress_warnings)
                                {
                                    MessageBox.Show("Unable to calibrate PA Power on current band.",
                                        "PA Power Cal Error",
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Error);
                                }
                                }
                            }
                            progress.SetPercent((float)((float)(++progress_count)/progress_total));
                        }
                    }
                }
            }

            ret_val = true;

            end:
                if(!progress.Visible) progress.Text = "";
            progress.Hide();

            chkMOX.Checked = false;
            Audio.TXInputSignal = Audio.SignalSource.RADIO;

            if(fwc_init && current_model == Model.FLEX5000)
                FullDuplex = false;
            EnableAllFilters();
            EnableAllModes();
            VFOLock = false;
            comboPreamp.Enabled = true;
            comboDisplayMode.Enabled = true;

            chkTXEQ.Checked = tx_eq;
            chkDX.Checked = dx;
            chkCPDR.Checked = cpdr;

            for(int i = (int)Band.B2M; i<(int)Band.LAST; i++)
                for(int j=0; j<13; j++)
                    power_table[i][j] = power_table[10][j];

            RX1DSPMode = mode;							// restore dsp mode
            VFOAFreq = 0.590;
            VFOAFreq = vfoa;								// restore frequency

            try
            {
                StreamWriter writer = new StreamWriter(Application.StartupPath+"\\power.csv");
                writer.WriteLine("Band, 1, 2, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100");
                for(int i=1; i<=(int)Band.B6M; i++)
                {
                    writer.Write(((Band)i).ToString()+",");
                    for(int j=0; j<13; j++)
                        writer.Write(power_table[i][j].ToString("f4")+",");
                    writer.WriteLine("");
                }
                writer.Close();
            }
            catch(Exception)
            {
                MessageBox.Show("Error writing power.csv file.  Please make sure this file is not open and try again.",
                    "Error writing power.csv",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
            }

            calibrating = false;
            return ret_val;
        }
开发者ID:ae6jl-mdd,项目名称:powersdr-iq,代码行数:101,代码来源:console.cs

示例6: CalibrateLevel


//.........这里部分代码省略.........
                            DttSP.GetSpectrum(0, ptr);		// read again to clear out changed DSP
                        calibration_mutex.ReleaseMutex();
                        max = float.MinValue;						// find the max spectrum value
                        for(int j=0; j<Display.BUFFER_SIZE; j++)
                            if(a[j] > max) max = a[j];

                        num2 += max;

                        Thread.Sleep(100);

                        if(!progress.Visible)
                            goto end;
                        else progress.SetPercent((float)((float)++counter/170));
                    }
                    avg2 = num2 / 20.0f;

                    // calculate the difference between the current value and the correct multimeter value
                    float diff = level - (avg + rx1_meter_cal_offset + rx1_preamp_offset[(int)rx1_preamp_mode]);
                    rx1_meter_cal_offset += diff;

                    // calculate the difference between the current value and the correct spectrum value
                    diff = level - (avg2 + rx1_display_cal_offset + rx1_preamp_offset[(int)rx1_preamp_mode]);
                    for(int i=0; i<(int)Band.LAST; i++)
                    {
                        rx1_level_table[i][0] = diff;
                        rx1_level_table[i][2] = rx1_meter_cal_offset;
                    }
                    RX1DisplayCalOffset += diff;

                    ret_val = true;

                    end:
                        if(!progress.Visible) progress.Text = "";
                    progress.Hide();
                    EnableAllFilters();
                    EnableAllModes();
                    VFOLock = false;
                    comboPreamp.Enabled = true;
                    comboDisplayMode.Enabled = true;
                    comboMeterRXMode.Enabled = true;

                    if(ret_val == false)
                    {
                        rx1_meter_cal_offset = old_multimeter_cal;
                        rx1_display_cal_offset = old_display_cal;
                    }

                    comboDisplayMode.Text = display;
                    chkRIT.Checked = rit_on;							// restore RIT on
                    udRIT.Value = rit_val;								// restore RIT value
                    //SetupForm.RXOnly = rx_only;						// restore RX Only
                    DisplayAVG = display_avg;							// restore AVG value
                    //RX1PreampMode = preamp;						// restore preamp value
                    RX1Filter = am_filter;							// restore AM filter
                    RX1DSPMode = dsp_mode;							// restore DSP mode
                    RX1Filter = filter;								// restore filter
                    if(dsp_buf_size != 4096)
                        chkPower.Checked = false;						// go to standby
                    SetupForm.DSPPhoneRXBuffer = dsp_buf_size;				// restore DSP Buffer Size
                    VFOAFreq = vfoa;									// restore vfo frequency
                    if(dsp_buf_size != 4096)
                    {
                        Thread.Sleep(100);
                        chkPower.Checked = true;
                    }
                    CurrentMeterRXMode = rx_meter;						// restore RX Meter mode
开发者ID:ae6jl-mdd,项目名称:powersdr-iq,代码行数:67,代码来源:console.cs

示例7: CalibratePABias

        public bool CalibratePABias(Progress progress, float driver_target, float final_target, float tol, int index)
        {
            bool ret_val = false;
            float driver_limit = 10.0f;
            float final_limit = 10.0f;

            if(!(fwc_init && current_model == Model.FLEX5000))
            {
                progress.Text = "";
                progress.Hide();
                return false;
            }

            if(chkPower.Checked &&
                (rx1_dsp_mode == DSPMode.CWL || rx1_dsp_mode == DSPMode.CWU))
                RX1DSPMode = DSPMode.DSB;

            int val = 0;
            float volts = 0.0f;
            float current = 0.0f;
            int counter = 0;

            // read 13.8V for a sanity check of the ADC
            FWC.ReadPAADC(2, out val);
            volts = (float)val/4096*2.5f;
            float v138 = volts*11;

            if(v138 < 13.0 || v138 > 14.5)
            {
                progress.Hide();
                MessageBox.Show("13.8V not within tolerance [13.0, 14.5] -- (read "+v138.ToString("f1")+")",
                    "ADC/Power Problem",
                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                calibration_running = false;
                return false;
            }

            Thread.Sleep(100);
            FWC.ReadPAADC(4, out val);
            volts = (float)val/4096*2.5f;
            double temp_c = 305-volts*1000/2.2;
            if(temp_c > 50 || temp_c < 18)
            {
                progress.Hide();
                MessageBox.Show("Temperature ("+temp_c.ToString("f0")+"°C) is outside of normal range (18-50°C).",
                    "PA Bias Cal Error: Temp",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                calibration_running = false;
                return false;
            }

            for(int i=0; i<8; i++)
                flex5000DebugForm.SetPAPot(i, 0);

            FWC.SetPABias(true);

            byte Q2=128, Q3=128;
            // find point where Q2 and Q3 just tickle the driver bias current
            float baseline = 0.0f;
            Thread.Sleep(50);
            baseline = ReadDriverBias(3);
            /*if(baseline > 0.020)
            {
                Thread.Sleep(50);
                baseline = ReadDriverBias(3);
            }
            if(baseline > 0.020) goto error;*/
            //MessageBox.Show("Driver Baseline: "+baseline.ToString("f3"));
            Debug.WriteLine("baseline: "+baseline.ToString("f3"));

            for(int i=0; i<4; i++)
                flex5000DebugForm.SetPAPot(i, 128);

            do
            {
                if(!progress.Visible) goto end;
                flex5000DebugForm.SetPAPot(0, Q2+=10);
                if(Q2 < 128)
                {
                    FWC.SetPABias(false);
                    progress.Hide();
                    MessageBox.Show("PA Bias Error: Unable to hit target bias on Q2.  Likely hardware problem.",
                        "PA Bias Error",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Error);
                    calibration_running = false;
                    return false;
                }
                Thread.Sleep(50);
                current = ReadDriverBias(3);
                if(current > driver_limit) goto high_current;
                if(Q2 == 255) goto error;
            }
            while(current < baseline + 0.002);
            progress.SetPercent(++counter/(float)16);
            flex5000DebugForm.SetPAPot(0, 0);
            Q2-=10;

            do
//.........这里部分代码省略.........
开发者ID:ae6jl-mdd,项目名称:powersdr-iq,代码行数:101,代码来源:console.cs

示例8: LowPowerPASweep

        // calibrate PA Gain values
        public bool LowPowerPASweep(Progress progress, int power)
        {
            //			HiPerfTimer t1 = new HiPerfTimer();
            //			t1.Start();

            bool ret_val = false;

            if(!chkPower.Checked)
            {
                MessageBox.Show("Power must be on in order to run PA Sweep.", "Power Is Off",
                    MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return false;
            }

            calibrating = true;

            DSPMode dsp_mode = RX1DSPMode;				// save current DSP Mode
            RX1DSPMode = DSPMode.USB;					// set DSP Mode to USB

            double vfo_freq = VFOAFreq;						// save current frequency

            int pwr = (int)udPWR.Value;						// save current pwr level
            udPWR.Value = power;							// set pwr level to 100W

            progress.SetPercent(0.0f);

            float[] band_freqs = { 1.9f, 3.75f, 5.3665f, 7.15f, 10.125f, 14.175f, 18.1f, 21.225f, 24.9f, 28.85f };

            for(int i=0; i<band_freqs.Length; i++)
            {
                VFOAFreq = band_freqs[i];				// set frequency
                Audio.TXInputSignal = Audio.SignalSource.SINE;
                Audio.SourceScale = 1.0;
                chkMOX.Checked = true;
                for(int j=0; j<30; j++)
                {
                    Thread.Sleep(100);
                    if(!progress.Visible)
                        goto end;
                }
                chkMOX.Checked = false;
                Audio.TXInputSignal = Audio.SignalSource.RADIO;

                if(!progress.Visible)
                    goto end;

                for(int j=0; j<40; j++)
                {
                    Thread.Sleep(100);
                    if(!progress.Visible)
                        goto end;
                }
                if(!progress.Visible)
                    goto end;

                progress.SetPercent((float)((float)(i+1)/10));
            }

            ret_val = true;

            end:
                progress.Hide();
            chkMOX.Checked = false;
            Audio.TXInputSignal = Audio.SignalSource.RADIO;
            RX1DSPMode = dsp_mode;							// restore dsp mode
            VFOAFreq = vfo_freq;								// restore frequency
            txtVFOAFreq_LostFocus(this, EventArgs.Empty);
            udPWR.Value = pwr;									// restore pwr level

            calibrating = false;

            //t1.Stop();
            //MessageBox.Show(t1.Duration.ToString());
            return ret_val;
        }
开发者ID:ae6jl-mdd,项目名称:powersdr-iq,代码行数:76,代码来源:console.cs

示例9: RX2RestoreCalData

        public void RX2RestoreCalData()
        {
            Progress p = new Progress("Retrieving Calibration Data from RX2 EEPROM");
            p.SetPercent(0.0f);
            this.Invoke(new MethodInvoker(p.Show));
            Application.DoEvents();
            float total_reads = 55.0f;
            int count = 0;

            FWCEEPROM.ReadRX2Level(rx2_level_table); // 33 reads
            p.SetPercent((count+=33)/total_reads);
            Application.DoEvents();
            FWCEEPROM.ReadRX2Image(rx2_image_gain_table, rx2_image_phase_table); // 22 reads
            p.SetPercent((count+=22)/total_reads);
            Application.DoEvents();

            RX2SyncCalDateTime();
            p.Hide();
            p.Close();
        }
开发者ID:ae6jl-mdd,项目名称:powersdr-iq,代码行数:20,代码来源:console.cs

示例10: FLEX5000RestoreCalData

        public void FLEX5000RestoreCalData()
        {
            Progress p = new Progress("Retrieving Calibration Data from TRX EEPROM");
            p.SetPercent(0.0f);
            this.Invoke(new MethodInvoker(p.Show));
            Application.DoEvents();
            float total_reads = 324.0f;
            int count = 0;

            FWCEEPROM.ReadRXLevel(rx1_level_table); // 33 reads
            p.SetPercent((count+=33)/total_reads);
            Application.DoEvents();
            FWCEEPROM.ReadRXImage(rx1_image_gain_table, rx1_image_phase_table); // 22 reads
            p.SetPercent((count+=22)/total_reads);
            Application.DoEvents();
            FWCEEPROM.ReadTXImage(tx_image_gain_table, tx_image_phase_table); // 22 reads
            p.SetPercent((count+=22)/total_reads);
            Application.DoEvents();
            FWCEEPROM.ReadTXCarrier(tx_carrier_table); // 11 reads
            p.SetPercent((count+=11)/total_reads);
            Application.DoEvents();
            FWCEEPROM.ReadPABias(pa_bias_table); // 8 reads
            p.SetPercent((count+=8)/total_reads);
            Application.DoEvents();
            FWCEEPROM.ReadPAPower(power_table); // 143 reads
            p.SetPercent((count+=143)/total_reads);
            Application.DoEvents();
            FWCEEPROM.ReadPABridge(pa_bridge_table); // 66 reads
            p.SetPercent((count+=66)/total_reads);
            Application.DoEvents();
            FWCEEPROM.ReadPASWR(swr_table); // 11 reads
            p.SetPercent((count+=11)/total_reads);
            Application.DoEvents();

            if(flex5000DebugForm != null && !flex5000DebugForm.IsDisposed)
            {
                for(int i=0; i<8; i++)
                    flex5000DebugForm.SetPAPot(i, (byte)pa_bias_table[0][i]);
            }
            p.SetPercent((count+=8)/total_reads);
            Application.DoEvents();

            FLEX5000SyncCalDateTime();
            p.Hide();
            p.Close();
            Application.DoEvents();

            for(int i=(int)Band.B2M; i<(int)Band.LAST; i++)
                for(int j=0; j<13; j++)
                    power_table[i][j] = power_table[10][j];
        }
开发者ID:ae6jl-mdd,项目名称:powersdr-iq,代码行数:51,代码来源:console.cs

示例11: CalibrateTXImage

        public bool CalibrateTXImage(float freq, Progress progress, bool suppress_errors)
        {
            if(!fwc_init || current_model != Model.FLEX5000)
            {
                progress.Text = "";
                progress.Hide();
                return false;
            }

            if(!chkPower.Checked)
            {
                if(!suppress_errors)
                {
                    MessageBox.Show("Power must be on in order to calibrate TX Image.", "Power Is Off",
                        MessageBoxButtons.OK, MessageBoxIcon.Stop);
                }
                calibration_running = false;
                progress.Text = "";
                tx_image_rejection[(int)tx_band] = 0.0f;
                return false;
            }

            float tol = 10.0f;
            float phase_step = 2;
            float gain_step = 2;
            float global_min_phase = 0;
            float global_min_gain = 0;
            float gain_index = 0.0f, phase_index = 0.0f;
            float global_min_value = float.MaxValue;
            bool progressing = true;
            int gain_dir = -1;
            int phase_dir = 1;
            int gain_count = 1, phase_count = 1;
            int wrong_direction_count;
            int switch_direction_count;
            string index_string;
            string val_string;
            string gain_string = "";
            string phase_string = "";
            float fundamental = -200.0f;

            HiPerfTimer t1 = new HiPerfTimer();
            t1.Start();
            HiPerfTimer t2 = new HiPerfTimer();

            // Setup Rig for TX Image Null Cal
            bool ret_val = false;
            calibration_running = true;

            //int retval = 0;
            progress.SetPercent(0.0f);

            bool spur_red = chkSR.Checked;					// save current spur reduction setting
            chkSR.Checked = false;							// turn spur reduction off

            bool polyphase = SetupForm.Polyphase;			// save current polyphase setting
            SetupForm.Polyphase = false;					// disable polyphase

            int dsp_buf_size = SetupForm.DSPPhoneRXBuffer;		// save current DSP buffer size
            SetupForm.DSPPhoneRXBuffer = 4096;					// set DSP Buffer Size to 4096

            DSPMode dsp_mode = rx1_dsp_mode;			// save current dsp mode
            RX1DSPMode = DSPMode.USB;					// set dsp mode to USB

            // Setting filters for TX calibration (optmized for SSB) and we need to fix the VAR filter setting
            // consequence of this action

            string display_mode = comboDisplayMode.Text;
            comboDisplayMode.Text = "Spectrum";

            bool avg = chkDisplayAVG.Checked;				// save current average state
            chkDisplayAVG.Checked = true;

            Filter filter = rx1_filter;					// save current filter
            UpdateRX1Filters(300, 3000);						// set filter to -3k, -300 ... LSB for image

            int tx_filt_low = SetupForm.TXFilterLow;		// save tx filter low cut
            SetupForm.TXFilterLow = 300;					// set low cut to 300Hz

            int tx_filt_high = SetupForm.TXFilterHigh;		// save tx filter high cut
            SetupForm.TXFilterHigh = 3000;					// set high cut to 3kHz

            PreampMode preamp = rx1_preamp_mode;		// save current preamp setting
            RX1PreampMode = PreampMode.HIGH;			// set preamp to high

            bool duplex = full_duplex;
            FullDuplex = true;

            double vfo_freq = VFOAFreq;						// save current frequency
            VFOAFreq = freq;								// set frequency to passed value
            VFOBFreq = freq;

            Audio.TXInputSignal = Audio.SignalSource.SINE;
            double last_scale = Audio.SourceScale;			// saved audio scale
            Audio.SourceScale = 1.0;
            double tone_freq = Audio.SineFreq1;				// save tone freq
            Audio.SineFreq1 = 1500.0;						// set freq

            int pwr = (int)udPWR.Value;
            udPWR.Value = 100;
//.........这里部分代码省略.........
开发者ID:ae6jl-mdd,项目名称:powersdr-iq,代码行数:101,代码来源:console.cs

示例12: CalibrateTXCarrier

        public bool CalibrateTXCarrier(float freq, Progress progress, bool suppress_errors)
        {
            if(!(fwc_init && current_model == Model.FLEX5000))
            {
                progress.Text = "";
                progress.Hide();
                return false;
            }

            if(!chkPower.Checked)
            {
                MessageBox.Show("Power must be on in order to calibrate TX Carrier.", "Power Is Off",
                    MessageBoxButtons.OK, MessageBoxIcon.Stop);
                calibration_running = false;
                progress.Text = "";
                return false;
            }

            HiPerfTimer t1 = new HiPerfTimer();
            t1.Start();
            HiPerfTimer t2 = new HiPerfTimer();

            bool ret_val = false;
            calibration_running = true;
            progress.SetPercent(0.0f);

            // Setup hardware
            FWC.SetQSD(true);
            Thread.Sleep(50);
            FWC.SetQSE(true);
            Thread.Sleep(50);
            FWC.SetSig(true);
            Thread.Sleep(50);
            FWC.SetGen(false);
            Thread.Sleep(50);
            FWC.SetTest(true);
            Thread.Sleep(50);
            FWC.SetTXMon(false);
            Thread.Sleep(50);

            bool duplex = full_duplex;
            FullDuplex = true;

            bool spur_red = chkSR.Checked;					// save current spur reduction setting
            chkSR.Checked = false;							// turn spur reduction off

            bool polyphase = SetupForm.Polyphase;			// save current polyphase setting
            SetupForm.Polyphase = false;					// disable polyphase

            int dsp_buf_size = SetupForm.DSPPhoneRXBuffer;		// save current DSP buffer size
            SetupForm.DSPPhoneRXBuffer = 4096;					// set DSP Buffer Size to 4096

            // setup display mode
            string display = comboDisplayMode.Text;
            comboDisplayMode.Text = "Spectrum";

            // setup dsp mode
            DSPMode dsp_mode = RX1DSPMode;
            RX1DSPMode = DSPMode.DSB;

            // setup filter
            Filter filter = RX1Filter;
            UpdateRX1Filters(-1000, 1000);

            double vfoa = VFOAFreq;
            VFOAFreq = freq;

            double vfob = VFOBFreq;
            VFOBFreq = freq;

            // setup transmit to be carrier only
            Audio.TXInputSignal = Audio.SignalSource.SILENCE;

            // default pots
            for(int i=1; i<4; i++)
                FWC.TRXPotSetRDAC(i, 0);

            // find carrier peak
            float[] a = new float[Display.BUFFER_SIZE];
            for(int i=0; i<5; i++)
            {
                calibration_mutex.WaitOne();
                fixed(float* ptr = &a[0])
                    DttSP.GetSpectrum(0, ptr);// get the spectrum values
                calibration_mutex.ReleaseMutex();
                Thread.Sleep(50);
            }

            // find peak bin
            int peak_bin = 2048+(int)(0.0/sample_rate1*4096.0);
            float max_signal = float.MinValue;
            float sum = 0.0f;
            int filt_low_bin = 2048+(int)(-1000.0/sample_rate1*4096.0);
            int filt_high_bin = 2048+(int)(1000.0/sample_rate1*4096.0);
            for(int i=0; i<20; i++)
            {
                calibration_mutex.WaitOne();
                fixed(float* ptr = &a[0])
                    DttSP.GetSpectrum(0, ptr);// get the spectrum values
                calibration_mutex.ReleaseMutex();
//.........这里部分代码省略.........
开发者ID:ae6jl-mdd,项目名称:powersdr-iq,代码行数:101,代码来源:console.cs

示例13: CalibrateRXImageManual


//.........这里部分代码省略.........

            int filt_low = RX1FilterLow;
            int filt_high = RX1FilterHigh;
            Filter filter = rx1_filter;					// save current filter
            RX1Filter = Filter.F1;						// set filter to 6kHz

            PreampMode preamp = rx1_preamp_mode;		// save current preamp setting
            RX1PreampMode = PreampMode.HIGH;			// set preamp to high

            bool duplex = full_duplex;
            FullDuplex = true;

            if(fwc_init && current_model == Model.FLEX5000)
            {
                VFOBFreq = freq;
                Thread.Sleep(50);
                FWC.SetTest(true);
                Thread.Sleep(50);
                FWC.SetGen(true);
                Thread.Sleep(50);
                FWC.SetSig(true);
                Thread.Sleep(50);
                FWC.SetQSE(false);
                Thread.Sleep(50);
            }

            double vfo_freq = VFOAFreq;						// save current frequency
            VFOAFreq = freq+2*(float)if_freq;				// set frequency to passed value + 2*IF

            DisableAllFilters();
            DisableAllModes();
            VFOLock = true;
            comboPreamp.Enabled = false;
            comboDisplayMode.Enabled = false;

            //int retval = 0;
            progress.SetPercent(0.0f);

            Thread.Sleep(200);

            while(progressing)
            {
                if(!progress.Visible) goto end;
                else
                {
                    t1.Stop();
                    if(t1.Duration > 200.0)
                    {
                        goto end;
                    }
                    else progress.SetPercent((float)(t1.Duration/200.0));
                }
                if(!progressing) break;
            }

            // Finish the algorithm and reset the values
            ret_val = true;
            end:
            progress.Hide();
            calibration_running = false;

            if(fwc_init && current_model == Model.FLEX5000)
            {
                VFOBFreq = vfo_freq;
                Thread.Sleep(50);
                FWC.SetTest(false);
                Thread.Sleep(50);
                FWC.SetGen(false);
                Thread.Sleep(50);
                FWC.SetSig(false);
                Thread.Sleep(50);
            }

            EnableAllFilters();
            EnableAllModes();
            VFOLock = false;
            FullDuplex = duplex;
            comboPreamp.Enabled = true;
            comboDisplayMode.Enabled = true;

            chkSR.Checked = spur_red;							// restore spur reduction setting
            RX1PreampMode = preamp;							// restore preamp mode
            comboDisplayMode.Text = display_mode;				// restore display mode
            //SetupForm.RXOnly = rx_only;						// restore RX Only setting
            RX1DSPMode = dsp_mode;							// restore dsp mode
            RX1Filter = filter;								// restore filter
            if(filter == Filter.VAR1 || filter == Filter.VAR2)
                UpdateRX1Filters(filt_low, filt_high);

            VFOAFreq = vfo_freq;								// restore frequency
            txtVFOAFreq_LostFocus(this, EventArgs.Empty);
            chkDisplayAVG.Checked = avg;						// restore average state
            SetupForm.DSPPhoneRXBuffer = dsp_buf_size;				// restore DSP Buffer Size
            SetupForm.Polyphase = polyphase;					// restore polyphase

            t1.Stop();
            //MessageBox.Show(t1.Duration.ToString());
            Debug.WriteLine("timer: "+t1.Duration);
            return ret_val;
        }
开发者ID:ae6jl-mdd,项目名称:powersdr-iq,代码行数:101,代码来源:console.cs

示例14: CalibrateRXImage2


//.........这里部分代码省略.........

                    // find image
                    if(i < 2048)
                    {
                        start = 2048;
                        end = 4096;
                    }
                    else
                    {
                        start = 0;
                        end = 2048;
                    }
                    for(int j=start; j<end; j++)
                    {
                        float mag = a[j*2]*a[j*2] + a[j*2+1]*a[j*2+1];
                        // find peak signal
                        if(mag > image_mag)
                        {
                            image_mag = mag;
                            image_i[i] = a[j*2];
                            image_q[i] = a[j*2+1];
                            image_bin[i] = j;
                        }
                    }
                    power = image_i[i]*image_i[i] + image_q[i]*image_q[i] + sig_i[i]*sig_i[i] + sig_q[i]*sig_q[i];
                    ab_i = (sig_i[i]*image_i[i]-sig_q[i]*image_q[i])/power;
                    ab_q = (sig_i[i]*image_q[i] + sig_q[i]*image_i[i])/power;
                    gain[i] = (float)Math.Sqrt(1.0-4.0*ab_i);
                    phase[i] = (float)(Math.Asin(2.0*ab_q/gain[i])*180.0/Math.PI);
                    //Debug.WriteLine(i+" ("+VFOBFreq.ToString("f6")+"): "+sig_bin[i]+" ("+sig_i[i].ToString("f3")+")  "+image_bin+" ("+image_mag.ToString("f3")+")");
                    //sig_string += i+","+sig_i[i]+","+sig_q[i]+","+sig_bin[i]+"\n";
                    //image_string += i+","+image_i[i]+","+image_q[i]+","+image_bin[i]+"\n";
                    //gain_string += gain+",\n";
                    //phase_string += ","+phase+"\n";
                    output_string += i+","+gain[i].ToString("f7")+","+phase[i].ToString("f7")+"\n";
                    progress.SetPercent((float)i/4096);
                    if(!progress.Visible) goto end;
                }
            }

            StreamWriter writer = new StreamWriter(Application.StartupPath+"\\rx_image2.csv");
            writer.WriteLine("index, gain, phase");
            writer.WriteLine(output_string);

            /*writer.WriteLine("index, I, Q, Bin");
            writer.WriteLine(sig_string);
            writer.WriteLine(image_string);*/
            writer.Close();
            /*Debug.Write("non-matching sig_bin: ");
            for(int i=0; i<100; i++)
                if(sig_bin[i] != i) Debug.Write(i+"("+sig_bin[i]+"),");
            Debug.WriteLine("");

            Debug.Write("non-matching image_bin: ");
            for(int i=0; i<100; i++)
                if(image_bin[i] != 4095-i) Debug.Write(i+"("+image_bin[i]+"),");
            Debug.WriteLine("");*/

            // Finish the algorithm and reset the values
            ret_val = true;
            end:
                if(!progress.Visible) progress.Text = "";
            progress.Hide();
            calibration_running = false;

            if(fwc_init && current_model == Model.FLEX5000)
            {
                VFOBFreq = vfo_freq;
                FWC.SetTest(false);
                Thread.Sleep(50);
                FWC.SetGen(false);
                Thread.Sleep(50);
                FWC.SetSig(false);
                Thread.Sleep(50);
            }

            EnableAllFilters();
            EnableAllModes();
            VFOLock = false;
            FullDuplex = duplex;
            comboPreamp.Enabled = true;
            comboDisplayMode.Enabled = true;

            chkSR.Checked = spur_red;							// restore spur reduction setting
            RX1PreampMode = preamp;							// restore preamp mode
            RX1DSPMode = dsp_mode;							// restore dsp mode
            comboDisplayMode.Text = display_mode;				// restore display mode
            VFOAFreq = vfo_freq;								// restore frequency
            txtVFOAFreq_LostFocus(this, EventArgs.Empty);
            chkDisplayAVG.Checked = avg;						// restore average state
            SetupForm.DSPPhoneRXBuffer = dsp_buf_size;				// restore DSP Buffer Size
            SetupForm.Polyphase = polyphase;					// restore polyphase
            SetupForm.ImageGainRX = saveImageGainRX;			// restore ImageGainRX
            SetupForm.ImagePhaseRX = saveImagePhaseRX;			// restore ImagePhaseRX

            t1.Stop();
            //MessageBox.Show(t1.Duration.ToString());
            Debug.WriteLine("timer: "+t1.Duration);
            return ret_val;
        }
开发者ID:ae6jl-mdd,项目名称:powersdr-iq,代码行数:101,代码来源:console.cs


注:本文中的Progress.Hide方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。