<?php
//var_dump($_GET);
$sensor=$_GET['sensor'];
$number=$_GET['positionnumber'];
$shuter=$_GET['shutterTime'];

set_time_limit(0);
ob_end_clean();//清空（擦除）缓冲区并关闭输出缓冲
ob_implicit_flush(1);//将打开或关闭绝对（隐式）刷送。绝对（隐式）刷送将导致在每次输出调用后有一次刷送操作，以便不再需要对 flush() 的显式调用
system("sudo pkill shutter_calibrate");


$cmd = 'sudo /home/pi/bin/shutter_calibrate '.$sensor." ".$number.' '.$shuter;
echo $cmd.'<br>';

while(@ ob_end_flush());

$proc = popen($cmd, 'r');


while(!feof($proc)){
    echo fread($proc, 4096);
    @ flush();
}
echo "<br>";
echo "finish";