Skip to content

Commit

Permalink
bux fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
21isenough committed Jul 10, 2020
1 parent 6f41515 commit 31b11b4
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 17 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ https://docs.lightningatm.me/requirements/hardware-requirements
### Todo

#### Prio 1
- [X] Add "no wallet setup" warning at boot
- [ ] Implement LNURLProxyAPI
- [ ] Support for more Lightning implementations and wallets
- [ ] Try different way of detecting inserted coins (populating a list and setting a delimiter)
- [ ] PCB Board design (https://easyeda.com/, http://kicad-pcb.org/)
Expand Down
28 changes: 16 additions & 12 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ def softreset():
"""Displays startup screen and deletes fiat amount
"""
global led
# Inform about coin, bill and sat amounts
if config.COINCOUNT > 0:
logger.info("Last payment:")
logger.info("%s Coin(s), XX Bill(s), %s Sats", config.COINCOUNT, config.SATS)

config.SATS = 0
config.FIAT = 0
config.COINCOUNT = 0
Expand Down Expand Up @@ -61,18 +66,21 @@ def button_pushed():
If coins inserted, scan a qr code for the exchange amount
"""

if config.FIAT == 0:
display.update_nocoin_screen()
time.sleep(3)
display.update_startup_screen()

if not config.conf["atm"]["activewallet"]:
logger.error("No wallet has been configured for the ATM.")
logger.error("Please configure your Lightning Wallet first.")
# Add "no wallet setup" message

# Softreset and startup screen
softreset()
return

if config.FIAT == 0:
display.update_nocoin_screen()
time.sleep(3)
display.update_startup_screen()
return

lnurlproxy = config.conf["lnurl"]["lnurlproxy"]
activewallet = config.conf["atm"]["activewallet"]
# Determine if LNURL Withdrawls are possible
Expand All @@ -94,7 +102,9 @@ def button_pushed():
logger.info("QR scan process started")
display.update_qr_request()
config.INVOICE = qr.scan_attempts(4)
# TODO Add "on the way" message
lntxbot.payout(config.SATS, config.INVOICE)
# TODO Add thank you screen
softreset()
return

Expand All @@ -112,6 +122,7 @@ def button_pushed():
response = requests.post(request_url, json=data)

qr_img = utils.generate_lnurl_qr(response.json()["lnurl"])
# TODO Adjust size according to screen used
qr_img = qr_img.resize((122, 122), resample=0)

# draw the qr code on the e-ink screen
Expand Down Expand Up @@ -158,13 +169,6 @@ def button_pushed():
else:
logger.error("No valid wallet configured")

# # Option to inform about coin, bill and sat amounts
# if config.COINCOUNT > 0:
# logger.info("Last payment:")
# logger.info(
# "%s Coin(s), XX Bill(s), %s Sats", config.COINCOUNT, config.SATS
# )

if config.PUSHES == 3:
"""Scan and store new wallet credentials
"""
Expand Down
6 changes: 3 additions & 3 deletions displays/papiruszero2in.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,19 +443,19 @@ def update_lnurl_cancel_notice():
image, width, height, draw = init_screen(color=config.WHITE)

draw.text(
(16, 20),
(8, 18),
messages.lnurl_cancel_notice_1,
fill=config.BLACK,
font=utils.create_font("freemono", 18),
)
draw.text(
(16, 65),
(11, 53),
messages.lnurl_cancel_notice_2,
fill=config.BLACK,
font=utils.create_font("freemono", 14),
)
draw.text(
(15, 85),
(10, 73),
messages.lnurl_cancel_notice_3,
fill=config.BLACK,
font=utils.create_font("freemono", 14),
Expand Down
2 changes: 0 additions & 2 deletions lndrest.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,6 @@ def handle_invoice():
else:
display.update_payment_failed()
time.sleep(120)

logger.info("Initiating softreset...")
else:
print("Please show correct invoice")

Expand Down

0 comments on commit 31b11b4

Please sign in to comment.