Skip to content

Commit e45943f

Browse files
committed
CAN2B corrected packet length
1 parent 5556f67 commit e45943f

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Firmware/FFBoard/Inc/CANPort2B.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class CANPort_2B : public CANPort, public CommandHandler,public CanHandler{
6969
static const uint32_t sendTimeout = 20;
7070

7171
CAN_TxHeaderTypeDef header = {0,0,0,CAN_RTR_DATA,8,(FunctionalState)0};
72-
72+
uint8_t nextLen = 8;
7373

7474
};
7575
#endif

Firmware/FFBoard/Src/CANPort2B.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,15 +356,16 @@ CommandStatus CANPort_2B::command(const ParsedCommand& cmd,std::vector<CommandRe
356356
CAN_tx_msg msg;
357357
memcpy(msg.data,&cmd.val,8);
358358
msg.header.id = cmd.adr;
359+
msg.header.length = nextLen;
359360
sendMessage(msg);
360361
}else{
361362
return CommandStatus::NOT_FOUND;
362363
}
363364
break;
364365
}
365366
case CanPort_commands::len:
366-
handleGetSet(cmd, replies, header.DLC);
367-
header.DLC = std::min<uint32_t>(header.DLC,8);
367+
handleGetSet(cmd, replies, nextLen);
368+
nextLen = std::min<uint32_t>(nextLen,8);
368369
break;
369370
default:
370371
return CommandStatus::NOT_FOUND;

0 commit comments

Comments
 (0)