From 0a785033765bde000affbc6885ab644222539f2b Mon Sep 17 00:00:00 2001 From: "rpi2.0" <rpi2.0> Date: Fri, 28 Oct 2022 14:56:05 +0200 Subject: [PATCH] Fixes issue on play and stop buttons on http interface --- config.py | 8 ++++---- example_simple_measurement.py | 8 +++++--- http_interface.py | 1 - ohmpi.py | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/config.py b/config.py index 9345d1d9..60db22e5 100644 --- a/config.py +++ b/config.py @@ -21,10 +21,10 @@ OHMPI_CONFIG = { 'board_version': '22.10' } # TODO: add a dictionary with INA models and associated gain values -# CONTROL_CONFIG = { -# 'tcp_port': 5555, -# 'interface': 'mqtt_interface.py' # 'http_interface' -# } +CONTROL_CONFIG = { + 'tcp_port': 5555, + 'interface': 'mqtt_interface.py' # 'http_interface' +} # Execution logging configuration EXEC_LOGGING_CONFIG = { 'logging_level': logging.DEBUG, diff --git a/example_simple_measurement.py b/example_simple_measurement.py index 2a5d5093..ee795b18 100644 --- a/example_simple_measurement.py +++ b/example_simple_measurement.py @@ -16,8 +16,10 @@ k.sequence = np.array([[1,2,3,4]]) #Â set numpy array of shape (n,4) # k.load_sequence('ABMN.txt') # load sequence from a local file ### Run contact resistance check -k.rs_check() +#Â k.rs_check() ### Run sequence -k.run_sequence() -#Â k.interrupt() \ No newline at end of file +k.run_sequence() +# k.run_sequence_async() +# time.sleep(2) +# k.interrupt() \ No newline at end of file diff --git a/http_interface.py b/http_interface.py index bc0e71f3..4a42e878 100644 --- a/http_interface.py +++ b/http_interface.py @@ -95,7 +95,6 @@ class MyServer(SimpleHTTPRequestHandler): payload = json.dumps({'cmd_id': cmd_id, 'cmd': 'run_sequence'}) publish.single(payload=payload, **publisher_config) elif dic['cmd'] == 'interrupt': - # ohmpi.stop() payload = json.dumps({'cmd_id': cmd_id, 'cmd': 'interrupt'}) publish.single(payload=payload, **publisher_config) elif dic['cmd'] == 'getData': diff --git a/ohmpi.py b/ohmpi.py index ed1f456c..4fe8ac6e 100644 --- a/ohmpi.py +++ b/ohmpi.py @@ -1013,7 +1013,7 @@ class OhmPi(object): self.exec_logger.warning(f'Unable to set sequence: {e}') status = False elif cmd == 'run_sequence': - self.run_sequence(cmd_id) + self.run_sequence_async(cmd_id) while not self.status == 'idle': time.sleep(0.1) status = True -- GitLab