CAN Callback - Zombieverter VCU

Post Reply
modellfan
Posts: 94
Joined: Tue Jul 12, 2022 11:20 am
Has thanked: 17 times
Been thanked: 15 times

CAN Callback - Zombieverter VCU

Post by modellfan »

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;
}
User avatar
tom91
Posts: 2409
Joined: Fri Mar 01, 2019 9:15 pm
Location: Bristol
Has thanked: 207 times
Been thanked: 569 times

Re: CAN Callback - Zombieverter VCU

Post by tom91 »

Correct this is the limitation, it is all legacy code and being stretched very far and is breaking at the seams.
Creator of SimpBMS
Founder Volt Influx https://www.voltinflux.com/
Webstore: https://citini.com/
Post Reply