My Suzuki turns 16.000rpm. This is more or less the maximum capable OBD II rpm number.
I could see it dropping to 1.000 after reaching something above 15-16. Alright: A classic integer overflow.
Due to the speed & rpm recording, the Virb is rarely attached in the bikes cockpit. That´s why I did not recognized the cause!
My rev meter shows 12.000 and Virb Edit 14.000. Now it is clear, that it overflows!
So I began some research and tried to unpack my fit-File from that turn.
Using the ThisIsAnt C# example just show me a dozen "ObdiiDataMesg" values. Not very much for a 21 minutes turn with around 7 PIDs per second...
And it seems to be quite strange:
RPM 10147
RPM 7079
Speed 0km/h
Throttle56%
RPM 10218
RPM 15274
Speed 0km/h
Throttle18%
Load 2
AirFlow 0 grams/sec
RPM 9736
RPM 10726
Speed 0km/h
Throttle52%
RPM 8362
RPM 15396
Speed 0km/h
Throttle7%
RPM comes twice, with divergent values. Speed is always 0. But importing that to Connect, it shows the correct speed.
My code enhancement:
private static void MesgBroadcaster_ObdiiDataMesgEvent(object sender, MesgEventArgs e)
{
//Console.WriteLine("MonitoringHandler: Received {1} Mesg, it has global ID#{0}", e.mesg.Num, e.mesg.Name);
var myObdiiDataMesg = (ObdiiDataMesg)e.mesg;
try
{
//Console.WriteLine("\tTimestamp {0}", myObdiiDataMesg.GetTimestamp());
//Console.WriteLine("\tPid {0}", myObdiiDataMesg.GetPid());
switch (myObdiiDataMesg.GetPid()) // Cycles is a dynamic field
{
case 0x04:
Console.WriteLine("\tLoad\t{0}", CalcRawData(myObdiiDataMesg, 1));
break;
case 0x05:
Console.WriteLine("\tEngineTemp\t{0}°C", CalcTemp(myObdiiDataMesg));
break;
case 0x0C:
//Console.WriteLine("\tRPM {0} {1}", myObdiiDataMesg.GetRawData(0), myObdiiDataMesg.GetRawData(1));
Console.WriteLine("\tRPM\t{0}", CalcRpm(myObdiiDataMesg));
break;
case 0x0D:
Console.WriteLine("\tSpeed\t{0}km/h", CalcRawData(myObdiiDataMesg,1));
break;
case 0x0F:
Console.WriteLine("\tAirTemp\t{0}°C", CalcTemp(myObdiiDataMesg));
break;
case 0x10:
Console.WriteLine("\tAirFlow\t{0} grams/sec", CalcRawData(myObdiiDataMesg, 1) / 100);
break;
case 0x11:
Console.WriteLine("\tThrottle\t{0}%", CalcRawData(myObdiiDataMesg, 1) * 100/255);
break;
default:
Console.WriteLine("\tPid:{0}\t{1}", myObdiiDataMesg.GetPid(), myObdiiDataMesg.GetNumRawData());
break;
}
}
catch (FitException exception)
{
Console.WriteLine("\tOnDeviceInfoMesg Error {0}", exception.Message);
Console.WriteLine("\t{0}", exception.InnerException);
}
}
#endregion
private static int CalcRawData(ObdiiDataMesg msg, int lenth)
{
int rawData = 0;
var dataLenth = lenth;
for (int i = 0; i < dataLenth; i++)
{
rawData *= 256;
if (msg.GetRawData(i) != null)
rawData += (int)msg.GetRawData(i);
}
return rawData;
}
private static int CalcRpm(ObdiiDataMesg msg)
{
return CalcRawData(msg, 2) / 4;
}
private static int CalcTemp(ObdiiDataMesg msg)
{
return CalcRawData(msg, 1) -40;
}
}
My bike has rpm with double precision. OBD II expects it to be 4. It cannot be related to that simple formula, I think.
Maybe someone can take a look into the FIT-File and see whats wrong there or maybe in Edit. I cannot figure out where the problem is :(