Skip to content

Commit

Permalink
Update README and ntag215.js to clarify save behavior and ensure tag …
Browse files Browse the repository at this point in the history
…refreshes correctly
  • Loading branch information
DanTheMan827 committed Jan 20, 2025
1 parent 1195ae3 commit 620a409
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Writes data to a slot.

#### 0x04 - Save

Saves the slot. If `SAVE_TO_FLASH` is true, this will save the slot to flash, otherwise it will do nothing. This should always be called after `COMMAND_WRITE` or `COMMAND_FULL_WRITE`.
Saves the slot. If `SAVE_TO_FLASH` is true, this will save the slot to flash, otherwise it will do nothing. This should always be called after `COMMAND_WRITE`.

**Parameters:**
- `slot` (optional): The slot number. If out of range, the current slot is used.
Expand Down
10 changes: 7 additions & 3 deletions ntag215.js
Original file line number Diff line number Diff line change
Expand Up @@ -920,9 +920,13 @@ function fastRx(data) {
// Only store the tag if the target CRC32 is not set, or if the received CRC32 matches the target.
if (crc32 === null || compareArrays(crc32, receivedCrc32)) {
getTag(slot).set(rxData, 0, 0);
}

refreshTag(slot);
refreshTag(slot);

if (SAVE_TO_FLASH) {
saveTag(slot);
}
}

_Bluetooth.write([COMMAND_FULL_WRITE, slot, receivedCrc32[0], receivedCrc32[1], receivedCrc32[2], receivedCrc32[3]]);
});
Expand Down Expand Up @@ -956,7 +960,7 @@ function fastRx(data) {
tag = generateBlankTag();
getTag(slot).set(tag);

refreshTag();
refreshTag(slot);

if (SAVE_TO_FLASH) {
saveTag(slot);
Expand Down

0 comments on commit 620a409

Please sign in to comment.