예제 #1
0
 void trionicCan_onWriteProgress(object sender, ITrionic.WriteProgressEventArgs e)
 {
     UpdateProgressStatus(e.Percentage);
 }
예제 #2
0
 private void UpdateFlashStatus(ITrionic.CanInfoEventArgs e)
 {
     try
     {
         Invoke(m_DelegateUpdateStatus, e);
     }
     catch (Exception ex)
     {
         logger.Debug(ex.Message);
     }
 }
예제 #3
0
 void trionicCan_onCanFrame(object sender, ITrionic.CanFrameEventArgs e)
 {
     logger.Debug("Rx frame: 0x" + e.Message.getID().ToString("X4") + " 0x" + e.Message.getData().ToString("X16"));
     UpdateFrame(e);
 }
예제 #4
0
 void trionicCan_onCanInfo(object sender, ITrionic.CanInfoEventArgs e)
 {
     UpdateFlashStatus(e);
 }
예제 #5
0
        void trionic7_onCanFrame(ITrionic.CanFrameEventArgs e)
        {
            //TODO: handle additional information from the canbus
            // the messages have been filtered already
            // only handle this when the realtime stuff is running... otherwise just ignore
            if (m_appSettings.UseAdditionalCanbusFrames)
            {
                ulong _data = e.Message.getData();
                switch (e.Message.getID())
                {
                    case 0x1A0:         //1A0h - Engine information
                        // rpm is 16 bit value (RPM0 and RPM1 which are byte 1 and 2)
                        int _rpm = Convert.ToInt32(e.Message.getCanData(1)) * 256;
                        _rpm += Convert.ToInt32(e.Message.getCanData(2));
                        UpdateRealtimeInformation("ActualIn.n_Engine", _rpm);
                        int _tps = Convert.ToInt32(e.Message.getCanData(5));
                        UpdateRealtimeInformation("Out.X_AccPedal", _tps);
                        break;
                    case 0x280:         //280h - Pedals, reverse gear
                        // reverse = msg.data(1) & 0x02
                        // clutch = msg.data(2) & 0x08
                        // brake = msg.data(2) & 0x0A
                        // cruise = msg.data(4) & 0x20

                        break;
                    case 0x290:         //290h - Steering wheel and SID buttons
                        /*
                If (msg.data(2) And &H4) = &H4 Then LabelSteeringWheel.Text = "NXT"
                If (msg.data(2) And &H8) = &H8 Then LabelSteeringWheel.Text = "SEEK-"
                If (msg.data(2) And &H10) = &H10 Then LabelSteeringWheel.Text = "SEEK+"
                If (msg.data(2) And &H20) = &H20 Then LabelSteeringWheel.Text = "SRC"
                If (msg.data(2) And &H40) = &H40 Then LabelSteeringWheel.Text = "VOL+"
                If (msg.data(2) And &H80) = &H80 Then LabelSteeringWheel.Text = "VOL-"

                If (msg.data(3) And &H10) = &H10 Then LabelSID.Text = "+"
                If (msg.data(3) And &H40) = &H40 Then LabelSID.Text = "SET"
                If (msg.data(3) And &H80) = &H80 Then LabelSID.Text = "CLR"                         * */
                        break;
                    case 0x2F0:         //2F0h - Vehicle speed
                        break;
                    case 0x320:         //320h - Doors, central locking and seat belts
                        //msg.data(1) & 0x80 = central locking = unlocked
                        //msg.data(1) & 0x40 = Front left door
                        //msg.data(1) & 0x20 = Front right door
                        //msg.data(1) & 0x10 = Back left door
                        //msg.data(1) & 0x08 = Back right door
                        //msg.data(1) & 0x04 = Hatch door

                        break;
                    case 0x370:         //370h - Mileage
                        break;
                    case 0x3A0:         //3A0h - Vehicle speed
                        int _speed = Convert.ToInt32(e.Message.getCanData(3)) * 256;
                        _speed += Convert.ToInt32(e.Message.getCanData(4));
                        float spd = (float)_speed;
                        spd /= 10F;
                        UpdateRealtimeInformation("In.v_Vehicle", spd);
                        break;
                    case 0x3B0:         //3B0h - Head lights
                        int _lightStatus = Convert.ToInt32(e.Message.getCanData(1));
                        if ((_lightStatus & 0x0001) > 0)
                        {
                            _currentEngineStatus.HeadlightsOn = true;
                        }
                        else
                        {
                            _currentEngineStatus.HeadlightsOn = false;
                        }
                        break;
                    case 0x3E0:         //3E0h - Automatic Gearbox
                        break;
                    case 0x410:         //410h - Light dimmer and light sensor
                        break;
                    case 0x430:         //430h - SID beep request (interesting for Knock indicator?)
                        break;
                    case 0x460:         //460h - Engine rpm and speed
                        _rpm = Convert.ToInt32(e.Message.getCanData(1)) * 256;
                        _rpm += Convert.ToInt32(e.Message.getCanData(2));
                        UpdateRealtimeInformation("ActualIn.n_Engine", _rpm);
                        // rpm = msg.data(1) * 255 + msg.data(2)
                        // speed = (msg.data(3) * 255 + msg.data(4)) / 10
                        _speed = Convert.ToInt32(e.Message.getCanData(3)) * 256;
                        _speed += Convert.ToInt32(e.Message.getCanData(4));
                        spd = (float)_speed;
                        spd /= 10F;
                        UpdateRealtimeInformation("In.v_Vehicle", spd);
                        break;
                    case 0x4A0:         //4A0h - Steering wheel, Vehicle Identification Number
                        //msg.data(2) & 0x40 = left signal indicator
                        //msg.data(2) & 0x20 = right signal indicator
                        break;
                    case 0x520:         //520h - ACC, inside temperature
                        // temperature = msg.data(5) - 40
                        break;
                    case 0x530:         //530h - ACC
                        break;
                    case 0x5C0:         //5C0h - Coolant temperature, air pressure
                        break;
                    case 0x630:         //630h - Fuel usage
                        break;
                    case 0x640:         //640h - Mileage
                        break;
                    case 0x7A0:         //7A0h - Outside temperature
                        break;
                    default:
                        break;
                }
            }
        }
예제 #6
0
 void trionic7_onCanInfo(ITrionic.CanInfoEventArgs e)
 {
     // display progress in the statusbar
     //TODO: For testing only
     SetProgress(e.Info);
 }
예제 #7
0
파일: frmMain.cs 프로젝트: ChrisPea/Trionic
 private void UpdateFlashStatus(ITrionic.CanInfoEventArgs e)
 {
     try
     {
         logger.Trace("UpdateFlashStatus");
         Invoke(m_DelegateUpdateStatus, e);
     }
     catch (Exception ex)
     {
         AddLogItem(ex.Message);
     }
 }
예제 #8
0
 void t8can_onReadProgress(object sender, ITrionic.ReadProgressEventArgs e)
 {
     SetProgress(String.Format("Downloading {0} %", e.Percentage));
     SetProgressPercentage(e.Percentage);
 }
예제 #9
0
파일: frmMain.cs 프로젝트: ChrisPea/Trionic
 void trionicCan_onCanInfo(object sender, ITrionic.CanInfoEventArgs e)
 {
     logger.Trace("trionicCan_onCanInfo");
     UpdateFlashStatus(e);
 }
예제 #10
0
파일: frmMain.cs 프로젝트: ChrisPea/Trionic
 void trionicCan_onWriteProgress(object sender, ITrionic.WriteProgressEventArgs e)
 {
     logger.Trace("trionicCan_onWriteProgress" + e.Percentage);
     UpdateProgressStatus(e.Percentage);
 }
예제 #11
0
파일: frmMain.cs 프로젝트: ChrisPea/Trionic
 private void StartBGWorkerLog(ITrionic trionic)
 {
     AddLogItem("Logging in progress");
     bgworkerLogCanData = new BackgroundWorker
     {
         WorkerReportsProgress = true,
         WorkerSupportsCancellation = true
     };
     bgworkerLogCanData.DoWork += new DoWorkEventHandler(trionic.LogCANData);
     bgworkerLogCanData.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bgWorker_RunWorkerCompleted);
     bgworkerLogCanData.RunWorkerAsync();
 }
예제 #12
0
파일: frmMain.cs 프로젝트: ChrisPea/Trionic
        private void SetGenericOptions(ITrionic trionic)
        {
            trionic.OnlyPBus = cbOnlyPBus.Checked;
            trionic.DisableCanConnectionCheck = cbDisableConnectionCheck.Checked;

            switch (cbxAdapterType.SelectedIndex)
            {
                case (int)CANBusAdapter.JUST4TRIONIC:
                    trionic.ForcedBaudrate = 115200;
                    break;
                case (int)CANBusAdapter.ELM327:
                    //set selected com speed
                    switch (cbxComSpeed.SelectedIndex)
                    {
                        case (int)ComSpeed.S2Mbit:
                            trionic.ForcedBaudrate = 2000000;
                            break;
                        case (int)ComSpeed.S1Mbit:
                            trionic.ForcedBaudrate = 1000000;
                            break;
                        case (int)ComSpeed.S230400:
                            trionic.ForcedBaudrate = 230400;
                            break;
                        case (int)ComSpeed.S115200:
                            trionic.ForcedBaudrate = 115200;
                            break;
                        default:
                            trionic.ForcedBaudrate = 0; //default , no speed will be changed
                            break;
                    }
                    break;
                case (int)CANBusAdapter.MXWIFI:
                    trionic.ForcedBaudrate = Convert.ToInt32(cbxComSpeed.Text);
                    break;
                default:
                    break;
            }

            trionic.setCANDevice((CANBusAdapter)cbxAdapterType.SelectedIndex);
            if (cbAdapter.SelectedItem != null)
            {
                trionic.SetSelectedAdapter(cbAdapter.SelectedItem.ToString());
            }
        }
예제 #13
0
 void t8can_onWriteProgress(object sender, ITrionic.WriteProgressEventArgs e)
 {
     SetProgress(String.Format("Sending {0} %", e.Percentage));
     SetProgressPercentage(e.Percentage);
 }
예제 #14
0
 private void UpdateFrame(ITrionic.CanFrameEventArgs e)
 {
     try
     {
         Invoke(m_DelegateCanFrame, e);
     }
     catch (Exception ex)
     {
         logger.Debug(ex.Message);
     }
 }
예제 #15
0
파일: frmMain.cs 프로젝트: ChrisPea/Trionic
 private void updateStatusInBox(ITrionic.CanInfoEventArgs e)
 {
     AddLogItem(e.Info);
     if (cbxEcuType.SelectedIndex == (int)ECU.TRIONIC7)
     {
         if (e.Type == ActivityType.FinishedFlashing || e.Type == ActivityType.FinishedDownloadingFlash)
         {
             TimeSpan ts = DateTime.Now - dtstart;
             AddLogItem("Total duration: " + ts.Minutes + " minutes " + ts.Seconds + " seconds");
             trionic7.Cleanup();
             AddLogItem("Connection closed");
             EnableUserInput(true);
         }
     }
 }
예제 #16
0
 private void updateStatusInBox(ITrionic.CanInfoEventArgs e)
 {
     SetProgress(e.Info);
 }
예제 #17
0
 void t8can_onCanInfo(object sender, ITrionic.CanInfoEventArgs e)
 {
     SetProgress(e.Info);
 }