Skip to content

Commit e5908c0

Browse files
author
brentru
committed
lintin
1 parent 7a13a02 commit e5908c0

1 file changed

Lines changed: 3 additions & 15 deletions

File tree

PyPortal_TOTP_Friend/code.py

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,8 @@
77
import adafruit_hashlib as hashlib
88
import adafruit_touchscreen
99
import displayio
10-
import neopixel
1110
import terminalio
12-
from adafruit_binascii import hexlify, unhexlify
13-
from adafruit_bitmap_font import bitmap_font
1411
from adafruit_button import Button
15-
from adafruit_display_shapes.circle import Circle
1612
from adafruit_display_shapes.roundrect import RoundRect
1713
from adafruit_display_text.label import Label
1814
from adafruit_esp32spi import adafruit_esp32spi
@@ -230,15 +226,14 @@ def generate_otp(int_input, secret_key, digits=6):
230226
fill_color=0x00FF00, style=Button.ROUNDRECT)
231227
buttons.append(button)
232228
# add some padding btween buttons
233-
btn_x+=63
229+
btn_x += 63
234230

235231
# append buttons to splash group
236232
for b in buttons:
237233
splash.append(b.group)
238234

239235
# how long to stay on if not in always_on mode
240236
countdown = ON_SECONDS
241-
timer = 30
242237

243238
# current button state, defaults to first item in totp_keys
244239
current_button = secrets['totp_keys'][0][0]
@@ -262,7 +257,7 @@ def generate_otp(int_input, secret_key, digits=6):
262257
# display the key's name
263258
label_title.text = name
264259
# format and display the OTP
265-
label_secret.text = "{} {}".format(str(otp)[0:3],str(otp)[3:6])
260+
label_secret.text = "{} {}".format(str(otp)[0:3], str(otp)[3:6])
266261
else:
267262
b.selected = False
268263
else:
@@ -273,14 +268,7 @@ def generate_otp(int_input, secret_key, digits=6):
273268
# display the key's name
274269
label_title.text = name
275270
# format and display the OTP
276-
label_secret.text = "{} {}".format(str(otp)[0:3],str(otp)[3:6])
277-
278-
if timer > 0:
279-
timer=-0.25
280-
print('Timer: ', int(timer))
281-
else:
282-
# reset the display timer
283-
timer = 30
271+
label_secret.text = "{} {}".format(str(otp)[0:3], str(otp)[3:6])
284272

285273
# We'll update every 1/4 second, we can hash very fast so its no biggie!
286274
countdown -= 0.25

0 commit comments

Comments
 (0)