Merge branch '1.0-local' into 1.0

This commit is contained in:
xdrm-brackets 2017-02-23 16:40:47 +01:00
commit 74cedbd331
1 changed files with 17 additions and 13 deletions

View File

@ -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