-
Notifications
You must be signed in to change notification settings - Fork 93
Description
I've got this working really well as a gateway using a DUE board and a home built shield using two MCP2562's. My problem is when I try to modify vertain bytes in a particular id, I get all of the bytes in every id modified.
I started with the example CAN_TrafficModifier but I can either get no modification or I get the correct modification but also the same bytes modified in every ID.
I've currently got an if statement set up to pick the address I want out. However, it doesn't seem to acknowledge the address.
Also, I don't think I'm understanding the watchFor or watchForRange at all. I ahve not been able to get them to work in any format.
Offending code attached. This one does nothing but it does gateway perfectly. Just no mods.
The commented lines are failed attempts
<
if (Can0.available() > 0) {
Can0.read(incoming);
if (incoming.id == 0x740) {
// incoming.id == 0x740;
incoming.data.bytes[1] *= 1.1;
incoming.data.bytes[3] *= 1.1;
incoming.data.bytes[5] *= 1.1;
incoming.data.bytes[7] *= 1.1;
Can1.sendFrame(incoming);
}
else {
// incoming.data.bytes[1] = incoming.data.bytes[1];
// incoming.data.bytes[3] = incoming.data.bytes[3];
// incoming.data.bytes[5] = incoming.data.bytes[5];
// incoming.data.bytes[7] = incoming.data.bytes[7];
Can1.sendFrame(incoming);
}
}