mirror of
http://172.16.0.230/r/SIF/TowerOptoSifAndSpectral.git
synced 2025-10-19 03:49:42 +08:00
修改php 适配了唐超的更新
This commit is contained in:
@ -1,7 +1,8 @@
|
||||
<?php
|
||||
$a=$_GET["p"];
|
||||
$position=$_GET["p"];
|
||||
$sensorType=$_GET["sensor"];
|
||||
|
||||
if ($a==0)
|
||||
if ($position==0)
|
||||
{
|
||||
echo "error";
|
||||
return;
|
||||
@ -12,6 +13,26 @@ ob_implicit_flush(1);//将打开或关闭绝对(隐式)刷送。绝对(隐
|
||||
//echo shell_exec("D:\\03MyGit\\linux\\movingliner\\cmake-build-debug-mingw\\movingliner.exe");
|
||||
echo "application beging<br>";
|
||||
//$cmd = 'ping 127.0.0.1';
|
||||
$ini=parse_ini_file("/home/data/Setting/DeviceSettings.ini",true);
|
||||
$numberofsensor=intval($ini['DEVICE INFO']['TotalSpectrometer']);
|
||||
$numberofFS=0;
|
||||
for($i=0;$i<$numberofsensor;$i++){
|
||||
$tempsens=$ini['FS'.$i+1]['Model'];
|
||||
if ($sensorType=$tempsens)
|
||||
{
|
||||
$numberofFS=$i+1;
|
||||
break;
|
||||
}
|
||||
if ($i=$numberofsensor-1)
|
||||
{
|
||||
echo "cannot find the sensor";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
system("sudo pkill ocean_optics_calibration_console");
|
||||
system("sudo gpio write 1 1");
|
||||
@ -20,13 +41,34 @@ $cmd="";
|
||||
|
||||
|
||||
|
||||
if ($a==1)
|
||||
if ($position==1)
|
||||
{
|
||||
$cmd = 'sudo /home/pi/bin/ocean_optics_calibration_console -t 30 -slfs ocean_optics.lmp --cfon FSNsdfsd'.$a.'.data -p '.$a;
|
||||
if($sensorType=="OSIFAlpha"||$sensorType=="OSIFBeta")
|
||||
{
|
||||
$cmd = 'sudo /home/pi/bin/ocean_optics_calibration_console --deviceType OceanOptics -t 30 -slfs ocean_optics.lmp --cfon FSN'.sensorType.$position.'.data --position '.$position;
|
||||
}
|
||||
else{
|
||||
$port=$ini['FS'.$i+1]['Port'];
|
||||
getonestring($port,'/');
|
||||
getonestring($port,'/');
|
||||
$cmd = 'sudo /home/pi/bin/ocean_optics_calibration_console --deviceType OPTOSKY --serialPort '.$port.' -t 30 -slfs ocean_optics.lmp --cfon FSN'.sensorType.$position.'.data --position '.$position;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$cmd = 'sudo /home/pi/bin/ocean_optics_calibration_console -t 30 -slfs 4000nit.dat --cfon FSNsdfsd'.$a.'.data -p '.$a;
|
||||
if($sensorType=="OSIFAlpha"||$sensorType=="OSIFBeta")
|
||||
{
|
||||
$cmd = 'sudo /home/pi/bin/ocean_optics_calibration_console --deviceType OceanOptics -t 30 -slfs 4000nit.dat --cfon FSNsdfsd'.sensorType.$position.'.data --position '.$position;
|
||||
}else{
|
||||
$port=$ini['FS'.$i+1]['Port'];
|
||||
getonestring($port,'/');
|
||||
getonestring($port,'/');
|
||||
$cmd = 'sudo /home/pi/bin/ocean_optics_calibration_console --deviceType OPTOSKY --serialPort '.$port.' -t 30 -slfs 4000nit.dat --cfon FSNsdfsd'.sensorType.$position.'.data --position '.$position;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -42,4 +84,14 @@ while(!feof($proc)){
|
||||
@ flush();
|
||||
}
|
||||
echo 'FINISH!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!';
|
||||
echo '<a href=/config/position.html>回到首页</a>';
|
||||
echo '<a href=/config/position.html>回到首页</a>';
|
||||
|
||||
function getonestring(&$bytes,$fenge)
|
||||
{
|
||||
$pattern = '{^.*?'.$fenge.'}';
|
||||
$lenth=strlen($fenge);
|
||||
preg_match($pattern, $bytes, $aa, PREG_OFFSET_CAPTURE);
|
||||
$bytes = substr($bytes, strlen($aa[0][0]));
|
||||
$bb = substr($aa[0][0], 0, -$lenth);
|
||||
return $bb;
|
||||
}
|
63
html/config/location.php
Normal file
63
html/config/location.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
$a=$_GET["p"];
|
||||
|
||||
if ($a==0)
|
||||
{
|
||||
echo "error";
|
||||
return;
|
||||
}
|
||||
set_time_limit(0);
|
||||
ob_end_clean();//清空(擦除)缓冲区并关闭输出缓冲
|
||||
ob_implicit_flush(1);//将打开或关闭绝对(隐式)刷送。绝对(隐式)刷送将导致在每次输出调用后有一次刷送操作,以便不再需要对 flush() 的显式调用
|
||||
//echo shell_exec("D:\\03MyGit\\linux\\movingliner\\cmake-build-debug-mingw\\movingliner.exe");
|
||||
//$cmd = 'ping 127.0.0.1';
|
||||
//sy""
|
||||
system("sudo pkill movingliner");
|
||||
Echo $a;
|
||||
$cmd = 'sudo /home/pi/bin/movingliner '.$a;
|
||||
|
||||
while(@ ob_end_flush());
|
||||
|
||||
$proc = popen($cmd, 'r');
|
||||
|
||||
|
||||
while(!feof($proc)){
|
||||
echo fread($proc, 4096);
|
||||
@ flush();
|
||||
}
|
||||
|
||||
|
||||
echo '<form action="/config/calibrate.php?p" method="get">';
|
||||
|
||||
echo '设备<input id="sensor" name="sensor" type="text" list="typelist" placeholder="请选择">
|
||||
|
||||
<datalist id="typelist">
|
||||
<option>IS1</option>
|
||||
<option>IS2</option>
|
||||
<option>ISIF</option>
|
||||
<option>OSIFAlpha</option>
|
||||
<option>OSIFBeta</option>
|
||||
</datalist>';
|
||||
echo '<input id="p" name="p" type="hidden" value="'.$a.'">';
|
||||
echo '<input type="submit" value="定标">';
|
||||
|
||||
echo '</form>';
|
||||
|
||||
|
||||
echo '<a href=/config/position.html>回到首页</a>';
|
||||
|
||||
/*
|
||||
$i = 100;
|
||||
while ($i<1000) {
|
||||
++$i;
|
||||
//部分浏览器需要内容达到一定长度了才输出
|
||||
if ($i === 103) {
|
||||
echo"<p>hello word".$i."</p>";;
|
||||
} else {
|
||||
echo"<p>hello word".$i."</p>";;
|
||||
}
|
||||
sleep(1);
|
||||
|
||||
}
|
||||
*/
|
Reference in New Issue
Block a user