Add packet filtering (Ioniq only)
Signed-off-by: Martin Kolací <martin.kolaci@lmc.eu>
This commit is contained in:
@@ -222,7 +222,7 @@ void CommObd2Can::sendFlowControlFrame() {
|
|||||||
Receive PID
|
Receive PID
|
||||||
*/
|
*/
|
||||||
uint8_t CommObd2Can::receivePID() {
|
uint8_t CommObd2Can::receivePID() {
|
||||||
|
|
||||||
if (!digitalRead(pinCanInt)) // If CAN0_INT pin is low, read receive buffer
|
if (!digitalRead(pinCanInt)) // If CAN0_INT pin is low, read receive buffer
|
||||||
{
|
{
|
||||||
lastDataSent = millis();
|
lastDataSent = millis();
|
||||||
@@ -237,6 +237,16 @@ uint8_t CommObd2Can::receivePID() {
|
|||||||
|
|
||||||
Serial.print(msgString);
|
Serial.print(msgString);
|
||||||
|
|
||||||
|
// Filter received messages (Ioniq only)
|
||||||
|
if(liveData->settings.carType == CAR_HYUNDAI_IONIQ_2018) {
|
||||||
|
long unsigned int atsh_response = liveData->hexToDec(liveData->currentAtshRequest.substring(4), 2, false) + 8;
|
||||||
|
|
||||||
|
if(rxId != atsh_response) {
|
||||||
|
Serial.println(" [Filtered packet]");
|
||||||
|
return 0xff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ((rxId & 0x40000000) == 0x40000000) { // Determine if message is a remote request frame.
|
if ((rxId & 0x40000000) == 0x40000000) { // Determine if message is a remote request frame.
|
||||||
sprintf(msgString, " REMOTE REQUEST FRAME");
|
sprintf(msgString, " REMOTE REQUEST FRAME");
|
||||||
Serial.print(msgString);
|
Serial.print(msgString);
|
||||||
|
|||||||
Reference in New Issue
Block a user