UNO R4 CAN - Mask & Filter

Hello,

can't find how to setup CAN Mask & Filter in the "Arduino_CAN" libary.

In order to make all relevant information available to any who are interested in this subject, I'll share a link to @woodwarth's formal report in the issue tracker here:

Mailbox Groups 0 - 3 -> TRANSMIT
Mailbox Groups 4 - 5-> RECEIVE EXTENDED
Mailbox Groups 6 - 7-> RECEIVE STANDARD

4 Mailboxes per Mailbox Group

void setup() {
   CAN.setMailboxMask(4, 0x1FFFFFFF); //  Mailbox Group 4 for extended ID
   CAN.setMailboxMask(6, 0x1FFFFFFF); //  Mailbox Group 6 for standard ID

  

  for (int c=16; c <= 31; c++) {
     CAN.setMailboxID(c, 0x13); 
  }

}

R7FA4M1_CAN.h

 void setMailboxMask(int nr,uint32_t mask);
 void setMailboxID(int nr,int id);

R7FA4M1_CAN.cpp

void R7FA4M1_CAN::setMailboxMask(int nr, uint32_t mask)
{
	_can_mailbox_mask[nr] = mask;
}

void R7FA4M1_CAN::setMailboxID(int nr, int id)
{
	_can_mailbox[nr].mailbox_id = id;
}

I saw the pull request and updated my library per pull request #170

How do I access the mailbox? I am looking to filter a specific can ID, 0x30 and then read the data from byte 0 and byte 1. What would this look like?

void setup()
{
  Serial.begin(115200);
  while (!Serial) { }

  CAN.setMailboxMask(4,0x1FFC0000);
  CAN.setMailboxMask(6,0x1FFC0000);

 

  for (int c=16; c <= 31; c++) {
    CAN.setMailboxID(c, 0x30);
  }

  if (!CAN.begin(CanBitRate::BR_500k))
  {
    Serial.println("CAN.begin(...) failed.");
    for (;;) {}
  }
}

void loop()
{
  if (CAN.available())
  {
    CanMsg const msg = CAN.read();
    Serial.println(msg);
  }
}

I can't find these .set... commands in any of the .h files, nor will they compile on an R4. What am I missing?

CAN.setMailboxMask(6, 0x1FFFFFFF); // Mailbox Group 6 for standard ID

Sorry about a basic question, how do I get the IDE to include the version I see in github?

These .h and .cpp files contain setMask functions, but not the ones I see included in my up to date IDE.

First arduino project, so starting to understand a bit. This indeed worked fine once I moved the original .h and .cpp files out of a subfolder, which the compiler found. I'm curious if one really needs the group 4 mask if only standard ID's are wanted and/or present?

I'm intercepting all vehicle traffic to sort out and manage PID requests, which the arduino sends. I was seeing ECU response times of 6-9 ms before filtering which dropped to a steady 4ms. I assume the difference was the time it took for the loop to catch up with the read buffer.