Пример #1
0
 private void startCalculation()
 {
     this._selectedConfig.CommandSet = null;
     base.Enabled = this.dgvEzConfigEnable = false;
     if ((((this._runMode == RunMode.AddConfig) || (this._runMode == RunMode.TestMode)) || ((this._selectedProject.Name != "Empty framework") && (this._selectedConfig.StoredProperties == null))) || (((this._selectedProject.Name == "PN9") || (this._selectedProject.Name == "Unmodulated carrier")) || this._isModemRecalculationNeeded))
     {
         if ((this._matlabCalcForm == null) || this._matlabCalcForm.IsDisposed)
         {
             this._matlabCalcForm = new MatlabCalculatorExeutionFront(this._chipType, this._chipRev, this._adtRec.UniqId);
             this.components.Add(this._matlabCalcForm);
             this._matlabCalcForm.Location = new Point((base.Location.X + (base.Width / 2)) - (this._matlabCalcForm.Width / 2), (base.Location.Y + (base.Height / 2)) - (this._matlabCalcForm.Height / 2));
             this._matlabCalcForm.Owner = this;
             this._matlabCalcForm.FormClosing += new FormClosingEventHandler(this.matlabCalc_FormClosing);
             if (this._runMode == RunMode.AddConfig)
             {
                 this.fillCalculatorInput(this._matlabCalcForm.getInputRef(), this._createdConfig, this._selectedProject);
             }
             else
             {
                 this.fillCalculatorInput(this._matlabCalcForm.getInputRef(), this._selectedConfig, this._selectedProject);
             }
             this._matlabCalcForm.Show();
         }
         else
         {
             this._matlabCalcForm.BringToFront();
         }
     }
     else
     {
         this.matlabCalc_FormClosing(null, null);
     }
 }
Пример #2
0
 private void addMatlabCommands()
 {
     if (this.rdbRX.Checked || this.rdbTX.Checked)
     {
         if ((this._matlabCalcForm == null) || this._matlabCalcForm.IsDisposed)
         {
             this._matlabCalcForm = new MatlabCalculatorExeutionFront(this._chipType, this._chipRev, this._adtRec.UniqId);
             this.components.Add(this._matlabCalcForm);
             this._matlabCalcForm.Location = new Point((base.Location.X + (base.Width / 2)) - (this._matlabCalcForm.Width / 2), (base.Location.Y + (base.Height / 2)) - (this._matlabCalcForm.Height / 2));
             this._matlabCalcForm.Owner = this;
             this._matlabCalcForm.FormClosing += new FormClosingEventHandler(this.matlabCalc_FormClosing);
             this.fillCalculatorInput(this._matlabCalcForm.getInputRef());
             this._matlabCalcForm.Show();
         }
         else
         {
             this._matlabCalcForm.BringToFront();
         }
         base.Enabled = false;
     }
     else
     {
         this.matlabCalc_FormClosing(null, null);
     }
 }
Пример #3
0
        private void matlabCalc_FormClosing(object sender, EventArgs e)
        {
            byte[] buffer;
            byte[] buffer2;
            if (sender != null)
            {
                switch (this._matlabCalcForm.MatlabResult)
                {
                    case Result.Success:
                        if (this._matlabCalcForm.RegularOutput != null)
                        {
                            if (this._runMode == RunMode.AddConfig)
                            {
                                Pro2Calc.PropertyValuePair[] array = new Pro2Calc.PropertyValuePair[this._matlabCalcForm.RegularOutput.propertyValues.Count];
                                this._matlabCalcForm.RegularOutput.propertyValues.CopyTo(array);
                                this._createdConfig.StoredProperties = new List<Pro2Calc.PropertyValuePair>(array);
                                string strValue = "";
                                int index = this._matlabCalcForm.LogFileContent.IndexOf("BW =");
                                if (index != -1)
                                {
                                    strValue = this._matlabCalcForm.LogFileContent.Substring(index + 4);
                                    int length = strValue.IndexOf("kHz)");
                                    strValue = strValue.Substring(0, length).Trim().Replace(".", CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator);
                                }
                                double doubleValue = 0.0;
                                WDSConverters.ParseDouble(strValue, out doubleValue);
                                if (doubleValue < 40.0)
                                {
                                    this._createdConfig.CrystalTolerance = 0;
                                    this._createdConfig.ChannelBandwith = 40.0 + this._iterationValue;
                                    this._iterationValue++;
                                    this._matlabCalcForm = null;
                                    this.startCalculation();
                                    return;
                                }
                                this._createdConfig.ChannelBandwith = doubleValue;
                                this._createdConfig.ConfigNumber = this._configurationDescriptor.Count + 3;
                                this._configurationDescriptor.Add(this._createdConfig);
                                base.Invoke(new EventHandler(this.cbbXtalTolerance_SelectedIndexChanged), new object[2]);
                                this.loadConfigList(true);
                                base.Enabled = this.dgvEzConfigEnable = true;
                                return;
                            }
                            this._selectedConfig.StoredProperties = this._matlabCalcForm.RegularOutput.propertyValues;
                            goto Label_027B;
                        }
                        _log.Error("Modem calculation did not result any commands!");
                        base.Enabled = this.dgvEzConfigEnable = true;
                        return;

                    case Result.Cancelled:
                        base.Enabled = this.dgvEzConfigEnable = true;
                        return;
                }
                MessageBox.Show("Matlab calculation failed!\n" + this._matlabCalcForm.LogFileContent + "\n" + this._matlabCalcForm.MatlabResult.ToString());
                base.Enabled = this.dgvEzConfigEnable = true;
                return;
            }
            Label_027B:
            foreach (Pro2Calc.PropertyValuePair pair in this._selectedConfig.StoredProperties)
            {
                if ((pair.name == "MODEM_MOD_TYPE") && (this._selectedProject.Name == "Direct TX"))
                {
                    pair.value = (byte) (pair.value & 7);
                    pair.value = (byte) (pair.value | 8);
                }
            }
            if (!this._ezr2Config.createEZConfigCommand(this._selectedConfig.StoredProperties, this.createUserProperties(), this._selectedProject.Name != "Range test demo", out buffer, out buffer2))
            {
                _log.Error("Could not create EZConfig command array!");
            }
            else
            {
                this._selectedConfig.CommandSet = buffer;
                switch (this._runMode)
                {
                    case RunMode.LabEval:
                        if (this.loadFirmwareCode(this._selectedProject.LabEvaluation.Firmware, null))
                        {
                            Thread.Sleep(0x3e8);
                            this.loadProjectSpecificCommands();
                        }
                        break;

                    case RunMode.FirmwareLoad:
                        this.loadFirmwareCode(this._selectedProject.FirmwareLoad.Firmware, this.createFirmwareChanges());
                        break;

                    case RunMode.IDELaunch:
                        this.launchIDE(this.createHeaderFile());
                        break;
                }
                base.Enabled = this.dgvEzConfigEnable = true;
            }
        }
Пример #4
0
 private void startSetupCalculationAndDeploy()
 {
     if ((_deployOption != DeployOption.ConfigureAndEvaluate) && (_evaluationWindow != null))
     {
         _evaluationWindow.Close();
     }
     _calculatedModulationIndex = 0;
     _calculatedBandwidthText = string.Empty;
     _matlabWarningText = string.Empty;
     if ((_matlabCalcForm == null) || _matlabCalcForm.IsDisposed)
     {
         _matlabCalcForm = new MatlabCalculatorExeutionFront(_chipType, _chipRev, _adtRec.UniqId);
         components.Add(_matlabCalcForm);
         _matlabCalcForm.Location = new Point((base.Location.X + (base.Width / 2)) - (_matlabCalcForm.Width / 2), (base.Location.Y + (base.Height / 2)) - (_matlabCalcForm.Height / 2));
         _matlabCalcForm.Owner = this;
         _matlabCalcForm.FormClosing += new FormClosingEventHandler(matlabCalc_FormClosing);
         fillCalculatorInput(_matlabCalcForm.getInputRef());
         _matlabCalcForm.Show();
     }
     else
     {
         _matlabCalcForm.BringToFront();
     }
     base.Enabled = false;
 }