Merge branch '1.0-local' into 1.0
This commit is contained in:
commit
eb99924c6c
|
@ -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 );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue