-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmainwindow.cpp
More file actions
1427 lines (1354 loc) · 68.9 KB
/
Copy pathmainwindow.cpp
File metadata and controls
1427 lines (1354 loc) · 68.9 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
// file mainwindow.cpp
// Power FC Simulator simulates the complete Power FC MAP of a RX7 FD3S Version 4.11
// All Sensor values are static Values
// Copyright Bastian Gschrey and Markus Ippy
// author Bastian Gschrey and Markus Ippy
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDebug>
#include <QtGlobal>
#include <QTimer>
#include <QThread>
#include <QtSerialPort/QSerialPortInfo>
QByteArray Advanced = (QByteArray::fromHex("f02000001d2836091d02000000000000ff3602015d5c007300000000004c000025"));
QByteArray Basic = (QByteArray::fromHex("da1600000000000000000000f60200005c005b007d00e3"));
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
fillPortsParameters();
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::fillPortsParameters()
{
foreach(const QSerialPortInfo &info, QSerialPortInfo::availablePorts())
{
ui->comboBox->addItem(info.portName());
}
}
void MainWindow::dataAvailable()
{
QByteArray receivedData;
QByteArray Lignition1;
QByteArray Lignition2;
QByteArray Lignition3;
QByteArray Lignition4;
QByteArray Tignition1;
QByteArray Tignition2;
QByteArray Tignition3;
QByteArray Tignition4;
QByteArray injcorrection1;
QByteArray injcorrection2;
QByteArray injcorrection3;
QByteArray injcorrection4;
QByteArray MapRef;
QByteArray Injoverlap;
QByteArray InjvFuel;
QByteArray Turbotrans;
QByteArray Oilervswater;
QByteArray Fanvswater;
QByteArray Fuelinj;
QByteArray airtempboost;
QByteArray primlagbatt;
QByteArray AccelInj;
QByteArray Injvsaccel;
QByteArray Ignvsaircold;
QByteArray notshure;
QByteArray Ignvswater;
QByteArray IgnvsAirwarm;
receivedData = serialport->readAll();
quint8 requesttype = receivedData[0];
quint8 readwrite = receivedData[01];
//serialport->blockSignals(true);
// qDebug() << "Serial signal raised" << requesttype << readwrite;
//serialport->blockSignals(true);
qDebug() << "Serial signal raised";
// Process to calculate checksum
int checksum = 255; //calculated checksum from serial message 0xFF - each byte in message (except the last byte)
QByteArray checksumhex;
QByteArray recvchecksumhex = QByteArray::number(receivedData[readwrite], 16).right(2); // reading the checksum byte , convert to Hex , and cut to 2 positions
recvchecksumhex = recvchecksumhex.rightJustified(2, '0'); // If the checksumbyte is less than 2 positions , prepend a 0 for example if value is 0x9 turn it into 0x09
//test1 = test.rightJustified(2, '0');
for (int i = 0; i <= readwrite-1; i++)
{
checksum = checksum - receivedData[i];
checksumhex = QByteArray::number(checksum, 16).right(2);
checksumhex = checksumhex.rightJustified(2, '0');
}
// Process to calculate checksum
/*
int8_t checksum = 0xFFFFFFFFFFFFFFFF; //calculated checksum from serial message 0xFF - each byte in message (except the last byte)
int8_t checksumposition = readwrite; //determines in which position of the message the checksumbyte is located
int8_t receivedchecksum = receivedData[checksumposition]; //checksum from serial message
//int8_t integrity = checksum - receivedchecksum;
for (int i = 0; i <= readwrite-1; i++)
{
checksum = checksum - receivedData[i];
}
*/
// ui->txtConsole->append(+ "Calculated checksum " + QString::number(checksum,16).toUpper());
// ui->txtConsole->append(+ "received checksum " + QString::number(receivedchecksum,16).toUpper());
// Read only Data
//First request from FC Edit ?
if(requesttype == 0x01 && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0x01 0x02 0xFC");
ui->txtConsole->append("Sending reply FC info...First request from FC Edit ?");
serialport->write(QByteArray::fromHex("01 03 01 fa "));
serialport->blockSignals(false);
}
//FC Commander Display
if(requesttype == 0xDA) //&& readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0xDA 0x02 0x23");
ui->txtConsole->append("Sending reply FC info...FC Commander Display");
serialport->write(Basic);
//serialport->write(QByteArray::fromHex("da 16 00 00 00 00 00 00 00 00 00 00 f6 02 00 00 5c 00 5b 00 7d 00 e3")); //
serialport->blockSignals(false);
}
// Sensor Strings
if(requesttype == 0xDD && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0xDD 0x02 0x20");
ui->txtConsole->append("Sending reply FC info...Sensor Strings");
serialport->write(QByteArray::fromHex("dd 52 20 50 49 4d 56 54 41 31 56 54 41 32 56 4d 4f 50 57 54 52 54 41 49 52 54 46 55 45 4c 20 4f 32 53 53 54 52 41 2f 43 50 57 53 4e 54 52 43 4c 54 53 54 50 43 41 54 45 4c 44 48 57 4c 46 50 44 46 50 52 41 50 52 50 41 43 43 43 4e 54 43 4e 50 52 43 8b")); //
serialport->blockSignals(false);
}
// PIM Strings and Injector Adjustment
if(requesttype == 0xCB && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0xCB 0x02 0x32");
ui->txtConsole->append("Sending reply FC info...PIM Strings and Injector Adjustment");
serialport->write(QByteArray::fromHex("cb 6d 00 20 31 2e 20 4e 6f 72 6d 61 6c 20 20 20 20 20 20 20 00 20 32 2e 20 4f 70 74 69 6f 6e 31 20 20 20 20 20 20 00 20 33 2e 20 4f 70 74 69 6f 6e 32 20 20 20 20 20 20 00 20 34 2e 20 4f 70 74 69 6f 6e 33 20 20 20 20 20 20 00 20 35 2e 20 4f 70 74 69 6f 6e 34 20 20 20 20 20 20 00 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 ab")); //
serialport->blockSignals(false);
}
//write request
if(requesttype == 0xCB && readwrite > 0x02 && recvchecksumhex == checksumhex)
{
QByteArray injcorrection1 = receivedData;
ui->txtConsole->append("Write PM Strings and Inhector Adjustment to PowerFC");
ui->txtConsole->append("Power FC Send Acknlowedged 0xF2 0x02 0x0B");
serialport->write(QByteArray::fromHex("F2 02 0B"));
serialport->blockSignals(false);
}
// Version number
if(requesttype == 0xF5 && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0xF5 0x02 0x08");
ui->txtConsole->append("Sending reply FC info...Version number");
serialport->write(QByteArray::fromHex(" f5 07 34 2e 31 31 20 1f")); // Power FC Version number 5.08
//serialport->write(QByteArray::fromHex("f6 07 34 2e 31 31 20 1f")); // Power FC Version number 5.08
//serialport->write(QByteArray::fromHex("F507342E31302020"));
serialport->blockSignals(false);
}
// Map Reference
if(requesttype == 0x8A && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0x8A 0x02 0x73");
ui->txtConsole->append("Sending reply FC info...Map Reference");
serialport->write(QByteArray::fromHex("8a 52 f8 0a e0 0e c8 12 b0 16 98 1a 80 1e 68 22 50 26 38 2a 20 2e 08 32 c5 33 d9 38 4c 3e b5 43 0a 49 73 4e 91 53 9b 58 6a 5c 90 01 20 03 b0 04 40 06 d0 07 60 09 f0 0a 80 0c 10 0e a0 0f 30 11 c0 12 50 14 e0 15 70 17 00 19 90 1a 20 1c b0 1d 40 1f be ")); //
serialport->blockSignals(false);
}
//write request
if(requesttype == 0x8A && readwrite ==0x52 && recvchecksumhex == checksumhex)
{
QByteArray MapRef = receivedData;
ui->txtConsole->append("Write Map Reference to PowerFC");
ui->txtConsole->append("Power FC Send Acknlowedged 0xF2 0x02 0x0B");
serialport->write(QByteArray::fromHex("F2 02 0B"));
serialport->blockSignals(false);
}
//Advanced data
if(requesttype == 0xF0 && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0xF0 0x02 0x0D");
ui->txtConsole->append("Sending reply FC info...Adv");
serialport->write(Advanced);
//serialport->write(QByteArray::fromHex("F0 20 88 13 1d 28 36 09 1d 02 00 00 00 00 00 00 ff 36 02 01 5d 5c 00 73 DC 00 00 00 00 4C 00 00 25")); //changed speed to 220 and rev to 5500
// serialport->write(QByteArray::fromHex("f0 28 00 00 6d 28 45 09 27 02 00 00 00 00 00 00 ff 36 02 01 5d 5c 00 7c 00 00 00 00 00 4c 00 00 00 00 00 00 00 00 00 00 22"));
serialport->blockSignals(false);
}
//Sensor data
if(requesttype == 0xDE && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0xDE 0x02 0x1F");
ui->txtConsole->append("Sending reply FC info...Sensor Info");
serialport->write(QByteArray::fromHex("DE 14 EB 00 36 00 78 00 07 80 13 01 15 01 F2 81 01 00 28 31 F6"));
serialport->blockSignals(false);
}
//Map Indicies
if(requesttype == 0xDB && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0xDB 0x02 0x22");
ui->txtConsole->append("Sending reply FC info...Map Indicies");
serialport->write(QByteArray::fromHex("DB 04 05 06 15"));
serialport->blockSignals(false);
}
//Aux data (AN1-AN4) /lenght byte and checksum to be verified
if(requesttype == 0x00 && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0x00 0x02 0xFD");
ui->txtConsole->append("Sending reply FC info...Aux info");
serialport->write(QByteArray::fromHex("00 06 33 66 99 CC FB"));
serialport->blockSignals(false);
}
//All values below are simulating my Rx7 FD3S version 4.11 MAP
//Read and write packets
//This packet is sent by the Apexi Pro Software
if(requesttype == 0xF8 && readwrite == 0x06 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0xf8 0x06 0x06 0x07 0x03 0x03 0xee");
ui->txtConsole->append("Sending reply FC info...Unknown Apexi FC Pro command");
serialport->write(QByteArray::fromHex("f8 0a e0 0e c8 12 b0 16 98 1a "));
serialport->blockSignals(false);
}
// Leading Ignition Packet 1
if(requesttype == 0x76 && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0x76 0x02 0x87");
ui->txtConsole->append("Sending reply FC info...Leading Ignition Packet1");
serialport->write(QByteArray::fromHex("76 66 1e 1e 1e 1e 1e 22 22 1f 1d 1c 19 18 17 17 17 17 17 17 17 17 1e 1e 1e 1e 22 28 25 22 1f 1d 1b 1a 19 18 18 18 18 18 18 18 22 22 22 22 2a 2e 2a 24 22 1f 1d 1b 1a 18 18 18 18 18 18 18 2a 2a 2a 2f 2f 2f 2e 29 27 26 22 21 1e 1a 1a 19 19 19 19 19 35 35 35 34 32 30 2d 2a 28 27 26 23 21 1f 1d 1b 19 18 18 18 a6"));
//serialport->write (Lignition1);
serialport->blockSignals(false);
}
//write request
if(requesttype == 0x76 && readwrite ==0x66 && recvchecksumhex == checksumhex)
{
QByteArray Lignition1 = serialport->readAll();
ui->txtConsole->append("Write Leading Ignition Packet 1 to PowerFC");
ui->txtConsole->append("Power FC Send Acknlowedged 0xF2 0x02 0x0B");
serialport->write(QByteArray::fromHex("F2 02 0B"));
serialport->blockSignals(false);
}
// Leading Ignition Packet 2
if(requesttype == 0x77 && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0x77 0x02 0x86");
ui->txtConsole->append("Sending reply FC info...Leading Ignition Packet2");
serialport->write(QByteArray::fromHex("77 66 36 36 36 35 33 31 2c 2a 28 27 26 23 21 1f 1e 1d 1a 1a 19 19 36 36 36 36 34 32 2e 2c 29 28 26 24 23 21 20 1e 1c 1a 1a 1a 37 37 37 37 36 34 2e 2c 2b 2a 28 27 26 25 23 21 1f 1d 1b 1b 39 39 39 38 37 36 2f 2e 2b 2a 29 29 29 29 26 23 20 1e 1d 1d 3c 3c 3c 3b 3a 38 31 2f 2d 2b 2b 2b 2b 2a 28 25 22 20 1f 1d be"));
serialport->blockSignals(false);
}
//write request
if(requesttype == 0x77 && readwrite ==0x66 && recvchecksumhex == checksumhex)
{
QByteArray Lignition2 = receivedData;
ui->txtConsole->append("Write Leading Ignition Packet 2 to PowerFC");
ui->txtConsole->append("Power FC Send Acknlowedged 0xF2 0x02 0x0B");
serialport->write(QByteArray::fromHex("F2 02 0B"));
serialport->blockSignals(false);
}
// Leading Ignition Packet 3
if(requesttype == 0x78 && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0x78 0x02 0x85");
ui->txtConsole->append("Sending reply FC info...Leading Ignition Packet3");
serialport->write(QByteArray::fromHex("78 66 3f 3f 3f 3e 3c 3b 34 32 2f 2e 2c 2c 2c 2b 28 26 22 20 1f 1d 41 41 41 40 3e 3d 37 33 32 31 30 30 2d 2b 28 26 21 20 1e 1c 43 43 43 42 40 3c 3a 39 37 36 33 31 2f 2c 28 26 21 1f 1d 1b 44 44 44 43 42 3e 3d 3c 39 36 35 32 2f 2d 29 26 21 1f 1d 1b 46 46 46 45 45 43 40 3e 3c 3a 36 32 2f 2d 29 25 1f 1d 1b 19 a3"));
serialport->blockSignals(false);
}
//write request
if(requesttype == 0x78 && readwrite ==0x66 && recvchecksumhex == checksumhex)
{
QByteArray Lignition3 = receivedData;
ui->txtConsole->append("Write Leading Ignition Packet 3 to PowerFC");
ui->txtConsole->append("Power FC Send Acknlowedged 0xF2 0x02 0x0B");
serialport->write(QByteArray::fromHex("F2 02 0B"));
serialport->blockSignals(false);
}
// Leading Ignition Packet 4
if(requesttype == 0x79 && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0x79 0x02 0x84" );
ui->txtConsole->append("Sending reply FC info...Leading Ignition Packet4");
serialport->write(QByteArray::fromHex("79 66 47 47 47 46 46 43 41 3f 3d 3b 37 33 30 2e 2a 26 21 1f 1d 1b 47 47 47 47 46 45 41 40 3e 3d 37 33 31 2e 2b 28 24 22 20 1e 48 48 48 47 47 46 43 42 41 3f 37 34 31 2f 2d 2b 29 27 25 23 48 48 48 48 48 48 47 44 41 3f 39 36 32 2f 2e 2c 2b 29 27 25 49 49 49 49 48 48 47 44 41 3f 39 36 32 30 2f 2f 2d 2b 29 27 2a"));
// serialport->write(QByteArray::fromHex("79 66 47 47 47 46 46 43 41 3f 3d 3b 37 33 30 2e 2a 26 21 1f 1d 1b 47 47 47 47 46 45 41 40 3e 3d 37 33 31 2e 2b 28 24 22 20 1e 48 48 48 47 47 46 43 42 41 3f 37 34 31 2f 2d 2b 29 27 25 23 48 48 48 48 48 48 47 44 41 3f 39 36 32 2f 2e 2c 2b 29 27 25 49 49 49 49 48 48 47 44 41 3f 39 36 32 30 2f 2f 2d 2b "));
serialport->blockSignals(false);
}
//write request
if(requesttype == 0x79 && readwrite ==0x66 && recvchecksumhex == checksumhex)
{
QByteArray Lignition4 = receivedData;
ui->txtConsole->append("Write Leading Ignition Packet 4 to PowerFC");
ui->txtConsole->append("Power FC Send Acknlowedged 0xF2 0x02 0x0B");
serialport->write(QByteArray::fromHex("F2 02 0B"));
serialport->blockSignals(false);
}
// Trailing Ignition Packet 1
if(requesttype == 0x81 && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0x81 0x02 0x7C");
ui->txtConsole->append("Sending reply FC info...Trailing Ignition Packet1");
serialport->write(QByteArray::fromHex("81 66 16 16 16 16 16 20 1d 19 17 16 15 0e 0d 0d 0d 0d 0d 0d 0d 0d 16 16 16 16 20 23 21 1d 1a 18 15 10 0f 0e 0e 0e 0e 0e 0e 0e 1a 1a 1a 1a 28 2d 29 23 1f 1b 19 11 10 0e 0e 0e 0e 0e 0e 0e 2a 2a 2a 2f 2f 2f 2c 28 23 21 1d 17 14 10 10 0f 0f 0f 0f 0f 35 35 35 34 32 30 2d 2a 27 25 1f 19 17 15 13 11 0f 0e 0e 0e 2d"));
serialport->blockSignals(false);
}
//write request
if(requesttype == 0x81 && readwrite ==0x66 && recvchecksumhex == checksumhex)
{
QByteArray Tignition1 = receivedData;
ui->txtConsole->append("Write Trailing Ignition Packet 1 to PowerFC");
ui->txtConsole->append("Power FC Send Acknlowedged 0xF2 0x02 0x0B");
serialport->write(QByteArray::fromHex("F2 02 0B"));
serialport->blockSignals(false);
}
// Trailing Ignition Packet 2
if(requesttype == 0x82 && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0x82 0x02 0x7B");
ui->txtConsole->append("Sending reply FC info...Trailing Ignition Packet 2");
serialport->write(QByteArray::fromHex("82 66 36 36 36 35 33 31 2c 2a 27 25 20 19 17 15 14 13 10 10 0f 0f 36 36 36 36 34 32 2e 2c 28 25 20 1a 19 17 16 14 12 10 10 10 37 37 37 37 36 34 2e 2c 2a 26 21 1d 1c 1b 19 17 15 13 11 11 39 39 39 38 37 36 2f 2e 2b 27 22 1f 1f 1f 1c 19 16 14 13 13 3c 3c 3c 3b 3a 38 31 2f 2d 29 24 21 21 20 1e 1b 18 16 15 13 a7"));
serialport->blockSignals(false);
}
//write request
if(requesttype == 0x82 && readwrite ==0x66 && recvchecksumhex == checksumhex)
{
QByteArray Tignition2 = receivedData;
ui->txtConsole->append("Write Trailing Ignition Packet 2 to PowerFC");
ui->txtConsole->append("Power FC Send Acknlowedged 0xF2 0x02 0x0B");
serialport->write(QByteArray::fromHex("F2 02 0B"));
serialport->blockSignals(false);
}
// Trailing Ignition Packet 3
if(requesttype == 0x83 && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0x83 0x02 0x7A");
ui->txtConsole->append("Sending reply FC info...Trailing Ignition Packet 3");
serialport->write(QByteArray::fromHex("83 66 3f 3f 3f 3e 3c 3b 34 32 2f 2c 26 22 22 21 1e 1c 18 16 15 13 41 41 41 40 3e 3d 37 33 31 2c 28 26 23 21 1e 1c 17 16 14 12 43 43 43 42 40 3c 3a 39 36 32 2b 27 25 22 1e 1c 17 15 13 11 44 44 44 43 42 3e 3d 3b 37 31 2d 28 25 23 1f 1c 17 15 13 11 46 46 46 45 44 42 3f 3c 38 34 2e 28 25 23 1f 1b 15 13 11 0f a4"));
serialport->blockSignals(false);
}
//write request
if(requesttype == 0x83 && readwrite ==0x66 && recvchecksumhex == checksumhex)
{
QByteArray Tignition3 = receivedData;
ui->txtConsole->append("Write Trailing Ignition Packet 3 to PowerFC");
ui->txtConsole->append("Power FC Send Acknlowedged 0xF2 0x02 0x0B");
serialport->write(QByteArray::fromHex("F2 02 0B"));
serialport->blockSignals(false);
}
// Trailing Ignition Packet 4
if(requesttype == 0x84 && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0x84 0x02 0x79");
ui->txtConsole->append("Sending reply FC info...Trailing Ignition Packet 4");
serialport->write(QByteArray::fromHex("84 66 47 47 47 46 46 44 40 3c 3b 35 2f 29 26 24 20 1c 17 15 13 11 47 47 47 47 46 45 41 3e 3b 36 2f 29 27 24 21 1e 1a 18 16 14 48 48 48 48 47 46 43 40 3d 38 31 2a 27 25 23 21 1f 1d 1b 19 48 48 48 48 48 48 46 42 3e 39 33 2c 28 25 24 22 21 1f 1d 1b 49 49 49 49 48 48 46 42 3e 39 33 2c 28 26 25 25 23 21 1f 1d 3e"));
serialport->blockSignals(false);
}
//write request
if(requesttype == 0x84 && readwrite ==0x66 && recvchecksumhex == checksumhex)
{
QByteArray Tignition4 = receivedData;
ui->txtConsole->append("Write Trailing Ignition Packet 4 to PowerFC");
ui->txtConsole->append("Power FC Send Acknlowedged 0xF2 0x02 0x0B");
serialport->write(QByteArray::fromHex("F2 02 0B"));
serialport->blockSignals(false);
}
// Init Platform
if(requesttype == 0xF3 && readwrite <= 0x02)
{
ui->txtConsole->append("0xF3 0x02 0x0A");
ui->txtConsole->append("Sending reply FC info...init platform string");
//Simulate a delay in message reception
//serialport->write(QByteArray::fromHex("F30a324A5A2D47544531EE")); //2JZE-GTE
serialport->write(QByteArray::fromHex("f3 0a 31 33 42 2d 52 45 57 20 21")); //13B-REW
/*
serialport->write(QByteArray::fromHex("f3 0a"));
//
::msleep(1000);
serialport->write(QByteArray::fromHex("31 33"));
// QThread::msleep(5000);
serialport->write(QByteArray::fromHex("42 2d"));
// QThread::msleep(20);
serialport->write(QByteArray::fromHex("52"));
// QThread::msleep(10);
serialport->write(QByteArray::fromHex("45 57"));
// QThread::msleep(100);
serialport->write(QByteArray::fromHex("20 21"));
*/
serialport->blockSignals(false);
}
// Injector Overlap
if(requesttype == 0x7B && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0x7B 0x02 0x82");
ui->txtConsole->append("Sending reply FC info...Injector Overlap");
serialport->write(QByteArray::fromHex("7b 08 41 03 2e 02 1a 01 ed")); //
serialport->blockSignals(false);
}
//write request
if(requesttype == 0x7B && readwrite ==0x08 && recvchecksumhex == checksumhex)
{
QByteArray Injoverlap = receivedData;
ui->txtConsole->append("Write Injector Overlap to PowerFC");
ui->txtConsole->append("Power FC Send Acknlowedged 0xF2 0x02 0x0B");
serialport->write(QByteArray::fromHex("F2 02 0B"));
serialport->blockSignals(false);
}
// Injector vs Fuel Temp
if(requesttype == 0x7C && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0x7C 0x02 0x80");
ui->txtConsole->append("Sending reply FC info...Injector vs Fuel Temp");
serialport->write(QByteArray::fromHex("7c 0b 8c 05 01 78 00 01 64 00 01 08")); //
serialport->blockSignals(false);
}
//write request
if(requesttype == 0x7C && readwrite ==0x0B && recvchecksumhex == checksumhex)
{
QByteArray InjvFuel = receivedData;
ui->txtConsole->append("Write Injector vs Fuel Temp to PowerFC");
ui->txtConsole->append("Power FC Send Acknlowedged 0xF2 0x02 0x0B");
serialport->write(QByteArray::fromHex("F2 02 0B"));
serialport->blockSignals(false);
}
// Turbo Transition
if(requesttype == 0x7D && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0x7D 0x02");
ui->txtConsole->append("Sending reply FC info...Turbo Transition");
serialport->write(QByteArray::fromHex("7d 0b 99 66 33 4b 4b 4b 66 6b 8c 07")); //
serialport->blockSignals(false);
}
//write request
if(requesttype == 0x7D && readwrite ==0x0B && recvchecksumhex == checksumhex)
{
QByteArray Turbotrans = receivedData;
ui->txtConsole->append("Write Turbo Transition to PowerFC");
ui->txtConsole->append("Power FC Send Acknlowedged 0xF2 0x02 0x0B");
serialport->write(QByteArray::fromHex("F2 02 0B"));
serialport->blockSignals(false);
}
// Oiler vs Water Temperature
if(requesttype == 0x7E && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0x7E 0x02 0x7F");
ui->txtConsole->append("Sending reply FC info...Oiler vs Water Temperature");
serialport->write(QByteArray::fromHex("7e 08 be 97 aa 89 a7 81 c9")); //
serialport->blockSignals(false);
}
//write request
if(requesttype == 0x7E && readwrite ==0x08 && recvchecksumhex == checksumhex)
{
QByteArray Oilervswater = receivedData;
ui->txtConsole->append("Write Oiler vs Water Temperature to PowerFC");
ui->txtConsole->append("Power FC Send Acknlowedged 0xF2 0x02 0x0B");
serialport->write(QByteArray::fromHex("F2 02 0B"));
serialport->blockSignals(false);
}
// Fan vs Water Temperature
if(requesttype == 0x7F && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0x7F 0x02 0x7E");
ui->txtConsole->append("Sending reply FC info...Fan vs Water Temperature");
serialport->write(QByteArray::fromHex("7f 05 a6 a6 a6 89")); //
serialport->blockSignals(false);
}
//write request
if(requesttype == 0x7F && readwrite ==0x05 && recvchecksumhex == checksumhex)
{
QByteArray Fanvswater = receivedData;
ui->txtConsole->append("Write Fan vs Water Temperature to PowerFC");
ui->txtConsole->append("Power FC Send Acknlowedged 0xF2 0x02 0x0B");
serialport->write(QByteArray::fromHex("F2 02 0B"));
serialport->blockSignals(false);
}
// Injector Correction Packet 1
// read request
if(requesttype == 0x86 && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0x86 0x02 0x77");
ui->txtConsole->append("Sending reply FC info...Injector Correction Packet 1");
serialport->write(QByteArray::fromHex("86 66 80 80 80 80 80 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 80 80 80 80 80 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 80 80 80 80 80 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 80 80 80 80 80 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 80 80 80 80 80 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 c0")); //
serialport->blockSignals(false);
}
//write request
if(requesttype == 0x86 && readwrite ==0x66 && recvchecksumhex == checksumhex)
{
QByteArray injcorrection1 = receivedData;
ui->txtConsole->append("Write Injector Correction Packet 1 to PowerFC");
ui->txtConsole->append("Power FC Send Acknlowedged 0xF2 0x02 0x0B");
serialport->write(QByteArray::fromHex("F2 02 0B"));
serialport->blockSignals(false);
}
// Injector Correction Packet 2
if(requesttype == 0x87 && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0x87 0x02 0x76 ");
ui->txtConsole->append("Sending reply FC info...Injector Correction Packet 2");
serialport->write(QByteArray::fromHex("87 66 80 80 80 80 80 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 80 80 80 80 80 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 80 80 80 80 80 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 80 80 80 80 80 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 80 80 80 80 80 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 bf")); //
serialport->blockSignals(false);
}
//write request
if(requesttype == 0x87 && readwrite ==0x66 && recvchecksumhex == checksumhex)
{
QByteArray injcorrection2 = receivedData;
ui->txtConsole->append("Write Injector Correction Packet 2 to PowerFC");
ui->txtConsole->append("Power FC Send Acknlowedged 0xF2 0x02 0x0B");
serialport->write(QByteArray::fromHex("F2 02 0B"));
serialport->blockSignals(false);
}
// Injector Correction Packet 3
if(requesttype == 0x88 && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0x88 0x02 0x75");
ui->txtConsole->append("Sending reply FC info...Injector Correction Packet 3");
serialport->write(QByteArray::fromHex("88 66 80 80 80 80 80 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 80 80 80 80 80 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 80 80 80 80 80 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 80 80 80 80 80 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 80 80 80 80 80 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 be")); //
serialport->blockSignals(false);
}
//write request
if(requesttype == 0x88 && readwrite ==0x66 && recvchecksumhex == checksumhex)
{
QByteArray injcorrection3 = receivedData;
ui->txtConsole->append("Write Injector Correction Packet 3 to PowerFC");
ui->txtConsole->append("Power FC Send Acknlowedged 0xF2 0x02 0x0B");
serialport->write(QByteArray::fromHex("F2 02 0B"));
serialport->blockSignals(false);
}
// Injector Correction Packet 4
if(requesttype == 0x89 && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0x89 0x02 0x74");
ui->txtConsole->append("Sending reply FC info...Injector Correction Packet 4");
serialport->write(QByteArray::fromHex("89 66 80 80 80 80 80 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 80 80 80 80 80 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 80 80 80 80 80 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 80 80 80 80 80 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 80 80 80 80 80 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 bd")); //
serialport->blockSignals(false);
}
//write request
if(requesttype == 0x89 && readwrite ==0x66 && recvchecksumhex == checksumhex)
{
QByteArray injcorrection4 = receivedData;
ui->txtConsole->append("Write Injector Correction Packet 4 to PowerFC");
ui->txtConsole->append("Power FC Send Acknlowedged 0xF2 0x02 0x0B");
serialport->write(QByteArray::fromHex("F2 02 0B"));
serialport->blockSignals(false);
}
// Fuel Injectors
if(requesttype == 0x8D && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0x8D 0x02 0x70 ");
ui->txtConsole->append("Sending reply FC info...Fuel Injectors");
serialport->write(QByteArray::fromHex("8d 1a 00 80 00 80 0a 80 23 80 0a 80 23 80 26 02 90 06 90 01 19 00 00 00 00 00 96")); //
serialport->blockSignals(false);
}
//write request
if(requesttype == 0x8D && readwrite ==0x1A && recvchecksumhex == checksumhex)
{
QByteArray Fuelinj = receivedData;
ui->txtConsole->append("Write Fuel Injectors to PowerFC");
ui->txtConsole->append("Power FC Send Acknlowedged 0xF2 0x02 0x0B");
serialport->write(QByteArray::fromHex("F2 02 0B"));
serialport->blockSignals(false);
}
// Cranking
if(requesttype == 0x8E && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0x8E 0x02 0x6F");
ui->txtConsole->append("Sending reply FC info...Cranking");
serialport->write(QByteArray::fromHex("8e 0e b8 0b 9a 10 58 1b aa 37 28 55 c2 65 fe")); //
serialport->blockSignals(false);
}
//write request
if(requesttype == 0x8E && readwrite ==0x0E && recvchecksumhex == checksumhex)
{
QByteArray injcorrection1 = receivedData;
ui->txtConsole->append("Write Cranking to PowerFC");
ui->txtConsole->append("Power FC Send Acknlowedged 0xF2 0x02 0x0B");
serialport->write(QByteArray::fromHex("F2 02 0B"));
serialport->blockSignals(false);
}
// Water Temp Correction
if(requesttype == 0x8F && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0x8F 0x02 0x6E");
ui->txtConsole->append("Sending reply FC info...Water Temp Correction");
serialport->write(QByteArray::fromHex("8f 10 40 43 4c 60 81 b4 40 41 4e 60 78 a5 1a 41 55")); //
serialport->blockSignals(false);
}
//write request
if(requesttype == 0x8F && readwrite ==0x10 && recvchecksumhex == checksumhex)
{
QByteArray injcorrection1 = receivedData;
ui->txtConsole->append("Write Cranking to PowerFC");
ui->txtConsole->append("Power FC Send Acknlowedged 0xF2 0x02 0x0B");
serialport->write(QByteArray::fromHex("F2 02 0B"));
serialport->blockSignals(false);
}
// Injector vs Water Temperature and Boost
if(requesttype == 0x90 && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0x90 0x02 0x6D");
ui->txtConsole->append("Sending reply FC info...Injector vs Water Temperature and Boost");
serialport->write(QByteArray::fromHex("90 08 be 8a af 80 41 1a 95")); //
serialport->blockSignals(false);
}
//write request
if(requesttype == 0x90 && readwrite ==0x08 && recvchecksumhex == checksumhex)
{
QByteArray injcorrection1 = receivedData;
ui->txtConsole->append("Write Injector vs Water Temoerature to PowerFC");
ui->txtConsole->append("Power FC Send Acknlowedged 0xF2 0x02 0x0B");
serialport->write(QByteArray::fromHex("F2 02 0B"));
serialport->blockSignals(false);
}
// Injector vs Air Temperature and Boost
if(requesttype == 0x91 && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0x91 0x02 0x6C");
ui->txtConsole->append("Sending reply FC info...Injector vs Air Temperature and Boost");
serialport->write(QByteArray::fromHex("91 0a aa 85 a0 82 96 80 3a 13 b0")); //
serialport->blockSignals(false);
}
//write request
if(requesttype == 0x91 && readwrite ==0x0A && recvchecksumhex == checksumhex)
{
QByteArray airtempboost = receivedData;
ui->txtConsole->append("Write Injector vs Air Temperature to PowerFC");
ui->txtConsole->append("Power FC Send Acknlowedged 0xF2 0x02 0x0B");
serialport->write(QByteArray::fromHex("F2 02 0B"));
serialport->blockSignals(false);
}
// Inj Primary Lag (uS) vs Battery Voltage
if(requesttype == 0x92 && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0x92 0x02 0x6B ");
ui->txtConsole->append("Sending reply FC info...Inj Primary Lag (uS) vs Battery Voltage");
serialport->write(QByteArray::fromHex("92 0e 84 00 b6 00 fc 00 56 01 ec 01 bc 02 27")); //
serialport->blockSignals(false);
}
//write request
if(requesttype == 0x92 && readwrite ==0x0E && recvchecksumhex == checksumhex)
{
QByteArray primlagbatt = receivedData;
ui->txtConsole->append("Write Injector Primary Lag (uS) vs Battery voltage to PowerFC");
ui->txtConsole->append("Power FC Send Acknlowedged 0xF2 0x02 0x0B");
serialport->write(QByteArray::fromHex("F2 02 0B"));
serialport->blockSignals(false);
}
// Accelerate Inject (mS)
if(requesttype == 0x93 && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0x93 0x02 0x6A ");
ui->txtConsole->append("Sending reply FC info...Accelerate Inject (mS)");
serialport->write(QByteArray::fromHex("93 1b 7d 64 4b 32 19 53 07 53 07 53 07 d0 07 dc 05 fa 00 fa 00 77 01 c2 01 f4 01 f0")); //
serialport->blockSignals(false);
}
//write request
if(requesttype == 0x93 && readwrite ==0x1B && recvchecksumhex == checksumhex)
{
QByteArray AccelInj = receivedData;
ui->txtConsole->append("Write Accelerate Inject (mS) to PowerFC");
ui->txtConsole->append("Power FC Send Acknlowedged 0xF2 0x02 0x0B");
serialport->write(QByteArray::fromHex("F2 02 0B"));
serialport->blockSignals(false);
}
// Injector vs Accel TPS
if(requesttype == 0x94 && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0x94 0x02 0x69");
ui->txtConsole->append("Sending reply FC info...Injector vs Accel TPS");
serialport->write(QByteArray::fromHex("94 0b 67 00 01 25 e6 00 14 19 00 c0")); //
serialport->blockSignals(false);
}
//write request
if(requesttype == 0x94 && readwrite ==0x0B && recvchecksumhex == checksumhex)
{
QByteArray Injvsaccel = receivedData;
ui->txtConsole->append("Write Injector vs Accel to PowerFC");
ui->txtConsole->append("Power FC Send Acknlowedged 0xF2 0x02 0x0B");
serialport->write(QByteArray::fromHex("F2 02 0B"));
serialport->blockSignals(false);
}
// Ignition vs Air Temperature (cold)
if(requesttype == 0x96 && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0x96 0x02 0x67");
ui->txtConsole->append("Sending reply FC info...Ignition vs Air Temperature (cold)");
serialport->write(QByteArray::fromHex("96 06 91 00 8c 00 46")); //
serialport->blockSignals(false);
}
//write request
if(requesttype == 0x96 && readwrite ==0x06 && recvchecksumhex == checksumhex)
{
QByteArray Ignvsaircold = receivedData;
ui->txtConsole->append("Write Ignition vs Air Temperature (cold) to PowerFC");
ui->txtConsole->append("Power FC Send Acknlowedged 0xF2 0x02 0x0B");
serialport->write(QByteArray::fromHex("F2 02 0B"));
serialport->blockSignals(false);
}
// not shure what this is
if(requesttype == 0x97 && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0x9 0x02 ");
ui->txtConsole->append("Sending reply FC info...not shure what this is ");
serialport->write(QByteArray::fromHex("97 04 31 26 0d")); //
serialport->blockSignals(false);
}
//write request
if(requesttype == 0x97 && readwrite ==0x04 && recvchecksumhex == checksumhex)
{
QByteArray notshure = receivedData;
ui->txtConsole->append("Write not shure what this is to PowerFC");
ui->txtConsole->append("Power FC Send Acknlowedged 0xF2 0x02 0x0B");
serialport->write(QByteArray::fromHex("F2 02 0B"));
serialport->blockSignals(false);
}
// Ignition vs Water Temperature
if(requesttype == 0x98 && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0x98 0x02 0x65");
ui->txtConsole->append("Sending reply FC info...Ignition vs Water Temperature");
serialport->write(QByteArray::fromHex("98 06 b4 06 af 00 f8")); //
serialport->blockSignals(false);
}
//write request
if(requesttype == 0x98 && readwrite ==0x06 && recvchecksumhex == checksumhex)
{
QByteArray Ignvswater = receivedData;
ui->txtConsole->append("Write Ignition vs Water Temperature to PowerFC");
ui->txtConsole->append("Power FC Send Acknlowedged 0xF2 0x02 0x0B");
serialport->write(QByteArray::fromHex("F2 02 0B"));
serialport->blockSignals(false);
}
// Ignition vs Air Temperature (warm)
if(requesttype == 0x9A && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0x9A 0x02 0x63");
ui->txtConsole->append("Sending reply FC info...Ignition vs Air Temperature (warm)");
serialport->write(QByteArray::fromHex("9a 08 96 06 8c 04 82 00 af")); //
serialport->blockSignals(false);
}
//write request
if(requesttype == 0x9A && readwrite ==0x08 && recvchecksumhex == checksumhex)
{
QByteArray IgnvsAirwarm = receivedData;
ui->txtConsole->append("Write Ignition vs Air Temperature (warm) to PowerFC");
ui->txtConsole->append("Power FC Send Acknlowedged 0xF2 0x02 0x0B");
serialport->write(QByteArray::fromHex("F2 02 0B"));
serialport->blockSignals(false);
}
// Leading Ignition vs RPM
if(requesttype == 0x9B && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0x9B 0x02 0x62");
ui->txtConsole->append("Sending reply FC info...Leading Ignition vs RPM");
serialport->write(QByteArray::fromHex("9b 08 7b 6c 46 22 11 09 f3")); //
serialport->blockSignals(false);
}
//write request
if(requesttype == 0x9B && readwrite ==0x08 && recvchecksumhex == checksumhex)
{
QByteArray injcorrection1 = receivedData;
ui->txtConsole->append("Write Leading Ignition vs RPM to PowerFC");
ui->txtConsole->append("Power FC Send Acknlowedged 0xF2 0x02 0x0B");
serialport->write(QByteArray::fromHex("F2 02 0B"));
serialport->blockSignals(false);
}
// IGN vs Battery Voltage
if(requesttype == 0x9C && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0x9C 0x02 0x61");
ui->txtConsole->append("Sending reply FC info...IGN vs Battery Voltage");
serialport->write(QByteArray::fromHex("9c 08 35 4051 67 77 87 30")); //
serialport->blockSignals(false);
}
//write request
if(requesttype == 0x9C && readwrite ==0x08 && recvchecksumhex == checksumhex)
{
QByteArray injcorrection1 = receivedData;
ui->txtConsole->append("Write IGN vs Battery Voltage to PowerFC");
ui->txtConsole->append("Power FC Send Acknlowedged 0xF2 0x02 0x0B");
serialport->write(QByteArray::fromHex("F2 02 0B"));
serialport->blockSignals(false);
}
// Boost vs Ignition S.F.
if(requesttype == 0x9D && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0x9D 0x02 0x60");
ui->txtConsole->append("Sending reply FC info...Boost vs Ignition S.F.");
serialport->write(QByteArray::fromHex("9d 06 64 32 26 16 8a")); //
serialport->blockSignals(false);
}
//write request
if(requesttype == 0x9D && readwrite ==0x06 && recvchecksumhex == checksumhex)
{
QByteArray injcorrection1 = receivedData;
ui->txtConsole->append("Write Boost vs Ignition S.F to PowerFC");
ui->txtConsole->append("Power FC Send Acknlowedged 0xF2 0x02 0x0B");
serialport->write(QByteArray::fromHex("F2 02 0B"));
serialport->blockSignals(false);
}
// Trailing Ignition vs RPM
if(requesttype == 0x9E && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0x9E 0x02 0x5F");
ui->txtConsole->append("Sending reply FC info...Trailing Ignition vs RPM");
serialport->write(QByteArray::fromHex("9e 08 7b 78 4b 23 11 09 de")); //
serialport->blockSignals(false);
}
//write request
if(requesttype == 0x9E && readwrite ==0x08 && recvchecksumhex == checksumhex)
{
QByteArray injcorrection1 = receivedData;
ui->txtConsole->append("Write Trailing Ignition vs RPM to PowerFC");
ui->txtConsole->append("Power FC Send Acknlowedged 0xF2 0x02 0x0B");
serialport->write(QByteArray::fromHex("F2 02 0B"));
serialport->blockSignals(false);
}
// Injector Secondary Lag (uS) vs Battery Voltage
if(requesttype == 0x9F && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0x9F 0x02 0x5E");
ui->txtConsole->append("Sending reply FC info...Injector Secondary Lag (uS) vs Battery Voltage");
serialport->write(QByteArray::fromHex("9f 0e 8e 00 c0 00 06 01 60 01 f6 01 c6 02 dd")); //
serialport->blockSignals(false);
}
//write request
if(requesttype == 0x9F && readwrite ==0x0E && recvchecksumhex == checksumhex)
{
QByteArray injcorrection1 = receivedData;
ui->txtConsole->append("Write Secondary Lag (uS) to PowerFC");
ui->txtConsole->append("Power FC Send Acknlowedged 0xF2 0x02 0x0B");
serialport->write(QByteArray::fromHex("F2 02 0B"));
serialport->blockSignals(false);
}
// Injector Warning
if(requesttype == 0xA8 && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0xA8 0x02 0x55");
ui->txtConsole->append("Sending reply FC info...Injector Warning");
serialport->write(QByteArray::fromHex("a8 06 00 d4 03 1e 5c")); //
serialport->blockSignals(false);
}
//write request
if(requesttype == 0xA8 && readwrite ==0x06 && recvchecksumhex == checksumhex)
{
QByteArray injcorrection1 = receivedData;
ui->txtConsole->append("Write Injector warning to PowerFC");
ui->txtConsole->append("Power FC Send Acknlowedged 0xF2 0x02 0x0B");
serialport->write(QByteArray::fromHex("F2 02 0B"));
serialport->blockSignals(false);
}
// Knock Warning
if(requesttype == 0xA9 && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0xA9 0x02 ");
ui->txtConsole->append("Sending reply FC info...Knock Warning");
serialport->write(QByteArray::fromHex("a9 06 00 3c 00 09 0b")); //
serialport->blockSignals(false);
}
//write request
if(requesttype == 0xA9 && readwrite ==0x06 && recvchecksumhex == checksumhex)
{
QByteArray injcorrection1 = receivedData;
ui->txtConsole->append("Write Knock warning to PowerFC");
ui->txtConsole->append("Power FC Send Acknlowedged 0xF2 0x02 0x0B");
serialport->write(QByteArray::fromHex("F2 02 0B"));
serialport->blockSignals(false);
}
// O2 Feedback
if(requesttype == 0xAA && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0xAA 0x02 0x53");
ui->txtConsole->append("Sending reply FC info...O2 Feedback");
serialport->write(QByteArray::fromHex("aa 05 ff 0c 01 44")); //
serialport->blockSignals(false);
}
//write request
if(requesttype == 0xAA && readwrite ==0x05 && recvchecksumhex == checksumhex)
{
QByteArray injcorrection1 = receivedData;
ui->txtConsole->append("Write 02 Feedback to PowerFC");
ui->txtConsole->append("Power FC Send Acknlowedged 0xF2 0x02 0x0B");
serialport->write(QByteArray::fromHex("F2 02 0B"));
serialport->blockSignals(false);
}
// Boost control
if(requesttype == 0xAB && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0xAB 0x02 0x52");
ui->txtConsole->append("Sending reply FC info...Boost control");
serialport->write(QByteArray::fromHex("ab 0d ff 00 00 12 12 12 12 28 1e 32 19 6f")); //
serialport->blockSignals(false);
}
//write request
if(requesttype == 0xAB && readwrite ==0x0D && recvchecksumhex == checksumhex)
{
QByteArray injcorrection1 = receivedData;
ui->txtConsole->append("Write Boost control to PowerFC");
ui->txtConsole->append("Power FC Send Acknlowedged 0xF2 0x02 0x0B");
serialport->write(QByteArray::fromHex("F2 02 0B"));
serialport->blockSignals(false);
}
// Setting Protections?
if(requesttype == 0xAC && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0xAC 0x02 0x51");
ui->txtConsole->append("Sending reply FC info...Setting Protections?");
serialport->write(QByteArray::fromHex("ac 0c 00 00 00 00 00 00 00 00 00 00 47")); //
serialport->blockSignals(false);
}
//write request
if(requesttype == 0xAC && readwrite ==0x0C && recvchecksumhex == checksumhex)
{
QByteArray injcorrection1 = receivedData;
ui->txtConsole->append("Write Setting Protections to PowerFC");
ui->txtConsole->append("Power FC Send Acknlowedged 0xF2 0x02 0x0B");
serialport->write(QByteArray::fromHex("F2 02 0B"));
serialport->blockSignals(false);
}
// Tuner String?
if(requesttype == 0xAD && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0xAD 0x02 0x50");
ui->txtConsole->append("Sending reply FC info...Tuner String?");
serialport->write(QByteArray::fromHex("ad 0a 20 20 20 20 20 20 20 20 48")); //
serialport->blockSignals(false);
}
//write request
if(requesttype == 0xAD && readwrite ==0x0A && recvchecksumhex == checksumhex)
{
QByteArray injcorrection1 = receivedData;
ui->txtConsole->append("Write Tuner String to PowerFC");
ui->txtConsole->append("Power FC Send Acknlowedged 0xF2 0x02 0x0B");
serialport->write(QByteArray::fromHex("F2 02 0B"));
serialport->blockSignals(false);
}
// Base Fuel packet 1
if(requesttype == 0xB0 && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0xB0 0x02 0x4D ");
ui->txtConsole->append("Sending reply FC info...Base Fuel packet 1");
serialport->write(QByteArray::fromHex("b0 66 60 00 c1 00 32 01 ca 01 74 02 62 03 1b 04 a3 04 54 05 60 06 44 07 ef 07 a9 08 4b 09 f3 09 7c 0a e6 0b 49 0d bd 0e 44 10 64 00 c8 00 4c 01 f5 01 88 02 7c 03 32 04 bd 04 5e 05 7e 06 76 07 12 08 bf 08 72 09 12 0a b9 0a 15 0c 8c 0d 14 0f 98 10 5e 00 be 00 4b 01 f2 01 39 02 fd 02 93 03 1f 04 de 04 fb 05 79")); //
serialport->blockSignals(false);
}
//write request
if(requesttype == 0xB0 && readwrite ==0x66 && recvchecksumhex == checksumhex)
{
QByteArray injcorrection1 = receivedData;
ui->txtConsole->append("Write Base Fuel packet 1 to PowerFC");
ui->txtConsole->append("Power FC Send Acknlowedged 0xF2 0x02 0x0B");
serialport->write(QByteArray::fromHex("F2 02 0B"));
serialport->blockSignals(false);
}
// Base Fuel packet 2
if(requesttype == 0xB1 && readwrite <= 0x02 && recvchecksumhex == checksumhex)
{
ui->txtConsole->append("0xB1 0x02 0x4C");
ui->txtConsole->append("Sending reply FC info...Base Fuel packet 2");
serialport->write(QByteArray::fromHex("b1 66 e1 06 67 07 19 08 cf 08 67 09 f7 09 36 0b 71 0c d9 0d 40 0f 5c 00 b5 00 4d 01 d7 01 5b 02 12 03 af 03 49 04 b4 04 25 06 0e 07 b2 07 69 08 30 09 cd 09 76 0a c2 0b ee 0c 63 0e e9 0f 5f 00 cd 00 58 01 08 02 7e 02 2b 03 cc 03 63 04 f4 04 2a 06 0e 07 cc 07 86 08 61 09 01 0a c4 0a 3d 0c 5f 0d b6 0e 6d 10 65")); //
serialport->blockSignals(false);
}
//write request
if(requesttype == 0xB1 && readwrite ==0x66 && recvchecksumhex == checksumhex)
{
QByteArray injcorrection1 = receivedData;
ui->txtConsole->append("Write Base Fuel packet 2 to PowerFC");
ui->txtConsole->append("Power FC Send Acknlowedged 0xF2 0x02 0x0B");
serialport->write(QByteArray::fromHex("F2 02 0B"));
serialport->blockSignals(false);
}
// Base Fuel packet 3
if(requesttype == 0xB2 && readwrite <= 0x02 && recvchecksumhex == checksumhex)