Second CAN #3687
This commit is contained in:
parent
4ad1f887fd
commit
a2bf7616ae
|
@ -61,7 +61,7 @@ bool acceptCanRx(int sid) {
|
|||
/**
|
||||
* this build-in CAN sniffer is very basic but that's our CAN sniffer
|
||||
*/
|
||||
static void printPacket(const CANRxFrame &rx) {
|
||||
static void printPacket(const size_t busIndex, const CANRxFrame &rx) {
|
||||
bool accept = acceptCanRx(CAN_SID(rx));
|
||||
if (!accept) {
|
||||
return;
|
||||
|
@ -70,7 +70,9 @@ static void printPacket(const CANRxFrame &rx) {
|
|||
// only print info if we're in can debug mode
|
||||
|
||||
// internet people use both hex and decimal to discuss packed IDs, for usability it's better to print both right here
|
||||
efiPrintf("CAN_rx %x(%d) %d: %02x %02x %02x %02x %02x %02x %02x %02x", CAN_SID(rx),
|
||||
efiPrintf("CAN_rx bus=%d %x(%d) %d: %02x %02x %02x %02x %02x %02x %02x %02x",
|
||||
busIndex,
|
||||
CAN_SID(rx),
|
||||
CAN_SID(rx), rx.DLC, rx.data8[0], rx.data8[1], rx.data8[2], rx.data8[3],
|
||||
rx.data8[4], rx.data8[5], rx.data8[6], rx.data8[7]);
|
||||
|
||||
|
@ -160,7 +162,7 @@ static void processCanRxImu(const CANRxFrame& frame, efitick_t nowNt) {
|
|||
|
||||
void processCanRxMessage(const size_t busIndex, const CANRxFrame &frame, efitick_t nowNt) {
|
||||
if (engineConfiguration->verboseCan) {
|
||||
printPacket(frame);
|
||||
printPacket(busIndex, frame);
|
||||
}
|
||||
|
||||
serviceCanSubscribers(frame, nowNt);
|
||||
|
@ -172,7 +174,7 @@ void processCanRxMessage(const size_t busIndex, const CANRxFrame &frame, efitick
|
|||
// todo: convert to CanListener or not?
|
||||
processCanRxImu(frame, nowNt);
|
||||
|
||||
processLuaCan(frame);
|
||||
processLuaCan(busIndex, frame);
|
||||
|
||||
#if EFI_CANBUS_SLAVE
|
||||
if (CAN_EID(frame) == engineConfiguration->verboseCanBaseAddress + CAN_SENSOR_1_OFFSET) {
|
||||
|
|
|
@ -28,7 +28,7 @@ chibios_rt::Mailbox<CANRxFrame*, canFrameCount> freeBuffers;
|
|||
// CAN frame buffers that are waiting to be processed by the lua thread
|
||||
chibios_rt::Mailbox<CANRxFrame*, canFrameCount> filledBuffers;
|
||||
|
||||
void processLuaCan(const CANRxFrame& frame) {
|
||||
void processLuaCan(const size_t busIndex, const CANRxFrame& frame) {
|
||||
// Filter the frame if we aren't listening for it
|
||||
if (!shouldRxCanFrame(frame)) {
|
||||
return;
|
||||
|
|
|
@ -62,5 +62,5 @@ void addLuaCanRxFilter(int32_t eid);
|
|||
// Called from the Lua loop to process any pending CAN frames
|
||||
void doLuaCanRx(LuaHandle& ls);
|
||||
// Called from the CAN RX thread to queue a frame for Lua consumption
|
||||
void processLuaCan(const CANRxFrame& frame);
|
||||
void processLuaCan(const size_t busIndex, const CANRxFrame& frame);
|
||||
#endif // not EFI_CAN_SUPPORT
|
||||
|
|
Loading…
Reference in New Issue