new: added support for 29bit obd2 identifiers

This commit is contained in:
Simone Margaritelli 2024-09-01 13:30:01 +02:00
parent c3999d6bb5
commit 97b4dcb46e
2 changed files with 6 additions and 3 deletions

View file

@ -34,13 +34,14 @@ func (obd *OBD2) Parse(mod *CANModule, msg *Message) bool {
odbMessage := &OBD2Message{}
if msg.Frame.ID == OBD2BroadcastRequestID {
if msg.Frame.ID == OBD2BroadcastRequestID || msg.Frame.ID == OBD2BroadcastRequestID29bit {
// parse as request
if odbMessage.ParseRequest(msg.Frame) {
msg.OBD2 = odbMessage
return true
}
} else if msg.Frame.ID >= OBD2ECUResponseMinID && msg.Frame.ID <= OBD2ECUResponseMaxID {
} else if (msg.Frame.ID >= OBD2ECUResponseMinID && msg.Frame.ID <= OBD2ECUResponseMaxID) ||
(msg.Frame.ID >= OBD2ECUResponseMinID29bit && msg.Frame.ID <= OBD2ECUResponseMaxID29bit) {
// parse as response
if odbMessage.ParseResponse(msg.Frame) {
msg.OBD2 = odbMessage

View file

@ -13,10 +13,12 @@ import (
// https://github.com/ejvaughan/obdii/blob/master/src/OBDII.c
// TODO: add support for 29bit identifiers
const OBD2BroadcastRequestID = 0x7DF
const OBD2ECUResponseMinID = 0x7E0
const OBD2ECUResponseMaxID = 0x7EF
const OBD2BroadcastRequestID29bit = 0x18DB33F1
const OBD2ECUResponseMinID29bit = 0x18DAF100
const OBD2ECUResponseMaxID29bit = 0x18DAF1FF
type OBD2Service uint8