def process_using_lnurl(amt): """Processes receiving an amount using the lnurl scheme """ # get the new lnurl display.update_lnurl_generation() logger.info("LNURL requested") print("LNURL requested") lnurl = request_lnurl(amt) print(lnurl["lnurl"]) # Check EPD_SIZE is defined utils.check_epd_size() # create a qr code image and print it to terminal qr_img = generate_lnurl_qr(lnurl["lnurl"]) qr_img = qr_img.resize((96, 96), resample=0) # draw the qr code on the e-ink screen draw_lnurl_qr(qr_img) # get the balance? back from the bot start_balance = get_lnurl_balance() print(start_balance) # loop while we wait for a balance update or until timeout reached success = wait_for_balance_update(start_balance, timeout=90) if success: display.update_thankyou_screen() logger.info("LNURL withdrawal succeeded") return else: # TODO: I think we should handle a failure here logger.error("LNURL withdrawal failed (within 90 seconds)")
def main(): utils.check_epd_size() logger.info("Application started") check_dangermode() # Display startup startup_screen display.update_startup_screen() setup_coin_acceptor() while True: monitor_coins_and_button()
def main(): utils.check_epd_size() logger.info("Application started") # Checks dangermode and start scanning for credentials # Only activate once software ready for it # check_dangermode() # Display startup startup_screen display.update_startup_screen() setup_coin_acceptor() while True: monitor_coins_and_button()
def main(killer): utils.check_epd_size() logger.info("Application started") # Checks dangermode and start scanning for credentials # Only activate once software ready for it # check_dangermode() # Display startup startup_screen display.update_startup_screen() lastupdate = time.time() setup_coin_acceptor() while not killer.kill_now: monitor_coins_and_button() # Update the homescreen (and thus the time) every 60s if (time.time() - lastupdate) > 60: display.update_startup_screen() lastupdate = time.time()
def run(): utils.check_epd_size() logger.info("Application started") # Display startup startup_screen display.update_startup_screen() while True: try: while True: utils.monitor_coins_and_button() except KeyboardInterrupt: display.update_shutdown_screen() utils.GPIO.cleanup() logger.info("Application finished (Keyboard Interrupt)") sys.exit("Manually Interrupted") except Exception: logger.exception("Oh no, something bad happened! Restarting...") utils.GPIO.cleanup() os.execv("/home/pi/LightningATM/app.py", [""])
def process_using_lnurl(amt): """Processes receiving an amount using the lnurl scheme """ # get the new lnurl display.update_lnurl_generation() logger.info("LNURL requested") print("LNURL requested") lnurl = request_lnurl(amt) print(lnurl["lnurl"]) # Check EPD_SIZE is defined utils.check_epd_size() # create a qr code image and print it to terminal qr_img = generate_lnurl_qr(lnurl["lnurl"]) print(type(qr_img)) print(qr_img.size) qr_img = qr_img.resize((96, 96), resample=0) print(qr_img.size) # draw the qr code on the e-ink screen draw_lnurl_qr(qr_img) # get the balance? back from the bot start_balance = get_lnurl_balance() print(start_balance) # loop while we wait for a balance update or until timeout reached success = wait_for_balance_update(start_balance, timeout=90) if success: display.update_thankyou_screen() logger.info("Initiating restart...") os.execv("/home/pi/LightningATM/app.py", [""]) else: # TODO: I think we should handle a failure here pass