[fix]
This commit is contained in:
parent
fc81076621
commit
f28cff5387
|
@ -36,8 +36,6 @@
|
||||||
$state = preg_replace('@^\s+@', '', $state);
|
$state = preg_replace('@^\s+@', '', $state);
|
||||||
$state = preg_replace('@\s+$@', '', $state);
|
$state = preg_replace('@\s+$@', '', $state);
|
||||||
|
|
||||||
var_dump($state);
|
|
||||||
|
|
||||||
/* (3) Check data */
|
/* (3) Check data */
|
||||||
if( strlen($state) < 1 )
|
if( strlen($state) < 1 )
|
||||||
return false;
|
return false;
|
||||||
|
@ -115,6 +113,10 @@
|
||||||
/* (5) Update global state */
|
/* (5) Update global state */
|
||||||
$state = get_gstate();
|
$state = get_gstate();
|
||||||
|
|
||||||
|
// manage error
|
||||||
|
if( $state === false )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
|
||||||
/* [2] Manage timeout
|
/* [2] Manage timeout
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
|
@ -298,19 +300,14 @@
|
||||||
/* [3] Check global state
|
/* [3] Check global state
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
/* (1) Check file */
|
/* (1) Check file */
|
||||||
$gstate = $f_gstate->current();
|
$gstate = get_gstate();
|
||||||
|
|
||||||
if( !$gstate )
|
/* (2) Manage error */
|
||||||
|
if( $gstate === false )
|
||||||
return 127;
|
return 127;
|
||||||
|
|
||||||
/* (3) Remove surrounding spaces */
|
|
||||||
$gstate = preg_replace('@^\s+@', '', $gstate);
|
|
||||||
$gstate = preg_replace('@\s+$@', '', $gstate);
|
|
||||||
|
|
||||||
/* (4) Manage error */
|
|
||||||
if( strlen($gstate) < 1 )
|
|
||||||
return 127;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,6 +326,13 @@
|
||||||
/* (2) Caches */
|
/* (2) Caches */
|
||||||
global $actions;
|
global $actions;
|
||||||
|
|
||||||
|
/* (3) Get global state */
|
||||||
|
$gstate = get_gstate();
|
||||||
|
|
||||||
|
// Manage error
|
||||||
|
if( $gstate === false )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* [1] Wait for rfid card
|
/* [1] Wait for rfid card
|
||||||
|
@ -394,10 +398,10 @@
|
||||||
|
|
||||||
// {2} If not updated -> error //
|
// {2} If not updated -> error //
|
||||||
if( !$updateds )
|
if( !$updateds )
|
||||||
slog("Cannot update chips to '".get_gstate()."'", 'mfrc522:loop');
|
slog("Cannot update chips to '{$gstate}'", 'mfrc522:loop');
|
||||||
// {3} If updated -> success //
|
// {3} If updated -> success //
|
||||||
else
|
else
|
||||||
slog("Chips updated to ".get_gstate()."'", 'mfrc522:loop');
|
slog("Chips updated to '{$gstate}'", 'mfrc522:loop');
|
||||||
|
|
||||||
/* (3) If not performed -> log error */
|
/* (3) If not performed -> log error */
|
||||||
}else
|
}else
|
||||||
|
|
Loading…
Reference in New Issue