diff --git a/SiliconTorch/floatOut.py b/SiliconTorch/floatOut.py index f6c78c5b53921579f69cdc4b14233b5c23c49307..26ffa6ff43071c5d07ba430b41bb539dafbc71c0 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 1f3b4df523a5e74db51a55fdd88280c0cee6504b..8cd4f1a8809ef47a14ff038e780b953c7be81803 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)