Merge branch '1.0-local' into 1.0
This commit is contained in:
commit
1098bce795
Binary file not shown.
|
@ -248,7 +248,7 @@
|
|||
continue;
|
||||
|
||||
/* (3) Add key (timeout) to cache */
|
||||
if( !isset($actions[$parsed[0]] )
|
||||
if( !isset($actions[$parsed[0]]) )
|
||||
$actions[$parsed[0]] = [];
|
||||
|
||||
/* (4) Add entry to cache */
|
||||
|
@ -290,7 +290,7 @@
|
|||
=========================================================*/
|
||||
/* (1) Check file */
|
||||
if( $f_gstate === false )
|
||||
return;
|
||||
return false;
|
||||
|
||||
/* (2) Remove surrounding spaces */
|
||||
$f_gstate = preg_replace('@^\s+@', '', $f_gstate);
|
||||
|
@ -300,7 +300,7 @@
|
|||
for( $c = 0 ; $c < strlen($f_gstate) ; $c++ )
|
||||
$state[] = $c;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -323,7 +323,7 @@
|
|||
/* [1] Wait for rfid card
|
||||
=========================================================*/
|
||||
/* (1) 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 */
|
||||
if( $code === false ){
|
||||
|
@ -351,6 +351,7 @@
|
|||
/* (2) If not found -> reset @last_user / @timeout + abort */
|
||||
if( is_null($user) ){
|
||||
|
||||
slog("Unknown user (not authenticated)", "mfrc522:loop");
|
||||
$last_user = null;
|
||||
$timeout = 0;
|
||||
return false;
|
||||
|
@ -404,10 +405,26 @@
|
|||
|
||||
|
||||
|
||||
/* [1] Set up daemon
|
||||
=========================================================*/
|
||||
/* (1) Set up */
|
||||
$exec = mfrc522_setup();
|
||||
|
||||
/* (2) Manage error */
|
||||
if( $exec === false ){
|
||||
slog('cannot set up the daemon', 'mfrc522:loop');
|
||||
echo $exec;
|
||||
die($exec);
|
||||
}
|
||||
|
||||
/* (3) Success message */
|
||||
slog('daemon started (loop)', 'mfrc522:loop');
|
||||
|
||||
|
||||
|
||||
|
||||
/* [2] Daemon loop
|
||||
=========================================================*/
|
||||
while( true ){
|
||||
|
||||
$start_ts = microtime(true);
|
||||
|
|
Loading…
Reference in New Issue