Variable length debugger

This commit is contained in:
redfast00 2020-09-07 19:05:44 +02:00
parent 5f2271582c
commit 95de8af77d
No known key found for this signature in database
GPG key ID: 5946E0E34FD0553C
2 changed files with 2 additions and 4 deletions

View file

@ -60,7 +60,7 @@ class Message:
if message_type == 0:
return "REGISTER"
elif message_type == 1:
return f"STRIKE {self.payload[5]}"
return f"STRIKE {self.payload[1]}"
elif message_type == 2:
return f"SOLVED"
else:

View file

@ -14,13 +14,11 @@ void setup() {
}
void loop() {
char message[9];
message[8] = '\0';
struct can_frame receive_frame;
if (mcp2515.readMessage(&receive_frame) == MCP2515::ERROR_OK) {
Serial.print("message ");
Serial.print(receive_frame.can_id, DEC);
for (int i = 0; i < 8; i++) {
for (int i = 0; i < receive_frame.can_dlc; i++) {
Serial.print(" ");
Serial.print(receive_frame.data[i], DEC);
}