Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix board type and init sequence #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions src/BinarySend.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions src/ExecShell.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down