You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
That is a weird outcome. I copied your code and only very slightly edited things. My testing seems to indicate it is working properly. However, and this could be significant, I was using only one CAN port as I didn't have enough hardware handy to do full passthrough between two ports and monitor it all. But, it is copying all the frames coming in and modifying only the proper bytes. I'll see if I can dig up enough hardware to do a full pass-through test with two ports.
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);
}
}
The text was updated successfully, but these errors were encountered: