diff --git a/index-mqtt.html b/index-mqtt.html index e90f129f3271c51698a607f6b2d0248fbdc13c77..29ff1906ace618014b935ec0ca14238cea54532e 100755 --- a/index-mqtt.html +++ b/index-mqtt.html @@ -9,7 +9,7 @@ mosquitto_sub -h raspberrypi.local -t ohmpi_0001/ctrl <link rel="shortcut icon" type="image/jpg" href="logo_ohmpi.jpg"/> <!-- dependencies (need to be local as no internet in AP mode)--> - <script src="js/plotly-basic-2.8.3.min.js"></script> + <script src="js/plotly-2.26.0.min.js"></script> <script src="js/jquery-3.4.1.min.js"></script> <link type="text/css" href="css/bootstrap.min.css" rel="stylesheet"> <!-- <script src="https://code.jquery.com/jquery-3.4.1.min.js"></script> --> @@ -156,7 +156,7 @@ mosquitto_sub -h raspberrypi.local -t ohmpi_0001/ctrl let squads = [] // selected quadrupoles for time-serie figure let commands = {} // store commands and their id let callbacks = {} // store callback (might not be needed) - let invertData = [{ + 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], @@ -509,8 +509,7 @@ mosquitto_sub -h raspberrypi.local -t ohmpi_0001/ctrl processData(ddic) } else { // inversion related - console.log('--------', ddic) - let invertData = ddic[0] + invertedData = ddic showInvFunc() } } @@ -626,10 +625,10 @@ mosquitto_sub -h raspberrypi.local -t ohmpi_0001/ctrl let cmin = document.getElementById('cminInv').value let cmax = document.getElementById('cmaxInv').value - var data = [{ - z: invertData[0]['rho'], - x: invertData[0]['x'], - y: invertData[0]['z'], + var invData = [{ + z: invertedData[0]['rho'], + x: invertedData[0]['x'], + y: invertedData[0]['z'], type: 'contour', colorscale: 'Jet', autocontour: true, // set to false if cmin is given @@ -640,7 +639,7 @@ mosquitto_sub -h raspberrypi.local -t ohmpi_0001/ctrl }, }] - var layout = { + var invLayout = { title: 'Inverted section', yaxis: { title: 'Z [m]', @@ -649,8 +648,10 @@ mosquitto_sub -h raspberrypi.local -t ohmpi_0001/ctrl title: 'X [m]' } } - Plotly.newPlot('inv', data, layout) + + Plotly.newPlot('inv', invData, invLayout) } + showInvFunc() //invert data function invertBtnFunc() { diff --git a/ohmpi/config.py b/ohmpi/config.py index 0763f48ca2240311e01b281a1eea9571c324defd..8bd970d8096ec3515ced1a1c9d11ea5e2aeabbc7 100644 --- a/ohmpi/config.py +++ b/ohmpi/config.py @@ -1,7 +1,7 @@ import logging from ohmpi.utils import get_platform -from paho.mqtt.client import MQTTv31 +from paho.mqtt.client import MQTTv31 # noqa _, on_pi = get_platform() # DEFINE THE ID OF YOUR OhmPi @@ -18,25 +18,34 @@ OHMPI_CONFIG = { } HARDWARE_CONFIG = { - 'ctl': {'model' : 'dummy_ctl' - }, - 'tx' : {'model' : 'dummy_tx', - 'current_max': 4800 / 50 / 2, # Maximum current mA - 'r_shunt': 2, # Shunt resistance in Ohms - 'low_battery': 12. # Volts + 'ctl': {'model': 'raspberry_pi'}, + 'pwr': {'model': 'pwr_batt', 'voltage': 12., 'interface_name': 'none'}, + 'tx': {'model': 'mb_2023_0_X', + 'voltage_max': 12., # Maximum voltage supported by the TX board [V] + 'adc_voltage_max': 4800., # Maximum voltage read by the current ADC on the TX board [mA] + 'r_shunt': 2., # Shunt resistance in Ohms + 'interface_name': 'i2c', }, - 'rx' : {'model': 'dummy_rx', + 'rx': {'model': 'mb_2023_0_X', + 'coef_p2': 2.50, # slope for conversion for ADS, measurement in V/V + 'sampling_rate': 50., # number of samples per second + 'interface_name': 'i2c', }, - 'mux': {'model' : 'dummy_mux', - 'max_elec': 64, - 'voltage_max' : 100, - 'current_max' : 3 - } + 'mux': # default properties given in config are system properties that will be + # overwritten by properties defined in each the board dict below. + # if defined in board specs, values out of specs will be bounded to remain in specs + # omitted properties in config will be set to board specs default values if they exist + {'boards': {}, + 'default': {'interface_name': 'i2c', + 'voltage_max': 100., + 'current_max': 3.} + } } + # SET THE LOGGING LEVELS, MQTT BROKERS AND MQTT OPTIONS ACCORDING TO YOUR NEEDS # Execution logging configuration EXEC_LOGGING_CONFIG = { - 'logging_level': logging.INFO, + 'logging_level': logging.DEBUG, # TODO: set logging level back to INFO 'log_file_logging_level': logging.DEBUG, 'logging_to_console': True, 'file_name': f'exec{logging_suffix}.log', @@ -60,8 +69,8 @@ DATA_LOGGING_CONFIG = { # State of Health logging configuration (For a future release) SOH_LOGGING_CONFIG = { 'logging_level': logging.INFO, - 'log_file_logging_level': logging.DEBUG, 'logging_to_console': True, + 'log_file_logging_level': logging.DEBUG, 'file_name': f'soh{logging_suffix}.log', 'max_bytes': 16777216, 'backup_count': 1024,