File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -89,20 +89,20 @@ bool Rdm6300::update(void)
8989 /* if a new tag appears- return it */
9090 if (_last_tag_id != tag_id) {
9191 _last_tag_id = tag_id;
92- _next_read_ms = 0 ;
92+ _last_read_ms = 0 ;
9393 }
9494 /* if the old tag is still here set tag_id to zero */
95- if (_next_read_ms > millis ())
95+ if (is_tag_near ())
9696 tag_id = 0 ;
97- _next_read_ms = millis () + RDM6300_NEXT_READ_MS ;
97+ _last_read_ms = millis ();
9898
9999 _tag_id = tag_id;
100100 return tag_id;
101101}
102102
103103bool Rdm6300::is_tag_near (void )
104104{
105- return _next_read_ms > millis ();
105+ return millis () - _last_read_ms < RDM6300_NEXT_READ_MS ;
106106}
107107
108108uint32_t Rdm6300::get_tag_id (void )
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ class Rdm6300
4949 Stream *_stream = NULL ;
5050 uint32_t _tag_id = 0 ;
5151 uint32_t _last_tag_id = 0 ;
52- uint32_t _next_read_ms = 0 ;
52+ uint32_t _last_read_ms = 0 ;
5353};
5454
5555#endif
You can’t perform that action at this time.
0 commit comments