From 73356ff845e53f0cf7e77eb46990864affb9b6ba Mon Sep 17 00:00:00 2001 From: deimi Date: Thu, 21 Nov 2019 07:20:51 +0100 Subject: [PATCH 1/2] fix: check if intseq is active before sending --- src/BinarySend.py | 16 ++++++++++------ src/ExecShell.js | 10 +++++----- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/BinarySend.py b/src/BinarySend.py index 9fc7478..2a80ce7 100644 --- a/src/BinarySend.py +++ b/src/BinarySend.py @@ -17,11 +17,12 @@ cmdLen = 40 def init_code(): - print 'init seq' - GPIO.output(pin, 1) - sleep(initHigh) - GPIO.output(pin, 0) - sleep(initLow) + if initSeq == True: + print 'init seq' + GPIO.output(pin, 1) + sleep(initHigh) + GPIO.output(pin, 0) + sleep(initLow) def transmit_code(command): print 'transmit' @@ -105,7 +106,10 @@ def main(argsv): boardType = GPIO.BCM elif opt == '-o': global initSeq - initSeq = arg.upper() == 'TRUE' + if (arg.upper() == 'TRUE') or (arg.upper() == ' TRUE'): + initSeq = True + else: + initSeq = False elif opt == '-d': global initLow initLow = float(arg) / 1000000 diff --git a/src/ExecShell.js b/src/ExecShell.js index f70c921..cd757ef 100644 --- a/src/ExecShell.js +++ b/src/ExecShell.js @@ -28,25 +28,25 @@ ExecShell.prototype.getParams = function (config) { } if (Number.parseFloat(config.initTimeHigh) < 0) { - throw 'Initialization bit timing needs to be >= 0'; + throw 'Initialization bit timing high needs to be >= 0'; } else { params.push('-u ' + Number.parseFloat(config.initTimeHigh)); } - if (Number.parseFloat(config.initTimeHigh) < 0) { - throw 'Initialization bit timing needs to be >= 0'; + if (Number.parseFloat(config.initTimeLow) < 0) { + throw 'Initialization bit timing low needs to be >= 0'; } else { params.push('-d ' + Number.parseFloat(config.initTimeLow)); } if (Number.parseFloat(config.bitLongTime) < 0) { - throw 'Bit timing needs to be >= 0'; + throw 'Bit timing long needs to be >= 0'; } else { params.push('-m ' + Number.parseFloat(config.bitLongTime)); } if (Number.parseFloat(config.bitShortTime) < 0) { - throw 'Bit timing needs to be >= 0'; + throw 'Bit timing short needs to be >= 0'; } else { params.push('-l ' + Number.parseFloat(config.bitShortTime)); } From 0f4f1b8e3a44eb085942e9662668117153719b09 Mon Sep 17 00:00:00 2001 From: deimi Date: Sat, 23 Nov 2019 00:11:37 +0100 Subject: [PATCH 2/2] fix: setting of board type --- src/BinarySend.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/BinarySend.py b/src/BinarySend.py index 2a80ce7..0200234 100644 --- a/src/BinarySend.py +++ b/src/BinarySend.py @@ -100,7 +100,8 @@ def main(argsv): pin = int(arg) elif opt == '-t': print arg - if arg.upper() == 'BOARD': + global boardType + if (arg.upper() == 'BOARD') or (arg.upper() == ' BOARD'): boardType = GPIO.BOARD else: boardType = GPIO.BCM