public TuningResult FreeTuneBinary(IECUFile m_File, double peakTorque, double peakBoost, bool tuneBasedOnTorque, MapSensorType mapType, TurboType turboType, InjectorType injectorType, BPCType valve, int rpmlimiter, int knockTime)
        {
            Trionic5Resume _localResume = new Trionic5Resume();
            m_fileInformation = m_File.GetFileInfo();
            string filename = m_fileInformation.Filename;
            // first set things right by running the tunetostagex wizard
            // generate a nice x_scale for ignition map (18 long)
            PressureToTorque ptt = new PressureToTorque();
            double peak_boost = ptt.CalculatePressureFromTorque(peakTorque, turboType);
            if (!tuneBasedOnTorque) peak_boost = peakBoost;
            double peak_boost_request = peak_boost;
            double correction = 1.0;
            if (mapType == MapSensorType.MapSensor30) correction = 1.2;
            if (mapType == MapSensorType.MapSensor35) correction = 1.4;
            if (mapType == MapSensorType.MapSensor40) correction = 1.6;
            if (mapType == MapSensorType.MapSensor50) correction = 2.0;
            peak_boost_request *= 100;
            peak_boost_request += 100;
            peak_boost_request /= correction;
            peak_boost_request -= 100;
            peak_boost_request /= 100;

            double min_pressure = -1;
            double max_pressure = peak_boost;

            #region preparation

            /********* start of prepare phase *********/
            string enginetp = readenginetype(filename);
            string partnumber = readpartnumber(filename);
            PartNumberConverter pnc = new PartNumberConverter();
            ECUInformation ecuinfo = pnc.GetECUInfo(partnumber, enginetp);
            bool isLpt = true;
            if (ReadTunedToStageMarker(filename) > 0)
            {
                return TuningResult.TuningFailedAlreadyTuned;
            }
            else if (ReadThreeBarConversionMarker(filename) > 0)
            {
                return TuningResult.TuningFailedThreebarSensor;
            }
            Trionic5Properties t5p = m_File.GetTrionicProperties();
            if (ecuinfo.Valid)
            {
                if (ecuinfo.Isaero || ecuinfo.Isfpt)
                {
                    isLpt = false;
                }
            }

            if (t5p.MapSensorType != mapType)
            {
                ConvertFileToThreeBarMapSensor(m_fileInformation, t5p.MapSensorType, mapType);
            }
            // check injector type
            if (t5p.InjectorType != injectorType)
            {
                int inj_konst_diff = DetermineDifferenceInInjectorConstant(t5p.InjectorType, injectorType);
                AddToInjectorConstant(filename, inj_konst_diff);
                SetInjectorBatteryCorrectionMap(m_File, injectorType); //TODO: check this function for correctness!
            }
            /*if (injectorType == InjectorType.Stock) writebyteinfile(filename, GetSymbolAddress("Inj_konst!"), 19);
            else if (injectorType == InjectorType.GreenGiants) writebyteinfile(filename, GetSymbolAddress("Inj_konst!"), 18);
            else if (injectorType == InjectorType.Siemens630Dekas) writebyteinfile(filename, GetSymbolAddress("Inj_konst!"), 15);
            else if (injectorType == InjectorType.Siemens875Dekas) writebyteinfile(filename, GetSymbolAddress("Inj_konst!"), 13);
            else if (injectorType == InjectorType.Siemens875Dekas) writebyteinfile(filename, GetSymbolAddress("Inj_konst!"), 13);*/
            t5p.TurboType = turboType;
            t5p.InjectorType = injectorType;
            t5p.MapSensorType = mapType;
            // determine stage??
            int stage = 0;
            if (peak_boost < 1.2) stage = 1;
            else if (peak_boost < 1.3) stage = 2;
            else if (peak_boost < 1.4) stage = 3;
            else if (peak_boost < 1.5) stage = 4;
            else if (peak_boost < 1.6) stage = 5;
            else if (peak_boost < 1.7) stage = 6;
            else if (peak_boost < 1.8) stage = 7;
            else if (peak_boost < 1.9) stage = 8;
            else stage = 9;

            m_File.SetTrionicOptions(t5p);
            TuneToStage(filename, stage, peak_boost_request, 0.52, 1.0, 0.52, 1.54, 90, isLpt, turboType, injectorType, mapType);
            _localResume.ResumeTuning = m_resume.ResumeTuning.Copy();
            /*********** end of prepare phase **************/

            // set limiter, bpc valve type and knock time
            SetBPCValveType(filename, valve);
            _localResume.AddToResumeTable("Set BPC driving frequencies");
            SetRPMLimiter(filename, rpmlimiter);
            _localResume.AddToResumeTable("Set RPM limiter");
            SetKnockTime(filename, knockTime);
            _localResume.AddToResumeTable("Set knock time value");

            #endregion

            // if mapsensor != stock and injectors are 630 cc or bigger
            if (mapType != MapSensorType.MapSensor25 && (injectorType == InjectorType.Siemens630Dekas || injectorType == InjectorType.Siemens875Dekas || injectorType == InjectorType.Siemens1000cc))
            {
                // now scale it
                double step = (max_pressure - min_pressure) / 17;
                double[] axisforIgnitionMap = new double[18];
                for (int i = 0; i < 18; i++)
                {
                    axisforIgnitionMap.SetValue(min_pressure + (i * step), i);
                }
                byte[] actualAxis = new byte[36];
                int j = 0;
                for (int i = 0; i < 18; i++)
                {
                    double currValue = Convert.ToDouble(axisforIgnitionMap.GetValue(i));
                    currValue *= 100;
                    currValue += 100;
                    if (mapType == MapSensorType.MapSensor30) currValue /= 1.2;
                    else if (mapType == MapSensorType.MapSensor35) currValue /= 1.4;
                    else if (mapType == MapSensorType.MapSensor40) currValue /= 1.6;
                    else if (mapType == MapSensorType.MapSensor50) currValue /= 2.0;
                    int ival = Convert.ToInt32(currValue);
                    byte v1 = (byte)(ival / 256);
                    byte v2 = (byte)(ival - (int)v1 * 256);

                    actualAxis.SetValue(v1, j++);
                    actualAxis.SetValue(v2, j++);
                }
                m_File.WriteData(actualAxis, (uint)m_File.GetFileInfo().GetSymbolAddressFlash("Ign_map_0_x_axis!"));
                _localResume.AddToResumeTable("Generated and saved new ignition map x axis");
                //Generate the ignition map based on the axis values
                GenerateAndSaveNewIgnitionMap(m_File, false);
                _localResume.AddToResumeTable("Generated and saved new ignition map");
                min_pressure = -0.8;
                step = (max_pressure - min_pressure) / 15;
                // now setup x axis for fuel map
                double[] axisforFuelMap = new double[16];
                for (int i = 0; i < 16; i++)
                {
                    axisforFuelMap.SetValue(min_pressure + (i * step), i);
                }
                byte[] actualFuelAxis = new byte[16];
                for (int i = 0; i < 16; i++)
                {
                    double currValue = Convert.ToDouble(axisforFuelMap.GetValue(i));
                    currValue *= 100;
                    currValue += 100;
                    if (mapType == MapSensorType.MapSensor30) currValue /= 1.2;
                    else if (mapType == MapSensorType.MapSensor35) currValue /= 1.4;
                    else if (mapType == MapSensorType.MapSensor40) currValue /= 1.6;
                    else if (mapType == MapSensorType.MapSensor50) currValue /= 2.0;
                    int ival = Convert.ToInt32(currValue);
                    if (ival > 255) ival = 255;
                    actualFuelAxis.SetValue((byte)ival, i);
                }
                m_File.WriteData(actualFuelAxis, (uint)m_File.GetFileInfo().GetSymbolAddressFlash("Fuel_map_xaxis!"));
                _localResume.AddToResumeTable("Generated and saved new fuel map x axis");

                //Generate the ignition map based on the axis values
                GenerateAndSaveNewFuelMap(m_File);
                _localResume.AddToResumeTable("Generated and saved new fuel map");

                min_pressure = -0.3;
                step = (max_pressure - min_pressure) / 11;
                // now setup x axis for fuel map
                double[] axisforFuelKnockMap = new double[12];
                for (int i = 0; i < 12; i++)
                {
                    axisforFuelKnockMap.SetValue(min_pressure + (i * step), i);
                }
                byte[] actualFuelKnockAxis = new byte[12];
                for (int i = 0; i < 12; i++)
                {
                    double currValue = Convert.ToDouble(axisforFuelKnockMap.GetValue(i));
                    currValue *= 100;
                    currValue += 100;
                    if (mapType == MapSensorType.MapSensor30) currValue /= 1.2;
                    else if (mapType == MapSensorType.MapSensor35) currValue /= 1.4;
                    else if (mapType == MapSensorType.MapSensor40) currValue /= 1.6;
                    else if (mapType == MapSensorType.MapSensor50) currValue /= 2.0;
                    int ival = Convert.ToInt32(currValue);
                    if (ival > 255) ival = 255;
                    actualFuelKnockAxis.SetValue((byte)ival, i);
                }
                m_File.WriteData(actualFuelKnockAxis, (uint)m_File.GetFileInfo().GetSymbolAddressFlash("Fuel_knock_xaxis!"));
                _localResume.AddToResumeTable("Generated and saved new fuel knock map x axis");

                //Generate the ignition map based on the axis values
                GenerateAndSaveNewFuelKnockMap(m_File);
                _localResume.AddToResumeTable("Generated and saved new fuel knock map");

                // mesh up a boost request map for this.. already possible
                // adjust peak boost to be scaled for the mapsensor type

                SetBoostRequestMaps(turboType, injectorType, mapType, m_File.GetFileInfo().Filename, peak_boost_request, 100, isLpt);
                _localResume.AddToResumeTable("Generated boost request maps");

            }
            m_resume.ResumeTuning = _localResume.ResumeTuning.Copy();
            return TuningResult.TuningSuccess;
        }
        public TuningResult TuneFileToStage(int stage, string filename, IECUFile m_TrionicFile, IECUFileInformation trionicFileInformation, bool SilentMode)
        {
            //<COPY FROM HERE>
            m_fileInformation = trionicFileInformation;
            m_resume = new Trionic5Resume();
            TuningResult retval = TuningResult.TuningFailed;
            string enginetp = readenginetype(filename);
            string partnumber = readpartnumber(filename);
            PartNumberConverter pnc = new PartNumberConverter();
            ECUInformation ecuinfo = pnc.GetECUInfo(partnumber, enginetp);
            bool isLpt = false;
            if (ReadTunedToStageMarker(filename) > 0 && !SilentMode)
            {
                retval = TuningResult.TuningFailedAlreadyTuned;
            }
            else if (ReadThreeBarConversionMarker(filename) > 0 && !SilentMode)
            {
                retval = TuningResult.TuningFailedThreebarSensor;
            }
            else if (SilentMode)
            {
                Trionic5Properties t5p = m_TrionicFile.GetTrionicProperties();
                if (stage == 1)
                {
                    TuneToStage(filename, stage, ecuinfo.Stage1boost, 0.72, 1.54, 0.62, ecuinfo.Stage1boost, 90, isLpt, t5p.TurboType, t5p.InjectorType, t5p.MapSensorType);
                    retval = TuningResult.TuningSuccess;
                }
                else if (stage == 2)
                {
                    TuneToStage(filename, stage, ecuinfo.Stage2boost, 0.72, 1.54, 0.62, ecuinfo.Stage2boost, 90, isLpt, t5p.TurboType, t5p.InjectorType, t5p.MapSensorType);
                    retval = TuningResult.TuningSuccess;
                }
                else if (stage == 3)
                {
                    TuneToStage(filename, stage, ecuinfo.Stage3boost, 0.72, 1.54, 0.62, ecuinfo.Stage3boost, 90, isLpt, t5p.TurboType, t5p.InjectorType, t5p.MapSensorType);
                    retval = TuningResult.TuningSuccess;
                }
            }
            else
            {
                Trionic5Properties t5p = m_TrionicFile.GetTrionicProperties();
                string msg = string.Empty;
                if (ecuinfo.Valid)
                {
                    msg = "Tuning your: " + ecuinfo.Bhp.ToString() + " bhp ";
                    msg += ecuinfo.Carmodel.ToString() + " (" + ecuinfo.Enginetype.ToString() + ") ";
                    if (ecuinfo.Is2point3liter) msg += " 2.3 liter ";
                    else msg += " 2.0 liter ";
                    if (ecuinfo.Isaero)
                    {
                        t5p.TurboType = TurboType.TD0415T;
                        msg += " Aero binary";
                    }
                    else if (ecuinfo.Isfpt) msg += " Full pressure turbo binary";
                    else if (ecuinfo.Isturbo)
                    {
                        msg += " Low pressure turbo, you'll have to modify hardware (solenoid valve, hoses etc.) to get this working!";
                        isLpt = true;
                    }
                    else msg += " non turbo car to stage, you'll have to modify hardware to get this working!";
                }
                else
                {
                    msg = "Partnumber not recognized, tuning will continue anyway, please verify settings afterwards";
                }
                PSTaskDialog.cTaskDialog.ForceEmulationMode = false;
                PSTaskDialog.cTaskDialog.EmulatedFormWidth = 600;
                PSTaskDialog.cTaskDialog.UseToolWindowOnXP = false;
                PSTaskDialog.cTaskDialog.VerificationChecked = true;
                string stageDescription = ConvertToStageDescription(stage);
                PSTaskDialog.cTaskDialog.ShowTaskDialogBox("Tune me up™ to stage " + stageDescription + " wizard", "This wizard will tune your binary to a stage " + stageDescription + " equivalent.", "Boost request map, fuel injection and ignition tables will be altered" + Environment.NewLine + msg, "Happy driving!!!\nDilemma © 2009", "The author does not take responsibility for any damage done to your car or other objects in any form!", "Show me a summary after tuning", "", "Yes, tune me to stage " + stageDescription + "|No thanks!", PSTaskDialog.eTaskDialogButtons.None, PSTaskDialog.eSysIcons.Information, PSTaskDialog.eSysIcons.Warning);
                switch (PSTaskDialog.cTaskDialog.CommandButtonResult)
                {
                    case 0:
                        // tune to stage 1
                        if (stage == 1)
                        {
                            TuneToStage(filename, stage, ecuinfo.Stage1boost, 0.72, 1.54, 0.62, ecuinfo.Stage1boost, 90, isLpt, t5p.TurboType, t5p.InjectorType, t5p.MapSensorType);
                        }
                        else if (stage == 2)
                        {
                            TuneToStage(filename, stage, ecuinfo.Stage2boost, 0.72, 1.54, 0.62, ecuinfo.Stage2boost, 90, isLpt, t5p.TurboType, t5p.InjectorType, t5p.MapSensorType);
                        }
                        else if (stage == 3)
                        {
                            TuneToStage(filename, stage, ecuinfo.Stage3boost, 0.72, 1.54, 0.62, ecuinfo.Stage3boost, 90, isLpt, t5p.TurboType, t5p.InjectorType, t5p.MapSensorType);
                        }
                        else if (stage == 99) // stage X
                        {
                            // get parameters from user:
                            // max boost, turbo type, injector type, rpm limit etc etc
                            frmTuningSettings tunset = new frmTuningSettings();
                            tunset.Turbo = t5p.TurboType;
                            tunset.Injectors = t5p.InjectorType;
                            tunset.MapSensor = t5p.MapSensorType;
                            if (t5p.MapSensorType != MapSensorType.MapSensor25)
                            {
                                // set max boost etc
                                //tunset.PeakBoost = 1.75;
                                //tunset.BoostFuelcut = 2.05;
                            }
                            if (tunset.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            {
                                // write details to the file

                                if (t5p.MapSensorType != tunset.MapSensor)
                                {
                                    ConvertFileToThreeBarMapSensor(m_fileInformation, t5p.MapSensorType, tunset.MapSensor);
                                }
                                // check injector type
                                if (t5p.InjectorType != tunset.Injectors)
                                {
                                    int inj_konst_diff = DetermineDifferenceInInjectorConstant(t5p.InjectorType, tunset.Injectors);
                                    AddToInjectorConstant(filename, inj_konst_diff);
                                    // roughly set inj_konst
                                    // Stock = 21
                                    // Green giants = 20 (minus 1)
                                    // Siemens 630 = 16 (minus 5)
                                    // Siemens 875 = 13 (minus 8)
                                    // Siemens 1000 = 10 (minus 11)

                                    // set battery correction voltage maps

                                    SetInjectorBatteryCorrectionMap(m_TrionicFile, tunset.Injectors);
                                }
                                t5p.TurboType = tunset.Turbo;
                                t5p.InjectorType = tunset.Injectors;
                                t5p.MapSensorType = tunset.MapSensor;
                                // determine stage??
                                if (tunset.PeakBoost < 1.2) stage = 1;
                                else if (tunset.PeakBoost < 1.3) stage = 2;
                                else if (tunset.PeakBoost < 1.4) stage = 3;
                                else if (tunset.PeakBoost < 1.5) stage = 4;
                                else if (tunset.PeakBoost < 1.6) stage = 5;
                                else if (tunset.PeakBoost < 1.7) stage = 6;
                                else if (tunset.PeakBoost < 1.8) stage = 7;
                                else if (tunset.PeakBoost < 1.9) stage = 8;
                                else stage = 9;
                                if (tunset.MapSensor == MapSensorType.MapSensor30)
                                {
                                    // set correct values

                                    double conversion = CalculateConversionFactor(MapSensorType.MapSensor25, tunset.MapSensor);
                                    tunset.PeakBoost = (((((tunset.PeakBoost + 1) * 100) / conversion) / 100) - 1);
                                    tunset.BoostFirstGear = (((((tunset.BoostFirstGear + 1) * 100) / conversion) / 100) - 1);
                                    tunset.BoostSecondGear = (((((tunset.BoostSecondGear + 1) * 100) / conversion) / 100) - 1);
                                    tunset.BoostFuelcut = (((((tunset.BoostFuelcut + 1) * 100) / conversion) / 100) - 1);
                                }
                                else if (tunset.MapSensor == MapSensorType.MapSensor35)
                                {
                                    // set correct values
                                    double conversion = CalculateConversionFactor(MapSensorType.MapSensor25, tunset.MapSensor);
                                    tunset.PeakBoost = (((((tunset.PeakBoost + 1) * 100) / conversion) / 100) - 1);
                                    tunset.BoostFirstGear = (((((tunset.BoostFirstGear + 1) * 100) / conversion) / 100) - 1);
                                    tunset.BoostSecondGear = (((((tunset.BoostSecondGear + 1) * 100) / conversion) / 100) - 1);
                                    tunset.BoostFuelcut = (((((tunset.BoostFuelcut + 1) * 100) / conversion) / 100) - 1);
                                }
                                else if (tunset.MapSensor == MapSensorType.MapSensor40)
                                {
                                    // set correct values
                                    double conversion = CalculateConversionFactor(MapSensorType.MapSensor25, tunset.MapSensor);
                                    tunset.PeakBoost = (((((tunset.PeakBoost + 1) * 100) / conversion) / 100) - 1);
                                    tunset.BoostFirstGear = (((((tunset.BoostFirstGear + 1) * 100) / conversion) / 100) - 1);
                                    tunset.BoostSecondGear = (((((tunset.BoostSecondGear + 1) * 100) / conversion) / 100) - 1);
                                    tunset.BoostFuelcut = (((((tunset.BoostFuelcut + 1) * 100) / conversion) / 100) - 1);
                                }
                                else if (tunset.MapSensor == MapSensorType.MapSensor50)
                                {
                                    // set correct values
                                    double conversion = CalculateConversionFactor(MapSensorType.MapSensor25, tunset.MapSensor);
                                    tunset.PeakBoost = (((((tunset.PeakBoost + 1) * 100) / conversion) / 100) - 1);
                                    tunset.BoostFirstGear = (((((tunset.BoostFirstGear + 1) * 100) / conversion) / 100) - 1);
                                    tunset.BoostSecondGear = (((((tunset.BoostSecondGear + 1) * 100) / conversion) / 100) - 1);
                                    tunset.BoostFuelcut = (((((tunset.BoostFuelcut + 1) * 100) / conversion) / 100) - 1);
                                }
                                m_TrionicFile.SetTrionicOptions(t5p);
                                TuneToStage(filename, stage, tunset.PeakBoost, tunset.BoostFirstGear, tunset.BoostSecondGear, tunset.BoostFirstGear, tunset.BoostFuelcut, 90, /*isLpt*/ true, t5p.TurboType, t5p.InjectorType, t5p.MapSensorType);
                            }
                            else
                            {
                                retval = TuningResult.TuningCancelled;
                                return retval;
                            }

                        }
                        retval = TuningResult.TuningSuccess;
                        break;
                    /*                        case 1:
                                                // tune to stage 2
                                                TuneToStage(2, ecuinfo.Stage2boost, 0.72, 1.54, 0.62, 1.54, 90, isLpt);
                                                break;
                                            case 2:
                                                // tune to stage 3
                                                TuneToStage(3, ecuinfo.Stage3boost, 0.72, 1.54, 0.62, 1.54, 90, isLpt);
                                                break;*/
                    case 1:
                        // cancel
                        retval = TuningResult.TuningCancelled;
                        break;
                }
            }
            return retval;
        }
Exemple #3
0
        private bool OpenWorkingFile(string filename)
        {
            bool retval = false;
            if (File.Exists(filename))
            {
                m_trionicFile = new Trionic5File();

                m_trionicFile.LibraryPath = Application.StartupPath + "\\Binaries";

                m_trionicFile.SetAutoUpdateChecksum(m_appSettings.AutoChecksum);

                FileInfo fi = new FileInfo(filename); //<GS-07102010> remove read only flag if possible
                try
                {
                    fi.IsReadOnly = false;
                    btnReadOnly.Caption = "File access OK";
                }
                catch (Exception E)
                {
                    Console.WriteLine("Failed to remove read only flag: " + E.Message);
                    btnReadOnly.Caption = "File is READ ONLY";
                }

                m_trionicFile.onDecodeProgress += new IECUFile.DecodeProgress(m_trionicFile_onDecodeProgress);
                m_trionicFile.onTransactionLogChanged += new IECUFile.TransactionLogChanged(m_trionicFile_onTransactionLogChanged);
                m_trionicFile.SelectFile(filename);
                //m_trionicFileInformation = m_trionicFile.ParseTrionicFile(ofd.FileName);
                m_trionicFileInformation = m_trionicFile.ParseFile();
                props = m_trionicFile.GetTrionicProperties();
                // set indicators and menu items accoring to the file that has been opened
                if (props.IsTrionic55)
                {
                    barECUType.Caption = "T5.5";
                    // enable T5.5 maps
                    EnableT55Maps(true);
                }
                else
                {
                    barECUType.Caption = "T5.2";
                    EnableT55Maps(false);
                    // disable T5.5 maps
                }
                barECUSpeed.Caption = props.CPUspeed;
                if (props.RAMlocked)
                {
                    barECULocked.Caption = "RAM locked";
                }
                else
                {
                    barECULocked.Caption = "RAM unlocked";
                }
                if (CheckFileInLibrary(props.Partnumber))
                {
                    btnCompareToOriginalFile.Enabled = true;
                }
                else
                {
                    btnCompareToOriginalFile.Enabled = false;
                }
                _ecuConnection.MapSensorType = m_trionicFile.GetMapSensorType(m_appSettings.AutoDetectMapsensorType);
                gridSymbols.DataSource = m_trionicFileInformation.SymbolCollection;
                barStaticItem2.Caption = "File: " + Path.GetFileName(m_trionicFileInformation.Filename);
                this.Text = "T5Suite Professional 2.0 [" + Path.GetFileName(m_trionicFileInformation.Filename) + "]";
                OpenGridViewGroups(gridSymbols, 0);
                // enable buttons
                barButtonItem4.Enabled = true;
                btnConnectECU.Enabled = true;
                btnSwitchMode.Enabled = true;
                //btnSynchronizeMaps.Enabled = true;
                btnTuneForE85Fuel.Enabled = true; //<GS-06042010> todo
                btnTuneToLargerInjectors.Enabled = true; //<GS-06042010> todo
                btnTuneToStage1.Enabled = true;
                btnTuneToStage2.Enabled = true;
                btnTuneToStage3.Enabled = true;
                btnTuneToStageX.Enabled = true;

                //            btnTuneToThreeBarSensor.Enabled = true;
                barConvertMapSensor.Enabled = true;
                btnBoostAdaptionWizard.Enabled = true;
                btnHardcodedRPMLimit.Enabled = true;
                if (m_trionicFileInformation.Has2DRegKonMat())
                {
                    btnChangeRegkonMatRange.Enabled = true;
                }
                else
                {
                    btnChangeRegkonMatRange.Enabled = false;
                }

                m_appSettings.Lastfilename = filename;
                ctrlRealtime1.Currentfile = filename;

                if (m_AFRMaps != null)
                {
                    m_AFRMaps.SaveMaps(); // first save changes that might have been done
                }

                m_AFRMaps = null;
                if (m_AFRMaps == null && m_appSettings.AlwaysCreateAFRMaps)
                {
                    m_AFRMaps = new AFRMaps();
                    m_AFRMaps.onFuelmapCellChanged += new AFRMaps.FuelmapCellChanged(m_AFRMaps_onFuelmapCellChanged);
                    m_AFRMaps.onIdleFuelmapCellChanged += new AFRMaps.IdleFuelmapCellChanged(m_AFRMaps_onIdleFuelmapCellChanged);
                    m_AFRMaps.onCellLocked += new AFRMaps.CellLocked(m_AFRMaps_onCellLocked);
                    m_AFRMaps.TrionicFile = m_trionicFile;
                    m_AFRMaps.InitializeMaps();
                }
                // add realtime symbollist to ctrlRealtime1
                Trionic5Tools.SymbolCollection _rtSymbols = new Trionic5Tools.SymbolCollection();
                foreach (Trionic5Tools.SymbolHelper symh in m_trionicFileInformation.SymbolCollection)
                {
                    if (symh.Start_address > 0 && (symh.Length >= 1 && symh.Length <= 4)) // <GS-29072010> was 1 & 2 only
                    {
                        _rtSymbols.Add(symh);
                    }
                }
                ctrlRealtime1.RealtimeSymbolCollection = _rtSymbols;
                try
                {
                    LoadUserDefinedRealtimeSymbols(); // try to load it
                }
                catch (Exception E)
                {
                    Console.WriteLine(E.Message);
                }
                LoadKnockMaps();
                SetTaskProgress(0, false);
                retval = true;
            }
            return retval;
        }