From 8f9dce2e94dde4aba62e0b06f26f51bbf909d183 Mon Sep 17 00:00:00 2001 From: Arnaud Watlet <arnaud.watlet@umons.ac.be> Date: Wed, 28 Feb 2024 15:01:25 +0100 Subject: [PATCH] Merges v2024_rc in merge_testing_framework --- .dev/test_mb_2023_4_mux_2023.py | 14 +- .dev/test_mb_2024_4_mux_2023.py | 17 +- .dev/test_mb_2024_4_mux_2023_dps5005.py | 18 +- .gitignore | 3 +- .gitlab-ci.yml | 11 +- .../config_mb_2024_0_2__4_mux_2023_dps5005.py | 2 +- doc/source/source_rst/hardware/hw_ohmpi.rst | 2 +- doc/source/source_rst/hardware/mb/mb_2023.rst | 4 +- doc/source/source_rst/hardware/mb/mb_2024.rst | 189 ++++++++++++++---- index.html | 22 +- run_http_interface.sh | 2 +- start_mqtt_html.py | 8 +- 12 files changed, 208 insertions(+), 84 deletions(-) diff --git a/.dev/test_mb_2023_4_mux_2023.py b/.dev/test_mb_2023_4_mux_2023.py index 059a78eb..2841a90d 100644 --- a/.dev/test_mb_2023_4_mux_2023.py +++ b/.dev/test_mb_2023_4_mux_2023.py @@ -85,11 +85,11 @@ if within_ohmpi: print('Starting test with OhmPi.') k = OhmPi() # k.get_data() - k.load_sequence(os.path.join(os.path.dirname(__file__), '../sequences/wenner16.txt')) + k.load_sequence(os.path.join(os.path.dirname(__file__), '../sequences/wenner1-16.txt')) k.reset_mux() # k.run_multiple_sequences(sequence_delay=20, nb_meas=3) - # k.run_sequence(injection_duration=0.2) - k.rs_check(tx_volt=4) + k.run_sequence(injection_duration=0.2) + # k.rs_check(tx_volt=4) # k.test_mux(mux_id=None, activation_time=0.2) # k._hw.switch_mux([A, B, M, N], state='on') # k._hw.vab_square_wave(12.,1., cycles=2) @@ -103,11 +103,11 @@ if within_ohmpi: # k._hw.switch_mux([A, B, M, N], state='off') # print(f'OhmPiHardware Resistance: {k._hw.last_rho :.2f} ohm, dev. {k._hw.last_dev:.2f} %, rx bias: {k._hw.rx._bias:.2f} mV') # k._hw._plot_readings() - A, B, M, N = (17, 20, 18, 19) + # A, B, M, N = (17, 20, 18, 19) # A, B, M, N = (1, 4, 2, 3) - d = k.run_measurement([A, B, M, N], injection_duration=0.5, nb_stack=2, duty_cycle=0.5) - print(d) - k._hw._plot_readings() + # d = k.run_measurement([A, B, M, N], injection_duration=0.5, nb_stack=2, duty_cycle=0.5) + # print(d) + # k._hw._plot_readings() # print(f'OhmPiHardware: Resistance: {k._hw.last_resistance() :.2f} ohm, dev. {k._hw.last_dev():.2f} %, sp: {k._hw.sp:.2f} mV, rx bias: {k._hw.rx._bias:.2f} mV') # print(f'OhmPi: Resistance: {d["R [ohm]"] :.2f} ohm, dev. {d["R_std [%]"]:.2f} %, rx bias: {k._hw.rx._bias:.2f} mV') # k._hw._plot_readings(save_fig=False) diff --git a/.dev/test_mb_2024_4_mux_2023.py b/.dev/test_mb_2024_4_mux_2023.py index 84d5f5ce..d0700b5a 100644 --- a/.dev/test_mb_2024_4_mux_2023.py +++ b/.dev/test_mb_2024_4_mux_2023.py @@ -91,19 +91,20 @@ if within_ohmpi: # print(f'Resistance: {k._hw.last_rho :.2f} ohm, dev. {k._hw.last_dev:.2f} %, rx bias: {k._hw.rx._bias:.2f} mV') # k._hw._plot_readings() A, B, M, N = (1, 4, 2, 3) - # k._hw.switch_mux([A, B, M, N], state='on') - # k._hw.vab_square_wave(12., cycle_duration=10., cycles=3) - # k._hw.switch_mux([A, B, M, N], state='off') + k._hw.switch_mux([A, B, M, N], state='on') + k._hw.vab_square_wave(12., cycle_duration=10., cycles=3) + k._hw.switch_mux([A, B, M, N], state='off') # print(f'OhmPiHardware Resistance: {k._hw.last_rho :.2f} ohm, dev. {k._hw.last_dev:.2f} %, rx bias: {k._hw.rx._bias:.2f} mV') - # k._hw._plot_readings() - k.load_sequence('sequences/test_circuit_1423.txt') - k.run_sequence(tx_volt=5, injection_duration=1., nb_stack=2, duty_cycle=0.5) + k._hw._plot_readings() + # k.load_sequence('sequences/test_circuit_1423.txt') + #k.load_sequence('sequences/wenner1-16.txt') + # k.run_sequence(tx_volt=5, injection_duration=1., nb_stack=2, duty_cycle=0.5) print('using OhmPi') #d = k.run_measurement([A, B, M, N], injection_duration=1., nb_stack=2, duty_cycle=0.5) #print(d) #k._hw._plot_readings() - print(f'OhmPiHardware: Resistance: {k._hw.last_resistance() :.2f} ohm, dev. {k._hw.last_dev():.2f} %, sp: {k._hw.sp:.2f} mV, rx bias: {k._hw.rx._bias:.2f} mV') - print(f'OhmPi: Resistance: {d["R [ohm]"] :.2f} ohm, dev. {d["R_std [%]"]:.2f} %, rx bias: {k._hw.rx._bias:.2f} mV') + # print(f'OhmPiHardware: Resistance: {k._hw.last_resistance() :.2f} ohm, dev. {k._hw.last_dev():.2f} %, sp: {k._hw.sp:.2f} mV, rx bias: {k._hw.rx._bias:.2f} mV') + # print(f'OhmPi: Resistance: {d["R [ohm]"] :.2f} ohm, dev. {d["R_std [%]"]:.2f} %, rx bias: {k._hw.rx._bias:.2f} mV') # k._hw._plot_readings(save_fig=False) # plot_exec_log('ohmpi/logs/exec.log') change_config('../configs/config_default.py', verbose=False) diff --git a/.dev/test_mb_2024_4_mux_2023_dps5005.py b/.dev/test_mb_2024_4_mux_2023_dps5005.py index bc1c87b7..347d670e 100644 --- a/.dev/test_mb_2024_4_mux_2023_dps5005.py +++ b/.dev/test_mb_2024_4_mux_2023_dps5005.py @@ -82,6 +82,9 @@ if within_ohmpi: k = OhmPi() # A, B, M, N = (32, 29, 31, 30) k.reset_mux() + # k.export(ftype='protocol') + # k.export(fnames=['data/measurements_20240226T180635.csv'], ftype='bert') + # k.download_data() # k.test_mux(mux_id='mux_03') # k._hw.switch_mux([A, B, M, N], state='on') # k._hw.vab_square_wave(12.,1., cycles=2) @@ -90,20 +93,23 @@ if within_ohmpi: # k._hw.rx._bias = -1.38 # print(f'Resistance: {k._hw.last_rho :.2f} ohm, dev. {k._hw.last_dev:.2f} %, rx bias: {k._hw.rx._bias:.2f} mV') # k._hw._plot_readings() - A, B, M, N = (1, 4, 2, 3) + # A, B, M, N = (1, 4, 2, 3) + # A, B, M, N = (5, 8, 6, 7) # k._hw.switch_mux([A, B, M, N], state='on') - # k._hw.vab_square_wave(12., cycle_duration=10., cycles=3) + # k._hw.vab_square_wave(5., cycle_duration=0.500, cycles=2, duty_cycle=0.5) # k._hw.switch_mux([A, B, M, N], state='off') # print(f'OhmPiHardware Resistance: {k._hw.last_rho :.2f} ohm, dev. {k._hw.last_dev:.2f} %, rx bias: {k._hw.rx._bias:.2f} mV') + # if k._hw.sp is None: + # k._hw.sp = 0 # if not off-time, sp is None # k._hw._plot_readings() - k.load_sequence('sequences/test_circuit_1423.txt') - k.run_sequence(tx_volt=5, injection_duration=1., nb_stack=2, duty_cycle=0.5) + # k.load_sequence('sequences/test_circuit_1423.txt') + # k.run_sequence(tx_volt=5, injection_duration=1., nb_stack=2, duty_cycle=0.5) print('using OhmPi') #d = k.run_measurement([A, B, M, N], injection_duration=1., nb_stack=2, duty_cycle=0.5) #print(d) #k._hw._plot_readings() - print(f'OhmPiHardware: Resistance: {k._hw.last_resistance() :.2f} ohm, dev. {k._hw.last_dev():.2f} %, sp: {k._hw.sp:.2f} mV, rx bias: {k._hw.rx._bias:.2f} mV') - print(f'OhmPi: Resistance: {d["R [ohm]"] :.2f} ohm, dev. {d["R_std [%]"]:.2f} %, rx bias: {k._hw.rx._bias:.2f} mV') + # print(f'OhmPiHardware: Resistance: {k._hw.last_resistance() :.2f} ohm, dev. {k._hw.last_dev():.2f} %, sp: {k._hw.sp:.2f} mV, rx bias: {k._hw.rx._bias:.2f} mV') + # print(f'OhmPi: Resistance: {d["R [ohm]"] :.2f} ohm, dev. {d["R_std [%]"]:.2f} %, rx bias: {k._hw.rx._bias:.2f} mV') # k._hw._plot_readings(save_fig=False) # plot_exec_log('ohmpi/logs/exec.log') change_config('../configs/config_default.py', verbose=False) diff --git a/.gitignore b/.gitignore index 72d06a5c..d5ab81ab 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ ohmpy/* logs/* sequence.txt /Proposition interface.odp - +doc/build/* +doc/_static/*.pdf \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index de4de2c6..5ec294e7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,16 +6,13 @@ pages: stage: deploy script: - apt-get update - - apt-get install --assume-yes pandoc - - pip install numpy pandas termcolor paho-mqtt zmq # top import of Ohmpi.py + - apt-get install --assume-yes pandoc latexmk texlive-latex-extra + - pip install numpy pandas termcolor paho-mqtt zmq tqdm # top import of Ohmpi.py - pip install sphinx numpydoc sphinx_rtd_theme pandoc recommonmark linuxdoc - - cp configs/config_default.py ohmpi/config.py # only compile doc with dummy if not on rpi with correct config.py - cd doc + - make latexpdf + - mv build/latex/ohmpi.pdf source/_static/ohmpi.pdf - make html - - # also make latexpdf (to be tested) -# - make latexpdf -# - mv build/latex/ohmpi.pdf source/_static/ohmpi.pdf - cd .. - mv doc/build/html/ public/ - ls public/ diff --git a/configs/config_mb_2024_0_2__4_mux_2023_dps5005.py b/configs/config_mb_2024_0_2__4_mux_2023_dps5005.py index 57cd2686..d555152d 100644 --- a/configs/config_mb_2024_0_2__4_mux_2023_dps5005.py +++ b/configs/config_mb_2024_0_2__4_mux_2023_dps5005.py @@ -64,7 +64,7 @@ HARDWARE_CONFIG = { 'electrodes': range(1, 65), } }, - 'default': {'interface_name': 'i2c_ext', + 'default': {'interface_name': 'i2c', 'voltage_max': 50., 'current_max': 3.} } diff --git a/doc/source/source_rst/hardware/hw_ohmpi.rst b/doc/source/source_rst/hardware/hw_ohmpi.rst index 6212902c..c4c6bd2e 100644 --- a/doc/source/source_rst/hardware/hw_ohmpi.rst +++ b/doc/source/source_rst/hardware/hw_ohmpi.rst @@ -10,7 +10,7 @@ Today, version 1.0x is no longer maintained, but all boards from v2023 upwards a Depending on your needs and applications, you can choose the board you are going to use. -Recommanded configurations +Recommended configurations ****************************** +-------------------------------+--------------------------------+--------------------+--------------------------+--------------------------+--------------------------------------------------+ diff --git a/doc/source/source_rst/hardware/mb/mb_2023.rst b/doc/source/source_rst/hardware/mb/mb_2023.rst index 84509fa1..f692842e 100644 --- a/doc/source/source_rst/hardware/mb/mb_2023.rst +++ b/doc/source/source_rst/hardware/mb/mb_2023.rst @@ -456,7 +456,7 @@ Setting up an equivalent electronic circuit, for this you will need: +--------+-------------------------------------------------------------------------------+ | | .. image:: ../../../img/v2023.x.x/step_n_2/c/thonny_first_interface.jpg | - |7 +-------------------------------------------------------------------------------+ + |8 +-------------------------------------------------------------------------------+ | | Run the Thonny Interpreter | | | | +--------+-------------------------------------------------------------------------------+ @@ -467,7 +467,7 @@ Setting up an equivalent electronic circuit, for this you will need: +--------+------------------------------------------------------------------------------+ | | .. image:: ../../../img/v2023.x.x/step_n_2/c/20211206_144334.jpg | - |7 +------------------------------------------------------------------------------+ + |9 +------------------------------------------------------------------------------+ | | Run sample_measurement_example.py example, if everything | | | works you should get the following result (220 Ohm) | +--------+------------------------------------------------------------------------------+ diff --git a/doc/source/source_rst/hardware/mb/mb_2024.rst b/doc/source/source_rst/hardware/mb/mb_2024.rst index 42a30815..80c40144 100644 --- a/doc/source/source_rst/hardware/mb/mb_2024.rst +++ b/doc/source/source_rst/hardware/mb/mb_2024.rst @@ -22,59 +22,61 @@ Assembly of the measurement board Schematics ~~~~~~~~~~ -Overview of the measurement board. -.. figure:: ../../../img/mb.2024.x.x/mb.2024.0.2_page-0001.jpg - :width: 600px - :align: center - :height: 450px - :alt: alternate text - :figclass: align-center -Schematic of the power supply. +.. figure:: ../../../img/mb.2024.x.x/mb.2024.0.2_page-0001.jpg + :width: 600px + :align: center + :height: 450px + :alt: alternate text + :figclass: align-center + + Overview of the measurement board. .. figure:: ../../../img/mb.2024.x.x/mb.2024.0.2_page-0002.jpg - :width: 600px - :align: center - :height: 450px - :alt: alternate text - :figclass: align-center + :width: 600px + :align: center + :height: 450px + :alt: alternate text + :figclass: align-center -Schematic of the DPS (digital power source) power supply. + Schematic of the power supply. .. figure:: ../../../img/mb.2024.x.x/mb.2024.0.2_page-0003.jpg - :width: 600px - :align: center - :height: 450px - :alt: alternate text - :figclass: align-center + :width: 600px + :align: center + :height: 450px + :alt: alternate text + :figclass: align-center -Schematic of the Vmn signal conditioning. + Schematic of the DPS (digital power source) power supply. .. figure:: ../../../img/mb.2024.x.x/mb.2024.0.2_page-0004.jpg - :width: 600px - :align: center - :height: 450px - :alt: alternate text - :figclass: align-center + :width: 600px + :align: center + :height: 450px + :alt: alternate text + :figclass: align-center -Schematic of the current injection and measurement. + Schematic of the Vmn signal conditioning. .. figure:: ../../../img/mb.2024.x.x/mb.2024.0.2_page-0005.jpg - :width: 600px - :align: center - :height: 450px - :alt: alternate text - :figclass: align-center + :width: 600px + :align: center + :height: 450px + :alt: alternate text + :figclass: align-center -Schematic of the human-machine interface. + Schematic of the current injection and measurement. .. figure:: ../../../img/mb.2024.x.x/mb.2024.0.2_page-0006.jpg - :width: 600px - :align: center - :height: 450px - :alt: alternate text - :figclass: align-center + :width: 600px + :align: center + :height: 450px + :alt: alternate text + :figclass: align-center + + Schematic of the human-machine interface. Required components ~~~~~~~~~~~~~~~~~~~~ @@ -104,6 +106,7 @@ Description Soldering various `RESISTOR <https://eepower.com/resistor-guide/resistor-fundamentals/what-is-a-resistor/#>`_ on the measurement board PCB + .. table:: :align: center @@ -113,12 +116,22 @@ Soldering various `RESISTOR <https://eepower.com/resistor-guide/resistor-fundame | | Soldering thirteen 100 kOhm resistors | | | | +--------+-------------------------------------------------------------------+ + +.. table:: + :align: center + + +--------+-------------------------------------------------------------------+ | | .. image:: ../../../img/mb.2024.x.x/2.jpg | | | | | 2 +-------------------------------------------------------------------+ | | Soldering four 330 ohm resistors | | | | +--------+-------------------------------------------------------------------+ + +.. table:: + :align: center + + +--------+-------------------------------------------------------------------+ | | .. image:: ../../../img/mb.2024.x.x/3.jpg | | 3 +-------------------------------------------------------------------+ | | Soldering four 4K7 ohm resistors | @@ -149,36 +162,71 @@ Soldering `SCHOTTKY DIODE <https://www.electronics-tutorials.ws/diode/schottky-d | | Soldering two Schottky diodes bat85 ou bat86 | | | | +--------+-------------------------------------------------------------------+ + +.. table:: + :align: center + + +--------+-------------------------------------------------------------------+ | | .. image:: ../../../img/mb.2024.x.x/6.jpg | | 6 +-------------------------------------------------------------------+ | | Soldering five DIP-8 sockets | | | | +--------+-------------------------------------------------------------------+ + +.. table:: + :align: center + + +--------+-------------------------------------------------------------------+ | | .. image:: ../../../img/mb.2024.x.x/7.jpg | | 7 +-------------------------------------------------------------------+ | | Soldering two DIP-18 sockets | | | | +--------+-------------------------------------------------------------------+ + +.. table:: + :align: center + + +--------+-------------------------------------------------------------------+ | | .. image:: ../../../img/mb.2024.x.x/8.jpg | | 8 +-------------------------------------------------------------------+ | | Soldering one DIP-16 sockets | | | | +--------+-------------------------------------------------------------------+ + +.. table:: + :align: center + + +--------+-------------------------------------------------------------------+ | | .. image:: ../../../img/mb.2024.x.x/9.jpg | | 9 +-------------------------------------------------------------------+ | | Soldering twelve cut sockets for 3 THD | | | | +--------+-------------------------------------------------------------------+ + +.. table:: + :align: center + + +--------+-------------------------------------------------------------------+ | | .. image:: ../../../img/mb.2024.x.x/10.jpg | | 10 +-------------------------------------------------------------------+ | | Soldering header socket 1 row 10 positions | | | | +--------+-------------------------------------------------------------------+ + +.. table:: + :align: center + + +--------+-------------------------------------------------------------------+ | | .. image:: ../../../img/mb.2024.x.x/11.jpg | | 11 +-------------------------------------------------------------------+ | | Soldering two header sockets with 1 row and 8 positions | | | | +--------+-------------------------------------------------------------------+ + +.. table:: + :align: center + + +--------+-------------------------------------------------------------------+ | | .. image:: ../../../img/mb.2024.x.x/12.jpg | | 12 +-------------------------------------------------------------------+ | | Soldering 1 header (1 row, 2 positions -> cut a bigger one), | @@ -224,6 +272,11 @@ What is a `CAPACITOR <https://en.wikipedia.org/wiki/Capacitor>`_? | | Soldering eleven 100 nF 50V tantalum capacitors | | | | +--------+-------------------------------------------------------------------+ + +.. table:: + :align: center + + +--------+-------------------------------------------------------------------+ | | .. image:: ../../../img/mb.2024.x.x/16.jpg | | 16 +-------------------------------------------------------------------+ | | Soldering ten 10 µF 50V Electrolytic capacitors, **pay attention**| @@ -245,22 +298,42 @@ What is a `CAPACITOR <https://en.wikipedia.org/wiki/Capacitor>`_? | | Soldering the 2 ohms shunt resistor | | | | +--------+-------------------------------------------------------------------+ + +.. table:: + :align: center + + +--------+-------------------------------------------------------------------+ | | .. image:: ../../../img/mb.2024.x.x/18.jpg | | 18 +-------------------------------------------------------------------+ | | Soldering the two IDC 6 pins connectors. | | | **pay attention to the connectors orientation** | | | | +--------+-------------------------------------------------------------------+ + +.. table:: + :align: center + + +--------+-------------------------------------------------------------------+ | | .. image:: ../../../img/mb.2024.x.x/19.jpg | | 19 +-------------------------------------------------------------------+ | | Soldering six screw terminals for cable connection | | | | +--------+-------------------------------------------------------------------+ + +.. table:: + :align: center + + +--------+-------------------------------------------------------------------+ | | .. image:: ../../../img/mb.2024.x.x/20.jpg | | 20 +-------------------------------------------------------------------+ | | Soldering six omron G5LE relays 5 VDC | | | | +--------+-------------------------------------------------------------------+ + +.. table:: + :align: center + + +--------+-------------------------------------------------------------------+ | | .. image:: ../../../img/mb.2024.x.x/21.jpg | | 21 +-------------------------------------------------------------------+ | | Soldering the 2x20 header for connection with the raspberry GPIO | @@ -271,6 +344,8 @@ What is a `Op-Amp <https://en.wikipedia.org/wiki/Operational_amplifier>`_? In addition, the notch provides a way to visually identify the orientation of the package. +.. table:: + :align: center +--------+-------------------------------------------------------------------+ | | .. image:: ../../../img/mb.2024.x.x/22.jpg | @@ -279,6 +354,11 @@ In addition, the notch provides a way to visually identify the orientation of th | | **the notch must face upwards** | | | | +--------+-------------------------------------------------------------------+ + +.. table:: + :align: center + + +--------+-------------------------------------------------------------------+ | | .. image:: ../../../img/mb.2024.x.x/23.jpg | | 23 +-------------------------------------------------------------------+ | | Place the REF03 reference voltage (2.5v) on its DIP-8 socket | @@ -287,41 +367,74 @@ In addition, the notch provides a way to visually identify the orientation of th +--------+-------------------------------------------------------------------+ What is an `analogue switch <https://en.wikipedia.org/wiki/Analogue_switch>`_? - + +.. table:: + :align: center + +--------+-------------------------------------------------------------------+ | | .. image:: ../../../img/mb.2024.x.x/24.jpg | | 24 +-------------------------------------------------------------------+ | | Place the DG411 **the notch must face the left side** | | | | +--------+-------------------------------------------------------------------+ + +.. table:: + :align: center + + +--------+-------------------------------------------------------------------+ | | .. image:: ../../../img/mb.2024.x.x/25.jpg | | 25 +-------------------------------------------------------------------+ | | Place the MCP23008 on its DIP-16 socket | | | **pay attention to the notches orientation** | | | | +--------+-------------------------------------------------------------------+ + +.. table:: + :align: center + + +--------+-------------------------------------------------------------------+ | | .. image:: ../../../img/mb.2024.x.x/26.jpg | | 26 +-------------------------------------------------------------------+ | | Place the Three THD, install the right reference at | | | the right place according to the yellow boxes | | | | +--------+-------------------------------------------------------------------+ + +.. table:: + :align: center + + +--------+-------------------------------------------------------------------+ | | .. image:: ../../../img/mb.2024.x.x/27.jpg | | 27 +-------------------------------------------------------------------+ | | Place the ADS1115 board on its female header 1x10 pins | | | | +--------+-------------------------------------------------------------------+ + +.. table:: + :align: center + + +--------+-------------------------------------------------------------------+ | | .. image:: ../../../img/mb.2024.x.x/28.jpg | | 28 +-------------------------------------------------------------------+ | | Place the two I2C level adjusters | | | | +--------+-------------------------------------------------------------------+ + +.. table:: + :align: center + + +--------+-------------------------------------------------------------------+ | | .. image:: ../../../img/mb.2024.x.x/29.jpg | | 29 +-------------------------------------------------------------------+ | | Place the I2C isolator add-on board | | | **make sure you have right selection** according to the red box | | | | +--------+-------------------------------------------------------------------+ + +.. table:: + :align: center + + +--------+-------------------------------------------------------------------+ | | .. image:: ../../../img/mb.2024.x.x/30.jpg | | 30 +-------------------------------------------------------------------+ | | Place the current click add-on board | diff --git a/index.html b/index.html index 21caa76d..c4ebc192 100755 --- a/index.html +++ b/index.html @@ -33,6 +33,7 @@ mosquitto_sub -h raspberrypi.local -t ohmpi_0001/ctrl <!-- <button id="removeDataBtn" type="button" class="btn btn-danger">Clear data</button> --> <button id="rmDataModal" type="button" class="btn btn-danger" data-toggle="modal" data-target="#rmModal">Clear data</button> <button id="getDataBtn" type="button" class="btn btn-info">Get data</button> + <div><b id='connection'>Connecting...</b></div> <div class="form-check"> <input id="dataRetrievalCheck" class="form-check-input" type="checkbox" value=""> <label class="form-check-label" for="dataRetrievalCheck"> @@ -189,13 +190,16 @@ mosquitto_sub -h raspberrypi.local -t ohmpi_0001/ctrl let commands = {} // store commands and their id let callbacks = {} // store callback (might not be needed) let invertedData = [{ - rho: [[10, 10.625, 12.5, 15.625, 20], - [5.625, 6.25, 8.125, 11.25, 15.625], - [2.5, 3.125, 5., 8.125, 12.5], - [0.625, 1.25, 3.125, 6.25, 10.625], - [0, 0.625, 2.5, 5.625, 10]], - x: [-9, -6, -5 , -3, -1], - y: [0, 1, 4, 5, 7], + // rho: [[10, 10.625, 12.5, 15.625, 20], + // [5.625, 6.25, 8.125, 11.25, 15.625], + // [2.5, 3.125, 5., 8.125, 12.5], + // [0.625, 1.25, 3.125, 6.25, 10.625], + // [0, 0.625, 2.5, 5.625, 10]], + // x: [-9, -6, -5 , -3, -1], + // y: [0, 1, 4, 5, 7], + rho: [], + x: [], + y: [] }] // store inverted data // function with MQTT @@ -227,9 +231,11 @@ mosquitto_sub -h raspberrypi.local -t ohmpi_0001/ctrl message = new Paho.MQTT.Message("Hello from index.html") message.destinationName = topic_ctrl client.send(message) + document.getElementById('connection').innerText = 'Connected' } function onConnectionLost(responseObject) { + document.getElementById('connection').innerText = 'Connecting...' if (responseObject.errorCode !== 0) console.log("onConnectionLost:" + responseObject.errorMessage) console.log("trying to reconnect...") @@ -660,7 +666,7 @@ mosquitto_sub -h raspberrypi.local -t ohmpi_0001/ctrl surveySelect.value = surveyNames[surveyNames.length - 1] // call the function directly - // (as progammatically chaging the value does not trigger the event) + // (as progammatically changing the value does not trigger the event) surveySelectFunc({'target': surveySelect}) // update list of survey for inversion diff --git a/run_http_interface.sh b/run_http_interface.sh index 0dabb4f0..a4958962 100755 --- a/run_http_interface.sh +++ b/run_http_interface.sh @@ -1,3 +1,3 @@ export PYTHONPATH=`pwd` source $PYTHONPATH/ohmpy/bin/activate -python3 start_mqtt_html.py +python start_mqtt_html.py diff --git a/start_mqtt_html.py b/start_mqtt_html.py index 7e5ec9ea..6c59c7fe 100644 --- a/start_mqtt_html.py +++ b/start_mqtt_html.py @@ -5,7 +5,7 @@ from ohmpi.utils import change_config # change_config('../configs/config_mb_2023.py', verbose=False) # change_config('../configs/config_mb_2023__4_mux_2023.py', verbose=False) -#change_config('../configs/config_mb_2024_0_2__4_mux_2023_dps5005.py', verbose=False) +# change_config('../configs/config_mb_2024_0_2__4_mux_2023_dps5005.py', verbose=False) # start html interface import subprocess @@ -16,9 +16,9 @@ try: from ohmpi.ohmpi import OhmPi from ohmpi.config import OHMPI_CONFIG k = OhmPi(settings=OHMPI_CONFIG['settings']) - import os - k.load_sequence(os.path.join(os.path.dirname(__file__), './sequences/wenner16.txt')) - k.reset_mux() + # import os + # k.load_sequence(os.path.join(os.path.dirname(__file__), './sequences/wenner1-16.txt')) + # k.reset_mux() #k.run_multiple_sequences(sequence_delay=20, nb_meas=3) if k.controller is not None: -- GitLab