aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2018-11-28 15:14:45 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2018-11-28 15:14:45 +0100
commitd952405886dab44f12c1de53b57912b34320c7c8 (patch)
tree370b2dfea6f07a388ff78a5792ad63d2c155a7e3
parent8b42d3115db2ecec9031c5d1421463b0191e055c (diff)
downloaddabmod-d952405886dab44f12c1de53b57912b34320c7c8.tar.gz
dabmod-d952405886dab44f12c1de53b57912b34320c7c8.tar.bz2
dabmod-d952405886dab44f12c1de53b57912b34320c7c8.zip
Get calibration to show nice numbers on web page
-rwxr-xr-xgui/api/__init__.py1
-rw-r--r--gui/dpd/__init__.py4
-rw-r--r--gui/static/js/odr-predistortion.js23
-rw-r--r--gui/templates/predistortion.html2
4 files changed, 23 insertions, 7 deletions
diff --git a/gui/api/__init__.py b/gui/api/__init__.py
index c1d73a0..70a4eff 100755
--- a/gui/api/__init__.py
+++ b/gui/api/__init__.py
@@ -125,7 +125,6 @@ class API:
return send_ok()
else:
if self.calibration_result is not None:
- print("cal result", repr(self.calibration_result))
return send_ok(self.calibration_result)
else:
return send_error("DPD calibration result unknown")
diff --git a/gui/dpd/__init__.py b/gui/dpd/__init__.py
index 85abe86..2c7649b 100644
--- a/gui/dpd/__init__.py
+++ b/gui/dpd/__init__.py
@@ -57,8 +57,8 @@ class DPD:
def capture_calibration(self):
tx_ts, tx_median, rx_ts, rx_median, coarse_offset, correlation_coefficient = self.capture.calibrate()
result = {'status': "ok"}
- result['tx_median'] = "{:.2}dB".format(20*np.log10(tx_median))
- result['rx_median'] = "{:.2}dB".format(20*np.log10(rx_median))
+ result['tx_median'] = "{:.2f}dB".format(20*np.log10(tx_median))
+ result['rx_median'] = "{:.2f}dB".format(20*np.log10(rx_median))
result['tx_ts'] = tx_ts
result['rx_ts'] = rx_ts
result['coarse_offset'] = int(coarse_offset)
diff --git a/gui/static/js/odr-predistortion.js b/gui/static/js/odr-predistortion.js
index e13fb88..6c5f4d3 100644
--- a/gui/static/js/odr-predistortion.js
+++ b/gui/static/js/odr-predistortion.js
@@ -18,16 +18,31 @@
// You should have received a copy of the GNU General Public License
// along with ODR-DabMod. If not, see <http://www.gnu.org/licenses/>.
+function calibraterefresh() {
+ doApiRequestGET("/api/calibrate", function(data) {
+ var text = "Captured TX signal and feedback." +
+ " TX median: " + data['tx_median'] +
+ " RX median: " + data['rx_median'] +
+ " with relative timestamp offset " +
+ (data['tx_ts'] - data['rx_ts']) +
+ " and measured offset " + data['coarse_offset'] +
+ ". Correlation: " + data['correlation'];
+ $('#calibrationresults').text(text);
+ });
+}
+
$(function(){
+ $('#calibraterefreshbtn').click(calibraterefresh);
+
$('#calibratebtn').click(function() {
doApiRequestPOST("/api/calibrate", {}, function(data) {
console.log("calibrate succeeded: " + JSON.stringify(data));
+ $('#calibrationresults').text("Processing...");
+
setTimeout(function() {
- doApiRequestGET("/api/calibrate", function(data) {
- $('#calibrationresults').text(data);
- });
- }, 2000);
+ calibraterefresh();
+ }, 3000);
});
});
diff --git a/gui/templates/predistortion.html b/gui/templates/predistortion.html
index 139d982..398b4b7 100644
--- a/gui/templates/predistortion.html
+++ b/gui/templates/predistortion.html
@@ -36,6 +36,8 @@ along with ODR-DabMod. If not, see <http://www.gnu.org/licenses/>.
parameters are invalidated!</div>
<button type="button" class="btn btn-sm btn-info" id="calibratebtn">
Calibrate</button>
+ <button type="button" class="btn btn-sm btn-info" id="calibraterefreshbtn">
+ Refresh results</button>
<div>Calibration results:<span id="calibrationresults">N/A<span></div>
</div>
</div>