Commit edaa3147 authored by Andrey Filippov's avatar Andrey Filippov

More status from camogm, timing of debug messages, start record behavior

parent 5a1a4d6f
......@@ -93,7 +93,8 @@ var refresh_status_intvl;
var refresh_previews_intvl;
var exp_ms = 50;
var quality = 97;
var refresh_during_record=false; // when false - disable image refresh during recording
const start_date = Date.now();
$(function(){
init();
......@@ -314,26 +315,28 @@ function check_camogm_status(cam_i){ // full check, slow
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+";");
var min_free = parseInt($(res).find('buf_mfree').text().replace(/"/gm,''));
var mmin_free = parseInt($(res).find('buf_mmin').text().replace(/"/gm,''));
var error_restarts = parseInt($(res).find('error_restarts').text().replace(/"/gm,''));
cam.restarts = error_restarts;
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+"), ");
console.log("min_free="+min_free);
console.log("mmin_free="+mmin_free);
console.log("error_restarts="+error_restarts);
var free_buf = Math.round(100 *min_free / full_buf);
var mfree_buf = Math.round(100 *mmin_free / full_buf);
console.log(free_buf+"% - min free="+min_free+" ("+full_buf+"), "+mfree_buf+"% - min free="+mmin_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+";");
se.find("#s_mbuf").html(mfree_buf+'%');
var bgcol_buf = (mfree_buf > 25) ? "rgb(200, 255, 200)":"rgb(255, 100,100)";
se.find("#s_mbuf").attr("style","background-color:"+bgcol_buf+";");
}
}
}).fail(function(data,status){
......@@ -385,6 +388,7 @@ function rec_button_update_state(){
var all_ready = true;
var any_running = false;
var any_stopped = false;
const elapsed_millis = Date.now() - start_date;
for(var i=0;i<cams.length;i++){
if (cams[i].init){
if ((cams[i].camogm=='on')&&(!cams[i].recording)){
......@@ -403,7 +407,7 @@ function rec_button_update_state(){
if (all_ready){
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, time=" + (elapsed_millis / 1000)+"s"); // false
for(var i=0;i<cams.length;i++){
console.log(i+": "+cams[i].recording);
}
......@@ -434,7 +438,7 @@ function rec_button_update_state(){
}
function startStopRefresh (){
if (refresh_en) {
if (refresh_en && (!recording || refresh_during_record)) {
if (!skip_previews) {
if (refresh_previews_intvl) {
clearInterval(refresh_previews_intvl);
......@@ -443,24 +447,31 @@ function startStopRefresh (){
refresh_previews_intvl = setInterval(refresh_previews,multicam_rperiod * 1000);
refresh_previews(); // first time - immediately
}
console.log("setInterval(refresh_previews_intvl); refresh_previews_intvl="+refresh_previews_intvl+', period='+(multicam_rperiod * 1000));
} else {
clearInterval(refresh_previews_intvl);
console.log("clearInterval(refresh_previews_intvl); refresh_previews_intvl="+refresh_previews_intvl);
refresh_previews_intvl = null;
blankBackground($('#display_previews'));
}
if (refresh_en) {
if (refresh_status_intvl) {
clearInterval(refresh_status_intvl);
refresh_status_intvl = null;
}
refresh_status_intvl = setInterval(refresh_status,multicam_speriod * 1000);
refresh_status(); // first time - immediately
console.log("setInterval(refresh_previews_intvl); refresh_previews_intvl="+refresh_previews_intvl+', period='+(multicam_rperiod * 1000));
console.log("setInterval(refresh_status_intvl); refresh_status_intvl="+refresh_status_intvl+', period='+(multicam_speriod * 1000));
} else {
clearInterval(refresh_previews_intvl);
clearInterval(refresh_status_intvl);
console.log("clearInterval(refresh_previews_intvl); refresh_previews_intvl="+refresh_previews_intvl);
console.log("clearInterval(refresh_status_intvl); refresh_status_intvl="+refresh_status_intvl);
refresh_previews_intvl = null;
refresh_status_intvl = null;
blankBackground($('#display_previews'));
blankBackground($('#display_status'));
}
console.log("startStopRefresh(): "+refresh_en)
}
......@@ -619,7 +630,8 @@ function init3(index){
'<td id=\'s_space\'></td>',
'<td id=\'s_errors\'></td>',
'<td id=\'s_restarts\'></td>',
'<td id=\'s_buf\'></td>'
'<td id=\'s_buf\'></td>',
'<td id=\'s_mbuf\'></td>'
].join('\n');
$("#display_status").find("tr[ip=\'"+cam.ip+"\']").html($(status_str));
......
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