forked from aster94/Keyword-Protocol-2000
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPIDs.h
152 lines (127 loc) · 4.52 KB
/
PIDs.h
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
/*
PIDs.h
Parameter IDs
Copyright (c) 2019 Aster94
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute,
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
////////////// MODIFY HERE ////////////////
// First choose only one of these motorbikes:
// To choose delete the "//" at the beginning of the line
//#define SUZUKI
//#define KAWASAKI
//#define YAMAYA
//#define HONDA
////////////// DON'T MODIFY UNDER THIS LINE ////////////////
////////////// UNLESS YOU KNOW WHAT YOU ARE DOING ////////////////
const uint8_t format_physical = 0x80;
const uint8_t format_functional = 0xC0; // not supported
const uint8_t format_CARB = 0x40; // not supported
const uint8_t ECU_addr = 0x12; // between hex 10 and 17
const uint8_t OUR_addr = 0xF1; // between hex F0 and FD
const uint8_t start_com[] = {0x81};
const uint8_t stop_com[] = {0x82};
// access timing parameter and timing paramenter indicator
const uint8_t atp_read_limits[] = {0x83, 0x00};
const uint8_t atp_set_default[] = {0x83, 0x01};
const uint8_t atp_read_current[] = {0x83, 0x02};
const uint8_t atp_set_given[] = {0x83, 0x03};
const uint8_t tester_present_with_answer[] = {0x3E, 0x01}; // the ECU will ansker
const uint8_t tester_present_without_answer[] = {0x3E, 0x02}; // the ECU won't answer
const uint8_t trouble_codes_all[] = {0x13};
const uint8_t trouble_codes_only_active[] = {0x17};
const uint8_t trouble_codes_with_status[] = {0x18};
const uint8_t clear_trouble_codes[] = {0x14};
#define request_ok(x) x | 0x40
const uint8_t request_rejected = 0x7F;
#if defined(SUZUKI)
#if defined(BIKE_CHOOSED)
#error "two or more bikes choosed, please see src/PIDs.h"
#else
#define BIKE_CHOOSED
#endif // BIKE_CHOOSED
const uint8_t request_sens[] = {0x21, 0x08};
#define PID_SPEED 16
#define PID_RPM_H 17 // high byte
#define PID_RPM_L 18 // low byte
#define PID_TPS 19
#define PID_IAP 20
#define PID_ECT 21
#define PID_IAT 22
#define PID_AP 23
#define PID_BATT 24
#define PID_HO2 25
#define PID_GPS 26
//31 to 38 FUEL 1 2 3 H and L
//41 to 44 ignition IGN
#define PID_STPS 47
#define PID_PAIR 51
#define PID_CLUTCH 52
#define PID_GEAR_3 53
//from mark's (ciclegadget) PID_STP 46
#endif // SUZUKI
#if defined(KAWASAKI)
#if defined(BIKE_CHOOSED)
#error "two or more bikes choosed, please see src/PIDs.h"
#else
#define BIKE_CHOOSED
#endif // BIKE_CHOOSED
const uint8_t request_sens[][4] = {
{0, 1, 2, 3}, //Speed
{4, 5, 6, 7}, //RPM
{8, 9, 10, 11} //GEAR
//todo
};
#define PID_SPEED 16
#define PID_RPM_H 17 // high byte
#define PID_RPM_L 18 // low byte
#define PID_TPS 19
#define PID_IAP 20
#define PID_ECT 21
#define PID_IAT 22
#define PID_AP 23
#define PID_BATT 24
#define PID_HO2 25
#define PID_GPS 26
//31 to 38 FUEL 1 2 3 H and L
//41 to 44 ignition IGN
#define PID_STPS 47
#define PID_PAIR 51
#define PID_CLUTCH 52
#define PID_GEAR_3 53
#endif // KAWASAKI
#if defined(YAMAYA)
#if defined(BIKE_CHOOSED)
#error "two or more bikes choosed, please see src/PIDs.h"
#else
#define BIKE_CHOOSED
#endif // BIKE_CHOOSED
/*
As far as I could understand the YDS (Yamaha Diagnostic Protocol) protocol, it is close to the Honda protocol.
There are no sender-/receiver-adresses or header information. Just the checksum at the end.
You initialize the diagnostic mode by sending 0x80 and from then on you can just submit 0x02 and it gives you:
Rpm, Speed, Error, Gear & Checksum.
todo: need more info
*/
#endif // YAMAYA
#if defined(HONDA)
#if defined(BIKE_CHOOSED)
#error "two or more bikes choosed, please see src/PIDs.h"
#else
#define BIKE_CHOOSED
#endif // BIKE_CHOOSED
// see above
#endif // HONDA
#ifndef BIKE_CHOOSED
#error "no bike selected, please see src/PIDs.h"
#endif // BIKE_CHOOSED