summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2019-01-22 11:15:00 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2019-01-22 11:15:00 +0100
commitd7a0913ead6724bfd508a5480c7014b2516975ce (patch)
treee253d46fb900dcb871211df947d637727756f361
parent77cfae162dea6195e8869c95db8876bbaf98fad1 (diff)
downloaddabmod-d7a0913ead6724bfd508a5480c7014b2516975ce.tar.gz
dabmod-d7a0913ead6724bfd508a5480c7014b2516975ce.tar.bz2
dabmod-d7a0913ead6724bfd508a5480c7014b2516975ce.zip
GUI: Check for underruns in home screen
-rw-r--r--python/gui/static/js/odr-home.js51
-rw-r--r--python/gui/templates/home.html4
2 files changed, 51 insertions, 4 deletions
diff --git a/python/gui/static/js/odr-home.js b/python/gui/static/js/odr-home.js
index 9498ae7..2fa873a 100644
--- a/python/gui/static/js/odr-home.js
+++ b/python/gui/static/js/odr-home.js
@@ -43,8 +43,20 @@ function apiRequestChain(uri, get_data, success_callback, fail_callback) {
});
}
-function mark_pending(id) {
+function mark_pending(id, comment) {
document.getElementById(id).className = "glyphicon glyphicon-refresh glyphicon-refresh-animate";
+
+ if (comment) {
+ document.getElementById(id + "_comment").innerHTML = comment;
+ }
+}
+
+var failure_encountered = false;
+
+function mark_overall_ok() {
+ if (!failure_encountered) {
+ document.getElementById("overall_state").className = "glyphicon glyphicon-ok";
+ }
}
function mark_ok(id, comment) {
@@ -56,6 +68,8 @@ function mark_ok(id, comment) {
}
function mark_fail(id, reason) {
+ failure_encountered = true;
+
var el = document.getElementById(id);
el.className = "glyphicon glyphicon-remove";
el.style.color = "#FF3333";
@@ -95,7 +109,7 @@ function check_modulating(last_num_frames) {
}
else {
mark_ok('is_modulating', "Number of frames modulated: " + data);
- check_rate_4x();
+ check_underrunning(0, 0);
}
}
}
@@ -108,6 +122,35 @@ function check_modulating(last_num_frames) {
});
}
+function check_underrunning(iteration, first_underruns) {
+ var n_checks = 3;
+
+ apiRequestChain("/api/parameter",
+ {controllable: 'sdr', param: 'underruns'},
+ function(data) {
+ if (iteration == 0) {
+ mark_pending('is_underrunning', "Checking for underruns");
+ setTimeout(function() { check_underrunning(iteration+1, data); }, 2000);
+ }
+ else if (iteration < n_checks) {
+ mark_pending('is_underrunning', "Check " + iteration + "/" + n_checks + "...");
+ setTimeout(function() { check_underrunning(iteration+1, first_underruns); }, 2000);
+ }
+ else {
+ if (data == first_underruns) {
+ mark_ok('is_underrunning', "Number of underruns is not increasing: " + data);
+ }
+ else {
+ mark_fail('is_underrunning', "Underruns observed in last " + n_checks + " seconds: " + data);
+ }
+ check_rate_4x();
+ }
+ },
+ function(data) {
+ mark_fail('is_underrunning', data);
+ });
+}
+
function check_rate_4x() {
mark_pending('is_rate_4x');
apiRequestChain("/api/parameter",
@@ -115,11 +158,11 @@ function check_rate_4x() {
function(data) {
if (data == 8192000) {
mark_ok('is_rate_4x', "Samplerate: " + data);
- check_dpdce_running();
}
else {
mark_fail('is_rate_4x', "Samplerate is not 8192ksps: " + data);
}
+ check_dpdce_running();
},
function(data) {
mark_fail('is_rate_4x', JSON.parse(data)['reason']);
@@ -132,7 +175,7 @@ function check_dpdce_running() {
{},
function(data) {
mark_ok('is_dpdce_running', "State: " + data['state']);
- mark_ok('overall_state');
+ mark_overall_ok();
},
function(data) {
mark_fail('is_dpdce_running', JSON.parse(data)['reason']);
diff --git a/python/gui/templates/home.html b/python/gui/templates/home.html
index 0a0713a..d1c8d02 100644
--- a/python/gui/templates/home.html
+++ b/python/gui/templates/home.html
@@ -23,6 +23,10 @@
<span id="is_modulating" class="glyphicon glyphicon-question-sign"></span>
<span id="is_modulating_comment"><span>
</li>
+ <li>Underruns:
+ <span id="is_underrunning" class="glyphicon glyphicon-question-sign"></span>
+ <span id="is_underrunning_comment"><span>
+ </li>
</ul>
<p>Checking predistortion