From 076ae4c74adcc0fe121ab4717d47de65749b53fb Mon Sep 17 00:00:00 2001 From: Gutierrez PS Date: Mon, 3 Jun 2019 18:41:33 -0300 Subject: [PATCH 1/2] Changed _next_read_ms to _last_read_ms to prevent millis() rollover --- src/rdm6300.cpp | 8 ++++---- src/rdm6300.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/rdm6300.cpp b/src/rdm6300.cpp index 5e6a201..2fafeac 100644 --- a/src/rdm6300.cpp +++ b/src/rdm6300.cpp @@ -89,12 +89,12 @@ bool Rdm6300::update(void) /* if a new tag appears- return it */ if (_last_tag_id != tag_id) { _last_tag_id = tag_id; - _next_read_ms = 0; + _last_read_ms = 0; } /* if the old tag is still here set tag_id to zero */ - if (_next_read_ms > millis()) + if (is_tag_near()) tag_id = 0; - _next_read_ms = millis() + RDM6300_NEXT_READ_MS; + _last_read_ms = millis(); _tag_id = tag_id; return tag_id; @@ -102,7 +102,7 @@ bool Rdm6300::update(void) bool Rdm6300::is_tag_near(void) { - return _next_read_ms > millis(); + return millis() - _last_read_ms < RDM6300_NEXT_READ_MS; } uint32_t Rdm6300::get_tag_id(void) diff --git a/src/rdm6300.h b/src/rdm6300.h index c74504e..505d338 100644 --- a/src/rdm6300.h +++ b/src/rdm6300.h @@ -49,7 +49,7 @@ class Rdm6300 Stream *_stream = NULL; uint32_t _tag_id = 0; uint32_t _last_tag_id = 0; - uint32_t _next_read_ms = 0; + uint32_t _last_read_ms = 0; }; #endif From 2f92ce7ccc3760942e66ac0512d93cfed5a73a33 Mon Sep 17 00:00:00 2001 From: arduino12 Date: Tue, 4 Jun 2019 06:56:19 +0300 Subject: [PATCH 2/2] Pump version to 1.1.2 - fix 50 days false tag detection! --- library.json | 2 +- library.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/library.json b/library.json index 4a71165..a877758 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "rdm6300", - "version": "1.1.1", + "version": "1.1.2", "keywords": "rdm6300, rfid", "description": "A simple library to interface with rdm6300 rfid reader.", "repository": diff --git a/library.properties b/library.properties index 7e4c04f..fdf3a13 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Rdm6300 -version=1.1.1 +version=1.1.2 author=Arad Eizen maintainer=Arad Eizen sentence=A simple library to interface with rdm6300 rfid reader.