Beispiel #1
0
		// ======================================================
		// Display Tab Event Handlers
		// ======================================================

		private void btnWizard_Click(object sender, System.EventArgs e)
		{
			SetupWizard w = new SetupWizard(console, comboAudioSoundCard.SelectedIndex);
			w.Show();
			w.Focus();
		}
Beispiel #2
0
        public Console(string[] args)
        {
            CmdLineArgs = args;
            #if DEBUG
                        //System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = true;
            #endif

            Splash.ShowSplashScreen();							// Start splash screen

            Splash.SetStatus("Initializing Components");		// Set progress point
            InitializeComponent();								// Windows Forms Generated Code
            Splash.SetStatus("DPI resize");
            float dpi = this.CreateGraphics().DpiX;
            this.AutoScaleMode = AutoScaleMode.Dpi;
            SizeF d = this.AutoScaleDimensions;
            d.Height = dpi;
            d.Width = dpi;
            this.AutoScaleDimensions = d;
            float ratio = dpi / 96.0f;
            string font_name = this.Font.Name;
            float size = (float)(8.25 / ratio);
            System.Drawing.Font new_font = new System.Drawing.Font(font_name, size);
            this.Font = new_font;

            Splash.SetStatus("Initializing Database");			// Set progress point
            DB.AppDataPath = Application.StartupPath;
            DB.Init();											// Initialize the database

            Splash.SetStatus("Initializing DSP");				// Set progress point

            if (!DttSP.Init())									// Initialize the DSP processor
            {
                Splash.SetStatus("Error in DSP!");
                Thread.Sleep(3000);
                this.ExitConsole();
            }

            Splash.SetStatus("Initializing PortAudio");			// Set progress point
            int result = PA19.PA_Initialize();					// Initialize the audio interface

            if (result < 0)
            {
                Splash.SetStatus("Error while initializing PortAudio!");
                Thread.Sleep(2000);
                this.ExitConsole();
            }

            Splash.SetStatus("Loading Main Form");				// Set progress point
#if !DEBUG
            //Splash.SplashForm.Owner = this;						// So that main form will show when splash disappears
#endif
            break_in_timer = new HiPerfTimer();

            Splash.SetStatus("Initializing Genesis radio communication");	// Set progress point

            InitConsole();										// Initialize all forms and main variables

            Splash.SetStatus("Finished");						// Set progress point
            // Activates double buffering

            SetStyle(ControlStyles.UserPaint |
                ControlStyles.AllPaintingInWmPaint |
                ControlStyles.OptimizedDoubleBuffer, true);
            UpdateStyles();

            Splash.CloseForm();									// End splash screen

            if (run_setup_wizard)
            {
                SetupWizard w = new SetupWizard(this, 0);
                w.ShowDialog();
            }

            if (multimeter_cal_offset == 0.0f)
            {
                switch (current_soundcard)
                {
                    case SoundCard.SANTA_CRUZ:
                        multimeter_cal_offset = -26.39952f;
                        break;
                    case SoundCard.AUDIGY_2_ZS:
                        multimeter_cal_offset = 1.024933f;
                        break;
                    case SoundCard.MP3_PLUS:
                        multimeter_cal_offset = -33.40224f;
                        break;
                    case SoundCard.EXTIGY:
                        multimeter_cal_offset = -29.30501f;
                        break;
                    case SoundCard.DELTA_44:
                        multimeter_cal_offset = -25.13887f;
                        break;
                    case SoundCard.FIREBOX:
                        multimeter_cal_offset = -20.94611f;
                        break;
                    case SoundCard.EDIROL_FA_66:
                        multimeter_cal_offset = -46.82864f;
                        break;
                    case SoundCard.UNSUPPORTED_CARD:
                        multimeter_cal_offset = -52.43533f;
                        break;
                }
            }

            if (display_cal_offset == 0.0f)
            {
                switch (current_soundcard)
                {
                    case SoundCard.SANTA_CRUZ:
                        DisplayCalOffset = -56.56675f;
                        break;
                    case SoundCard.AUDIGY_2_ZS:
                        DisplayCalOffset = -29.20928f;
                        break;
                    case SoundCard.MP3_PLUS:
                        DisplayCalOffset = -62.84578f;
                        break;
                    case SoundCard.EXTIGY:
                        DisplayCalOffset = -62.099f;
                        break;
                    case SoundCard.DELTA_44:
                        DisplayCalOffset = -57.467f;
                        break;
                    case SoundCard.FIREBOX:
                        DisplayCalOffset = -54.019f;
                        break;
                    case SoundCard.EDIROL_FA_66:
                        DisplayCalOffset = -80.429f;
                        break;
                    case SoundCard.UNSUPPORTED_CARD:
                        DisplayCalOffset = -82.62103f;
                        break;
                }
            }

            loscFreq = LOSCFreq;
            vfoAFreq = VFOAFreq;
            vfoBFreq = VFOBFreq;

            NewVFOSignalGauge.GaugeTarget = picAGauge;
            NewVFOSignalGauge.Width = picAGauge.Width;
            NewVFOSignalGauge.Height = picAGauge.Height;
            NewVFOSignalGauge.booting = false;
            AnalogSignalGauge.GaugeTarget = picSmallAGauge;
            AnalogSignalGauge.Width = picSmallAGauge.Width;
            AnalogSignalGauge.Height = picSmallAGauge.Height;
            AnalogSignalGauge.Center = new Point(78, 155);
            AnalogSignalGauge.m_NeedleRadius = 120;
            AnalogSignalGauge.m_BaseArcStart = 237;
            AnalogSignalGauge.m_BaseArcSweep = 65;
            AnalogSignalGauge.booting = false;

#if DirectX
            Display_DirectX.booting = false;
            NewVFOSignalGauge.booting = false;
            NewVFOSignalGauge.DirectX_Init(NewVFO_background_image);
            Display_DirectX.PanadapterTarget = picDisplay;
            Display_DirectX.WaterfallTarget = picWaterfall;
#endif

            Console_Resize(this, EventArgs.Empty);
            Console_Resize(this, EventArgs.Empty);

            if (auto_pwr_up)
            {
                chkPower.Checked = true;
                this.WindowState = FormWindowState.Minimized;
            }
        }
Beispiel #3
0
 private void mnuWizard_Click(object sender, EventArgs e)
 {
     SetupWizard w = new SetupWizard(this, 0);
     w.ShowDialog();
 }
Beispiel #4
0
        // ======================================================
        // Constructor and Destructor
        // ======================================================
        public Console(string[] args)
        {
            //			HiPerfTimer t1 = new HiPerfTimer();
            //			Debug.WriteLine("timer_freq: "+t1.GetFreq());

            //fwc_init = FWC.Open1394Driver();

            CmdLineArgs = args;

            Splash.ShowSplashScreen();							// Start splash screen

            Splash.SetStatus("Initializing Components");		// Set progress point
            InitializeComponent();								// Windows Forms Generated Code

            Splash.SetStatus("Initializing Database");			// Set progress point
            DB.Init();											// Initialize the database

            Splash.SetStatus("Initializing Hardware");				// Set progress point
            // check model in Options table
            ArrayList list = DB.GetOptions();						// Get the saved list of controls
            DB.GetIQ();

            list.Sort();
            /*			foreach(string s in list)
            {
                if(s.StartsWith("radGenModelFLEX5000") && s.IndexOf("True") >= 0)
                    fwc_init = true;
            }

            if(fwc_init)
            {
                int count = 0;
                while(!(fwc_init = FWCMidi.Open()))
                {
                    if(count++ > 15)
                    {
                        Splash.HideForm();
                        DialogResult dr = MessageBox.Show("Error communicating with FLEX-5000.  Would you like to switch\n"+
                            "to Demo (no hardware) mode?  If not, check that the unit has\n"+
                            "power and FireWire connections and try again.",
                            "FLEX-5000 Not Found: Switch to Demo mode?",
                            MessageBoxButtons.YesNo,
                            MessageBoxIcon.Error);
                        if(dr == DialogResult.Yes)
                        {
                            ArrayList a = new ArrayList();
                            a.Add("radGenModelFLEX5000/False");
                            a.Add("radGenModelDemoNone/True");
                            DB.SaveOptions(ref a);
                            DB.Exit();
                            DB.Init();
                            fwc_init = false;
                        }
                        else
                        {
                            foreach(Control c in this.Controls)
                                c.Enabled = false;
                            Splash.CloseForm();
                            //Thread.CurrentThread.Abort();
                            Process.GetCurrentProcess().Kill();
                            return;
                        }
                        break;
                    }
                    Thread.Sleep(1000);
                }
            }
            else if(list.Count == 0)
            {
                fwc_init = FWCMidi.Open();
            }

            if(fwc_init)
            {
                FWCEEPROM.Init();
                InitFLEX5000();
            }

            if(fwc_init && current_model == Model.FLEX5000)
            {
                if(FWCEEPROM.RX2OK)
                {
                    chkRX2.Visible = true;
                    lblAntRX2.Visible = true;
                    panelRX2Divider.Visible = true;
                }
                else
                {
                    this.Height -= (grpRX2Filter.Height+16);
                    if(chkRX2.Checked) chkRX2.Checked = false;
                }
            }
            */
            Splash.SetStatus("Initializing Radio");				// Set progress point
            radio = new Radio();								// Initialize the Radio processor

            Splash.SetStatus("Initializing PortAudio");			// Set progress point
            PA19.PA_Initialize();								// Initialize the audio interface

            Splash.SetStatus("Loading Main Form");				// Set progress point
            Splash.SplashForm.Owner = this;						// So that main form will show/focus when splash disappears
            break_in_timer = new HiPerfTimer();

            InitConsole();										// Initialize all forms and main variables

            Splash.SetStatus("Finished");						// Set progress point
            // Activates double buffering
            SetStyle(ControlStyles.DoubleBuffer, true);

            Splash.CloseForm();									// End splash screen

            if(File.Exists("extended.edf"))						// Check for extended capabilities file
            {
                ArrayList a = DB.GetVars("State");
                a.Sort();
                ArrayList names = new ArrayList();
                ArrayList vals = new ArrayList();

                foreach(string s in a)
                {
                    string[] str = s.Split('/');
                    if(str.Length > 2)
                    {
                        for(int j=2; j<str.Length; j++)
                            str[1] += "/"+str[j];
                    }
                    names.Add(str[0]);
                    vals.Add(str[1]);
                }

                int i = names.BinarySearch("extended");
                if(i < 0) // If not found, prompt for logon info
                {
                    LogOn LogOnForm = new LogOn(this);
                    LogOnForm.ShowDialog();
                }
                else  // If found, check for existing logon info
                {
                    string text = (string)vals[i];

                    StreamReader sr = File.OpenText("extended.edf");
                    string data = sr.ReadLine();
                    sr.Close();

                    if(text == data)
                        extended = true;
                    else	// Logon information found, but doesn't match
                    {
                        MessageBox.Show("Error reading logon information.", "Logon Error",
                            MessageBoxButtons.OK, MessageBoxIcon.Error);
                        LogOn LogOnForm = new LogOn(this);
                        LogOnForm.ShowDialog();
                    }
                }
            }

            if(this.Text.IndexOf("SVN") >= 0)
            {
                if(File.Exists(Application.StartupPath+"\\.svn\\entries"))
                {
                    try
                    {
                        string temp = this.Text;
                        StreamReader reader = new StreamReader(Application.StartupPath+"\\.svn\\entries");
                        for(int i=0; i<3; i++)
                            reader.ReadLine();

                        string current_rev = reader.ReadLine();
                        reader.Close();

                        int svn_rev = int.Parse(current_rev);
                        int title_rev = int.Parse(temp.Substring(temp.IndexOf(":")+2, 4));
                        if(title_rev < svn_rev)
                            this.Text = temp.Replace(title_rev.ToString(), svn_rev.ToString());
                    }
                    catch(Exception)
                    {
                        // do nothing
                    }
                }

                if(show_alpha_warning)
                {
                    AlphaWarnForm form = new AlphaWarnForm(this);
                    form.ShowDialog();
                }

                mnuReportBug.Visible = true;
            }

            if(run_setup_wizard)
            {
                SetupWizard w = new SetupWizard(this, 0);
                w.ShowDialog();
                if(fwc_init && current_model == Model.FLEX5000)
                {
                    SetupForm.ResetFLEX5000();
                    CheckFLEX5000CalData();
                    for(int i=0; i<8; i++)
                        flex5000DebugForm.SetPAPot(i, (byte)pa_bias_table[0][i]);
                    RX1Band = RX2Band = TXBand = rx1_band;
                    fwcAntForm.SetBand(rx1_band);
                    fwcAntForm.CurrentAntMode = current_ant_mode;
                    fwcAntForm.RX1Ant = rx1_ant;
                    fwcAntForm.RX1Loop = rx1_loop;
                    fwcAntForm.RX2Ant = rx2_ant;
                    fwcAntForm.TXAnt = tx_ant;
                    CheckRX2CalData();
                }
            }

            if(rx1_meter_cal_offset == 0.0f)
            {
                switch(current_soundcard)
                {
                    case SoundCard.SANTA_CRUZ:
                        rx1_meter_cal_offset = -26.39952f;
                        break;
                    case SoundCard.AUDIGY_2_ZS:
                        rx1_meter_cal_offset = 1.024933f;
                        break;
                    case SoundCard.MP3_PLUS:
                        rx1_meter_cal_offset = -33.40224f;
                        break;
                    case SoundCard.EXTIGY:
                        rx1_meter_cal_offset = -29.30501f;
                        break;
                    case SoundCard.DELTA_44:
                        rx1_meter_cal_offset = -25.13887f;
                        break;
                    case SoundCard.FIREBOX:
                        rx1_meter_cal_offset = -20.94611f;
                        break;
                    case SoundCard.EDIROL_FA_66:
                        rx1_meter_cal_offset = -46.82864f;
                        break;
                    case SoundCard.UNSUPPORTED_CARD:
                        rx1_meter_cal_offset = -22.43533f;
                        break;
                }
            }

            if(rx1_display_cal_offset == 0.0f)
            {
                switch(current_soundcard)
                {
                    case SoundCard.SANTA_CRUZ:
                        RX1DisplayCalOffset = -56.56675f;
                        break;
                    case SoundCard.AUDIGY_2_ZS:
                        RX1DisplayCalOffset = -29.20928f;
                        break;
                    case SoundCard.MP3_PLUS:
                        RX1DisplayCalOffset = -62.84578f;
                        break;
                    case SoundCard.EXTIGY:
                        RX1DisplayCalOffset = -62.099f;
                        break;
                    case SoundCard.DELTA_44:
                        RX1DisplayCalOffset = -57.467f;
                        break;
                    case SoundCard.FIREBOX:
                        RX1DisplayCalOffset = -54.019f;
                        break;
                    case SoundCard.EDIROL_FA_66:
                        RX1DisplayCalOffset = -80.429f;
                        break;
                    case SoundCard.UNSUPPORTED_CARD:
                        RX1DisplayCalOffset = -48.62103f;
                        break;
                }
            }

            /*if(notify_on_beta || notify_on_release)
            {
                Thread t = new Thread(new ThreadStart(CheckForUpdates));
                t.IsBackground = true;
                t.Priority = ThreadPriority.Lowest;
                t.Name = "Update Check Thread";
                t.Start();
            }*/

            foreach(string s in CmdLineArgs)
            {
                if(s == "-autostart")
                    chkPower.Checked = true;
            }

            //			if((current_model == Model.FLEX5000) && !fwc_init)
            //				MessageBox.Show("Error opening FLEX-5000 driver.", "Driver Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

            if(!fwc_init || current_model != Model.FLEX5000)
            {
                if(console_basis_size.Height > (this.Height - (grpRX2Filter.Height+16)))
                    console_basis_size.Height -= (grpRX2Filter.Height+16);
                this.MinimumSize = new Size(console_basis_size.Width, console_basis_size.Height);
                this.Height -= (grpRX2Filter.Height+16);
                if(chkRX2.Checked) chkRX2.Checked = false;
            }
            #if(DEBUG)
            button1.Visible = true;
            #endif
            #if (SWEEPGEN && !DEBUG)
            button1.Visible = true;
            #endif
            /*
            byte HSUSB_Data;

            HSUSB.InitI2C();

            HSUSB_Data = 0x55;
            HSUSB.SetI2CAddr(&HSUSB_Data);
            HSUSB_Data = 0x00;
            HSUSB.GetI2CAddr(&HSUSB_Data);

            HSUSB_Data = 0x01;
            HSUSB.WriteI2C(&HSUSB_Data);
            //			HSUSB_Data = 0x00;
            //			HSUSB.ReadI2C(&HSUSB_Data);

            HSUSB_Data = 0x00;
            HSUSB.GetRDY(&HSUSB_Data);

            HSUSB_Data = 0x00;
            HSUSB.SetCtrlLine(&HSUSB_Data);
            HSUSB_Data = 0xFF;
            HSUSB.GetCtrlLine(&HSUSB_Data);

            HSUSB_Data = 0x01;
            HSUSB.SetCtrlLine(&HSUSB_Data);
            HSUSB_Data = 0x00;
            HSUSB.GetCtrlLine(&HSUSB_Data);

            HSUSB_Data = 0x02;
            HSUSB.SetCtrlLine(&HSUSB_Data);
            HSUSB_Data = 0x00;
            HSUSB.GetCtrlLine(&HSUSB_Data);

            HSUSB_Data = 0x04;
            HSUSB.SetCtrlLine(&HSUSB_Data);
            HSUSB_Data = 0x00;
            HSUSB.GetCtrlLine(&HSUSB_Data);

            HSUSB_Data = 0xB0;
            HSUSB.SetPortA(&HSUSB_Data);
            HSUSB_Data = 0x00;
            HSUSB.GetPortA(&HSUSB_Data);

            HSUSB_Data = 0xC0;
            HSUSB.SetPortB(&HSUSB_Data);
            HSUSB_Data = 0x00;
            HSUSB.GetPortB(&HSUSB_Data);

            HSUSB_Data = 0xD0;
            HSUSB.SetPortD(&HSUSB_Data);
            HSUSB_Data = 0x00;
            HSUSB.GetPortD(&HSUSB_Data);
            */
            initializing = false;
        }