Skip to content

Commit

Permalink
add hash check
Browse files Browse the repository at this point in the history
  • Loading branch information
yconst committed Jan 6, 2024
1 parent e97cfe2 commit 9c0cc3d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions examples/arduino_mkr_wifi_1010/arduino_mkr_wifi_1010.ino
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,15 @@ void setup()
Serial.println("Setting CAN filters failed!");
while (1);
}

// As a final step check that the hash returned by the node
// is the same as the hash stored by the Tinymovr library.
// This is crucial to prevent potential mismatches in commands.
if (tinymovr.get_protocol_hash() != avlos_proto_hash)
{
Serial.println("Wrong device spec!");
while (1);
}
}

/*
Expand Down
9 changes: 9 additions & 0 deletions examples/esp32_mcp2551/esp32_mcp2551.ino
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,15 @@ void setup()
Serial.println("Setting CAN filters failed!");
while (1);
}

// As a final step check that the hash returned by the node
// is the same as the hash stored by the Tinymovr library.
// This is crucial to prevent potential mismatches in commands.
if (tinymovr.get_protocol_hash() != avlos_proto_hash)
{
Serial.println("Wrong device spec!");
while (1);
}
}

/*
Expand Down

0 comments on commit 9c0cc3d

Please sign in to comment.