From 1c4ce952f57086d5477f6b3392ae6787716a3d7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=BB=E7=AB=8B=E6=96=B0?= Date: Wed, 19 Jan 2022 16:11:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9php=20=E9=80=82=E9=85=8D?= =?UTF-8?q?=E4=BA=86=E5=94=90=E8=B6=85=E7=9A=84=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- html/config/calibrate.php | 64 +++++++++++++++++++++++++++++++++++---- html/config/location.php | 63 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 121 insertions(+), 6 deletions(-) create mode 100644 html/config/location.php diff --git a/html/config/calibrate.php b/html/config/calibrate.php index eec3262..2e361e7 100644 --- a/html/config/calibrate.php +++ b/html/config/calibrate.php @@ -1,7 +1,8 @@ "; //$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 '回到首页'; \ No newline at end of file +echo '回到首页'; + +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; +} \ No newline at end of file diff --git a/html/config/location.php b/html/config/location.php new file mode 100644 index 0000000..cd27edd --- /dev/null +++ b/html/config/location.php @@ -0,0 +1,63 @@ +'; + +echo '设备 + + +    +    +    +    + + '; +echo ''; +echo ''; + +echo ''; + + +echo '回到首页'; + +/* +$i = 100; +while ($i<1000) { + ++$i; + //部分浏览器需要内容达到一定长度了才输出 + if ($i === 103) { + echo"

hello word".$i."

";; + } else { + echo"

hello word".$i."

";; + } + sleep(1); + +} +*/