示例#1
0
        public bool Get(Framebuffer frameBuffer)
        {
            Acc.PhysikInfo  pInfo;
            Acc.GraphicInfo gInfo;
            if (!_acc.GetData(out pInfo, out gInfo))
            {
                return(false);
            }

            SetTc(frameBuffer, pInfo.tcInAction);
            SetAbs(frameBuffer, pInfo.absInAction);

            // TODO: unused values
            // -------------------
            // gInfo.iLastTime
            // gInfo.isDeltaPositive
            // gInfo.iDeltaLapTime
            // gInfo.isValidLap

            // pInfo.carDamage[0]);
            // pInfo.carDamage[1]);
            // pInfo.carDamage[2]);
            // pInfo.carDamage[3]);
            // pInfo.carDamage[4]);

            string speedString = String.Format("{0,3} kph", (int)Math.Round(pInfo.speedKmh));

            frameBuffer.SetText(speedString, 5, 4);

            string lapString = String.Format("{0,2} lap", gInfo.numberOfLaps);

            frameBuffer.SetText(lapString, 7, 5);

            string fuelString = String.Format("{0,5:F2} l", pInfo.fuel);

            frameBuffer.SetText(fuelString, 5, 31);

            string rpmString = String.Format("{0,4} rpm", pInfo.rpm);

            frameBuffer.SetText(rpmString, 7, 31);

            SetCurrentTime(frameBuffer, gInfo.iCurrentTime);
            SetBestTime(frameBuffer, gInfo.iBestTime);

            string posString = String.Format("pos {0,2}", gInfo.position);

            frameBuffer.SetText(posString, 15, 17);

            string tyre0String = String.Format("{0,2}° {1,2:F1}bar", (int)pInfo.tyreCoreTemp[0], UnitConverter.PsiToBar(pInfo.wheelPressure[0]));
            string tyre1String = String.Format("{0,2}° {1,2:F1}bar", (int)pInfo.tyreCoreTemp[1], UnitConverter.PsiToBar(pInfo.wheelPressure[1]));
            string tyre2String = String.Format("{0,2}° {1,2:F1}bar", (int)pInfo.tyreCoreTemp[2], UnitConverter.PsiToBar(pInfo.wheelPressure[2]));
            string tyre3String = String.Format("{0,2}° {1,2:F1}bar", (int)pInfo.tyreCoreTemp[3], UnitConverter.PsiToBar(pInfo.wheelPressure[3]));

            frameBuffer.SetText(tyre0String, 9, 5);
            frameBuffer.SetText(tyre1String, 9, 25);
            frameBuffer.SetText(tyre2String, 11, 5);
            frameBuffer.SetText(tyre3String, 11, 25);

            string tcString = String.Format("tc   {0,1}", gInfo.tc);

            frameBuffer.SetText(tcString, 13, 25);

            string absString = String.Format("abs  {0,1}", gInfo.abs);

            frameBuffer.SetText(absString, 13, 33);
            int    brakeBiasPercent = (pInfo.brakeBias == 0.0) ? 0 : (int)(pInfo.brakeBias * 100) - 14; // TODO: offset only valid for Lexus RFC
            string biasString       = String.Format("bias   {0,2}%", brakeBiasPercent);

            frameBuffer.SetText(biasString, 15, 25);

            string brakeTemp0String = String.Format("{0,3:F1}°", pInfo.brakeTemp[0]);
            string brakeTemp1String = String.Format("{0,3:F1}°", pInfo.brakeTemp[1]);
            string brakeTemp2String = String.Format("{0,3:F1}°", pInfo.brakeTemp[2]);
            string brakeTemp3String = String.Format("{0,3:F1}°", pInfo.brakeTemp[3]);

            frameBuffer.SetText(brakeTemp0String, 13, 2);
            frameBuffer.SetText(brakeTemp1String, 13, 10);
            frameBuffer.SetText(brakeTemp2String, 15, 2);
            frameBuffer.SetText(brakeTemp3String, 15, 10);

            SetGear(frameBuffer, pInfo.gear);

            frameBuffer.SetSpeed(pInfo.rpm);

            return(true);
        }