PDA

View Full Version : sGearNumGears - how to interpret?



Siege
13-03-2018, 23:29
Hi fellow API users

playing around with UDP, and I have hit a stumbling block

I am trying to get the gears from the "sGearNumGears" block

My C# code is
GearNumGears = packet[45]; // 45 1

The C++ type is unsigned char, and I am simply putting that into a byte.

What I get, for a 9 (sequential) gear car are values like

R = 159
N = 144
1 = 145
2 = 146
3 = 147
4 = 148
5 = 149
6 = 150
7 = 151
8 = 151
9 = 151

What I get for a 6 gear car (tested 2, h-pattern and seq)

R = 111
N = 96
1 = 97
2 = 98
3 = 99
4 = 100
5 = 101
6 = 102

Any idea how I am supposed to interpret these? Many thanks guys!

satco1066
14-03-2018, 22:12
if you print it in HEX you'll see the system.

eg. 6 gear

R = 111 = 6F
N = 96 = 60
1 = 97 = 61
2 = 98 = 66
3 = 99 = 63
4 = 100 = 64
5 = 101 = 65
6 = 102 = 66

9 gear

R = 159 = 9F
N = 144 = 90
1 = 145 = 91
2 = 146 = 92
3 = 147 = 93
4 = 148 = 94
5 = 149 = 95
6 = 150 = 96
7 = 151 = 97
8 = 152 = 98
9 = 153 = 99

if you are coding, forget "decimal". Think HEX