Commit ddf0c9ca authored by Andrey Filippov's avatar Andrey Filippov

updating for Boson640

parent 1a7baa9c
...@@ -976,11 +976,19 @@ function detect_camera(){ ...@@ -976,11 +976,19 @@ function detect_camera(){
break; break;
} }
if ($GLOBALS['camera_state_arr']['is_boson640']){ if ($GLOBALS['camera_state_arr']['is_boson640']){
log_msg('Temporary Lepton 3.5 code'); log_msg('Temporary Boson640 code');
foreach ($GLOBALS['ports'] as $port) { foreach ($GLOBALS['ports'] as $port) { // only for detected ports
if ($port==$GLOBALS['master_port']){ /*
if ($port==$GLOBALS['master_port']){ // no need to setup single-frame mode for Boson
log_msg('ELPHEL_TRIG_MASTER: '.$GLOBALS['master_port']);
log_msg('ELPHEL_TRIG_MASTER: '.$GLOBALS['master_port']);
log_msg('ELPHEL_TRIG_MASTER: '.$GLOBALS['master_port']);
log_msg('ELPHEL_TRIG_MASTER: '.$GLOBALS['master_port']);
log_msg('ELPHEL_TRIG_MASTER: '.$GLOBALS['master_port']);
log_msg('ELPHEL_TRIG_MASTER: '.$GLOBALS['master_port']);
log_msg('ELPHEL_TRIG_MASTER: '.$GLOBALS['master_port']);
log_msg('ELPHEL_TRIG_MASTER: '.$GLOBALS['master_port']);
elphel_set_P_value ( $port, ELPHEL_TRIG_MASTER, $GLOBALS['master_port'], ELPHEL_CONST_FRAME_IMMED); elphel_set_P_value ( $port, ELPHEL_TRIG_MASTER, $GLOBALS['master_port'], ELPHEL_CONST_FRAME_IMMED);
elphel_set_P_value ( $port, ELPHEL_TRIG_PERIOD, 0, ELPHEL_CONST_FRAME_IMMED); elphel_set_P_value ( $port, ELPHEL_TRIG_PERIOD, 0, ELPHEL_CONST_FRAME_IMMED);
elphel_set_P_value ( $port, ELPHEL_TRIG_BITLENGTH, 0, ELPHEL_CONST_FRAME_IMMED); elphel_set_P_value ( $port, ELPHEL_TRIG_BITLENGTH, 0, ELPHEL_CONST_FRAME_IMMED);
...@@ -989,32 +997,27 @@ function detect_camera(){ ...@@ -989,32 +997,27 @@ function detect_camera(){
elphel_set_P_value ( $port, ELPHEL_TRIG_OUT, 0x00000, ELPHEL_CONST_FRAME_IMMED); elphel_set_P_value ( $port, ELPHEL_TRIG_OUT, 0x00000, ELPHEL_CONST_FRAME_IMMED);
elphel_set_P_value ( $port, ELPHEL_TRIG_CONDITION, 0x00000, ELPHEL_CONST_FRAME_IMMED); elphel_set_P_value ( $port, ELPHEL_TRIG_CONDITION, 0x00000, ELPHEL_CONST_FRAME_IMMED);
} }
elphel_set_P_value ( $port, ELPHEL_TRIG_DELAY, 0, ELPHEL_CONST_FRAME_IMMED); */
//elphel_set_P_value ( $port, ELPHEL_TRIG_DELAY, 0, ELPHEL_CONST_FRAME_IMMED);
// Wait for fully booted of each sensor - they should be booted in parallel
for ($i = 0; $i < 1000; $i++){
elphel_skip_frames($port,1); // increase to 5-10 at a time?
// will just trigger pgm_limit_fps and ELPHEL_BOOTED update
elphel_set_P_value ( $port, ELPHEL_BAYER, 0x00, 0, ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC );
if (elphel_get_P_value ( $port, ELPHEL_BOOTED) > 0){
log_msg("Break: Sensor port ".$port." booted, frame = ".elphel_get_frame($port).", frames16: "
.trim(file_get_contents('/sys/devices/soc0/elphel393-framepars@0/all_frames')).", i=".$i);
break;
} }
usleep ($GLOBALS['camera_state_arr']['max_frame_time']); // > 1 frame, so all channels will get trigger parameters
/*
* Mo snapshot mode in Lepton
foreach ($GLOBALS['ports'] as $port) {
elphel_set_P_value ( $port, ELPHEL_TRIG, ELPHEL_CONST_TRIGMODE_SNAPSHOT, ELPHEL_CONST_FRAME_IMMED);
} }
log_msg("Sensor port ".$port." booted, frame = ".elphel_get_frame($port).", frames16: ".trim(file_get_contents('/sys/devices/soc0/elphel393-framepars@0/all_frames')));
log_msg("Sensor port ".$port." ELPHEL_BOOTED = ".elphel_get_P_value ( $port, ELPHEL_BOOTED).", frame = ".elphel_get_frame($port));
elphel_skip_frames($port,16); // Let it initialize?
log_msg("Sensor port ".$port." Skipped 16 frames, frame = ".elphel_get_frame($port));
elphel_set_P_value ( $GLOBALS['master_port'], ELPHEL_TRIG_PERIOD, 1, ELPHEL_CONST_FRAME_IMMED, ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC);
usleep ($GLOBALS['camera_state_arr']['max_frame_time']);
*/
//Check that now all frame parameters are the same?
// reset sequencers
log_msg("Before reset sequencers:\n" .trim(file_get_contents('/sys/devices/soc0/elphel393-framepars@0/all_frames')));
/*
for ($port=0; $port < 4; $port++){
$f = fopen ( $GLOBALS['sysfs_frame_seq'].$port, 'w' ); fwrite($f,'0',1); fclose ( $f );
$f = fopen ( $GLOBALS['sysfs_i2c_seq'].$port, 'w' ); fwrite($f,'3',1); fclose ( $f ); // reset+run (copy frame number from frame_seq)
if (!in_array($port, $GLOBALS['ports'])) {
log_msg("Disabling sensor port ".$port);
$f = fopen ( $GLOBALS['sysfs_chn_en'].$port, 'w' ); fwrite($f,'0',1); fclose ( $f ); // disable sensor channel
} }
} usleep ($GLOBALS['camera_state_arr']['max_frame_time']); // > 1 frame, so all channels will get trigger parameters
*/ log_msg("Before reset sequencers:\n" .trim(file_get_contents('/sys/devices/soc0/elphel393-framepars@0/all_frames')));
log_msg("After reset sequencers (not reset for Lepton):\n" .trim(file_get_contents('/sys/devices/soc0/elphel393-framepars@0/all_frames'))); log_msg("After reset sequencers (not reset for Lepton):\n" .trim(file_get_contents('/sys/devices/soc0/elphel393-framepars@0/all_frames')));
// ======= First trigger, frame # = 1 ========. // ======= First trigger, frame # = 1 ========.
/* /*
...@@ -1024,6 +1027,7 @@ function detect_camera(){ ...@@ -1024,6 +1027,7 @@ function detect_camera(){
log_msg("After single trigger:\n" .trim(file_get_contents('/sys/devices/soc0/elphel393-framepars@0/all_frames'))); log_msg("After single trigger:\n" .trim(file_get_contents('/sys/devices/soc0/elphel393-framepars@0/all_frames')));
//echo "9. frames:\n"; for ($ii=0;$ii<4;$ii++) $frame_nums[$ii]=elphel_get_frame($ii); print_r($frame_nums); //echo "9. frames:\n"; for ($ii=0;$ii<4;$ii++) $frame_nums[$ii]=elphel_get_frame($ii); print_r($frame_nums);
*/ */
log_msg("1.Sensor port ".$port." ELPHEL_BOOTED = ".elphel_get_P_value ( $port, ELPHEL_BOOTED).", frame = ".elphel_get_frame($port));
$GLOBALS['camera_state_arr']['state'] ='SENSORS_SYNCHRONIZED'; $GLOBALS['camera_state_arr']['state'] ='SENSORS_SYNCHRONIZED';
write_php_ini ($GLOBALS['camera_state_arr'], $GLOBALS['camera_state_path'] ); write_php_ini ($GLOBALS['camera_state_arr'], $GLOBALS['camera_state_path'] );
log_msg('Frames: '. implode(", ",$frame_nums)); log_msg('Frames: '. implode(", ",$frame_nums));
...@@ -1040,8 +1044,7 @@ function detect_camera(){ ...@@ -1040,8 +1044,7 @@ function detect_camera(){
respond_xml($GLOBALS['camera_state_arr']['state']); respond_xml($GLOBALS['camera_state_arr']['state']);
} }
if ($GLOBALS['STOP_AFTER'][$GLOBALS['camera_state_arr']['state']]) break; // will break anyway if ($GLOBALS['STOP_AFTER'][$GLOBALS['camera_state_arr']['state']]) break; // will break anyway
log_msg("2.Sensor port ".$port." ELPHEL_BOOTED = ".elphel_get_P_value ( $port, ELPHEL_BOOTED).", frame = ".elphel_get_frame($port));
break; break;
} }
...@@ -1109,6 +1112,7 @@ function detect_camera(){ ...@@ -1109,6 +1112,7 @@ function detect_camera(){
default: default:
log_msg("camera_state=".$GLOBALS['camera_state_arr']['state']); log_msg("camera_state=".$GLOBALS['camera_state_arr']['state']);
} }
log_msg("3.Sensor port ".$port." ELPHEL_BOOTED = ".elphel_get_P_value ( $port, ELPHEL_BOOTED).", frame = ".elphel_get_frame($port));
log_msg("ports:". implode(", ",$GLOBALS['ports'])); log_msg("ports:". implode(", ",$GLOBALS['ports']));
} }
...@@ -1574,6 +1578,8 @@ function log_error($msg) { ...@@ -1574,6 +1578,8 @@ function log_error($msg) {
function log_close() { function log_close() {
log_msg ("Log file saved as " . $GLOBALS['logFilePath'], 3); log_msg ("Log file saved as " . $GLOBALS['logFilePath'], 3);
log_msg ("----------------------------------------------", 0); log_msg ("----------------------------------------------", 0);
log_msg("!.Sensor port ".$port." ELPHEL_BOOTED = ".elphel_get_P_value ( $port, ELPHEL_BOOTED).", frame = ".elphel_get_frame($port));
fclose ($GLOBALS['logFile']); fclose ($GLOBALS['logFile']);
unset ($GLOBALS['logFile']); // to catch errors unset ($GLOBALS['logFile']); // to catch errors
} }
...@@ -3053,12 +3059,19 @@ function createDefaultConfig($version, $port, $multisensor = false, $eyesis_mode ...@@ -3053,12 +3059,19 @@ function createDefaultConfig($version, $port, $multisensor = false, $eyesis_mode
$BITS = 16; $BITS = 16;
$OVERSIZE = 1; $OVERSIZE = 1;
$WOI_HEIGHT = 120; // w/o telemetry $WOI_HEIGHT = 120; // w/o telemetry
} elseif ($boson640) {
$COLOR = 15; // raw
$BITS = 16;
$OVERSIZE = 1;
$WOI_HEIGHT = 512; // w/o telemetry
} else { } else {
$COLOR = 0; $COLOR = 0;
$BITS = 8; $BITS = 8;
$OVERSIZE = 0; $OVERSIZE = 0;
$WOI_HEIGHT = 10000; $WOI_HEIGHT = 10000;
} }
log_msg("boson640=".$boson640.", COLOR=".$COLOR.", BITS=".$BITS);
//old: //old:
//$SENSOR_PHASE = $multisensor ? 0x55 : 0x15; //$SENSOR_PHASE = $multisensor ? 0x55 : 0x15;
//new: //new:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment