Skip to content
Open
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
12 changes: 6 additions & 6 deletions IRModule.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __init__(self, callback = None):

self.decoding = False
self.pList = []
self.timer = time.time()
self.timer = time.time_ns()
if callback == 'DECODE':
self.callback = self.print_ir_code
else:
Expand All @@ -47,8 +47,8 @@ def pWidth(self, pin):
of the IR remote signal and start the function to look for the
end of the IR remote signal"""

self.pList.append(time.time()-self.timer)
self.timer = time.time()
self.pList.append((time.time_ns()-self.timer)/1000000000.)
self.timer = time.time_ns()

if self.decoding == False:
self.decoding = True
Expand All @@ -68,10 +68,10 @@ def pulse_checker(self):
2 - if the length of time receiving the pulse is great than self.checkTime
- used for repeat codes"""

timer = time.time()
timer = time.time_ns()

while True:
check = (time.time()-timer)*1000
check = (time.time_ns()-timer)/1000000
if check > self.checkTime:
print(check, len(self.pList))
break
Expand Down Expand Up @@ -117,7 +117,7 @@ def decode_pulse(self,pList):

for p in range(0,len(pList)):
try:
pList[p]=float(pList[p])*1000
pList[p]=pList[p]*1000.
if self.verbose == True:
print(pList[p])
if pList[p]<11:
Expand Down