Example #1
0
        private void CalcCurrentRT(DiagData diagData)
        {
            oldRpmThrRtIndex = RpmThrRtIndex;

            var j7esDiag = diagData as J7esDiagData;

            if (j7esDiag != null && j7esDiag.RPM_RT != 0)
            {
                ThrRtIndex      = j7esDiag.THR_RT_16;
                GbcRtIndex      = j7esDiag.GBC_RT_16;
                RpmRtIndex      = j7esDiag.RPM_RT_16;
                RpmRt32Index    = DataHelper.rl(DataHelper.Swap((byte)(j7esDiag.RPM_RT + 4))) & 0x1F;
                TwatRtIndex     = j7esDiag.TWAT_RT;
                RpmThrRtIndex   = j7esDiag.RPM_THR_RT;
                RpmPressRtIndex = (((byte)(j7esDiag.PRESS_RT + 8)) & 0xF0) + RpmRtIndex;
            }
            else
            {
                ThrRtIndex        = DataHelper.Swap((byte)(thrSampling[Math.Min(diagData.TRT, thrSampling.Length - 1)] + 8)) & 0xF;
                GbcRtIndex        = DataHelper.NearCell(gbcRt, (int)Math.Round(diagData.GBC, MidpointRounding.AwayFromZero));
                RpmRtIndex        = DataHelper.NearCell(rpmRt16, diagData.RPM);
                RpmRt32Index      = DataHelper.NearCell(rpmRt32, diagData.RPM);
                TwatRtIndex       = DataHelper.NearCell(twatRt, diagData.TWAT);
                RpmThrRtIndex     = 16 * ThrRtIndex + RpmRtIndex;
                Rpm32PressRtIndex = (((byte)(j7esDiag.PRESS_RT + 8)) & 0xF0) + RpmRt32Index;
            }

            Rpm32ThrRtIndex = 32 * ThrRtIndex + RpmRt32Index;

            RpmGbcRtIndex = onlineManager.OltProtocol.Version == OltProtocolVersion.OltDiagV1
                                ? diagData.RPM_GBC_RT
                                : 16 * GbcRtIndex + RpmRtIndex;
        }