From e12f1f2ff881006f06f4cf8efd379984ae66ea16 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Mon, 4 Mar 2019 14:08:09 +0100 Subject: [PATCH] pyterm: add /sleep function The init_cmd feature is quite handy for automated pyterm runs but there is no delay between the commands that are executed. This adds a /sleep function that can be added between init_cmd commands to prevent them from overflowing the RX buffer on the target. --- dist/tools/pyterm/pyterm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dist/tools/pyterm/pyterm b/dist/tools/pyterm/pyterm index 617d1d3d62..24c39aa55f 100755 --- a/dist/tools/pyterm/pyterm +++ b/dist/tools/pyterm/pyterm @@ -303,6 +303,14 @@ class SerCmd(cmd.Cmd): date = time.strftime("%Y-%m-%d %H:%M:%S") return ["%s" % (date)] + def do_PYTERM_sleep(self, line): + """Pyterm command: Sleep for n seconds. + """ + if line: + time.sleep(float(line)) + else: + self.logger.error("sleep: missing operand") + def do_PYTERM_reset(self, line): """Pyterm command: Send a reset to the node. """