From c3f12611d81af4d1a6e513510edee64aae7607a7 Mon Sep 17 00:00:00 2001 From: Jochen Vothknecht <jochen3120@gmail.com> Date: Mon, 6 Dec 2021 21:22:41 +0100 Subject: [PATCH] =?UTF-8?q?=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SiliconTorch/floatOut.py | 18 +++++++++++++++--- SiliconTorch/fxCyanF.py | 6 +++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/SiliconTorch/floatOut.py b/SiliconTorch/floatOut.py index f6c78c5..26ffa6f 100755 --- a/SiliconTorch/floatOut.py +++ b/SiliconTorch/floatOut.py @@ -35,11 +35,23 @@ def send(x): pass -t = 2 * 60**2 # seconds -countDown = True +t = 1 * 60**2 # seconds -bits = 10 +if len(sys.argv) > 1: + if sys.argv[1] == 'up': + countDown = False + else: + countDown = True +else: + countDown = True + + +if len(sys.argv) > 2: + t = int(sys.argv[2]) * 60 + + +bits = 16 step = 2**bits / t / 10 / 2**bits print('step: ' + str(step)) diff --git a/SiliconTorch/fxCyanF.py b/SiliconTorch/fxCyanF.py index 1f3b4df..8cd4f1a 100644 --- a/SiliconTorch/fxCyanF.py +++ b/SiliconTorch/fxCyanF.py @@ -34,7 +34,7 @@ class Sender: return struct.pack('f' * len(channels), *channels) @classmethod - def _sendUDP(cls, data, host, port): + def _sendUDP(cls, data: bytearray, host: str, port: int = DEFAULT.port): try: cls._socket.sendto(data, (host, port)) except: @@ -42,13 +42,13 @@ class Sender: pass @classmethod - def sendTo(cls, channels, host, port): + def sendTo(cls, channels: list, host: str, port: int = DEFAULT.port): data = DEFAULT.header data += Sender._convertData(channels) cls._sendUDP(data, host, port) - def send(self, channels): + def send(self, channels: list): Sender.sendTo(channels, self._host, self._port) -- GitLab