diff --git a/src/BinarySend.py b/src/BinarySend.py index 9fc7478..0200234 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' @@ -99,13 +100,17 @@ 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 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)); }