Skip to content
Snippets Groups Projects
Commit 2d5425a9 authored by ed8g20's avatar ed8g20
Browse files

Update 3 files

- /synchronised_time.py
- /main.py
- /base32.py
parent ae34ef8e
No related branches found
No related tags found
No related merge requests found
def base32_decode(message):
"""
Decodes the supplied encoded Base32 message into a byte string
......@@ -14,28 +15,6 @@ def base32_decode(message):
decoded = []
for chunk in chunks:
bits = 0
bitbuff = 0
for c in chunk:
if 'A' <= c <= 'Z':
n = ord(c) - ord('A')
elif '2' <= c <= '7':
n = ord(c) - ord('2') + 26
elif c == '=':
continue
else:
raise ValueError("Not Base32")
bits += 5
bitbuff <<= 5
bitbuff |= n
if bits >= 8:
bits -= 8
byte = bitbuff >> bits
bitbuff &= ~(0xFF << bits)
decoded.append(byte)
#TODO: impliment method
return bytes(decoded)
......@@ -29,8 +29,7 @@ selected_idx = 0
synchronised_time = create_synchronised_time(display, button_a, button_b, button_x, button_y)
while True:
if button_a.read() :
selected_idx = (selected_idx + 1) % len(codes)
#TODO: change selected when user presses a button
code = codes[selected_idx]
......
......@@ -40,9 +40,6 @@ def create_synchronised_time(display, button_a, button_b, button_x, button_y):
display.update()
time.sleep(0.3)
delta = time.mktime(datetime + [0, 0]) - int(time.time())
def synchronised_time():
return int(time.time()) + delta
# TODO: Create a function that returns the epoch time when then function is run, called synchronised_time
return synchronised_time
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment