can_msg_tx, can_rx: use 1-based CAN indexing for error/verbose messages

This commit is contained in:
Andrey Gusakov 2025-02-06 12:25:29 +03:00 committed by rusefillc
parent 971d4ef8eb
commit ae3a7837bb
2 changed files with 10 additions and 10 deletions

View File

@ -35,7 +35,7 @@ static void printPacket(const size_t busIndex, const CANRxFrame &rx) {
if (CAN_ISX(rx)) {
// print extended IDs in hex only
efiPrintf("CAN%d RX: ID %07x DLC %d: %02x %02x %02x %02x %02x %02x %02x %02x",
busIndex,
busIndex + 1,
id,
rx.DLC,
rx.data8[0], rx.data8[1], rx.data8[2], rx.data8[3],
@ -43,7 +43,7 @@ static void printPacket(const size_t busIndex, const CANRxFrame &rx) {
} else {
// internet people use both hex and decimal to discuss packed IDs, for usability it's better to print both right here
efiPrintf("CAN%d RX: ID %03x(%d) DLC %d: %02x %02x %02x %02x %02x %02x %02x %02x",
busIndex,
busIndex + 1,
id, id, // once in hex, once in dec
rx.DLC,
rx.data8[0], rx.data8[1], rx.data8[2], rx.data8[3],

View File

@ -64,9 +64,9 @@ CanTxMessage::~CanTxMessage() {
txCanBuffer.put(m_frame);
#if EFI_UNIT_TEST
printf("%s Sending CAN bus%d message: ID=%x/l=%x %x %x %x %x %x %x %x %x \n",
printf("%s Sending CAN%d message: ID=%x/l=%x %x %x %x %x %x %x %x %x \n",
getCanCategory(category),
busIndex,
busIndex + 1,
#ifndef STM32H7XX
(unsigned int)((m_frame.IDE == CAN_IDE_EXT) ? CAN_EID(m_frame) : CAN_SID(m_frame)),
#else
@ -84,7 +84,7 @@ CanTxMessage::~CanTxMessage() {
auto device = s_devices[busIndex];
if (!device) {
criticalError("Send: CAN device not configured busIndex=%d", busIndex);
criticalError("Send: CAN%d device not configured", busIndex + 1);
return;
}
@ -92,13 +92,13 @@ CanTxMessage::~CanTxMessage() {
return;
}
bool verboseCan0 = engineConfiguration->verboseCan && busIndex == 0;
bool verboseCan1 = engineConfiguration->verboseCan2 && busIndex == 1;
bool verboseCan0 = engineConfiguration->verboseCan && busIndex == 0;
bool verboseCan1 = engineConfiguration->verboseCan2 && busIndex == 1;
if (verboseCan0 || verboseCan1) {
efiPrintf("%s Sending CAN bus%d message: ID=%x/l=%x %x %x %x %x %x %x %x %x",
getCanCategory(category),
busIndex,
efiPrintf("%s Sending CAN%d message: ID=%x/l=%x %x %x %x %x %x %x %x %x",
getCanCategory(category),
busIndex + 1,
#ifndef STM32H7XX
(unsigned int)((m_frame.IDE == CAN_IDE_EXT) ? CAN_EID(m_frame) : CAN_SID(m_frame)),
#else