Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elphel-web-393
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
elphel-web-393
Commits
5a1a4d6f
Commit
5a1a4d6f
authored
Jul 05, 2023
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed excessive killall polluting log and more debugging multicam3.js
parent
9389820e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
90 additions
and
30 deletions
+90
-30
lwir16.ini
src/lwir16/lwir16.ini
+1
-1
multicam3.js
src/multicam/multicam3.js
+74
-19
capture_range.php
src/php_top/capture_range.php
+15
-10
No files found.
src/lwir16/lwir16.ini
View file @
5a1a4d6f
...
@@ -24,7 +24,7 @@ tiff_bin_shift = 1
...
@@ -24,7 +24,7 @@ tiff_bin_shift = 1
tiff_auto
=
0
tiff_auto
=
0
frames_idle
=
10
frames_idle
=
10
frames_wait
=
20
frames_wait
=
20
debug
=
1
debug
=
0
output_log
=
/var/log/lwir16.log
output_log
=
/var/log/lwir16.log
# no spaces around commas!
# no spaces around commas!
CMD
=
INIT,START
CMD
=
INIT,START
\ No newline at end of file
src/multicam/multicam3.js
View file @
5a1a4d6f
...
@@ -59,6 +59,7 @@ var Camera = function(options){
...
@@ -59,6 +59,7 @@ var Camera = function(options){
camogm
:
false
,
camogm
:
false
,
recording
:
false
,
recording
:
false
,
mounted
:
false
,
mounted
:
false
,
restarts
:
0
,
ports
:
[]
ports
:
[]
};
};
...
@@ -213,7 +214,6 @@ function get_ports(){
...
@@ -213,7 +214,6 @@ function get_ports(){
}
}
function
check_camogm
(
cam_i
){
function
check_camogm
(
cam_i
){
// run_status does not interact with camogm, quickest response
// run_status does not interact with camogm, quickest response
$
.
ajax
({
$
.
ajax
({
url
:
"http://"
+
cams
[
cam_i
].
ip
+
"/camogm_interface.php?cmd=run_status"
,
url
:
"http://"
+
cams
[
cam_i
].
ip
+
"/camogm_interface.php?cmd=run_status"
,
...
@@ -226,11 +226,12 @@ function check_camogm(cam_i){
...
@@ -226,11 +226,12 @@ function check_camogm(cam_i){
console
.
log
(
cams
[
this
.
cam_i
].
ip
+
": camogm is off"
);
console
.
log
(
cams
[
this
.
cam_i
].
ip
+
": camogm is off"
);
// launch it
// launch it
camogm_launch
(
this
.
cam_i
);
camogm_launch
(
this
.
cam_i
);
cams
[
this
.
cam_i
].
restarts
++
;
}
}
if
(
state
==
'on'
){
if
(
state
==
'on'
){
console
.
log
(
cams
[
this
.
cam_i
].
ip
+
": camogm is on"
);
console
.
log
(
cams
[
this
.
cam_i
].
ip
+
": camogm is on"
);
//
check_camogm_status(this.cam_i);
check_camogm_status
(
this
.
cam_i
);
setDirSingle
(
this
.
cam_i
);
// wiil end with check_camogm_status(this.cam_i)
//
setDirSingle(this.cam_i); // wiil end with check_camogm_status(this.cam_i)
}
}
}
}
});
});
...
@@ -285,6 +286,7 @@ function check_camogm_status(cam_i){ // full check, slow
...
@@ -285,6 +286,7 @@ function check_camogm_status(cam_i){ // full check, slow
url
:
"http://"
+
cams
[
cam_i
].
ip
+
"/camogm_interface.php?cmd=status"
,
url
:
"http://"
+
cams
[
cam_i
].
ip
+
"/camogm_interface.php?cmd=status"
,
cam_i
:
cam_i
,
cam_i
:
cam_i
,
success
:
function
(
res
){
success
:
function
(
res
){
let
full_buf
=
0x4000000
-
4000000
;
// subtracted MIN_USED_SIZE from camogm.h
var
cam
=
cams
[
this
.
cam_i
];
var
cam
=
cams
[
this
.
cam_i
];
// console.log("check_camogm_status for "+cam_i+" success");
// console.log("check_camogm_status for "+cam_i+" success");
if
(
$
(
res
).
find
(
'state'
).
length
!=
0
){
if
(
$
(
res
).
find
(
'state'
).
length
!=
0
){
...
@@ -305,8 +307,33 @@ function check_camogm_status(cam_i){ // full check, slow
...
@@ -305,8 +307,33 @@ function check_camogm_status(cam_i){ // full check, slow
var
lba_current
=
parseInt
(
$
(
res
).
find
(
'lba_current'
).
text
());
var
lba_current
=
parseInt
(
$
(
res
).
find
(
'lba_current'
).
text
());
var
free_space
=
(
lba_end
-
lba_current
)
/
2
/
1024
/
1024
;
var
free_space
=
(
lba_end
-
lba_current
)
/
2
/
1024
/
1024
;
var
sdd_found
=
free_space
>
0
;
cam
.
mounted
=
sdd_found
;
free_space
=
Math
.
round
(
100
*
free_space
)
/
100
;
free_space
=
Math
.
round
(
100
*
free_space
)
/
100
;
se
.
find
(
"#s_space"
).
html
(
free_space
+
" GB"
);
se
.
find
(
"#s_space"
).
html
(
free_space
+
" GB"
);
var
bgcol
=
sdd_found
?
"rgb(200, 255, 200)"
:
"rgb(255, 100,100)"
;
// add yellow for low space
se
.
find
(
"#s_space"
).
attr
(
"style"
,
"background-color:"
+
bgcol
+
";"
);
se
.
find
(
"#s_restarts"
).
html
(
cam
.
restarts
);
var
bgcol_restarts
=
cam
.
camogm
?
"rgb(200, 255, 200)"
:
"rgb(255, 100,100)"
;
se
.
find
(
"#s_restarts"
).
attr
(
"style"
,
"background-color:"
+
bgcol_restarts
+
";"
);
// find free buffer size - minimum of all ports
var
buf_free_coll
=
$
(
res
).
find
(
'buffer_free'
);
// console.log(buf_free_coll);
var
min_free
=
full_buf
;
var
this_free
;
for
(
var
i
=
0
;
i
<
buf_free_coll
.
length
;
i
++
){
this_free
=
parseInt
(
buf_free_coll
[
i
].
innerHTML
);
if
(
this_free
<
min_free
)
min_free
=
this_free
;
// console.log(buf_free_coll[i]);
// console.log(i+":"+buf_free_coll[i].innerHTML);
}
var
free_buf
=
Math
.
round
(
100
*
min_free
/
full_buf
);
console
.
log
(
free_buf
+
"% - min free="
+
min_free
+
" ("
+
full_buf
+
"), "
);
se
.
find
(
"#s_buf"
).
html
(
free_buf
+
'%'
);
var
bgcol_buf
=
(
free_buf
>
25
)
?
"rgb(200, 255, 200)"
:
"rgb(255, 100,100)"
;
se
.
find
(
"#s_buf"
).
attr
(
"style"
,
"background-color:"
+
bgcol_buf
+
";"
);
}
}
}
}
}).
fail
(
function
(
data
,
status
){
}).
fail
(
function
(
data
,
status
){
...
@@ -339,7 +366,7 @@ function check_camogm_free_space(cam_i){ // file system, no raw
...
@@ -339,7 +366,7 @@ function check_camogm_free_space(cam_i){ // file system, no raw
se
.
find
(
"#s_space"
).
html
(
free_space
+
" GB"
);
se
.
find
(
"#s_space"
).
html
(
free_space
+
" GB"
);
var
bgcol
=
sdd_found
?
"rgb(200, 255, 200)"
:
"rgb(255, 100,100)"
;
// add yellow for low space
var
bgcol
=
sdd_found
?
"rgb(200, 255, 200)"
:
"rgb(255, 100,100)"
;
// add yellow for low space
se
.
find
(
"#s_space"
).
attr
(
"style"
,
"background-color:"
+
bgcol
+
";"
);
se
.
find
(
"#s_space"
).
attr
(
"style"
,
"background-color:"
+
bgcol
+
";"
);
console
.
log
(
"hdd: "
+
cam
.
ip
+
", mounted="
+
cam
.
mounted
);
}
}
}
}
}).
fail
(
function
(
data
,
status
){
}).
fail
(
function
(
data
,
status
){
...
@@ -358,7 +385,6 @@ function rec_button_update_state(){
...
@@ -358,7 +385,6 @@ function rec_button_update_state(){
var
all_ready
=
true
;
var
all_ready
=
true
;
var
any_running
=
false
;
var
any_running
=
false
;
var
any_stopped
=
false
;
var
any_stopped
=
false
;
for
(
var
i
=
0
;
i
<
cams
.
length
;
i
++
){
for
(
var
i
=
0
;
i
<
cams
.
length
;
i
++
){
if
(
cams
[
i
].
init
){
if
(
cams
[
i
].
init
){
if
((
cams
[
i
].
camogm
==
'on'
)
&&
(
!
cams
[
i
].
recording
)){
if
((
cams
[
i
].
camogm
==
'on'
)
&&
(
!
cams
[
i
].
recording
)){
...
@@ -378,6 +404,9 @@ function rec_button_update_state(){
...
@@ -378,6 +404,9 @@ function rec_button_update_state(){
if
(
any_running
&&
any_stopped
){
if
(
any_running
&&
any_stopped
){
console
.
log
(
"WARNING: some camogms are running, some are stopped"
);
// false
console
.
log
(
"WARNING: some camogms are running, some are stopped"
);
// false
for
(
var
i
=
0
;
i
<
cams
.
length
;
i
++
){
console
.
log
(
i
+
": "
+
cams
[
i
].
recording
);
}
}
}
if
(
all_ready_init_run
){
if
(
all_ready_init_run
){
...
@@ -588,7 +617,9 @@ function init3(index){
...
@@ -588,7 +617,9 @@ function init3(index){
'<td id=
\'
s_ip
\'
>'
+
cam
.
ip
+
'</td>'
,
'<td id=
\'
s_ip
\'
>'
+
cam
.
ip
+
'</td>'
,
'<td id=
\'
s_device
\'
></td>'
,
'<td id=
\'
s_device
\'
></td>'
,
'<td id=
\'
s_space
\'
></td>'
,
'<td id=
\'
s_space
\'
></td>'
,
'<td id=
\'
s_errors
\'
></td>'
'<td id=
\'
s_errors
\'
></td>'
,
'<td id=
\'
s_restarts
\'
></td>'
,
'<td id=
\'
s_buf
\'
></td>'
].
join
(
'
\
n'
);
].
join
(
'
\
n'
);
$
(
"#display_status"
).
find
(
"tr[ip=
\
'"
+
cam
.
ip
+
"
\
']"
).
html
(
$
(
status_str
));
$
(
"#display_status"
).
find
(
"tr[ip=
\
'"
+
cam
.
ip
+
"
\
']"
).
html
(
$
(
status_str
));
...
@@ -704,7 +735,13 @@ function init_rec_button(){
...
@@ -704,7 +735,13 @@ function init_rec_button(){
recording
=
1
;
recording
=
1
;
rec_button_switch
(
recording
);
rec_button_switch
(
recording
);
// mkdir for recording
// mkdir for recording
url
=
"camogm_interface.php?cmd=dir_prefix&name="
+
multicam_dir
;
if
(
use_file_system
){
url
=
"camogm_interface.php?cmd=dir_prefix&name="
+
multicam_dir
;
console
.
log
(
"Setting camogm directory/prefix, url="
+
url
);
}
else
{
url
=
"camogm_interface.php?cmd=set_prefix_raw&prefix="
+
multicam_dir
;
console
.
log
(
"Setting camogm raw prefix, url="
+
url
);
}
multi_ajax
(
url
,
function
(){
multi_ajax
(
url
,
function
(){
console
.
log
(
"starting recording in the camera "
+
this
.
ip
+
" to "
+
multicam_dir
);
console
.
log
(
"starting recording in the camera "
+
this
.
ip
+
" to "
+
multicam_dir
);
// launch recording
// launch recording
...
@@ -767,6 +804,8 @@ function addrs_create_tables(){
...
@@ -767,6 +804,8 @@ function addrs_create_tables(){
' <th>device</th>'
,
' <th>device</th>'
,
' <th>free space</th>'
,
' <th>free space</th>'
,
' <th>errors</th>'
,
' <th>errors</th>'
,
' <th>r</th>'
,
' <th>buf</th>'
,
'</tr>'
,
'</tr>'
,
'</table>'
'</table>'
].
join
(
'
\
n'
));
].
join
(
'
\
n'
));
...
@@ -1398,25 +1437,41 @@ function updateConfifs(){ // write modified settings to the master camera persis
...
@@ -1398,25 +1437,41 @@ function updateConfifs(){ // write modified settings to the master camera persis
function
setDirMulti
(){
function
setDirMulti
(){
// url = "camogm_interface.php?cmd=dir_prefix&name=" + multicam_dir;
// url = "camogm_interface.php?cmd=dir_prefix&name=" + multicam_dir;
url
=
"camogm_interface.php?cmd=set_prefix_raw&name="
+
multicam_dir
;
// can not mkdir before mounted
if
(
use_file_system
){
url
=
"camogm_interface.php?cmd=set_prefix&prefix="
+
multicam_dir
;
// can not mkdir before mounted
}
else
{
url
=
"camogm_interface.php?cmd=set_prefix_raw&prefix="
+
multicam_dir
;
// can not mkdir before mounted
}
console
.
log
(
"setDirMulti(), url="
+
url
);
console
.
log
(
"setDirMulti(), url="
+
url
);
multi_ajax
(
url
,
function
(){
multi_ajax
(
url
,
function
(){
console
.
log
(
this
.
ip
+
":
dir_prefix "
+
multicam_dir
);
console
.
log
(
this
.
ip
+
":
prefix "
+
multicam_dir
+
", url="
+
url
);
});
});
}
}
var
appply_pending
=
0
;
var
appply_pending
=
0
;
function
setDirSingle
(
cam_i
){
// set recording directory for one camera (after starting camogm), request status
function
setDirSingle
(
cam_i
){
// set recording directory for one camera (after starting camogm), request status
console
.
log
(
"csetDirSingle("
+
cam_i
+
")"
);
console
.
log
(
"setDirSingle("
+
cam_i
+
"):"
+
multicam_dir
+
"use_file_system="
+
use_file_system
);
$
.
ajax
({
if
(
use_file_system
){
// url: "http://"+cams[cam_i].ip+"/camogm_interface.php?cmd=dir_prefix&name=" + multicam_dir, // should never be done before partition is mounted!
$
.
ajax
({
url
:
"http://"
+
cams
[
cam_i
].
ip
+
"/camogm_interface.php?cmd=SET_prefix&name="
+
multicam_dir
,
// can not mkdir before mounted
// url: "http://"+cams[cam_i].ip+"/camogm_interface.php?cmd=dir_prefix&name=" + multicam_dir, // should never be done before partition is mounted!
cam_i
:
cam_i
,
url
:
"http://"
+
cams
[
cam_i
].
ip
+
"/camogm_interface.php?cmd=SET_prefix&name="
+
multicam_dir
,
// can not mkdir before mounted
success
:
function
(){
cam_i
:
cam_i
,
console
.
log
(
cams
[
this
.
cam_i
].
ip
+
": set directory to "
+
multicam_dir
);
success
:
function
(){
check_camogm_status
(
this
.
cam_i
);
console
.
log
(
cams
[
this
.
cam_i
].
ip
+
": set directory to "
+
multicam_dir
);
}
check_camogm_status
(
this
.
cam_i
);
});
}
});
}
else
{
// still need to create directory?
console
.
log
(
"set directory to, url="
+
"http://"
+
cams
[
cam_i
].
ip
+
"/camogm_interface.php?cmd=set_prefix_raw&prefix="
+
multicam_dir
);
$
.
ajax
({
url
:
"http://"
+
cams
[
cam_i
].
ip
+
"/camogm_interface.php?cmd=set_prefix_raw&prefix="
+
multicam_dir
,
// can not mkdir before mounted
cam_i
:
cam_i
,
success
:
function
(){
console
.
log
(
cams
[
this
.
cam_i
].
ip
+
": set directory to "
+
multicam_dir
);
check_camogm_status
(
this
.
cam_i
);
}
});
}
}
}
// LWIR16
// LWIR16
...
...
src/php_top/capture_range.php
View file @
5a1a4d6f
...
@@ -66,13 +66,13 @@
...
@@ -66,13 +66,13 @@
file_get_contents
(
$notify
);
file_get_contents
(
$notify
);
}
}
// fclose ( $f );
// fclose ( $f );
// can still get stuck for a long time, but testing file exists is faster that find a process
if
(
file_exists
(
CAPTURE_RANGE_STATE
))
{
unlink
(
CAPTURE_RANGE_STATE
);
}
exit
(
0
);
exit
(
0
);
}
}
// $output=null;
$retval
=-
1
;
// not used
$retval
=-
1
;
// not used
// kill CLI mode if it was running (e.g. waiting for 100 years)
// exec("killall capture_range.php", $output, $retval);
// exec("/www/pages/capture_range.php 1 2 3 4 > /dev/null 2>&1 &");
if
(
count
(
$_GET
)
<
1
)
{
if
(
count
(
$_GET
)
<
1
)
{
print
(
"CGI mode"
);
print
(
"CGI mode"
);
...
@@ -287,8 +287,12 @@ USAGE;
...
@@ -287,8 +287,12 @@ USAGE;
if
(
!
isset
(
$duration
))
{
if
(
!
isset
(
$duration
))
{
$duration
=
0
;
$duration
=
0
;
}
}
// kill CLI mode if it was running (e.g. waiting for 100 years)
// kill CLI mode if it was running (e.g. waiting for 100 years) first check file exists (faster)
exec
(
"killall capture_range.php"
,
$output
,
$retval
);
// if (file_exists(CAPTURE_RANGE_STATE) || getPIDByName('capture_range.php', 'php', $active_only = false)) {
if
(
file_exists
(
CAPTURE_RANGE_STATE
))
{
// getPIDByName('capture_range.php', 'php', $active_only = false) is slower
exec
(
"killall capture_range.php"
,
$output
,
$retval
);
// grows lighttpd_stderr.log, need to check before kill
unlink
(
CAPTURE_RANGE_STATE
);
}
// spawn CLI program in background duration <0 - start only, ==0 - stop only, >0 - start+stop
// spawn CLI program in background duration <0 - start only, ==0 - stop only, >0 - start+stop
// $f = fopen ( "/var/log/capture_range.log", 'a' );
// $f = fopen ( "/var/log/capture_range.log", 'a' );
// fwrite($f,"exec(/www/pages/capture_range.php $sensor_port $port_mask $frame $duration > /dev/null 2>&1 &\n");
// fwrite($f,"exec(/www/pages/capture_range.php $sensor_port $port_mask $frame $duration > /dev/null 2>&1 &\n");
...
@@ -300,15 +304,16 @@ USAGE;
...
@@ -300,15 +304,16 @@ USAGE;
if
(
isset
(
$ahead_now
)
&&
(
$ahead_now
==
0
)){
if
(
isset
(
$ahead_now
)
&&
(
$ahead_now
==
0
)){
$frame
=
0
;
// ASAP
$frame
=
0
;
// ASAP
}
}
$end_frame
=
$frame
;
if
(
$duration
>
0
)
{
$end_frame
+=
$duration
;
// xml will contain end frame
}
file_put_contents
(
CAPTURE_RANGE_STATE
,
"end_frame =
$end_frame
\n
"
);
exec
(
"/www/pages/capture_range.php
$sensor_port
$port_mask
$frame
$duration
'
$notify_url
'> /dev/null 2>&1 &"
);
exec
(
"/www/pages/capture_range.php
$sensor_port
$port_mask
$frame
$duration
'
$notify_url
'> /dev/null 2>&1 &"
);
// }
// }
// $f = fopen ( "/var/log/capture_range.log", 'a' );
// $f = fopen ( "/var/log/capture_range.log", 'a' );
// fwrite($f,"DONE exec\n");
// fwrite($f,"DONE exec\n");
// fclose ( $f );
// fclose ( $f );
if
(
$duration
>
0
)
{
$frame
+=
$duration
;
// xml will contain end frame
}
file_put_contents
(
CAPTURE_RANGE_STATE
,
"end_frame =
$frame
\n
"
);
if
(
$wait
)
{
if
(
$wait
)
{
elphel_wait_frame_abs
(
$sensor_port
,
$frame
+
1
);
elphel_wait_frame_abs
(
$sensor_port
,
$frame
+
1
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment