Exemplo n.º 1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            ConnectionState = ConnectionStateEnums.eDisconnected;
            lblProgramVersion.DataBindings.Add(new Binding("Text", ECUVars, "sProgramVersion"));
            lblPromVersion.DataBindings.Add(new Binding("Text", ECUVars, "sPromVersion"));
            //lblCalibrationCode.DataBindings.Add(new Binding("Text", ECUVars, "sCalibrationCode"));

            lblACRequest.DataBindings.Add(new Binding("Text", ECUVars, "sACRequest"));

            lblMapRaw.DataBindings.Add(new Binding("Text", ECUVars, "sMAP"));
            lblCTSRaw.DataBindings.Add(new Binding("Text", ECUVars, "sCTS"));
            lblIAT.DataBindings.Add(new Binding("Text", ECUVars, "sIAT"));
            lblVolts.DataBindings.Add(new Binding("Text", ECUVars, "sVolts"));
            lblO2.DataBindings.Add(new Binding("Text", ECUVars, "sLambda"));
            lblRPM.DataBindings.Add(new Binding("Text", ECUVars, "sRPM"));

            lblTPS.DataBindings.Add(new Binding("Text", ECUVars, "sTPS"));
            lblSparkAdv.DataBindings.Add(new Binding("Text", ECUVars, "sSparkAdvance"));
            lblInitialMAP.DataBindings.Add(new Binding("Text", ECUVars, "sInitialMAP"));
            lblLoopExhaust.DataBindings.Add(new Binding("Text", ECUVars, "sLoopStatusExhaust"));
            lblInjPulse.DataBindings.Add(new Binding("Text", ECUVars, "sInjPulseMs"));
            lblFuelSync.DataBindings.Add(new Binding("Text", ECUVars, "sfuelsync"));

            lblSTFuel.DataBindings.Add(new Binding("Text", ECUVars, "sSTFuelTrim"));
            lblLTFuel.DataBindings.Add(new Binding("Text", ECUVars, "sLTFuelTrim"));
            lblKnock.DataBindings.Add(new Binding("Text", ECUVars, "sKnock"));

            lblVacHg.DataBindings.Add(new Binding("Text", ECUVars, "sVacHg"));
            lblECUMode.DataBindings.Add(new Binding("Text", ECUVars, "ECUMode"));
            lblFuelMix.DataBindings.Add(new Binding("Text", ECUVars, "O2State"));
            lblThrottle.DataBindings.Add(new Binding("Text", ECUVars, "ThrottlePos"));
            lblLogTime.DataBindings.Add(new Binding("Text", ECUVars, "sLogTime"));

            lblACClutch.DataBindings.Add(new Binding("Text", ECUVars, "ACClutch"));

            lblACSwitch.DataBindings.Add(new Binding("Text", ECUVars, "ACState"));
            lblEGR.DataBindings.Add(new Binding("Text", ECUVars, "EGR"));

            lblbadFrames.DataBindings.Add(new Binding("Text", ECUVars, "sBadFrames"));

            IPAddress ip = GetDefaultGateway();

            lblCurrentGateWay.Text = ip.ToString();
            tmrUpdate.Interval     = 5000;
            nudUpdateRate.Value    = 5;

            tsStatLblSuccess.Text = SuccessfulReads.ToString();
        }
Exemplo n.º 2
0
        // private UpdateBadReads

        private void tmrUpdate_Tick(object sender, EventArgs e)
        {
            bool status;

            if (cbConnect.Checked)
            {
                status = JeepECUData.ReadECUData(ref ECUVars, lblCurrentGateWay.Text);
                if (status)
                {
                    ConnectionState = ConnectionStateEnums.eConnected;
                    fails           = 0;
                    ++SuccessfulReads;
                    tsStatLblSuccess.Text = SuccessfulReads.ToString();
                    ECUVars.LogTime       = DateTime.Now; //Timestamp record
                    //Handle Logging
                    if (cbLog.Checked)
                    {
                        CsvRecord     cr             = new CsvRecord(); //Get a new CSV Record
                        List <String> dataStringList = ECUVars.GetDataValueStringList();
                        foreach (String item in dataStringList)
                        {
                            cr.Fields.Add(item);
                        }
                        LogFile.Records.Add(cr);
                        needSave = true;
                    }
                }
                else
                {
                    ConnectionState = ConnectionStateEnums.eConnecting;
                    ++fails;
                    if (fails > 5)
                    {
                        status = CheckConnection(lblCurrentGateWay.Text);
                        if (!status)
                        {
                            tmrUpdate.Enabled = false;  //Disable timer since it runs asynchroniously and will continue to run this
                                                        //method while MessageBox is up.
                            MessageBox.Show("Lost Connection. Still Connected to SSID RenixECU?", "Error", MessageBoxButtons.OK);
                            cbConnect.Checked = false;
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
 private void cbConnect_CheckedChanged(object sender, EventArgs e)
 {
     if (cbConnect.Checked)
     {
         ConnectionState = ConnectionStateEnums.eConnecting;
         bool status = CheckConnection(lblCurrentGateWay.Text);
         if (!status)
         {
             MessageBox.Show("Connection Failed.  Ensure you're connected to SSID RenixECU.", "Error", MessageBoxButtons.OK);
             cbConnect.Checked = false;
         }
         else
         {
             tmrUpdate.Enabled = true;
         }
     }
     else
     {
         tmrUpdate.Enabled = false;
         ConnectionState   = ConnectionStateEnums.eDisconnected;
     }
 }