Merge branch '1.0-local' into 1.0

This commit is contained in:
xdrm-brackets 2017-02-24 10:20:47 +01:00
commit eb99924c6c
1 changed files with 16 additions and 4 deletions

View File

@ -338,10 +338,13 @@
/* [1] Wait for rfid card /* [1] Wait for rfid card
=========================================================*/ =========================================================*/
/* (1) Read card */ /* (1) Start timer */
$start_ts = microtime(true);
/* (2) Read card */
$code = syscall(SOURCE_DIR.'/lib/mfrc522/read'); $code = syscall(SOURCE_DIR.'/lib/mfrc522/read');
/* (2) If no card read -> reset @last_user / @timeout + abort */ /* (3) If no card read -> reset @last_user / @timeout + abort */
if( $code === false ){ if( $code === false ){
$last_user = null; $last_user = null;
@ -350,8 +353,18 @@
} }
/* (4) If timeout exceeded -> reset @timeout and @last_user */
if( microtime(true) - $start_ts >= 0.5 ){
$timeout = 0;
$last_user = null;
}
/* (3) If code -> format it */ /* (5) Wait for 1/2 second */
while( microtime(true) - $start_ts < 0.5 );
/* (6) If code -> format it */
$code = strtoupper($code); $code = strtoupper($code);
slog("card '$code' read", 'mfrc522:read'); slog("card '$code' read", 'mfrc522:read');
@ -447,7 +460,6 @@
mfrc522_loop(); mfrc522_loop();
while( microtime(true) - $start_ts < 0.5 );
} }
?> ?>