Skip to content

Commit

Permalink
Merge pull request #11 from tinymovr/hash_check
Browse files Browse the repository at this point in the history
add hash check to examples
  • Loading branch information
yconst authored Jan 8, 2024
2 parents e97cfe2 + 9c0cc3d commit 1d53af8
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 1d53af8

Please sign in to comment.