forked from jilleb/MQB-FPA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfpa_dataset.bt
989 lines (832 loc) · 36 KB
/
fpa_dataset.bt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
//--------------------------------------
//--- 010 Editor Binary Template
//
// File: fpa_dataset.bt
// Author: MQB-coding
// Revision: 9999
// Purpose: VAG MQB FPA (fahrprofilauswahl / driving profile) dataset parsing
// Comments: red = unknown, yellow = possible, green = sure
// Currently only useful for FPA datasets for 3Q0907530Q and newer.
//--------------------------------------
BitfieldDisablePadding();
char dataset_version[4] <format=hex,bgcolor=cGreen,comment="Version">; // something like J1 00
// Anything older than version IA seems to be a different format.
char unknown[4] <format=hex,bgcolor=cYellow,comment="sub-version?">;
FSeek(18);
ushort data_start<format=decimal,bgcolor=cGreen>;
FSeek(data_start-1); // this is pointing to the start of the datablock, is currently not implemented yet.
FSeek(518);
byte group_properties[8] <bgcolor=cYellow>;
// Known values:
// sets with 1 group
// IB: 21FF FFFF FFFF FFFF 0400 0000 - 1 group: 4 controls
// J6: 21FF FFFF FFFF FFFF 0400 0000 - 1 group: 4 controls
// JC: 21FF FFFF FFFF FFFF 0200 0000 - 1 group: 2 controls
// LI: 01FF FFFF FFFF FFFF 0500 0000 - 1 group: 5 controls
// LK: 01FF FFFF FFFF FFFF 0600 0000 - 1 group: 6 controls
// OS: 21FF FFFF FFFF FFFF 0400 0000 - 1 group: 4 controls
// sets with 2 groups
// M9: 2124 FFFF FFFF FFFF 0402 0000 - 2 groups: 4 controls, 2 controls
// OC: 2124 FFFF FFFF FFFF 0402 0000 - 2 groups: 4 controls, 2 controls
// OY: 2124 FFFF FFFF FFFF 0402 0000 - 2 groups: 4 controls, 2 controls
// sets with 3 groups:
// PF: 2124 07FF FFFF FFFF 0302 0200 0000 0000 - 3 groups: 3 controls, 3 controls, 2 controls.
// sets without groups
// J4: FFFF FFFF FFFF FFFF 0000 0000 - 0 groups
// KN: FFFF FFFF FFFF FFFF 0000 0000 - 0 groups
// O2: FFFF FFFF FFFF FFFF 0000 0000 - 0 groups
// O3: FFFF FFFF FFFF FFFF 0000 0000 - 0 groups
// ON: FFFF FFFF FFFF FFFF 0000 0000 - 0 groups
// OO: FFFF FFFF FFFF FFFF 0000 0000 - NO FPA, 0 groups
// P4: FFFF FFFF FFFF FFFF 0000 0000 - 0 groups
// Audi, so different logic:
// N1: 030A FFFF FFFF FFFF 0403 0000 - 2 groups
byte number_of_controls_in_specific_group[8]<bgcolor=cDkGreen >;
FSeek(568);
byte unknown_group_properties[8] <bgcolor=cRed>;
// Known values:
// sets with 1 group
// IB: 4018 0000 0000 0000 1 group: 4 controls
// J6: 4018 0000 0000 0000 1 group: 4 controls
// JC: 1000 0010 0000 0000 1 group: 2 controls
// LI: 4018 0000 0000 0000 1 group: 5 controls
// LK: 4018 0000 0000 0000 1 group: 6 controls
// OS: 4018 0000 0000 0000 1 group: 4 controls
// sets with 2 groups
// M9: 401C 0000 2001 0000 2 groups: 4 controls, 2 controls
// OC: 4018 0080 2000 0000 2 groups: 4 controls, 2 controls
// OY: 4018 0080 2000 0000 2 groups: 4 controls, 2 controls
// sets with 3 grOups
// PF: 4018 0080 2000 0000 0080 3 groups: 3 controls, 3 controls, 2 controls
// sets without groups
// J4: 0000 0000 0000 0000
// KN: 0000 0000 0000 0000
// O2: 0000 0000 0000 0000
// O3: 0000 0000 0000 0000
// ON: 0000 0000 0000 0000
// OO: 0000 0000 0000 0000
// P4: 0000 0000 0000 0000
// Audi, so different logic:
// N1: 0010 0080 2001 0000
FSeek(662);
ushort function_bytes_settings_shifted_by_1_bit[30] <bgcolor=cDkYellow >;
// this is an interesting one. it seems to match the amount of bytes in the next block,
// and it's the same amount as "individual_configuration bytes" as well
// Known values:
// Octavia: 001E 001E 0010 0012 0017 0017 0006 0007 0012 0017 0006 000E 0006 000A 000A 005E 0057 000A (18x short)
// Magotan: 0006 0006 0006 0007 0012 0017 0057 0006 0006 0007 00D7 (11x short)
// Passat: 0006 0006 0006 7FFF 0012 0017 0057 0006006 0007 00D7 (11x short)
// Leon: 001E 0010 001E 0037 0012 0006 0012 0007 001F (9x short)
// FR 2020: 001E 0010 001E 0037 0412 0012 0006 0012 0007 001F (10 values)
// TODO: Let's get rid of these car names and use more accurate dataset version numbering instead.
// OY00: 001E 001E 0010 0412 0006 0002 0006 7FFF 0012 0017 000E 000E 0012 005F 000A 000A 0007
FSeek(722);
ushort function_bytes_settings[30] <bgcolor=cDkYellow, comment=getFunctionByteSettingName>;
// this is an interesting one. it seems to match the amount of bytes in the next block,
// and seems to have a match with other settings as well.
// if DSG has value FFFE here, it will no longer go back to D at start.
// Known values:
// Octavia: 0004 0004 0001 0004 002E 002E 000C 000E 0024 002E 000C 000C 000C 0004 0004 0004 00AE 0004 (18x short)
// Magotan: 0004 0004 000C 000E 0024 002E 00AE 000C 000C 000E 01AE (11x short)
// Passat: 0004 0004 000C FFFE 0024 002E 00AE 000C 000C 000E 01AE (11x short)
// Leon: 0004 0001 0004 006E 0004 000C 0024 000E 003E (9x short)
// FR2020: 0004 0001 0004 006E 0800 0004 000C 0024 000E 003E (10x)
// OY00: 0004 0004 0001 0800 000C 0004 000C FFFE 0024 002E 000C 000C 0004 00AE 0004 0004 000E
// interesting!!!
// these values seem to be a *2 of the values at unknown_662!
FSeek(782);
byte is_active[30] <format=hex, bgcolor=cYellow, comment=getSettingByteActive>;
// 00 = setting byte not active, although setting value 0 doesn't seem to have any impact?
// 02 = active
// other known settings are:
// 0B; tested, no noticeable change.
// 11; tested, no noticeable change.
// 01;
// 03; (seen on PF)
// 08;
// TODO: more testing needed.
byte unknown_value_0 <bgcolor=cYellow>;
// tested different values, doesn't seem to do anything
// PF: 0000
// OY: 0000
// enabled profiles start here
byte FPA_profile[12] <format=hex,bgcolor=cGreen,name=getFPAName>;
// changing this will changes what button is shown in the FPA selection screen.
// these bytes determine what profile button is used in what position
// for instance:
// Put "04" into profile_1, and it will display as Offroad.
byte profile_returns_after_restart[12] <format=hex,bgcolor=cGreen>;
// This determines what profile position it returns to after restarting the car.
ushort unknown_value_1 <bgcolor=cRed>;
// OC: 00BF 10111111
// LK: 00CB 11001011
// ON: 00AF 10101111
// PF: 0009 00001001
// OY: 00BF 10111111
// maybe has to do with which profiles are enabled?
// TODO: more testing
byte profile_0_nodata[30] <bgcolor=cBlack>;
// tested with different values here, doesn't seem to do anything
struct
{
// refer to FPA_controls for the meaning of each byte number
byte setting_byte[30] <bgcolor=cDkGreen, comment=getSettingName, open=true, format=hex>;
}profile[12];
// the driving profiles as they are displayed underneath the (i) icon in the HMI.
byte list_of_grouped_controls[30]<format=hex,bgcolor=cGreen, comment=getControlName>;
// The value of this determines what value is used in the profiles for instance,
// if there's a value 01 on the first position, that means the first value in the
// profile sets this specific setting.
// This list is what's actually shown in the User Interface, and it can represent a group of controls.
// See list_of_controls for all the ungrouped controls
// NEVER PUT FF HERE
struct{
// this block consists of 30 bytes, after that the same pattern can be found, once for each enabled profile.
// so there will be data for profile 1, 2, 3, but the 4th set of data here will be filled with zeroes when it's not used.
// the 6th profile is used as "individual", so it has additional settings.
ushort individual_setting_byte[30] <comment=getIndividualSettingName,open=true, bgcolor=cDkGreen> ;
} available_choices_at_individual_profile[12];
byte filler <bgcolor=cYellow>;
// appears to be just zeroes, at all time
byte button_filler_1;
long enable_fpa_button_part_1 <bgcolor=cYellow, comment=getBoolean>;
// 1 = enabled
// 0 = disabled
// 0005 FDFE on Tiguan R (has enabled steering wheel FPA buttons)
byte button_filler_2;
long enable_fpa_button_part_2 <bgcolor=cYellow, comment=getBoolean>;
// 1 = enabled
// 0 = disabled
// 4 = unknown
// 0401 0100 on Tiguan R (has enabled steering wheel FPA buttons) (dataset version PF)
byte button_filler_3;
long button_behavior <bgcolor=cYellow, comment="01 = button press cycles through the modes, 03 = only open FPA dialog, no selection by button">;
// 01 = button press cycles through the modes
// 03 = only open FPA dialog, no selection by button
// TODO: test other values like 2, 4, 5, 6.
// 0101 0100 on Tiguan R (dataset version PF)
byte button_filler_4;
long cycling_through_modes <bgcolor=cGreen,comment="01 = there's no loop 03 = loop through all the modes over and over again">;
// 01 = there's no loop
// 03 = loop through all the modes over and over again
// 0303 0300 on Tiguan R (dataset version PF)
byte unknown_bytes_button_specifics[6] <bgcolor=cRed >;
// PF: 0000 0102 FFFF
// OY: 0000 FFFF FFFF
ulong button_order[9] <bgcolor=cGreen,name=getFPAName>; // in what order are the profiles set
short unknown_value<bgcolor=cRed >;
// PF: 0003
// OY: 02FF
short unknown_FFFFFF00<bgcolor=cDkRed >;
// PF: 06FF
// OY: FFFF
short unknown_value2<bgcolor=cRed >;
// PF: 0002
// OY: 0002
short unknown_value3<bgcolor=cDkRed >;
// PF: 0012
// OY: 0000
long unknown_value4<bgcolor=cRed >;//zeroes
// PF: 0042
// OY: 0000
long unknown_value5<bgcolor=cDkRed >;
// PF: FA06
// OY: FA00
byte unknown_profiles_related[12]<bgcolor=cLtRed >;
// todo: test this some more
// tested the following:
// 00 03 05 02 00 01 changed to
// 00 05 03 01 00 02
// result: after selecting comfort profile, the FPA screen dissappears.
// OY: 0003 0502 0001 F1F1 0000 0000
long unknown_value6<bgcolor=cDkRed >;
// todo: test this
// PF: 0270 7100
// OY: 0100 0000
FSeek(2242);
byte AID_profile_banner[12]<bgcolor=cGreen, comment=getAIDBanner>; //Determines what banner is shown on the AID when selecting the profile
byte reserved[12]<bgcolor=cGray>;
byte unknown_setting[9]<bgcolor=cRed>;
// after setting to 123456789, the default settings on individual profile were reset.
// OY: 0001 0200 0000 0000 00
short mode_light_on[12]<bgcolor=cGreen, name=getModeButtonLightState>;
// 00 = off
// 01 = on
// 02 = blink
// 03 = ?
// the following 8 groups of data map perfectly to the controls.
// it is the value range that is used when communicating to the control module.
// These bytes actually control what is happening when a certain mode is chosen
// You can diplay these as a matrix
ubyte control_request_value_0[30]<bgcolor=cBlack, fgcolor=cWhite>;
ubyte control_request_value_1[30]<bgcolor=cBlack, fgcolor=cLtYellow >;
ubyte control_request_value_2[30]<bgcolor=cBlack, fgcolor=cYellow >;
ubyte control_request_value_3[30]<bgcolor=cBlack, fgcolor=cDkYellow >;
ubyte control_request_value_4[30]<bgcolor=cBlack, fgcolor=cRed >;
ubyte control_request_value_5[30]<bgcolor=cBlack, fgcolor=cPurple >;
ubyte control_request_value_6[30]<bgcolor=cBlack, fgcolor=cBlue >;
ubyte control_request_value_7[30]<bgcolor=cBlack, fgcolor=cDkBlue >;
// range from 0 to 254 (decimal).
// it appears that:
// 0 = not set
// 16 = sport
// 50 = normal
// 84 = eco
// 118 = sport
// the values correspond with the request value that can be found in
// measurements values, driving profile selection, requested value.
// If a Requested Value leads to a change in Actual Value, it means the module accepts this value.
FSeek(2063);
byte unknown_01<bgcolor=cRed>; // unknown_what this does, testing between 00 and 01 didn't show any visible changes.
// OY: 01
FSeek(2539);
byte list_of_controls[30]<bgcolor=cGreen, comment=getControlName >;
// This determines what FPA-control is controled by the bytes at "available_choices_at_individual_profile"
// usage: set each byte to whatever FPA-control you would like to be handles by the "available_choices_at_individual_profile". This should be in line with FPA_controls
// NEVER PUT FF HERE
byte grouped_controls[30] <bgcolor=cDkGreen>;
// this byte range determines to which group a control belongs.
long grouped_controls_controlbyte <bgcolor=cDkGreen, fgcolor=cLtGreen,format=binary>;
// works as follows:
// 1 grouped setting: 01 (Bit 0 set)
// 2 grouped settings: 03 (Bit 0-1 set)
// 3 grouped settings: 07 (Bit 0-2 set)
// 4 grouped settings: 0F (Bit 0-3 set)
// 5 grouped settings: 1F (Bit 0-4 set)
// 6 grouped settings: 3F (Bit 0-5 set)
// 7 grouped settings: 7F (Bit 0-6 set)
byte gw_longcoding_controls_with_links[30]<bgcolor=cGreen, name=getLongCodingByteName>;
// Byte 9, Bit 0 = 0x19 = EDS and so forth
// Byte 9, Bit 1 = 0x1A = HHC
// see getLongCodingByteName
byte gw_longcoding_controls_without_links[30]<bgcolor=cDkGreen, name=getLongCodingByteName>;
// Same list as previous one, but can be used to link one control to another. Is used with Sailing and 4x4 features.
byte SettingBytes_again[30] <bgcolor=cRed>; // rhymes with earlier setting bytes?
// the following data appears to be related to Hybrid only, as it's almost completely empty on non-hybrid/PHEV datasets.
byte PHEV_data[1659]<format=decimal,bgcolor=cBlue>;
FSeek(3340);
byte hybrid_modes[12]<format=decimal,bgcolor=cYellow>; //not sure, needs testing
byte hybrid_modes_active[12]<bgcolor=cRed >; //not sure, needs testing
struct{
byte hybrid_mode_setting[16];
}
hybrid_mode_settings[12];
FSeek(3741);
byte AID_mode_banner[12]<bgcolor=cGreen, comment=getAIDBanner>;
FSeek(4348);
LittleEndian(); // go to littleendian mode because of checksum format
local int calculated_checksum;
calculated_checksum = Checksum(CHECKSUM_CRC32, 0,4348);
ulong dataset_checksum <format=hex,bgcolor=cGreen,comment="CRC32">;
// the following bytes are not known yet, but are different between datasets.
// versions:
// Octavia:
// Magotan:
// Passat:
// Leon:
// FR 2020: LI00
// Tiguan R 2021: PF00
// Passat 2021: 0Y00
FSeek(10);
long unknown_10 <bgcolor=cRed>;
// Known values:
// Octavia: 0132
// Magotan: 010A
// Passat: 0132
// Leon: 0132
// PF: 0014 0A01
// OY: 0114 0F01
// Some kind of date/year?
FSeek(14);
long unknown_14 <bgcolor=cRed>;
// Known values:
// Octavia: F406
// Magotan: F406
// Passat: F406
// Leon: F400
// PF00: F406
// OY: F406
FSeek(18);
long unknown_18 <bgcolor=cRed>;
// Known values:
// Octavia: F406
// Magotan: F406
// Passat: F406
// Leon: F400
// FR 2020: 0402 0000
// PF: 0702 0001
// OY: 0702 0000
// From here it appears to be some kind of table, 32 rows, 15 colums, or something like that.
FSeek(38);
struct{
byte unknown_38x[15];
} unknown_38[32];
/*
short unknown_38 <bgcolor=cRed>;
// Known values:
// Octavia: 2222
// Magotan: 2222
// Passat: 0000
// Leon: 0202
// PF00: 5500
// OY: 2222
FSeek(40);
short unknown_40 <bgcolor=cRed>;
// Known values:
// Octavia: 3344
// Magotan: 3344
// Passat: 0000
// Leon: 0304
// FR 2020: 0355
// PF00: 2244
// OY 3344
FSeek(42);
short unknown_42 <bgcolor=cRed>;
// Known values:
// Octavia: 5500
// Magotan: 5533
// Passat: 0000
// Leon: 5503
// FR 2020: 0000
// PF00: 0033
// OY: 4455
FSeek(52);
short unknown_52 <bgcolor=cRed>;
// Known values:
// Octavia: 0011
// Magotan: 0011
// Passat: 0000
// Leon: 0000
// PF00: 0011
// OY: 0000
FSeek(54);
short unknown_54 <bgcolor=cRed>;
// Known values:
// Octavia: 2233
// Magotan: 0011
// Passat: 0000
// Leon: 0000
// PF00: 0022
// OY: 0000
FSeek(56);
short unknown_56 <bgcolor=cRed>;
// Known values:
// Octavia: 0055
// Magotan: 0055
// Passat: 0000
// Leon: 0000
// PF00: 2400
// OY: 0000
FSeek(58);
short unknown_58 <bgcolor=cRed>;
// Known values:
// Octavia: 0000
// Magotan: 0000
// Passat: 0000
// Leon: 0000
// PF00: 3300
// OY: 0000
FSeek(60);
short unknown_60 <bgcolor=cRed>;
// Known values:
// Octavia: 0055
// Magotan: 0055
// Passat: 0000
// Leon: 0000
// PF00: 0000
// OY: 2322
*/
FSeek(158);
byte unknown_158[6] <bgcolor=cRed>;
// Known values:
// Octavia: 2020 2020 5500
// Magotan: b0b0 b020 5500
// Passat: 0000 0000 0000
// Leon: 1222 3324 5563
// FR 2020: 1222 3355 0132
// PF00: 0500 0202 0002
// OY: B0B0 B020 5500
FSeek(278);
byte unknown_278[6] <bgcolor=cRed>;
// FR 2020: 0B0B 0B05 0000
// after flashing with 0B 0B 0B 05 00 00, the dashboard and MIB showed offroad-icon for a short moment and that's it.
// PF: 0000 0000 0000
// OY: 0000 0000 0000
// Don't mess with anything below here, unless you know what you're doing.
printTitle("Dataset specifics");
Printf(" Version: %s", dataset_version);
Printf(" \n");
local int i = 0;
local int profile_number = 0;
local int setting_number = 0;
local string settingText;
printTitle("Profile buttons");
Printf (" The following buttons are configured, displayed in this exact order:\n\n");
while(i<9)
{
if (button_order[i] != 00){
{ if (button_order[i] < 100) {
Printf (" ║ %10s ║ ", getFPAName(FPA_profile[button_order[i]-1]));
}
}
}
i = i+1;
}
Printf (" \n");
Printf (" \n");
while( profile_number < 12 )
{
if (FPA_profile[profile_number] != 00) {
Printf (" Profile position %i: %s(%x) \n", profile_number, getFPAName(FPA_profile[profile_number]),FPA_profile[profile_number] );
Printf (" Returns to %s after restart\n", getFPAName(profile_returns_after_restart[profile_number]) );
Printf (" Banner on AID: %s \n", getAIDBanner(AID_profile_banner[profile_number]) );
Printf (" Mode button LED: %s \n", getModeButtonLightState(mode_light_on[profile_number]));
Printf (" Settings: \n");
for( setting_number = 0; setting_number < 30; setting_number++)
{
settingText = getSettingName(profile[profile_number].setting_byte[setting_number]);
if (settingText!="not set"){
Printf (" %i \t %-30s: %s (%x) \n", setting_number, getControlName(list_of_grouped_controls[setting_number]),getSettingName(profile[profile_number].setting_byte[setting_number]),profile[profile_number].setting_byte[setting_number]);
}
}
}
profile_number += 1;
Printf("\n");
}
local int indiv_profile_number = 0;
local int indiv_setting_number = 0;
printTitle("HMI");
Printf(" The following settings are shown in the HMI.\n Items that have no settings are hidden.\n\n");
while( indiv_profile_number < 12 )
{
{
Printf (" %s HMI shows the following settings: \n", getSettingName(indiv_profile_number+1) );
Printf (" Position Control setting: \n");
for( indiv_setting_number = 0; indiv_setting_number < 30; indiv_setting_number++)
{
if (list_of_grouped_controls[indiv_setting_number] > 0){
Printf (" %i \t %-30s: %s(%x) \n", indiv_setting_number, getControlName( list_of_grouped_controls[indiv_setting_number]),getIndividualSettingName(available_choices_at_individual_profile[indiv_profile_number].individual_setting_byte[indiv_setting_number]),(available_choices_at_individual_profile[indiv_profile_number].individual_setting_byte[indiv_setting_number]));
}
}
}
indiv_profile_number += 1;
Printf("\n");
}
local int indivgroup_setting_number = 0;
local int group_number = 0;
printTitle("Controls");
Printf(" Pos \tDisplayed Name \tControl \t Gateway Long Coding Byte \n");
local int ctrlPosition = 0;
for( ctrlPosition = 0; ctrlPosition < 30; ctrlPosition++)
{
if (list_of_controls[ctrlPosition] > 0){
if (gw_longcoding_controls_without_links[ctrlPosition] == gw_longcoding_controls_with_links[ctrlPosition]){
Printf (" %i \t%-30s\t%02x \t %s (%02x)\n", ctrlPosition, getControlName(list_of_controls[ctrlPosition]), list_of_controls[ctrlPosition], getLongCodingByteName(gw_longcoding_controls_with_links[ctrlPosition]),gw_longcoding_controls_with_links[ctrlPosition]);
} else {
Printf (" %i \t%-30s\t%02x \t %s (%02x) linked to %s (%02x)\n", ctrlPosition, getControlName(list_of_controls[ctrlPosition]), list_of_controls[ctrlPosition], getLongCodingByteName(gw_longcoding_controls_with_links[ctrlPosition]),gw_longcoding_controls_with_links[ctrlPosition],getLongCodingByteName(gw_longcoding_controls_without_links[ctrlPosition]),gw_longcoding_controls_without_links[ctrlPosition]);
}
}
}
printTitle("Setting Groups");
local int num_of_groups = 0;
while (indivgroup_setting_number < 30) {
group_number = 1;
while (group_number < 30) {
if (grouped_controls[indivgroup_setting_number] == group_number) {
Printf(" Group %i (%s): %s \n", group_number, getControlName(list_of_grouped_controls[group_number - 1]), getControlName(list_of_controls[indivgroup_setting_number]));
num_of_groups++;
}
group_number++;
}
indivgroup_setting_number++;
}
if (num_of_groups == 0) {
Printf(" No groups configured at 0xA09 range.\n");
}
local int group_number_2 = 0;
while (group_number_2 < 4){
if (number_of_controls_in_specific_group[group_number_2] > 0){
Printf(" Group number %i is configured in the 0x20E range to have %i controls.\n", group_number_2+1, number_of_controls_in_specific_group[group_number_2]);
}
group_number_2++;
}
printTitle("Research stuff");
// Showing how the byte_active bytes are set for each control. Currently, the meaning of these values is unknown.
Printf(" Byte_active settings\n");
Printf(" Position Control \t 0x30E \t Meaning\n");
local int tmp_i2 = 0;
for( tmp_i2 = 0; tmp_i2 < 30; tmp_i2++)
{
if (list_of_controls[tmp_i2] > 0){
Printf (" %i:\t %-30s \t %i \n", tmp_i2, getControlName(list_of_controls[tmp_i2]), is_active[tmp_i2]);
}
}
// Prints a table of all requests values that are sent to control modules.
Printf(" \n");
Printf(" Control-module request values (8FB range)\n");
Printf(" Position Control \t 0 \t 1 \t 2 \t 3 \t 4 \t 5 \t 6 \t 7\n");
local int tmp_i3 = 0;
for( tmp_i3 = 0; tmp_i3 < 30; tmp_i3++)
{
if (list_of_grouped_controls[tmp_i3] > 0){
Printf (" %i:\t %-30s \t %i \t %i \t %i \t %i \t %i \t %i \t %i \t %i\n", tmp_i3, getControlName(list_of_grouped_controls[tmp_i3]), control_request_value_0[tmp_i3], control_request_value_1[tmp_i3], control_request_value_2[tmp_i3],control_request_value_3[tmp_i3],control_request_value_4[tmp_i3],control_request_value_5[tmp_i3],control_request_value_6[tmp_i3],control_request_value_7[tmp_i3]);
}
}
//----
Printf("\n Individual controls research\n");
Printf(" Position Control \t ConfByte\t 0x296\t 0x2D2 \t Meaning\n");
local int tmp_i4 = 0;
for( tmp_i4 = 0; tmp_i4 < 30; tmp_i4++)
{
if (list_of_controls[tmp_i4] > 0){
Printf (" %i: \t%-30s \t %02x \t %04x \t %04x \t %s\n", tmp_i4, getControlName(list_of_controls[tmp_i4]), list_of_controls[tmp_i4], function_bytes_settings_shifted_by_1_bit[tmp_i4], function_bytes_settings[tmp_i4], getFunctionByteSettingName(function_bytes_settings[tmp_i4]));
}
}
//--- research stuff, what looks like a table from position 38:
Printf("\n Unknown 38x research\n");
Printf(" Number\t1\t2\t3\t4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\tAmount of values\n");
local int tmp_i5 = 0;
local int tmp_i6 = 0;
local int amount_of_unknown38_rows_with_value = 0;
local int amount_of_unknown38_values = 0;
for( tmp_i5 = 0; tmp_i5 < 32; tmp_i5++)
{
amount_of_unknown38_values = 0;
for( tmp_i6 = 0; tmp_i6 < 15; tmp_i6++)
if (unknown_38[tmp_i5].unknown_38x[tmp_i6]>0){
amount_of_unknown38_values++;
}
if (amount_of_unknown38_values > 0) {
Printf (" %i\t%02x\t%02x\t%02x\t%02x\t%02x\t%02x\t%02x\t%02x\t%02x\t%02x\t%02x\t%02x\t%02x\t%02x\t%02x\t%i\n", tmp_i5, unknown_38[tmp_i5].unknown_38x[0], unknown_38[tmp_i5].unknown_38x[1], unknown_38[tmp_i5].unknown_38x[2], unknown_38[tmp_i5].unknown_38x[3], unknown_38[tmp_i5].unknown_38x[4], unknown_38[tmp_i5].unknown_38x[5], unknown_38[tmp_i5].unknown_38x[6], unknown_38[tmp_i5].unknown_38x[7], unknown_38[tmp_i5].unknown_38x[8], unknown_38[tmp_i5].unknown_38x[9], unknown_38[tmp_i5].unknown_38x[10], unknown_38[tmp_i5].unknown_38x[11], unknown_38[tmp_i5].unknown_38x[12], unknown_38[tmp_i5].unknown_38x[13], unknown_38[tmp_i5].unknown_38x[14], amount_of_unknown38_values);
amount_of_unknown38_rows_with_value++;
}
}
Printf("Amount of rows with a value: %i\n", amount_of_unknown38_rows_with_value);
printTitle("Checksum");
Printf(" Checksum in file : %06lx \n", ((unsigned long)dataset_checksum & 0xFFFFFFFFUL));
Printf(" Calculated checksum : %06lx \n\n",((unsigned long)calculated_checksum & 0xFFFFFFFFUL));
if (dataset_checksum != calculated_checksum){
Printf(" ! Checksums are not identical \n ! Copy calculated value into checksum at Variables screen \n");
} else {
Printf(" Checksums are identical, no updates needed\n");
};
Printf(" #################################################\n");
// Lookup functions start here.
// Messing with these will mess up the display in the variables section and in the output console.
// helper function to get the setting name.
string getSettingName(int settingNumber) {
switch (settingNumber) {
case 0x0: return "not set";
case 0x1: return "Comfort";
case 0x2: return "Normal";
case 0x3: return "Sport";
case 0x4: return "Offroad";
case 0x5: return "Eco";
case 0x6: return "Race/Cupra";
case 0x7: return "Individual";
case 0x8: return "Config 8";
case 0x9: return "Config 9";
case 0xA: return "Config 10";
case 0xB: return "Config 11";
case 0xC: return "Config 12";
default: return "Unknown";
}
}
// helper function to get light mode name
string getModeButtonLightState(int lightMode) {
switch (lightMode) {
case 0x000: return "Off";
case 0x100: return "On";
case 0x200: return "Blinking";
case 0x500: return "Unknown Skoda value";
case 0x600: return "Blinking";
default: return "Unknown";
}
}
// helper function to get the control name.
string getControlName(int controlNumber) {
switch (controlNumber) {
case 0x00: return "not set";
case 0x01: return "Engine";
case 0x02: return "Start/Stop System";
case 0x03: return "Gearbox";
case 0x04: return "Rear Differential Lock";
case 0x05: return "Steering";
case 0x06: return "Progressive Steering";
case 0x07: return "DCC";
case 0x08: return "HVAC (Air Conditioning)";
case 0x0A: return "Interior Engine Sound";
case 0x09: return "ACC";
case 0x0B: return "Motorway Light";
case 0x0C: return "Background Lighting";
case 0x0D: return "Air Suspension";
case 0x0E: return "Automatic Belt Pre-Tensioning";
case 0x0F: return "Seat Bolster Setting";
case 0x10: return "Route Option";
case 0x11: return "Navigation";
case 0x12: return "DSG Coasting";
case 0x13: return "Eco Tips";
case 0x14: return "Exterior Engine Sound";
case 0x15: return "Front Differential Lock";
case 0x16: return "Center Differential Lock";
case 0x17: return "Four-Wheel Drive (AWD)";
case 0x18: return "Electronic Torque Vectoring (Audi-Text)";
case 0x19: return "Anti-Slip regulation";
case 0x1A: return "Headlight Control";
case 0x1B: return "Rear spoiler";
case 0x1C: return "ESC System";
case 0x1D: return "Rear Axle Steering";
case 0x1E: return "Adaptive Body Roll Compensation";
case 0x1F: return "Road Recognitiion";
case 0x20: return "Hybrid Drive";
case 0x21: return "Drive";
case 0x22: return "Chassis";
case 0x23: return "Exhaust Valves";
case 0x24: return "Engine Sound";
case 0x25: return "Passenger Compartment";
case 0x26: return "Driver's Seat";
case 0x27: return "Tyre Pressure Monitoring System (TPMS)";
case 0x28: return "Lane Assist";
case 0x29: return "Aggregatelagerung (Audi-Text)";
case 0x2A: return "Magnetic Ride (Audi-Text)";
case 0x2B: return "Sport Select Chassis";
case 0x2C: return "Hill Descent Assist";
case 0x2D: return "Hill Hold Assist";
case 0x2E: return "Parking Assist";
case 0x2F: return "Instrument Cluster";
case 0x30: return "Infotainment System";
case 0x31: return "Eco Driving Tips";
case 0x32: return "Speed Adjustment";
case 0x33: return "Electronic Engine Sound";
case 0x34: return "Nothing displays, just Engine";
case 0x35: return "Nothing displays, just Engine";
case 0x36: return "ESC System";
case 0x37: return "Nothing displays";
case 0x41: return "Engine";
case 0x4B: return "Engine"; //seen on TCR
case 0x4C: return "Freilauf_DefaultON";
default: return "Unknown";
}
}
string getFunctionByteSettingName(int byteSettingNumber) {
switch (byteSettingNumber) {
//TODO: research to get more known values here
case 65279: return "Remember after reset";
default: return "Unknown";
}
}
// helper function to get the control name.
string getLongCodingByteName(int controlNumber) {
switch (controlNumber) {
case 0x00: return "not set";
case 0x01: return "Byte 12, bit 0 - AGA (External Exhaust sound)";
case 0x02: return "Byte 12, bit 1 - ESP (Stability Program)";
case 0x03: return "Byte 12, bit 2 - Freilauf (Sailing/Freerunning)";
case 0x04: return "Byte 12, bit 3 - MO (Engine Management)";
case 0x05: return "Byte 12, bit 4 - GE (Transmission Management)";
case 0x06: return "Byte 12, bit 5 - ALR (All Wheel Drive)";
case 0x07: return "Byte 12, bit 6 - MO_BZS(Engine.......)";
case 0x08: return "Byte 12, bit 7 - DR (Damper Control / DCC)";
case 0x09: return "Byte 11, bit 0 - VAQ (Front differential lock)";
case 0x0A: return "Byte 11, bit 1 - AFS (Advanced Front Lighting)";
case 0x0B: return "Byte 11, bit 2 - RGS (Seatbelt Tensioner)";
case 0x0C: return "Byte 11, bit 3 - EPS (Electrical Power Steering)";
case 0x0D: return "Byte 11, bit 4 - ACC (Adaptive Cruise Control)";
case 0x0E: return "Byte 11, bit 5 - SAK (Interior Sound Control)";
case 0x0F: return "Byte 11, bit 6 - MO_StSt (Start/Stop System)";
case 0x10: return "Byte 11, bit 7 - AMB (Ambient Lights)";
case 0x11: return "Byte 10, bit 0 - IVB (??)";
case 0x12: return "Byte 10, bit 1 - KL (Climate control)";
case 0x13: return "Byte 10, bit 2 - HSP (Rear Spoiler)";
case 0x14: return "Byte 10, bit 3 - AV (Area View)";
case 0x15: return "Byte 10, bit 4 - RWB (Range calculation)";
case 0x16: return "Byte 10, bit 5 - HDC (Downhill Assistant)";
case 0x17: return "Byte 10, bit 6 - eBKV (Electric Brake Power Amplifier)";
case 0x18: return "Byte 10, bit 7 - AGK (Exhaust valves)";
case 0x19: return "Byte 09, bit 0 - EDS (Rear differential lock)";
case 0x1A: return "Byte 09, bit 1 - HHC (Hill Hold Control)";
case 0x1B: return "Byte 09, bit 2 - PDC (Park Distance Control)";
case 0x1C: return "Byte 09, bit 3 - FMA (Freewheeling, engine off)";
case 0x1D: return "Byte 09, bit 4 - Freewheeling, Default ON";
case 0x1E: return "Byte 09, bit 5 - mFDR (??)";
case 0x1F: return "Byte 09, bit 6 - SchaltDR (Operating Mode Selection?)";
case 0x20: return "Byte 09, bit 7 - Stages DCC (??)";
default: return "Unknown";
}
}
string getIndividualSettingName(int settingNumber) {
if (settingNumber == 0) {
return "not set ";
}
if (settingNumber == 65279) {
return "A slider is displayed ";
}
local string settingName = "";
if (settingNumber & (1 << 0)) { settingName += "On "; }
if (settingNumber & (1 << 1)) { settingName += "Off "; }
if (settingNumber & (1 << 2)) { settingName += "Snow "; }
if (settingNumber & (1 << 3)) { settingName += "Unknown 1 "; }
if (settingNumber & (1 << 4)) { settingName += "Unknown 2 "; }
if (settingNumber & (1 << 5)) { settingName += "Sand "; }
if (settingNumber & (1 << 6)) { settingName += "Unknown 3 "; }
if (settingNumber & (1 << 7)) { settingName += "Unknown 4 "; }
if (settingNumber & (1 << 8)) { settingName += "Unknown 5 "; }
if (settingNumber & (1 << 9)) { settingName += "Comfort "; }
if (settingNumber & (1 << 10)) { settingName += "Normal "; }
if (settingNumber & (1 << 11)) { settingName += "Sport "; }
if (settingNumber & (1 << 12)) { settingName += "Offroad "; }
if (settingNumber & (1 << 13)) { settingName += "Eco "; }
if (settingNumber & (1 << 14)) { settingName += "Race/Cupra "; }
if (settingNumber & (1 << 15)) { settingName += "Eco+ "; }
return settingName;
}
string getFPAName(int settingNumber) {
switch (settingNumber) {
case 0x00: return "not set";
case 0x01: return "Comfort";
case 0x02: return "Auto/Normal";
case 0x03: return "Dynamic/Sport";
case 0x04: return "Offroad";
case 0x05: return "Eco/Economy";
case 0x06: return "Race/Cupra";
case 0x07: return "Individual";
case 0x08: return "Range/PHEV 1/Clubsport";
case 0x09: return "Lift/PHEV 2";
case 0x0A: return "Offroad Snow/PHEV 3/EV On";
case 0x0B: return "Offroad Individual/PHEV 4/Hybrid Auto";
case 0x0C: return "Offroad 4/Hybrid Hold";
case 0x0D: return "Offroad 5/Hybrid Charge";
case 0x0E: return "Offroad 6/Hybrid Area";
case 0x0F: return "EV Off";
case 0x10: return "Second Hold/Torque Vectoring";
case 0x11: return "Racetrack/Hybrid Charge Off";
case 0x12: return "Offroad Level 2/Adaptive";
case 0x13: return "Offroad Level 3/Traction";
case 0x14: return "Offroad Level 4";
case 0x15: return "Hybrid Sport";
case 0x16: return "Second Auto";
case 0x17: return "Unknown Profile";
case 0x28: return "GTE Off";
case 0x29: return "GTE Off 2";
case 0x2A: return "Unknown Profile 2";
case 0xFF: return "none";
default: return "Unknown";
}
}
string getAIDBanner(int settingNumber) {
switch (settingNumber) {
case 0x00: return "not set";
case 0x01: return "Comfort";
case 0x02: return "Normal";
case 0x03: return "Sport";
case 0x04: return "Offroad";
case 0x05: return "Eco";
case 0x06: return "Individual";
case 0x07: return "Race/Cupra";
case 0x08: return "Eco";
case 0x09: return "Eco: driving and performance restricted";
case 0x0A: return "E-Mode";
case 0x0B: return "Hybrid Auto";
case 0x0C: return "Battery Hold";
case 0x0D: return "Battery Charge";
case 0x0E: return "E-Mode currently not available";
case 0x0F: return "Eco+";
case 0x10: return "Snow";
case 0x11: return "Normal";
case 0x12: return "Offroad individual, check individual settings";
case 0x13: return "Auto";
case 0x14: return "Driving Mode unable to switch";
case 0x15: return "Hybrid Mode, unable to switch";
case 0x16: return "Driving Mode Eco not available";
case 0x17: return "Driving Mode Normal is not available";
case 0x18: return "Mode Battery Hold not available";
case 0x19: return "Driving Mode Normal is not available";
case 0x1A: return "Mode Battery Charge not available";
case 0x1B: return "GTE Off";
case 0x1C: return "GTE Logo";
default: return "Unknown";
}
}
string getSettingByteActive(int state) {
switch (state) {
case 0x0: return "Inactive";
case 0x2: return "Active";
case 0xB: return "Unknown (needs testing)";
default: return "Unknown";
}
}
string getBoolean(int state) {
switch (state) {
case 0x0: return "Disabled";
case 0x1: return "Enabled";
default: return "Unknown";
}
}
// helper function to print nice titles without needing to type them manually each time
void printTitle( string title )
{
Printf(" \n");
Printf(" #################################################\n");
Printf(" %s\n", title);
Printf(" #################################################\n");
}