CAN Callback - Zombieverter VCU
Posted: Thu Jun 12, 2025 9:51 pm
Am I wrong, or is there an danger to not be able to use the same CAN ID on two different CAN Buses by the way, the callbacks and filters are currently implemented. The callback function is called no matter on which bus the data is recieved. Then only for the ID is filtered and not for the bus:
Code: Select all
canInterface[0] = &c;
canInterface[1] = &c2;
c.AddCallback(&cb);
c2.AddCallback(&cb);
TerminalCommands::SetCanMap(&cm);
Code: Select all
static bool CanCallback(uint32_t id, uint32_t data[2], uint8_t dlc) //This is where we go when a defined CAN message is received.
{
dlc = dlc;
switch (id)
{
case 0x7DF:
canOBD2.DecodeCAN(id,data);
break;
default:
if (Param::GetInt(Param::ShuntType) == 1) ISA::DecodeCAN(id, data);
if (Param::GetInt(Param::ShuntType) == 2) SBOX::DecodeCAN(id, data);
if (Param::GetInt(Param::ShuntType) == 3) VWBOX::DecodeCAN(id, data);
selectedInverter->DecodeCAN(id, data);
selectedVehicle->DecodeCAN(id, data);
selectedCharger->DecodeCAN(id, data);
selectedChargeInt->DecodeCAN(id, data);
selectedBMS->DecodeCAN(id, (uint8_t*)data);
selectedDCDC->DecodeCAN(id, (uint8_t*)data);
selectedShifter->DecodeCAN(id,data);
selectedHeater->DecodeCAN(id, data);
break;
}
return false;
}