ELP_FERR(fprintf(stderr,"Failed writing to %s\n",framepars_driver_name));
ELP_FERR(fprintf(stderr,"Failed writing to %s\n",framepars_driver_name[port]));
exit(1);
}
fprintf(stderr,"autocampars triggered\n");
signal(SIGCHLD,SIG_IGN);// no zombies
//! do we need any fork at all if we now serve images to one client at a time?
//! do we need any fork at all if we now serve images to one client at a time?
if(((pid=fork()))<0){/// error
ELP_FERR(fprintf(stderr,"fork() failed\n"));
exit(1);
}elseif(pid==0){/// child
fflush(stdout);
fflush(stderr);
// rslt= execl(php_path, "-q", script_path, "", "--daemon", (char *) NULL); /// We do not need to pass any parameters here, but if we had to - first argument is lost (probably to "-q" in the script line 1
rslt=execl(script_path,"","--daemon",(char*)NULL);/// We do not need to pass any parameters here, but if we had to - first argument is lost (probably to "-q" in the script line 1
// rslt= execl(php_path, "-q", script_path, "", "--daemon", (char *) NULL); /// We do not need to pass any parameters here, but if we had to - first argument is lost (probably to "-q" in the script line 1
rslt=execl(script_path,"","--daemon",sport,(char*)NULL);/// We do not need to pass any parameters here, but if we had to - first argument is lost (probably to "-q" in the script line 1
ELP_FERR(fprintf(stderr,"execl failed, returned %d, errno=%d\n",rslt,errno));
$protectedPage=0;/// change to -1 to enable saving to page 0
$needDetection=(elphel_get_P_value(ELPHEL_SENSOR)<=0);/// we need sensor detection to be started before we can read 10359 eeprom and so select default parameters
$needDetection=(elphel_get_P_value($GLOBALS['sensor_port'],ELPHEL_SENSOR)<=0);/// we need sensor detection to be started before we can read 10359 eeprom and so select default parameters
// check load command
if($_GET['load']!=''){
$load_filename=$_GET['load'];
...
...
@@ -301,14 +348,11 @@ require 'i2c.inc'; /// to read 10359 info
@@ -487,25 +533,25 @@ function get_eyesis_mode() {
return0;
}
functiondetectSensor(){
global$logFile;
global$logFile,$framepars_path;
$maxWait=5.0;///sec
$waitDaemons=5.0;/// Wait for daemons to stop (when disabled) before resetting frame number.
/// They should look at thei enable bit periodically and restart if the frame is
/// the frame is not what they were expecting to be
$sleepOnce=0.1;
/// Here trying full reset with zeroing the absolute frame number, setting all frame parameters to 0 and starting
$framepars_file=fopen("/dev/frameparsall","r");
$framepars_file=fopen($framepars_path,"r");
///TODO: Improve sequence here so it will not depend on delays
fseek($framepars_file,ELPHEL_LSEEK_FRAMEPARS_INIT,SEEK_END);/// NOTE: resets all the senor parameters (tasklet control)
/// elphel_set_P_value(ELPHEL_SENSOR, 0x00, 0, ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC);/// set sensor to 0 will start detection
echo"before reset - current frame=".elphel_get_frame()."\n";
// elphel_set_P_value(ELPHEL_SENSOR, 0x00, 0, ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC);/// set sensor to 0 will start detection
elphel_set_P_value(ELPHEL_SENSOR,0x00,elphel_get_frame(),ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC);/// set sensor to 0 will start detection
/// elphel_set_P_value($GLOBALS['sensor_port'],ELPHEL_SENSOR, 0x00, 0, ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC);/// set sensor to 0 will start detection
echo"before reset - current frame=".elphel_get_frame($GLOBALS['sensor_port'])."\n";
// elphel_set_P_value($GLOBALS['sensor_port'],ELPHEL_SENSOR, 0x00, 0, ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC);/// set sensor to 0 will start detection
elphel_set_P_value($GLOBALS['sensor_port'],ELPHEL_SENSOR,0x00,elphel_get_frame($GLOBALS['sensor_port']),ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC);/// set sensor to 0 will start detection
fseek($framepars_file,ELPHEL_LSEEK_SENSORPROC,SEEK_END);/// In case the autoprocessing after parameter write will be disabled in the future
/// (normally parameters are processed at frame sync interrupts - not yet available)
fclose($framepars_file);
/// Sensor should be up and running. let's wait for up to $maxWait seconds
fwrite($logFile,"Sensor failed to initialize at ".date("F j, Y, g:i a")."\n");
...
...
@@ -524,20 +570,20 @@ function processInit($initPage, $needDetection=true) {
/// They should look at thei enable bit periodically and restart if the frame is
/// the frame is not what they were expecting to be
if(elphel_get_frame()>0){
echo"Current frame=".elphel_get_frame().", sleeping to give daemons a chance\n";
elphel_set_P_value(ELPHEL_COMPRESSOR_RUN,0x00,0,ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC);/// turn compressor off
elphel_set_P_value(ELPHEL_DAEMON_EN,0x00,0,ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC);/// turn daemons off
if(elphel_get_frame($GLOBALS['sensor_port'])>0){
echo"Current frame=".elphel_get_frame($GLOBALS['sensor_port']).", sleeping to give daemons a chance\n";
elphel_set_P_value($GLOBALS['sensor_port'],ELPHEL_COMPRESSOR_RUN,0x00,0,ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC);/// turn compressor off
elphel_set_P_value($GLOBALS['sensor_port'],ELPHEL_DAEMON_EN,0x00,0,ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC);/// turn daemons off
usleep($waitDaemons*1000000);
echo"Current frame=".elphel_get_frame().", waking up, daemons should be dead already\n";
echo"Current frame=".elphel_get_frame($GLOBALS['sensor_port']).", waking up, daemons should be dead already\n";
}
if($needDetection){
if(!detectSensor())RETURN-1;
}
echo"after reset - current frame=".elphel_get_frame()."\n";
echo"after reset - current frame=".elphel_get_frame($GLOBALS['sensor_port'])."\n";
// $page=setParsFromPage($initPage,0xffffffff,true); /// all parameters, init mode - treat all parameters as new, even when they are the same as current (0)
$config['paramSets'][$page]=elphel_get_P_arr($config['groups']);/// 'text' parameters will be just ignored
$config['paramSets'][$page]=elphel_get_P_arr($GLOBALS['sensor_port'],$config['groups']);/// 'text' parameters will be just ignored
$config['paramSets'][$page]['comment']="Saved on ".date("F j, Y, g:i a");
$config['paramSets'][$page]['timestamp']=time();
// echo "\nafter:";print_r($config);
$config['nextPage']=findNextPage($page);
elphel_set_P_arr(array("AUTOCAMPARS_PAGE"=>$page+0));/// will set some (3?) frames ahead so not yet available until waited enough
elphel_set_P_arr($GLOBALS['sensor_port'],array("AUTOCAMPARS_PAGE"=>$page+0));/// will set some (3?) frames ahead so not yet available until waited enough
// echo "Saved to page $page, result=$result\n";
return$page;
//date("F j, Y, g:i a")
...
...
@@ -1068,7 +1118,7 @@ function calculateDefaultPhases(){
'MULTI_PHASE1'=>0,
'MULTI_PHASE2'=>0,
'MULTI_PHASE3'=>0);
$phases=elphel_get_P_arr($phases);// get current values
$phases=elphel_get_P_arr($GLOBALS['sensor_port'],$phases);// get current values
/**TODO: Here read and compare the 10359 (REV>=B) and 10338 (REV>=E), read other persistent parameters (set by /etc/fpga, defined in c313a.h, such as
#define G_CABLE_TIM (FRAMEPAR_GLOBALS + 7) /// Extra cable delay, signed ps)
#define G_FPGA_TIM0 (FRAMEPAR_GLOBALS + 8) /// FPGA timing parameter 0 - difference between DCLK pad and DCM input, signed (ps)
<builderarguments="apps-autocampars"command="${workspace_loc:/elphel-apps-autocampars/run_bitbake.sh}"enableCleanBuild="false"id="org.eclipse.cdt.build.core.settings.default.builder.1258366388"incrementalBuildTarget="-c compile -f"keepEnvironmentInBuildfile="false"managedBuildOn="false"name="Gnu Make Builder"superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
<toolid="org.eclipse.cdt.build.core.settings.holder.libs.1885972775"name="holder for library settings"superClass="org.eclipse.cdt.build.core.settings.holder.libs"/>