diff --git a/fw/.gdbinit b/fw/.gdbinit index e9e2a22..08c9f69 100644 --- a/fw/.gdbinit +++ b/fw/.gdbinit @@ -2,6 +2,7 @@ target remote localhost:3333 set print pretty on set print elements 512 +set pagination off # Update GDB's Python paths with the `sys.path` values of the local Python installation, # whether that is brew'ed Python, a virtualenv, or another system python. @@ -22,8 +23,12 @@ break debug_plot_hook commands dump binary memory /tmp/adc1_readings.bin adc1_readings adc1_readings+(sizeof(adc1_readings)/sizeof(*adc1_readings)) dump binary memory /tmp/adc2_readings.bin adc2_readings adc2_readings+(sizeof(adc1_readings)/sizeof(*adc1_readings)) + restore /tmp/dbg_settings.bin binary &dbg_settings + p/x dbg_settings cont end +dump binary memory /tmp/dbg_settings.bin &dbg_settings &dbg_settings+1 + load cont diff --git a/fw/adc_serve.py b/fw/adc_serve.py index 11fd9f9..66ff2b0 100644 --- a/fw/adc_serve.py +++ b/fw/adc_serve.py @@ -4,6 +4,7 @@ import logging from pathlib import Path import base64 import threading +import struct import numpy as np from flask import Flask, render_template, url_for @@ -14,6 +15,13 @@ app = Flask(__name__) sock = SocketIO(app) app.logger.setLevel(logging.INFO) +dbg_settings = { + 'mesh_flip': False, + 'mesh_flip_n': True, + 'rf_term': False, + 'rf_term_short': False, + } + @app.route('/') def index(): return render_template('index.html') @@ -37,6 +45,15 @@ def watch_adc_graphs(sock): adc_thr = threading.Thread(target=handler, daemon=True) adc_thr.start() +@sock.on('dev_settings') +def handle(data): + dbg_settings.update(data) + out = 0 + for i, key in enumerate(['mesh_flip_n', 'mesh_flip', 'rf_term', 'rf_term_short']): + if dbg_settings[key]: + out |= 1<BSRR = 1<<4; + } else { + GPIOC->BRR = 1<<4; + } + if (dbg_settings & DBG_MESH_FLIP_N) { + GPIOB->BSRR = 1<<1; + } else { + GPIOB->BRR = 1<<1; + } + if (dbg_settings & DBG_RF_TERM) { + GPIOC->BSRR = 1<<14; + } else { + GPIOC->BRR = 1<<14; + } + if (dbg_settings & DBG_RF_TERM_SHORT) { + GPIOC->BSRR = 1<<15; + } else { + GPIOC->BRR = 1<<15; + } } int main(void) { diff --git a/fw/templates/index.html b/fw/templates/index.html index d638d00..09a6e61 100644 --- a/fw/templates/index.html +++ b/fw/templates/index.html @@ -16,32 +16,235 @@ +

Device settings

+
+ + + + +
+

ADC 1

+
+
Threshold
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
101001000
Mean [ns]
Stdev [ps]
Min [ns]
Max [ns]
+
+
+

ADC 2

+
+
Threshold
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
101001000
Mean [ns]
Stdev [ps]
Min [ns]
Max [ns]
+
+