]> www.fi.muni.cz Git - slotcarman.git/commitdiff
Attempt to handle timing more exactly.
authorJan "Yenya" Kasprzak <kas@fi.muni.cz>
Fri, 11 Feb 2011 23:26:42 +0000 (00:26 +0100)
committerJan "Yenya" Kasprzak <kas@fi.muni.cz>
Fri, 11 Feb 2011 23:26:42 +0000 (00:26 +0100)
SCX/Parser.pm

index b71f26b75639c01c8477bd68cc0b867c643cfa54..080e8f21fdac67783ed87571e1a6b2b91f98e8f2 100644 (file)
@@ -185,9 +185,12 @@ sub car_lap_time_packet {
                || $bytes[5] & 0x01;
 
        $self->car_lap_time($bytes[0],
-               256*$bytes[1] + $bytes[2] + ($bytes[3] & 0x01 ? 1 : 0),
+               256*$bytes[1] + $bytes[2]
+                       + ($bytes[3] & 0x02 ? 256 : 0)
+                       + ($bytes[3] & 0x01 ? 1 : 0),
                sprintf('%.3f', 0.01024 * (256*$bytes[4] + $bytes[5]
-                       + ($bytes[3] & 0x08 ? 1 : 0))),
+                       + ($bytes[3] & 0x08 ? 256 : 0)
+                       + ($bytes[3] & 0x04 ? 1 : 0))),
                sprintf('%04b', $bytes[3])
        );
 }