-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
2043 lines (1893 loc) · 78.6 KB
/
Copy pathindex.html
File metadata and controls
2043 lines (1893 loc) · 78.6 KB
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
<!doctype html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="MK60EC1 - editor de long coding ABS/ESP Jetta BR 2009–2016" />
<title>MK60EC1 Long Code Editor</title>
<style>
*, *::before, *::after { box-sizing: border-box; }
:root {
--bg: #0f1419;
--surface: #1a2332;
--surface2: #243044;
--surface3: #2a3648;
--border: #2d3f56;
--text: #e8edf4;
--muted: #8b9cb3;
--accent: #3b82f6;
--accent-hover: #2563eb;
--success: #22c55e;
--warning: #f59e0b;
--error: #ef4444;
--vin: #6366f1;
--mirror: #8b5cf6;
--radius: 10px;
--font: 'Segoe UI', system-ui, -apple-system, sans-serif;
--mono: 'Cascadia Code', 'Consolas', monospace;
}
html { font-size: 16px; }
body {
margin: 0;
min-height: 100vh;
font-family: var(--font);
background: var(--bg);
color: var(--text);
line-height: 1.5;
}
.app {
max-width: 1560px;
margin: 0 auto;
padding: 1.25rem 1.25rem 1.5rem;
}
.header {
display: flex;
flex-wrap: wrap;
align-items: baseline;
justify-content: space-between;
gap: 0.5rem 1.5rem;
margin-bottom: 1rem;
padding-bottom: 0.85rem;
border-bottom: 1px solid var(--border);
}
.header h1 { margin: 0; font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
.header-note { margin: 0; font-size: 0.8125rem; color: var(--muted); }
/* Notebook wide: sidebar fixa + editor ocupa o resto */
.layout {
display: grid;
grid-template-columns: minmax(440px, 460px) minmax(0, 1fr);
gap: 1rem;
align-items: start;
}
@media (max-width: 960px) {
.layout { grid-template-columns: 1fr; }
}
.sidebar { display: flex; flex-direction: column; gap: 0.85rem; }
.panel {
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 1rem 1.1rem;
}
.panel-title {
margin: 0 0 0.75rem;
font-size: 0.6875rem;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.08em;
color: var(--muted);
}
.field { margin-bottom: 0.85rem; }
.field:last-child { margin-bottom: 0; }
.field label {
display: flex;
align-items: center;
gap: 0.3rem;
font-size: 0.75rem;
font-weight: 600;
color: var(--muted);
margin-bottom: 0.35rem;
text-transform: uppercase;
letter-spacing: 0.04em;
}
.field input[type='text'],
.field select,
.field textarea {
width: 100%;
padding: 0.6rem 0.7rem;
font-size: 0.9375rem;
font-family: var(--mono);
background: var(--surface2);
border: 1px solid var(--border);
border-radius: 6px;
color: var(--text);
}
.field textarea { resize: vertical; min-height: 2.75rem; font-size: 0.8125rem; }
.field input:focus, .field select:focus, .field textarea:focus {
outline: 2px solid var(--accent);
outline-offset: 1px;
}
.hint { margin: 0.3rem 0 0; font-size: 0.75rem; color: var(--muted); }
.chk-row {
display: flex;
align-items: center;
gap: 0.5rem;
font-size: 0.875rem;
margin-bottom: 0.75rem;
cursor: pointer;
}
.chk-row input { width: 1rem; height: 1rem; accent-color: var(--accent); }
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 0.5rem 0.85rem;
font-size: 0.8125rem;
font-weight: 600;
border-radius: 6px;
border: 1px solid var(--border);
background: var(--surface2);
color: var(--text);
cursor: pointer;
transition: border-color 0.15s;
}
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary {
width: 100%;
padding: 0.75rem;
font-size: 0.875rem;
text-transform: uppercase;
letter-spacing: 0.06em;
background: var(--accent);
border-color: var(--accent);
color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.65rem; }
.hex-bar {
display: block;
padding: 0.7rem 0.8rem;
font-family: var(--mono);
font-size: 0.8125rem;
white-space: nowrap;
overflow-x: auto;
background: var(--surface2);
border: 1px solid var(--border);
border-radius: 6px;
line-height: 1.55;
letter-spacing: 0.02em;
}
.hex-meta { margin: 0.35rem 0 0; font-size: 0.6875rem; color: var(--muted); }
.alert { padding: 0.65rem 0.85rem; border-radius: 6px; font-size: 0.8125rem; margin-top: 0.65rem; }
.alert.hidden { display: none; }
.alert-warning { background: rgba(245,158,11,0.12); border: 1px solid rgba(245,158,11,0.35); color: #fcd34d; }
.alert-error { background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.35); color: #fca5a5; }
.alert-info { background: rgba(59,130,246,0.12); border: 1px solid rgba(59,130,246,0.3); color: #93c5fd; }
/* Editor */
.editor-panel { padding: 1rem 1.1rem; min-width: 0; }
.editor-head {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
gap: 0.5rem 1rem;
margin-bottom: 0.75rem;
}
.editor-head h2 { margin: 0; font-size: 1rem; font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; font-size: 0.6875rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 0.3rem; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-vin { background: var(--vin); }
.dot-mirror { background: var(--mirror); }
.dot-edit { background: var(--success); }
.editor-intro { margin: 0 0 0.85rem; font-size: 0.8125rem; color: var(--muted); }
/* Bytes VIN / espelho - faixa compacta, sem cards */
.auto-bytes {
margin-bottom: 0.85rem;
padding: 0.65rem 0.85rem;
background: rgba(99, 102, 241, 0.07);
border: 1px solid rgba(99, 102, 241, 0.22);
border-radius: 8px;
}
.auto-bytes.hidden { display: none; }
.auto-bytes-head {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0.35rem 0.65rem;
margin-bottom: 0.5rem;
font-size: 0.6875rem;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.06em;
color: var(--vin);
}
.auto-bytes-note { font-weight: 400; text-transform: none; letter-spacing: normal; color: var(--muted); font-size: 0.75rem; }
.auto-chips {
display: flex;
flex-wrap: wrap;
gap: 0.35rem 0.5rem;
}
.auto-chip {
display: inline-flex;
align-items: center;
gap: 0.3rem;
padding: 0.2rem 0.45rem;
font-size: 0.75rem;
font-family: var(--mono);
background: var(--surface2);
border: 1px solid var(--border);
border-radius: 4px;
line-height: 1.3;
}
.auto-chip.mirror { border-color: rgba(139, 92, 246, 0.45); }
.auto-chip-idx { color: var(--muted); font-size: 0.625rem; font-family: var(--font); font-weight: 600; }
.auto-chip-val { color: var(--text); font-weight: 700; }
/* Grid wide: 3 colunas em notebook, 4 em telas maiores */
.byte-grid {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 0.65rem;
}
@media (min-width: 1400px) {
.byte-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
.byte-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.byte-card {
background: var(--surface2);
border: 1px solid var(--border);
border-radius: 8px;
padding: 0.7rem 0.8rem;
display: flex;
flex-direction: column;
gap: 0.45rem;
min-width: 0;
position: relative;
overflow: visible;
}
.byte-card.vin { border-left: 3px solid var(--vin); }
.byte-card.mirror { border-left: 3px solid var(--mirror); }
.byte-card.editable { border-left: 3px solid var(--success); }
.byte-card.span-2 { grid-column: span 2; }
@media (max-width: 1100px) { .byte-card.span-2 { grid-column: span 1; } }
.byte-head {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 0.5rem;
}
.byte-label {
font-size: 0.6875rem;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.05em;
color: var(--muted);
}
.byte-name-row {
display: flex;
align-items: center;
gap: 0.25rem;
flex-wrap: wrap;
margin-top: 0.1rem;
}
.byte-name { font-size: 0.8125rem; font-weight: 600; line-height: 1.25; }
.byte-hex-input {
width: 3rem;
padding: 0.2rem 0.35rem;
font-family: var(--mono);
font-size: 0.875rem;
font-weight: 700;
text-align: center;
background: var(--surface3);
border: 1px solid var(--border);
border-radius: 4px;
color: var(--accent);
flex-shrink: 0;
}
.byte-hex-input:disabled { color: var(--muted); opacity: 0.75; cursor: not-allowed; }
.bit-list { display: flex; flex-direction: column; gap: 0.3rem; }
.bit-row {
display: flex;
align-items: flex-start;
gap: 0.45rem;
font-size: 0.75rem;
line-height: 1.35;
cursor: pointer;
}
.bit-row input { width: 0.875rem; height: 0.875rem; margin-top: 0.12rem; accent-color: var(--accent); flex-shrink: 0; }
.bit-row.disabled { opacity: 0.55; cursor: default; }
.bit-text { flex: 1; min-width: 0; }
.bit-mask { font-family: var(--mono); font-size: 0.625rem; color: var(--muted); margin-left: 0.2rem; }
.wss-row {
display: grid;
grid-template-columns: 1fr auto;
align-items: center;
gap: 0.4rem;
font-size: 0.75rem;
}
.enum-select {
width: 100%;
padding: 0.4rem 0.5rem;
font-size: 0.75rem;
background: var(--surface3);
border: 1px solid var(--border);
border-radius: 4px;
color: var(--text);
}
.byte-decode {
font-size: 0.6875rem;
color: var(--muted);
padding-top: 0.35rem;
border-top: 1px solid var(--border);
line-height: 1.4;
}
/* Tooltip - abre para baixo para não cortar no scroll */
.tip-wrap { position: relative; display: inline-flex; vertical-align: middle; }
.tip-btn {
width: 15px;
height: 15px;
padding: 0;
border: 1px solid var(--border);
border-radius: 50%;
background: var(--surface3);
color: var(--muted);
font-size: 10px;
font-weight: 700;
line-height: 1;
cursor: help;
display: inline-flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.tip-btn:hover, .tip-btn:focus-visible {
border-color: var(--accent);
color: var(--accent);
outline: none;
}
.tip-popup {
display: none;
position: absolute;
z-index: 200;
left: 50%;
top: calc(100% + 5px);
transform: translateX(-50%);
width: max-content;
max-width: 260px;
padding: 0.5rem 0.65rem;
font-size: 0.75rem;
font-weight: 400;
line-height: 1.45;
text-transform: none;
letter-spacing: normal;
color: var(--text);
background: #1e2838;
border: 1px solid var(--accent);
border-radius: 6px;
box-shadow: 0 6px 20px rgba(0,0,0,0.4);
pointer-events: none;
white-space: normal;
}
.tip-wrap:hover .tip-popup,
.tip-wrap:focus-within .tip-popup { display: block; }
details.help {
padding: 0.75rem 1rem;
border: 1px solid var(--border);
border-radius: var(--radius);
background: var(--surface);
font-size: 0.8125rem;
}
details.help summary { cursor: pointer; font-weight: 600; color: var(--muted); }
details.help ol { margin: 0.65rem 0 0; padding-left: 1.25rem; line-height: 1.6; }
details.help code { font-family: var(--mono); font-size: 0.75rem; color: var(--accent); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.65rem; }
.migrate-log {
margin-top: 0.65rem;
padding: 0.65rem;
font-family: var(--mono);
font-size: 0.6875rem;
background: var(--surface2);
border-radius: 6px;
max-height: 160px;
overflow: auto;
white-space: pre-wrap;
color: var(--muted);
}
.badge-common {
display: inline-block;
margin-left: 0.35rem;
padding: 0.1rem 0.35rem;
font-size: 0.625rem;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.04em;
color: var(--success);
border: 1px solid rgba(34, 197, 94, 0.4);
border-radius: 4px;
vertical-align: middle;
}
.glossary { margin: 0.65rem 0 0; }
.glossary dt { font-weight: 600; font-size: 0.75rem; margin-top: 0.45rem; color: var(--text); }
.glossary dd { margin: 0.15rem 0 0; font-size: 0.75rem; color: var(--muted); line-height: 1.45; }
.checklist {
margin-top: 0.65rem;
padding: 0.65rem 0.75rem;
font-size: 0.75rem;
background: rgba(245, 158, 11, 0.08);
border: 1px solid rgba(245, 158, 11, 0.28);
border-radius: 6px;
line-height: 1.5;
}
.checklist.hidden { display: none; }
.checklist-title { font-weight: 700; color: #fcd34d; margin-bottom: 0.35rem; font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.05em; }
.checklist ul { margin: 0; padding-left: 1.1rem; color: var(--muted); }
.checklist li { margin-bottom: 0.2rem; }
.editor-empty {
grid-column: 1 / -1;
padding: 2rem 1.25rem;
text-align: center;
font-size: 0.875rem;
color: var(--muted);
background: var(--surface2);
border: 1px dashed var(--border);
border-radius: 8px;
line-height: 1.55;
}
.byte-section {
grid-column: 1 / -1;
border: 1px solid var(--border);
border-radius: 8px;
background: rgba(0, 0, 0, 0.12);
overflow: hidden;
}
.byte-section summary {
cursor: pointer;
padding: 0.55rem 0.75rem;
font-size: 0.75rem;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.05em;
color: var(--muted);
list-style: none;
display: flex;
align-items: center;
gap: 0.5rem;
}
.byte-section summary::-webkit-details-marker { display: none; }
.byte-section summary::before {
content: '▸';
font-size: 0.6875rem;
transition: transform 0.15s;
}
.byte-section[open] summary::before { transform: rotate(90deg); }
.byte-section-grid {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 0.65rem;
padding: 0.65rem;
border-top: 1px solid var(--border);
}
@media (min-width: 1400px) {
.byte-section-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
.byte-section-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.byte-section-grid .byte-card.span-2 { grid-column: span 2; }
@media (max-width: 1100px) {
.byte-section-grid .byte-card.span-2 { grid-column: span 1; }
}
.byte-plain {
font-size: 0.75rem;
color: var(--muted);
line-height: 1.4;
margin: 0;
}
.byte-note {
font-size: 0.6875rem;
color: var(--accent);
line-height: 1.35;
padding: 0.35rem 0.45rem;
background: rgba(59, 130, 246, 0.08);
border-radius: 4px;
border: 1px solid rgba(59, 130, 246, 0.2);
}
.byte-card.byte-diff {
border-color: rgba(245, 158, 11, 0.55);
box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.15);
}
.byte-diff-badge {
font-size: 0.625rem;
font-family: var(--mono);
color: #fcd34d;
padding: 0.15rem 0.35rem;
background: rgba(245, 158, 11, 0.12);
border-radius: 3px;
line-height: 1.3;
}
.bit-advanced {
margin-top: 0.25rem;
padding-top: 0.35rem;
border-top: 1px dashed var(--border);
}
.bit-advanced summary {
cursor: pointer;
font-size: 0.6875rem;
color: var(--muted);
font-weight: 600;
margin-bottom: 0.3rem;
}
.mirror-pairs {
display: flex;
flex-direction: column;
gap: 0.45rem;
}
.mirror-pair {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0.35rem 0.5rem;
font-size: 0.75rem;
}
.mirror-pair-label {
font-size: 0.6875rem;
font-weight: 600;
color: var(--mirror);
min-width: 5.5rem;
}
.hex-strip {
display: flex;
flex-wrap: wrap;
gap: 0.25rem;
margin-bottom: 0.75rem;
padding: 0.45rem;
background: var(--surface2);
border: 1px solid var(--border);
border-radius: 6px;
}
.hex-strip.hidden { display: none; }
.hex-strip-cell {
display: flex;
flex-direction: column;
align-items: center;
gap: 0.1rem;
padding: 0.2rem 0.25rem;
min-width: 1.75rem;
font-family: var(--mono);
font-size: 0.6875rem;
background: var(--surface3);
border: 1px solid var(--border);
border-radius: 4px;
cursor: pointer;
color: var(--text);
}
.hex-strip-cell:hover { border-color: var(--accent); }
.hex-strip-cell.diff { border-color: rgba(245, 158, 11, 0.55); color: #fcd34d; }
.hex-strip-cell.auto { opacity: 0.75; }
.hex-strip-idx { font-size: 0.5625rem; color: var(--muted); font-family: var(--font); }
.footer-note { margin-top: 1rem; font-size: 0.75rem; color: var(--muted); text-align: center; }
</style>
</head>
<body>
<div class="app">
<header class="header">
<div>
<h1>MK60EC1 Long Code Editor</h1>
<p class="header-note">Jetta 2009–2016 · edição byte a byte</p>
</div>
<p id="module-badge" class="hint"></p>
</header>
<div class="layout">
<aside class="sidebar">
<details class="help" open>
<summary>Como usar</summary>
<ol>
<li>Cole o <strong>VIN</strong> e escolha o part number do módulo (CC/BL/AD)</li>
<li>Clique <strong>Calcular</strong> (ou <strong>Importar hex</strong> se já tem coding)</li>
<li>Ajuste bytes <strong>16+</strong> se necessário</li>
<li>Compare com o hex lido no VCDS (campo opcional abaixo)</li>
<li><strong>Copie</strong> e grave no <strong>03-ABS</strong> · login <strong>20795</strong></li>
</ol>
</details>
<details class="help">
<summary>Termos comuns</summary>
<dl class="glossary">
<dt>G85</dt><dd>Sensor de ângulo do volante - o ESP usa para saber para onde você está virando.</dd>
<dt>Espelho</dt><dd>Byte calculado automaticamente a partir de outro (ex.: byte 14 espelha o 6).</dd>
<dt>VIN (bytes 1–13)</dt><dd>Parte do long code derivada do chassi - recalculada ao informar o VIN.</dd>
<dt>HHC</dt><dd>Hill Hold Control - segura o carro em ladeira por alguns segundos.</dd>
<dt>PLA (byte 17 ABS)</dt><dd>Assistente que <strong>estaciona sozinho</strong> (módulo J791, PLA 2.0+) - NÃO é sensor que apita. Jetta BR com 8K/OPS tem sensores no módulo 09, PLA aqui fica OFF.</dd>
<dt>ACC</dt><dd>Cruise adaptativo - radar dianteiro; desmarque se o carro não tiver.</dd>
<dt>XDS</dt><dd>Controle de tração extra em curva - comum no CC.</dd>
<dt>MCB</dt><dd>Multi-Collision Braking - frenagem automática pós-colisão via módulo airbag.</dd>
<dt>AK / byte 18</dt><dd>Sensores ABS direcionais (ativos) - só com PLA 2.0 ou ACC. Errado = DTC de roda.</dd>
<dt>EPS / J500</dt><dd>Direção elétrica - G85 integrado na caixa de direção (não na coluna).</dd>
<dt>Long code</dt><dd>Sequência hex gravada no módulo 03 via Coding-07 no VCDS.</dd>
<dt>MK60EC1</dt><dd>Família ABS/ESP 1K0907379 usada no Jetta importado BR.</dd>
</dl>
</details>
<section class="panel">
<h3 class="panel-title">Entrada</h3>
<div class="field">
<label for="vin">VIN (17 caracteres)</label>
<input id="vin" type="text" maxlength="17" placeholder="9BWZZZ1KZAT000001" autocomplete="off" spellcheck="false" />
<p id="profile-hint" class="hint"></p>
</div>
<div class="field">
<label for="module">Módulo ABS</label>
<select id="module">
<option value="CC" selected>1K0907379CC - 20 bytes (H46)</option>
<option value="BL">1K0907379BL - 19 bytes (H31)</option>
<option value="AD">1K0907379AD - 17 bytes (H35)</option>
</select>
</div>
<label class="chk-row">
<input type="checkbox" id="extra-variant" />
<span>Variant (perua)</span>
</label>
<button type="button" id="btn-calc" class="btn btn-primary">Calcular long code</button>
<div id="alert-error" class="alert alert-error hidden"></div>
<div id="alert-info" class="alert alert-info hidden"></div>
</section>
<section class="panel">
<h3 class="panel-title">Long code</h3>
<div class="field">
<label for="car-hex">Hex lido no VCDS (opcional)</label>
<textarea id="car-hex" rows="2" placeholder="Coding-07 do carro - para comparar diferenças"></textarea>
<p class="hint">Bytes diferentes ficam destacados no editor.</p>
</div>
<div id="checklist" class="checklist hidden"></div>
<output id="hex-out" class="hex-bar">-</output>
<p id="hex-meta" class="hex-meta"></p>
<div class="btn-row">
<button type="button" id="btn-copy" class="btn" disabled>Copiar</button>
<button type="button" id="btn-load-hex" class="btn">Importar hex</button>
<button type="button" id="btn-sync-mirrors" class="btn">Recalcular espelhos</button>
</div>
<div id="alert-unverified" class="alert alert-warning hidden">
Confira bytes 16+ antes de gravar no VCDS.
</div>
</section>
<details class="help">
<summary>Gravar no VCDS</summary>
<ol>
<li>Conectar VCDS → chassi → <strong>03 - ABS/ESP</strong></li>
<li><strong>Coding-07</strong> · login <strong>20795</strong> (CC/BM+)</li>
<li>Colar hex <strong>sem espaços</strong></li>
<li>Conferir byte a byte · Basic Settings <strong>G85</strong> após troca</li>
</ol>
</details>
<details class="help">
<summary>Migrar long code</summary>
<p class="hint" style="margin:0.5rem 0 0.65rem">Rotas comuns BR<span class="badge-common">mais comum</span>: <strong>AD→CC</strong>, <strong>AD→BL</strong>, <strong>BJ→BL</strong>, <strong>BJ→CC</strong>, <strong>BL→CC</strong>. AH ≈ AD.</p>
<div class="field" style="margin-top:0.65rem">
<label for="migrate-hex">Hex atual</label>
<textarea id="migrate-hex" rows="2" placeholder="113B400C492300FD…"></textarea>
</div>
<div class="field-row">
<div class="field">
<label for="migrate-from">De (módulo antigo)</label>
<select id="migrate-from">
<optgroup label="Comuns BR">
<option value="AD" selected>AD - 17B H35 (problemático)</option>
<option value="BJ">BJ - 18B H31</option>
<option value="BL">BL - 19B H31 (G251)</option>
<option value="CC">CC - 20B H46</option>
</optgroup>
<optgroup label="Outros">
<option value="AH">AH - 18B H35 (≈ AD)</option>
<option value="BC">BC - 18B</option>
<option value="AT">AT - 18B</option>
<option value="BM">BM - 20B H46</option>
</optgroup>
</select>
</div>
<div class="field">
<label for="migrate-to">Para (módulo novo)</label>
<select id="migrate-to">
<optgroup label="Recomendado">
<option value="CC" selected>CC - 20B H46 (top)</option>
</optgroup>
<optgroup label="Comuns BR">
<option value="BL">BL - 19B H31</option>
<option value="BJ">BJ - 18B H31</option>
<option value="AD">AD - 17B H35</option>
</optgroup>
<optgroup label="Outros">
<option value="AH">AH - 18B H35</option>
<option value="BM">BM - 20B H46</option>
</optgroup>
</select>
</div>
</div>
<button type="button" id="btn-migrate" class="btn">Migrar</button>
<p class="hint" style="margin-top:0.5rem">Após migrar, o resultado é aplicado automaticamente no editor abaixo.</p>
<pre id="migrate-log" class="migrate-log"></pre>
</details>
</aside>
<main class="panel editor-panel">
<div class="editor-head">
<h2>Long Coding Helper</h2>
<div class="legend">
<span><span class="dot dot-vin"></span> VIN</span>
<span><span class="dot dot-mirror"></span> Espelho</span>
<span><span class="dot dot-edit"></span> Editável</span>
</div>
</div>
<p class="editor-intro">Três tipos de byte: <strong style="color:var(--vin)">VIN</strong> (1,3,5,7,9,11,13) vêm do chassi · <strong style="color:var(--mirror)">espelho</strong> (8,10,12,14) copiam 0,2,4,6 · <strong style="color:var(--success)">editável</strong> (cards abaixo). A faixa automática recalcula ao calcular ou alterar bytes fonte.</p>
<div id="hex-strip" class="hex-strip hidden"></div>
<div id="auto-bytes" class="auto-bytes hidden"></div>
<div id="byte-grid" class="byte-grid"></div>
</main>
</div>
<p class="footer-note">Padrão Jetta: botão ESP · HHC · PLA off (8K OPS) · Dados não saem do navegador</p>
</div>
<script>
(function () {
'use strict';
const MIRROR_PAIRS = [[0, 8], [2, 10], [4, 12], [6, 14]];
const VIN_DERIVED = new Set([1, 3, 5, 7, 9, 11, 13]);
/** Padrão HW Jetta BR - bytes 16+ (ref. codings reais fórum + etz2k/DRIVE2) */
const JETTA_HW = {
CC: { 16: 0xE1, 17: 0x08, 18: 0x00, 19: 0x20 },
BL: { 16: 0xE1, 17: 0x08, 18: 0x00 },
AD: { 16: 0x35 },
};
/** Byte 18 - presets comuns (etz2k / DRIVE2 MK60EC1) */
const WSS_PRESETS = [
{ v: 0x00, l: 'Standard - 4× só velocidade', help: 'Factory Jetta 2.5/TSI BR sem ACC. Evita DTC de sensor se não tiver sensores AK.' },
{ v: 0x55, l: 'Ativo 4 rodas (AK)', help: 'Direção + detecção parado nas 4 rodas - ACC, PLA 2.0, Golf GTI.' },
{ v: 0x50, l: 'Ativo só traseiras', help: 'Sensores direcionais traseiros (AK).' },
{ v: 0xf0, l: 'Traseiras invertidas', help: 'Direção invertida traseira - conferir MVB 113/114.' },
{ v: 0xff, l: '4 rodas invertidas', help: 'Raro - só se MVB 111–114 confirmar rotação invertida.' },
];
/** Máscaras etz2k por roda: std / ativo / invertido */
const WSS_ETZ = [
{ l: 'Dianteiro esq. (FL)', help: 'MVB 111 - sentido rotação.', std: 0x00, active: 0x01, inv: 0x03 },
{ l: 'Dianteiro dir. (FR)', help: 'MVB 112.', std: 0x00, active: 0x04, inv: 0x0c },
{ l: 'Traseiro esq. (RL)', help: 'MVB 113.', std: 0x00, active: 0x10, inv: 0x30 },
{ l: 'Traseiro dir. (RR)', help: 'MVB 114.', std: 0x00, active: 0x40, inv: 0xc0 },
];
const MIRROR_PAIR_LABELS = [
{ src: 0, dst: 8, label: 'Chassis' },
{ src: 2, dst: 10, label: 'Freios' },
{ src: 4, dst: 12, label: 'G85 / G608' },
{ src: 6, dst: 14, label: 'Direção / ROP' },
];
const BYTE_GROUPS = {
AD: [
{ id: 'chassis', title: 'Carro, freios e direção', bytes: [0, 2, 4, 6, 15] },
{ id: 'features', title: 'Equipamentos (HHC, ACC…)', bytes: [16] },
],
BL: [
{ id: 'chassis', title: 'Carro, freios e direção', bytes: [0, 2, 4, 6, 15] },
{ id: 'features', title: 'Equipamentos (HHC, XDS, PLA 2.0…)', bytes: [16, 17] },
{ id: 'sensors', title: 'Sensores de roda ABS', bytes: [18] },
],
CC: [
{ id: 'chassis', title: 'Carro, freios e direção', bytes: [0, 2, 4, 6, 15] },
{ id: 'features', title: 'Equipamentos (HHC, XDS, PLA 2.0…)', bytes: [16, 17] },
{ id: 'sensors', title: 'Sensores de roda ABS', bytes: [18] },
{ id: 'esp', title: 'Botão ESP', bytes: [19] },
],
};
const BYTE_DEFS = {
1: { name: 'VIN pos. 7 - plataforma', help: 'Calculado automaticamente a partir do VIN (par 7–8).', kind: 'vin', modules: ['AD', 'BL', 'CC'] },
3: { name: 'VIN pos. 8 - motor', help: 'Calculado do 8º caractere do VIN.', kind: 'vin', modules: ['AD', 'BL', 'CC'] },
5: { name: 'VIN pos. 13', help: 'Fórmula: 0x22 + dígito VIN pos. 13.', kind: 'vin', modules: ['AD', 'BL', 'CC'] },
7: { name: 'VIN pos. 14', help: 'Fórmula: 0xFA + dígito VIN pos. 14.', kind: 'vin', modules: ['AD', 'BL', 'CC'] },
8: { name: 'Espelho de byte 0', help: 'Bits espelhados de byte 0 - recalculado automaticamente.', kind: 'mirror', modules: ['AD', 'BL', 'CC'] },
9: { name: 'VIN pos. 15', help: 'Fórmula: 0x0B + dígito VIN pos. 15.', kind: 'vin', modules: ['AD', 'BL', 'CC'] },
10: { name: 'Espelho de byte 2', help: 'Bits espelhados de byte 2 (freios).', kind: 'mirror', modules: ['AD', 'BL', 'CC'] },
11: { name: 'VIN pos. 16', help: 'Fórmula: 0xE4 + dígito VIN pos. 16.', kind: 'vin', modules: ['AD', 'BL', 'CC'] },
12: { name: 'Espelho de byte 4', help: 'Bits espelhados de byte 4 (G85/G608).', kind: 'mirror', modules: ['AD', 'BL', 'CC'] },
13: { name: 'Checksum VIN', help: 'Fórmula: 0x19 + dígito VIN pos. 17.', kind: 'vin', modules: ['AD', 'BL', 'CC'] },
14: { name: 'Espelho de byte 6', help: 'Calculado do byte 6 (espelho de bits). LBL LC,14: bit4=G85 coluna, bits6–7=ROP. Jetta factory = 0x00.', kind: 'mirror', modules: ['AD', 'BL', 'CC'] },
0: {
name: 'Chassis / freio / direção',
plain: 'Identifica plataforma PQ35, volante à esquerda e tipo de freio. Jetta 2.5 BR = 0x11.',
help: 'Define plataforma PQ35, cilindro mestre e lado do volante. Jetta 2.5 BR = 0x11.',
kind: 'enum',
modules: ['AD', 'BL', 'CC'],
values: [
{ v: 0x11, l: 'PQ35 LHD 2.5 Jetta', help: 'Sedan/Variant 2.5 importado BR Mk5.' },
{ v: 0xA4, l: 'PQ35 TSI Mk6', help: 'Jetta/Golf TSI a partir de ~2011.' },
{ v: 0xA6, l: 'Variant TDI', help: 'Perua diesel europeia.' },
],
},
2: {
name: 'Freios F / R',
plain: 'Tamanho dos discos dianteiro e traseiro. Sedan 2.5 = 288/253 mm.',
help: 'Diâmetro dos discos. Sedan 2.5 BR = 288/253 mm (0x40). Variant = 312/253 (0x60).',
kind: 'enum',
modules: ['AD', 'BL', 'CC'],
values: [
{ v: 0x20, l: '280 / 253 mm', help: 'Discos menores (Golf base).' },
{ v: 0x40, l: '288 / 253 mm', help: 'Padrão Jetta sedan 2.5 BR.' },
{ v: 0x60, l: '312 / 253 mm', help: 'Variant / freio dianteiro maior.' },
{ v: 0x44, l: '288 / tambor TR', help: 'Dianteiro disco, traseiro tambor.' },
],
},
4: {
name: 'G608 / G85',
plain: 'Diz ao ABS se tem sensor de vácuo (G608) e sensor de volante (G85). Jetta 2.5 = tem G85, sem G608 → 0x4A.',
help: 'G608 = sensor de vácuo do freio. G85 = sensor de ângulo do volante. Jetta 2.5 tem G85 integrado na direção elétrica, sem G608 = 0x4A.',
kind: 'enum',
modules: ['AD', 'BL', 'CC'],
values: [
{ v: 0x4A, l: 'G85 sim, G608 não', help: 'Configuração típica Jetta 2.5 BR.' },
{ v: 0x49, l: 'Variant 2.5', help: 'Perua 2.5 com setup específico.' },
{ v: 0x21, l: 'Setup TSI', help: 'Motor turbo - vácuo diferente.' },
],
},
6: {
name: 'ROP / EDS / G85 coluna',
plain: 'Jetta com direção elétrica (EPS): deixe tudo desmarcado (0x00). Bit G85 na coluna só para rack hidráulico antigo.',
note: 'Byte 14 = espelho automático deste byte. Jetta EPS = ambos 0x00.',
help: 'Ref. LBL LC,06. Byte 14 espelha este byte. Jetta 2.5 padrão = 0x00 (G85 integrado na caixa EPS). 0x08 aqui → byte 14 vira 0x10.',
kind: 'bits',
modules: ['AD', 'BL', 'CC'],
advancedLabel: 'Opções para Touran/Caddy/Yeti',
bits: [
{ m: 0x08, l: 'G85 na coluna', help: 'Bit 3 - G85 externo no volante/coluna. Jetta EPS = G85 na caixa → deixar OFF.' },
{ m: 0x01, l: 'ROP-1 (Yeti)', help: 'Bits 0–1: Roll-Over Prevention. Jetta = 00.', advanced: true },
{ m: 0x02, l: 'ROP-2/3', help: 'Use só Touran/Caddy - Jetta deixa desmarcado.', advanced: true },
{ m: 0x04, l: 'EDS Touran/Yeti', help: 'Bit 2 - variante EDS. Não usar no Jetta.', advanced: true },
],
},
15: {
name: 'Tração / CBC / volante',
plain: 'Lado do volante, CBC e DSR. Jetta importado BR = 0x41.',
help: 'LHD, CBC, DSR. Base Jetta BR importado = 0x41.',
kind: 'enum',
modules: ['AD', 'BL', 'CC'],
values: [
{ v: 0x41, l: 'Base Jetta BR', help: 'LHD + CBC - padrão sedan importado.' },
{ v: 0x82, l: 'Variant alt.', help: 'Alternativa para perua.' },
],
},
16: {
name: 'HHC / TPMS / ACC',
plain: 'O que o ABS espera do carro: ladeira (HHC), ACC, aviso de frenada forte, MCB…',
help: 'Ref. LBL CC 60EC1. Jetta 2.5 BR = 0xE1 (HHC + sem ACC + MCB off + sem aviso frenagem emerg.).',
kind: 'bits',
modules: ['AD', 'BL', 'CC'],
advancedLabel: 'Opções avançadas',
bits: [
{ m: 0x01, l: 'HHC', help: 'Hill Hold Control (segura em ladeira) [PR-UG1/UG4]. Bit 0 - LBL LC,16,0.' },
{ m: 0x20, l: 'Sem ACC / Front Assist', help: 'Bit 5=1 desativa interface ACC -J428. Marque se não tiver ACC.' },
{ m: 0x40, l: 'Sem aviso frenagem emerg.', help: 'Bit 6=1 desliga flash rápido do brake light em frenagem forte.' },
{ m: 0x80, l: 'Airbag sem MCB', help: 'Bit 7=1 se módulo airbag não suporta Multi-Collision Braking.' },
{ m: 0x02, l: 'Auto-Hold EPB', help: 'Freio estacionamento eletromecânico -J540. Bit 1 - LBL LC,16,1.', advanced: true },
{ m: 0x04, l: 'Avoidance Feature', help: 'Ausweich Feature. Bit 2 - raro Jetta BR.', advanced: true },
],
enums: {
AD: [{ v: 0x35, l: 'AD + HHC', help: '0x34 base AD com HHC.' }],
BL: [{ v: 0xE1, l: 'BL 2.5 BR (0xE1)', help: 'HHC + sem ACC + MCB + sem aviso frenagem - preset Jetta.' }],
CC: [{ v: 0xE1, l: 'CC 2.5 BR (0xE1)', help: 'Preset Jetta importado BR.' }, { v: 0xA1, l: 'CC alternativo (0xA1)', help: 'Sem bit6 aviso frenagem off.' }],
},
},
17: {
name: 'PLA 2.0 / ACC / XDS',
plain: 'Jetta importado com sensores dianteiros/traseiros (8K/OPS) NÃO tem PLA aqui - deixe PLA desmarcado. Padrão = só XDS (0x08).',
note: 'PLA ≠ sensores que apitam. Sensores 8K/OPS ficam no módulo 09 (BCM). Este bit é só para PLA 2.0+ (J791) que estaciona o carro sozinho - raro no Jetta BR.',
help: 'Bit 0 = PLA 2.0+ com intervenção de freio (J791, PR-7X5). Bit 3 = XDS. Jetta 2.5 BR com 8K = 0x08 (XDS on, PLA off). Só marque PLA se o carro estacionar semi-automaticamente de fábrica.',
kind: 'bits',
modules: ['BL', 'CC'],
advancedLabel: 'Opções avançadas',
bits: [
{ m: 0x01, l: 'PLA 2.0 (estaciona sozinho)', help: 'NÃO marque se só tem sensores 8K/OPS (bip ao estacionar). Só para PLA de fábrica com módulo J791 - o carro vira o volante sozinho na vaga.' },
{ m: 0x08, l: 'XDS', help: 'Expansão controle tração em curva - padrão Jetta CC (0x08 = só XDS).' },
{ m: 0x02, l: 'ACC Follow-To-Stop', help: 'CC 20B - cruise adaptativo (raro BR).', advanced: true },
{ m: 0x04, l: 'Reset iTPMS no MFA', help: 'RKA+ via painel - CC/BL recentes.', advanced: true },
{ m: 0x10, l: 'AWV / EDF', help: 'Alerta colisão - raro Jetta BR.', advanced: true },
],
},
18: {
name: 'Sensores de velocidade das rodas',
plain: 'Tipo de sensor em cada roda. Jetta sem PLA/ACC = 0x00. Valor errado = DTC de roda traseira.',
help: 'NÃO confundir com byte 18 do módulo 09 (BCM)! No ABS MK60EC1: tipo de sensor de velocidade. Jetta BR factory = 0x00 (standard). 0x55 só com sensores AK (ACC/PLA2). Errar aqui gera DTC roda traseira.',
kind: 'wss',
modules: ['BL', 'CC'],
presets: WSS_PRESETS,
wheels: WSS_ETZ,
},
19: {
name: 'Botão ESP',
plain: 'O botão no console é gravado ESP (não ASR OFF). Jetta BR = Com botão ESP (0x20).',
help: 'Só CC 20B. Nibble alto (bits 4–7): o que o botão ESP (E256) no console faz. Jetta BR = Com botão ESP (0x20). iTPMS = checkbox abaixo.',
kind: 'byte19',
modules: ['CC'],
advancedLabel: 'Opções avançadas',
escModes: [
{ v: 0x20, l: 'Com botão ESP', help: 'Padrão Jetta BR - botão gravado ESP no console. Pressão curta (~1s) desliga tração (ASR); ESP permanece ativo.' },
{ v: 0x60, l: 'Ciclos sport', help: 'Pressão curta (~1s) → ESP Sport · longa (~3s) → ESP OFF. Config sport (GTI, Leon Cupra).' },
{ v: 0x00, l: 'Sem botão', help: 'Sem E256 no console. Nibble alto zerado. Nota: 0x10 clássico costuma falhar no CC H46.' },
],
bits: [
{ m: 0x02, l: 'iTPMS ativo', help: 'PR-7K6 - pressão indireta via ABS (bit separado do botão).' },
{ m: 0x08, l: 'Lane Assist J1086', help: 'Assistente de faixa - raro no Jetta.', advanced: true },
],
},
};
const MODULE_PROFILE = { AD: 'len17', BL: 'len19', CC: 'len20' };
const PROFILE_LEN = { len17: 17, len18: 18, len19: 19, len20: 20 };
const BYTE1_VIN_PAIR = {
'3B': 0x3b, '3C': 0x3c, '3D': 0x3d, '3F': 0x3f, '42': 0x42, '4B': 0x4b,
'1K': 0x3b, '5K': 0x3b, AJ: 0x4b, '16': 0x3b, AT: 0x3b,
};
const BYTE3_VIN_CHAR = {
'3': 0xf5, '4': 0xf6, '5': 0xf7, '6': 0xf8, F: 0x08, H: 0x0a, J: 0x0c,
K: 0x0d, L: 0x0e, M: 0x0f, P: 0x12, T: 0x16, Z: 0x1c, A: 0x03, B: 0x04,
C: 0x05, D: 0x06, E: 0x07,
};
const VIN_MODEL_YEAR = {
A: 2010, B: 2011, C: 2012, D: 2013, E: 2014, F: 2015, G: 2016,
'9': 2009, '8': 2008, '7': 2007,
};
const VIN_FORMULA_BYTES = [
{ index: 1, formula: 'byte1_map' }, { index: 3, formula: 'byte3_map' },
{ index: 5, formula: 'add_0x22' }, { index: 7, formula: 'add_0xFA' },
{ index: 9, formula: 'add_0x0B' }, { index: 11, formula: 'add_0xE4' },
{ index: 13, formula: 'add_0x19' },
];
const VIN_CHARS = /^[A-HJ-NPR-Z0-9]{17}$/;
function toHexByte(n) { return (n & 0xff).toString(16).toUpperCase().padStart(2, '0'); }
function normalizeVin(v) { return v.replace(/\s/g, '').toUpperCase(); }
function isValidVin(v) { return VIN_CHARS.test(normalizeVin(v)); }
function vinDigitAt(vin, i) { const ch = vin[i]; return ch >= '0' && ch <= '9' ? parseInt(ch, 10) : 0; }
function bitMirrorByte(b) {
let out = 0;
for (let i = 0; i < 8; i++) if (b & (1 << i)) out |= 1 << (7 - i);
return out & 0xff;
}
function applyMirrorPairs(bytes) {
const out = [...bytes];
for (const [src, dst] of MIRROR_PAIRS) {
if (src < out.length && dst < out.length) out[dst] = bitMirrorByte(out[src]);
}
return out;
}
function computeVinByte(formula, vin) {
const v = normalizeVin(vin);
if (!isValidVin(v)) return null;
switch (formula) {