forked from jilleb/MQB-FPA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fpa_dataset.bt
1277 lines (1069 loc) · 46.5 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
990
991
992
993
994
995
996
997
998
999
1000
//--------------------------------------
//--- 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, gray = doesn't look very relevant.
// Currently only useful for FPA datasets for 3Q0907530Q and newer.
//--------------------------------------
OutputPaneClear();
local int groupsMatrixControlsArray[64];
BitfieldDisablePadding();
BigEndian();
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.
struct{
byte unknown_04<format=hex,bgcolor=cDkGray,comment="sub-version?">;
// Seems to be 64 in all datasets
byte unknown_05<format=hex,bgcolor=cDkGray>;
// Something like manufacturing year? (range: 7 to 12.. add 2010 to this to get MY?)
//IB: 07
//J4: 08
//J6: 08
//J7: 08
//JA: 08
//JC: 08
//JD: 08
//KN: 08
//LA: 07
//LG: 07
//LI: 0B
//LK: 08
//LO: 0B
//M9: 09
//MJ: 0A
//N1: 08
//N8: 0B
//O2: 09
//03: 09
//O4: 09
//05: 09
//OC: 09
//OJ: 0A
//ON: 09
//OO: 09
//OS: OB
//OY: OB
//OZ: 0B
//P4: OB
//PF: 0B
//TA: 0C
byte unknown_06<format=hex,bgcolor=cDkGray>;
// Always 00
byte unknown_07<format=hex,bgcolor=cDkGray>;
// Always OA
byte unknown_08<format=hex,bgcolor=cDkGray>;
// Almost always 00, except for:
//LA: 1E
//LG: 1E
//LI: 1E
//LK: 1E
//LO: 1E
//Seems to be a Seat-thing?
byte unknown_09<format=hex,bgcolor=cDkGray>;
// Almost always 01 except for:
// KN: FF
// N1: FF
// N8: FF
// FF Seems to be an Audi thing?
// J7: 00
byte unknown_0A <bgcolor=cDkGray>;
// Known values are either 01 or 00
//IB: 01
//J4: 01
//J6: 00
//J7: 06
//JA: 01
//JC: 01
//JD: 01
//KN: 00
//LA: 01
//LG: 01
//LI: 01
//LK: 01
//LO: 01
//M9: 01
//MJ: 01
//N1: 00
//N8: 00
//O2: 01
//O3: 01
//O4: 01
//05: 00
//OC: 01
//OJ: 01
//ON: 01
//OO: 01
//OS: 01
//OY: 01
//OZ: 00
//P4: 01
//PF: 00
//TA: 01
byte unknown_0B <format=decimal,bgcolor=cDkGray>;
// Known values are in the range of dec 10 to 50, but there's no clear pattern yet.
//IB: 32
//J4: 32
//J6: 0A
//J7: 03
//JA: 32
//JC: 32
//JD: 32
//KN: 00
//LA: 32
//LG: 32
//LI: 32
//LK: 32
//LO: 32
//M9: 32
//MJ: 32
//N1: 14
//N8: 14
//O2: 0A
//O3: 0A
//O4: 0A
//05: 0A
//OC: 32
//OJ: 32
//ON: 32
//OO: 32
//OS: 14
//OY: 14
//OZ: 14
//P4: 14
//PF: 14
//TA: 0A
byte unknown_0C<bgcolor=cDkGray>;
// Almost always 0F except for Tiguan datasets (J6, OZ, PF), where it's 0A
// Could this influence button behavior, because Tiguan has a knob instead of a mode button?\
byte unknown_0D<bgcolor=cDkGray>;
} header;
// From here it appears to be some kind of table, 32 rows, 15 colums, or something like that.
// it appears to override the request values before they are sent to a control module
FSeek(38);
struct{
struct{
ubyte value_B:4<bgcolor=cDkYellow>;
ubyte value_A:4<bgcolor=cYellow>;
}group_children_request_values_x [15]<optimize=true>;
}group_children_request_values[32]<optimize=true>;
// findings so far:
// on these datasets, the controls line up with their respective position in list_of_grouped_controls:
// IB (Golf 2019)
// J6 (Tiguan 2019)
// JA (Golf R 310)
// JD (Golf Standard)
// N1 (A3 tdi 2018)
// OC (Magotan 2021 with DCC Slider)
// OS (GTI 2021)
// OY
// looks like they match:
// M9 (Octavia 2019)
// MJ (Superb 2020)
// on these datasets, they don't:
// LI (Leon FR 2020)
// LK (Leon Cupra 300)
// LO (Leon Cupra)
// O2 (Magotan 2021 GTE)
FSeek(518);
ubyte group_member_request_values_controls[8] <bgcolor=cDkYellow,name=getControlName>;
ubyte amount_of_members_per_group[8] <bgcolor=cGreen>;
// these are the names of the groups.
// examples:
// IB 21 FF FF FF FF FF FF FF 04 - 1 group, 4 controls
// J6 21 FF FF FF FF FF FF FF 04 - 1 group, 4 controls
// JA 21 24 FF FF FF FF FF FF 03 02 - 2 groups, 3+2 controls
// JD 21 FF FF FF FF FF FF FF 04 - 1 group, 4 controls
// N1 03 0A FF FF FF FF FF FF 04 03 - 2 groups, 4 controls, 3 controls
// OC 21 24 FF FF FF FF FF FF 04 02 - 2 groups, 4 controls, 2 controls
// OS 21 FF FF FF FF FF FF FF 04 - 1 group, 4 controls
// OY 21 24 FF FF FF FF FF FF 04 02 - 2 groups, 4 + 2 controls
// LI 01 FF FF FF FF FF FF FF 05 - 1 group, 5 controls
// LK 01 FF FF FF FF FF FF FF 06 - 1 group, 6 controls
// LO 01 FF FF FF FF FF FF FF 07 - 1 group, 7 controls
// O2 00 FF FF FF FF FF FF FF FF - no groups
// PF 21 24 07 FF FF FF FF FF 03 02 02 - 3 groups, 3+2+2 controls
// Having 3+2+2 in dataset PF rules out that this is anything other than group size.
FSeek(566);
// these determine specifically which controls are set in the group member matrix.
long members_in_group_[4]<read=getGroupMemberLongCodingByteName>;
// 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: 7 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] <hidden=true>;
FSeek(662);
struct {
ubyte allowed_to_change_in_evoff: 1 <read = getYesNo>;
ubyte allowed_to_change_in_hybridarea: 1 <read = getYesNo>;
ubyte allowed_to_change_in_hybridcharge: 1 <read = getYesNo>;
ubyte allowed_to_change_in_hybridhold: 1 <read = getYesNo>;
ubyte allowed_to_change_in_offroadindividual: 1 <read = getYesNo>;
ubyte allowed_to_change_in_snow: 1 <read = getYesNo>;
ubyte allowed_to_change_in_lift: 1 <read = getYesNo>;
ubyte allowed_to_change_in_clubsport: 1 <read = getYesNo>;
ubyte allowed_to_change_in_notset: 1 <read = getYesNo>;
ubyte allowed_to_change_in_ecoplus: 1 <read = getYesNo>;
ubyte allowed_to_change_in_race: 1 <read = getYesNo>;
ubyte allowed_to_change_in_eco: 1 <read = getYesNo>;
ubyte allowed_to_change_in_offroad: 1 <read = getYesNo>;
ubyte allowed_to_change_in_sport: 1 <read = getYesNo>;
ubyte allowed_to_change_in_normal: 1 <read = getYesNo>;
ubyte allowed_to_change_in_comfort: 1 <read = getYesNo>;
} control_is_allowed_to_change[30] <bgcolor=cGreen,optimize=true>;
FSeek(722);
ushort function_bytes_settings[30] <comment=getFunctionByteSettingName,hidden=true>;
FSeek(722);
struct {
ubyte remember_after_reset_in_evoff: 1 <read = getYesNo>;
ubyte remember_after_reset_in_hybridarea: 1 <read = getYesNo>;
ubyte remember_after_reset_in_hybridcharge: 1 <read = getYesNo>;
ubyte remember_after_reset_in_hybridhold: 1 <read = getYesNo>;
ubyte remember_after_reset_in_offroadindividual: 1 <read = getYesNo>;
ubyte remember_after_reset_in_snow: 1 <read = getYesNo>;
ubyte remember_after_reset_in_lift: 1 <read = getYesNo>;
ubyte remember_after_reset_in_clubsport: 1 <read = getYesNo>;
ubyte remember_after_reset_in_ecoplus: 1 <read = getYesNo>;
ubyte remember_after_reset_in_race: 1 <read = getYesNo>;
ubyte remember_after_reset_in_eco: 1 <read = getYesNo>;
ubyte remember_after_reset_in_offroad: 1 <read = getYesNo>;
ubyte remember_after_reset_in_sport: 1 <read = getYesNo>;
ubyte remember_after_reset_in_normal: 1 <read = getYesNo>;
ubyte remember_after_reset_in_comfort: 1 <read = getYesNo>;
ubyte remember_after_reset_in_notset: 1 <read = getYesNo>;
}control_is_reset[30] <bgcolor=cDkGreen,optimize=true>;
FSeek(782);
byte restart_value[30] <format=hex, bgcolor=cGreen, name=getSettingName>;
// this is the default value after restart
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, name=getFPAName>;
// This determines what profile position it returns to after restarting the car.
struct{
ubyte allow_return_to_evoff: 1 <read = getYesNo>;
ubyte allow_return_to_hybridarea: 1 <read = getYesNo>;
ubyte allow_return_to_hybridcharge: 1 <read = getYesNo>;
ubyte allow_return_to_hybridhold: 1 <read = getYesNo>;
ubyte allow_return_to_offroadindividual: 1 <read = getYesNo>;
ubyte allow_return_to_snow: 1 <read = getYesNo>;
ubyte allow_return_to_lift: 1 <read = getYesNo>;
ubyte allow_return_to_clubsport: 1 <read = getYesNo>;
ubyte allow_return_to_individual: 1 <read = getYesNo>;
ubyte allow_return_to_race: 1 <read = getYesNo>;
ubyte allow_return_to_eco: 1 <read = getYesNo>;
ubyte allow_return_to_offroad: 1 <read = getYesNo>;
ubyte allow_return_to_sport: 1 <read = getYesNo>;
ubyte allow_return_to_normal: 1 <read = getYesNo>;
ubyte allow_return_to_comfort: 1 <read = getYesNo>;
ubyte allow_return_to_notset: 1 <read = getYesNo>;
} allow_return_to_profile <optimize=false>;
// this determines whether or not it's allowed to return to a given profile upon reset.
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, name=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;
ubyte enable_fpa_button_part_1_1 <bgcolor=cYellow, comment=getBoolean>;
// 1 = enabled
// 0 = disabled
// 5 = on PF00, which has R button on steering wheel
ubyte enable_fpa_button_part_1_2 <bgcolor=cYellow, comment=getBoolean>;
// FD on Tiguan R (has enabled steering wheel FPA buttons)
ubyte enable_fpa_button_part_1_3 <bgcolor=cYellow, comment=getBoolean>;
// FE on Tiguan R (has enabled steering wheel FPA buttons)
ubyte enable_fpa_button_part_1_4 <bgcolor=cYellow, comment=getBoolean>;
byte button_filler_2;
ubyte enable_fpa_button_part_2_1 <bgcolor=cYellow, comment=getBoolean>;
// 1 = enabled
// 0 = disabled
// 4 = unknown
// 0401 0100 on Tiguan R (has enabled steering wheel FPA buttons) (dataset version PF)
ubyte enable_fpa_button_part_2_2 <bgcolor=cYellow, comment=getBoolean>;
ubyte enable_fpa_button_part_2_3 <bgcolor=cYellow, comment=getBoolean>;
ubyte enable_fpa_button_part_2_4 <bgcolor=cYellow, comment=getBoolean>;
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)
ubyte unknown_bytes_button_specifics[6];
// PF: 0000 0102 FFFF
// OY: 0000 FFFF FFFF
struct{
ubyte order<bgcolor=cGreen,comment=getFPAName>; // in what order are the profiles set
ubyte unknown_button1<bgcolor=cYellow>; //untested, these seem to be just filler bytes, but are they?
ubyte unknown_button2<bgcolor=cYellow>; //Possible R-button bytes
ubyte unknown_button3<bgcolor=cYellow>;
} button[9] <optimize=true> ;
short unknown_value<bgcolor=cRed >; // this is Steering-wheel R-button related!
// PF: 0003
// OZ: 0002 - R steering wheel button
// OY: 02FF
short unknown_FFFFFF00<bgcolor=cDkRed >;
// OZ: 06FF
// 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
byte user_interface_specifics_button_[4]<bgcolor=cYellow >;
// todo:improve this. This determines the behavior of the FPA screen depending on the button you press.
// first position = mode button, second = knob, third = steeringwheel button
// 01: Title = "<brand> drive profile with DCC"
// 02: Title = "<brand> drive profile"
// 03: Profiles are no longer matching, and a different animation
// 04: No HMI screen, only FPA icon
// 05: Nothing on HMI screen, FPA only visible on virtual cockpit.
// 06: Title = profile name
// 07: No HMI screen, only FPA icon
// FA: -
ubyte 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
ubyte unknown_value6_1 <bgcolor=cDkRed >;
ubyte unknown_value6_2 <bgcolor=cLtRed >; // relevant for R button on steering wheel
ubyte unknown_value6_3 <bgcolor=cDkRed >;
ubyte unknown_value6_4 <bgcolor=cDkRed >;
// todo: test this
// PF: 0270 7100
// OY: 0100 0000
FSeek(2107);
ubyte unknown_2107[10]<bgcolor=cRed >;
// known values:
// all datasets: FF FF FF FF FF FF FF FF FF FF (reserved for future use?)
FSeek(2240);
ubyte unknown_2240<bgcolor=cDkRed >;
// Known values:
// 00
// 2E (0010 1110)
ubyte unknown_2241<bgcolor=cDkRed >;
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
string divideBy16(int value) {
string s;
value = value/16;
SPrintf( s, "%d", (int)value );
return s;
}
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
BitfieldRightToLeft();
struct{
struct{
int request_value_A :4;
int request_value_B :4;
}request_value[30]<optimize=true>;
} request_values[8]<bgcolor=cGreen,optimize=true>;
// This is a matrix of 8 bytes x 30 controls.
// Each byte holds 2 profiles (4 bit per profile)
// The value is sent to the control module, which changes it's behavior to a given mode when it's supported.
// 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?
// known values: 2 and 3. Changes didn't seem to touch the 0x38 table logic
byte SettingBytes_more[30] <bgcolor=cDkRed>; // rhymes with earlier setting bytes?
// known values: 0 and 8. Changes didn't seem to touch the 0x38 table logic
// the following data appears to be related to Hybrid only, as it's almost completely empty on non-hybrid/PHEV datasets.
byte PHEV_data[1625]<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(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
FSeek(3800);
byte unkonwn_3800<bgcolor=cDkRed>;
byte unkonwn_3801<bgcolor=cRed>;
// 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 j = 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[i].order != 00){
{ if (button[i].order < 100) {
Printf ("[ %s ]", getFPAName(FPA_profile[button[i].order-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 ("\t%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(%04x) \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) {
//The following statement is to fix a bug where the name of the group 4 needs the control that's in position 3.
if (group_number == 4){
Printf(" Group %i (%s): %s (%02x) - 0x38 Matrix line: %i\n", group_number, getControlName(list_of_grouped_controls[group_number-2]), getControlName(list_of_controls[indivgroup_setting_number]),list_of_controls[indivgroup_setting_number], groupMemberMatrixPosition(indivgroup_setting_number,group_number));
}else{
Printf(" Group %i (%s): %s (%02x) - 0x38 Matrix line: %i\n", group_number, getControlName(list_of_grouped_controls[group_number-1]), getControlName(list_of_controls[indivgroup_setting_number]),list_of_controls[indivgroup_setting_number], groupMemberMatrixPosition(indivgroup_setting_number,group_number));
}
num_of_groups++;
}
group_number++;
}
indivgroup_setting_number++;
}
if (num_of_groups == 0) {
Printf(" No groups configured at 0xA09 range.\n");
}
//----
printTitle("Allowed to make changes and remember after reset");
Printf(" \t \t Change allowed \t After ignition\n");
Printf(" Position Control \t ConfByte\t ???????? ?IREOSNC ???????? IREOSNC?\n");
for( i = 0; i < 30; i++)
{
if (list_of_controls[i] > 0){
Printf (" %i: \t%-30s \t %02x \t %s %s\n", i, getControlName(list_of_controls[i]), list_of_controls[i], IntToBinaryStr(function_bytes_settings_shifted_by_1_bit[i],2,true), IntToBinaryStr(function_bytes_settings[i],2,true));
}
}
printTitle("Request values");
// Prints a table of all requests values that are sent to control modules.
Printf(" \n");
Printf(" Control-module request values (8FB range)\n");
Printf ("\t\t\t\t\trequest_values_0\t|request_values_1\t|request_values_2\t|request_values_3\t|request_values_4\t|request_values_5\t|request_values_6\t|request_values_7\n");
Printf(" Position\tControl\t\t\t\t00\tcmft(1)\tnrml(2)\tsprt(3)\tofrd(4)\teco(5)\trace(6)\teco+(7)\ton(8)\toff(9)\tsnow(10)\t11\t12\tsand(13)\t14\t15\n");
for( i = 0; i < 30; i++)
{
if (list_of_grouped_controls[i] > 0){
Printf (" %i:\t %-30s(%02x)", i, getControlName(list_of_grouped_controls[i]),list_of_grouped_controls[i]);
j = 0;
while (j < 8){
Printf ("\t%02i\t%02i", request_values[j].request_value[i].request_value_A, request_values[j].request_value[i].request_value_B) ;
j++;
}
Printf("\n");
}
}
printTitle("Research stuff");
//--- research stuff, what looks like a table from position 38:
Printf("\n Unknown 38x research\n");
i = 0;
j = 0;
local int amount_of_unknown38_rows_with_value = 0;
local int amount_of_unknown38_values = 0;
local int amount_of_unknown38_values_A = 0;
local int amount_of_unknown38_values_B = 0;
local string even_lines;
local string uneven_lines;
local int line_number =0;
Printf("\n");
Printf(" Position\tControl\t\t\t\t1\t2\t3\t4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\n");
i = 0;
j = 0;
local int k = 0;
line_number =0;
local string filled_lines = "";
local string used_controls = "";
for( i = 0; i < 32; i++)
{
amount_of_unknown38_values_A=0;
amount_of_unknown38_values_B=0;
for( j = 0; j < 15; j++){
if (group_children_request_values[i].group_children_request_values_x[j].value_A!=0){
amount_of_unknown38_values_A++;
}
if (group_children_request_values[i].group_children_request_values_x[j].value_B!=0){
amount_of_unknown38_values_B++;
}
}
if (amount_of_unknown38_values_A > 0){
amount_of_unknown38_rows_with_value++;
Printf(" %i:\t %-30s (%02x)\t", line_number, getControlName(list_of_controls[groupsMatrixControlsArray[line_number]]),list_of_controls[groupsMatrixControlsArray[line_number]]);
filled_lines = filled_lines + Str("%i,",line_number);
for( j = 0; j < 15; j++)
{
Printf("%01x\t", group_children_request_values[i].group_children_request_values_x[j].value_A);
}
Printf("\n");
used_controls = used_controls + (getControlName(list_of_controls[amount_of_unknown38_rows_with_value-1])) + Str("(%i), ", list_of_controls[amount_of_unknown38_rows_with_value-1]);
}
line_number++;
if (amount_of_unknown38_values_B > 0){
amount_of_unknown38_rows_with_value++;
Printf(" %i:\t %-30s (%02x)\t", line_number, getControlName(list_of_controls[groupsMatrixControlsArray[line_number]]),list_of_controls[groupsMatrixControlsArray[line_number]]);
filled_lines = filled_lines + Str("%i,",line_number);
for( j = 0; j < 15; j++)
{
Printf("%01x\t", group_children_request_values[i].group_children_request_values_x[j].value_B);
}
Printf("\n");
used_controls = used_controls + (getControlName(list_of_controls[amount_of_unknown38_rows_with_value-1])) + Str("(%i), ", list_of_controls[amount_of_unknown38_rows_with_value-1]);
}
line_number++;
}
Printf("\n Group members as defined in matrix:\n");
for (i=0;i<4;i++){
if (members_in_group_[i] != 0){
Printf(" Group %i: %s \n", i+1, getGroupMemberLongCodingByteName(members_in_group_[i]));
}
}
Printf("\n Unknown values:");
Printf(" 0x38_controls (0x206):\t");
for (i=0;i<8;i++){
Printf("%02x ", group_member_request_values_controls[i]);
}
Printf("\n button_specifics (0x7D0):\t");
for (i=0;i<6;i++){
Printf("%02x ", unknown_bytes_button_specifics[i]);
}
Printf("\n profiles_related (0x80A):\t");
for (i=0;i<12;i++){
Printf("%02x ", unknown_profiles_related[i]);
}
// Showing how the byte_active bytes are set for each control. Currently, the meaning of these values is unknown.
Printf("\n\n Position Control \t 0xA67 \t 0xA85 \t Meaning\n");
for( i = 0; i < 30; i++)
{
if (list_of_controls[i] > 0){
Printf (" %i:\t %-30s \t %i \t %i \n", i, getControlName(list_of_controls[i]), SettingBytes_again[i],SettingBytes_more[i]);
}
}
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";
case 0x7: return "Individual/Eco+";
case 0x8: return "On";
case 0x9: return "Off";
case 0xA: return "Snow";
case 0xB: return "Config 11";
case 0xC: return "Config 12";
case 0xD: return "Sand";
default: return "Unknown";
}
}
// helper function to get light mode name
string getModeButtonLightState(int lightMode) {
switch (lightMode) {
case 0x0: return "Off";
case 0x1: return "On";
case 0x2: return "Blinking";
case 0x5: return "Unknown Skoda value";
case 0x6: 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"; //this one has the ability to change the start/stop behavior.
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";