diff --git a/dstat_interface/core/dstat/experiment_process.py b/dstat_interface/core/dstat/experiment_process.py index b82ea0b6ae6d82e191a074b512b2cef2c7716472..98501a49ce3fddd6df1c48b7c7274481f402cb4c 100644 --- a/dstat_interface/core/dstat/experiment_process.py +++ b/dstat_interface/core/dstat/experiment_process.py @@ -123,22 +123,22 @@ class BaseExperimentProcess(ABC): logger.warning("Expected RQP %s got: %s", n_params, reply) continue - tries = 5 - for i in params: - while True: + tries = 5 + while tries: self.serial.write(f"{i} ".encode('ascii')) try: reply = get_reply() if reply == f"@RCVC {i}": break - except serial.SerialException: - if tries <= 0: + elif reply == "@RCVE": continue + except serial.SerialException: tries -= 1 - pass - else: - break + continue + else: + logger.error('Communication failure') + return False return True return False