From 20a5a01203a43a3b1588d24b53b595e8d18d6bc0 Mon Sep 17 00:00:00 2001 From: Ingo Date: Sun, 7 Nov 2021 00:57:32 +0100 Subject: [PATCH 1/3] ADD: Display: Waveshare 2.66 --- config.py | 9 + displays/waveshare2in66.py | 500 +++++++++++++++++++++++++++++++++++++ example_config.ini | 1 + 3 files changed, 510 insertions(+) create mode 100644 displays/waveshare2in66.py diff --git a/config.py b/config.py index aba8384..86fba35 100644 --- a/config.py +++ b/config.py @@ -142,6 +142,15 @@ def create_config(config_file=None): except ImportError: logger.warning("Waveshare display library not installed.") sys.exit("Exiting...") + +# Display - Waveshare 2.66 is 296 * 152 pixels +elif "waveshare2in66" in conf["atm"]["display"]: + try: + from waveshare_epd import epd2in66 + WAVESHARE = epd2in66.EPD() + except ImportError: + logger.warning("Waveshare display library not installed.") + sys.exit("Exiting...") # Display - No configuration match else: diff --git a/displays/waveshare2in66.py b/displays/waveshare2in66.py new file mode 100644 index 0000000..6381f87 --- /dev/null +++ b/displays/waveshare2in66.py @@ -0,0 +1,500 @@ +#!/usr/bin/python3 + +import time +import math + +import config +import utils + +from displays import messages + +from PIL import Image, ImageFont, ImageDraw + + +def update_startup_screen(): + """Show startup screen on eInk Display + """ + image, width, height, draw = init_screen(color=config.WHITE) + + draw.text( + (18, 13), + messages.startup_screen_1, + fill=config.BLACK, + font=utils.create_font("freemono", 25), + ) + draw.text( + (12, 30), + messages.startup_screen_2, + fill=config.BLACK, + font=utils.create_font("sawasdee", 37), + ) + draw.text( + (9, 92), + messages.startup_screen_3, + fill=config.BLACK, + font=utils.create_font("freemono", 16), + ) + + config.WAVESHARE.init(config.WAVESHARE.FULL_UPDATE) + config.WAVESHARE.display(config.WAVESHARE.getbuffer(image)) + + +def update_qr_request(): + # initially set all white background + image, width, height, draw = init_screen(color=config.WHITE) + + draw.rectangle( + (2, 2, width - 2, height - 2), fill=config.WHITE, outline=config.BLACK + ) + draw.text( + (34, 10), + messages.qr_request_1, + fill=config.BLACK, + font=utils.create_font("freemono", 25), + ) + draw.text( + (10, 30), + messages.qr_request_2, + fill=config.BLACK, + font=utils.create_font("freemono", 25), + ) + + config.WAVESHARE.init(config.WAVESHARE.FULL_UPDATE) + config.WAVESHARE.displayPartBaseImage(config.WAVESHARE.getbuffer(image)) + + for i in range(0, 3): + draw.text( + (90, 55), + str(3 - i), + fill=config.BLACK, + font=utils.create_font("freemono", 58), + ) + config.WAVESHARE.init(config.WAVESHARE.PART_UPDATE) + config.WAVESHARE.displayPartial(config.WAVESHARE.getbuffer(image)) + draw.rectangle((75, 50, 115, 90), fill=config.WHITE, outline=config.WHITE) + time.sleep(0.5) + + draw.rectangle( + (2, 2, width - 2, height - 2), fill=config.WHITE, outline=config.BLACK + ) + draw.text( + (32, 15), + messages.qr_request_3, + fill=config.BLACK, + font=utils.create_font("freemono", 28), + ) + draw.text( + (22, 40), + messages.qr_request_4 + str(math.floor(config.SATS)) + messages.qr_request_5, + fill=config.BLACK, + font=utils.create_font("freemono", 28), + ) + config.WAVESHARE.init(config.WAVESHARE.PART_UPDATE) + config.WAVESHARE.displayPartial(config.WAVESHARE.getbuffer(image)) + + +def update_qr_failed(): + # initially set all white background + image, width, height, draw = init_screen(color=config.WHITE) + + draw.rectangle( + (2, 2, width - 2, height - 2), fill=config.WHITE, outline=config.BLACK + ) + + draw.text( + (25, 30), + messages.qr_failed_1, + fill=config.BLACK, + font=utils.create_font("freemono", 28), + ) + draw.text( + (30, 57), + messages.qr_failed_2, + fill=config.BLACK, + font=utils.create_font("freemono", 28), + ) + + config.WAVESHARE.init(config.WAVESHARE.FULL_UPDATE) + config.WAVESHARE.display(config.WAVESHARE.getbuffer(image)) + + +def update_payout_screen(): + """Update the payout screen to reflect balance of deposited coins. + Scan the invoice??? I don't think so! + """ + image, width, height, draw = init_screen(color=config.WHITE) + + draw.rectangle( + (2, 2, width - 2, height - 2), fill=config.WHITE, outline=config.BLACK + ) + draw.text( + (20, 30), + str(math.floor(config.SATS)) + messages.payout_screen_1, + fill=config.BLACK, + font=utils.create_font("freemono", 30), + ) + draw.text( + (20, 60), + messages.payout_screen_2, + fill=config.BLACK, + font=utils.create_font("freemono", 20), + ) + + config.WAVESHARE.init(config.WAVESHARE.FULL_UPDATE) + config.WAVESHARE.display(config.WAVESHARE.getbuffer(image)) + + # scan the invoice + # TODO: I notice this is commented out, I presume this function should _not_ be + # scanning a QR code on each update? + # config.INVOICE = qr.scan() + + +def update_payment_failed(): + image, width, height, draw = init_screen(color=config.WHITE) + + draw.text( + (25, 20), + messages.payment_failed_1, + fill=config.BLACK, + font=utils.create_font("freemono", 24), + ) + draw.text( + (35, 60), + messages.payment_failed_2, + fill=config.BLACK, + font=utils.create_font("freemono", 21), + ) + draw.text( + (60, 80), + messages.payment_failed_3, + fill=config.BLACK, + font=utils.create_font("freemono", 21), + ) + + config.WAVESHARE.init(config.WAVESHARE.FULL_UPDATE) + config.WAVESHARE.display(config.WAVESHARE.getbuffer(image)) + + +def update_thankyou_screen(): + image, width, height, draw = init_screen(color=config.WHITE) + + draw.text( + (15, 15), + messages.thankyou_screen_1, + fill=config.BLACK, + font=utils.create_font("freemono", 26), + ) + draw.text( + (40, 45), + messages.thankyou_screen_2, + fill=config.BLACK, + font=utils.create_font("freemono", 26), + ) + draw.text( + (15, 80), + messages.thankyou_screen_3, + fill=config.BLACK, + font=utils.create_font("freemono", 18), + ) + + config.WAVESHARE.init(config.WAVESHARE.FULL_UPDATE) + config.WAVESHARE.display(config.WAVESHARE.getbuffer(image)) + time.sleep(5) + + +def update_nocoin_screen(): + image, width, height, draw = init_screen(color=config.WHITE) + + draw.text( + (20, 10), + messages.nocoin_screen_1, + fill=config.BLACK, + font=utils.create_font("freemonobold", 24), + ) + draw.text( + (50, 50), + messages.nocoin_screen_2, + fill=config.BLACK, + font=utils.create_font("freemono", 22), + ) + draw.text( + (50, 75), + messages.nocoin_screen_3, + fill=config.BLACK, + font=utils.create_font("freemono", 22), + ) + + config.WAVESHARE.init(config.WAVESHARE.FULL_UPDATE) + config.WAVESHARE.display(config.WAVESHARE.getbuffer(image)) + + +def update_lnurl_generation(): + image, width, height, draw = init_screen(color=config.WHITE) + + draw.rectangle( + (2, 2, width - 2, height - 2), fill=config.WHITE, outline=config.BLACK + ) + draw.text( + (40, 35), + messages.lnurl_generation_1, + fill=config.BLACK, + font=utils.create_font("freemono", 24), + ) + draw.text( + (20, 60), + messages.lnurl_generation_2, + fill=config.BLACK, + font=utils.create_font("freemono", 24), + ) + + config.WAVESHARE.init(config.WAVESHARE.FULL_UPDATE) + config.WAVESHARE.display(config.WAVESHARE.getbuffer(image)) + + +def update_shutdown_screen(): + image, width, height, draw = init_screen(color=config.WHITE) + + draw.text( + (20, 10), + messages.shutdown_screen_1, + fill=config.BLACK, + font=utils.create_font("freemono", 24), + ) + draw.text( + (30, 50), + messages.shutdown_screen_2, + fill=config.BLACK, + font=utils.create_font("freemono", 22), + ) + draw.text( + (55, 75), + messages.shutdown_screen_3, + fill=config.BLACK, + font=utils.create_font("freemono", 22), + ) + + config.WAVESHARE.init(config.WAVESHARE.FULL_UPDATE) + config.WAVESHARE.display(config.WAVESHARE.getbuffer(image)) + + +def update_wallet_scan(): + # initially set all white background + image, width, height, draw = init_screen(color=config.WHITE) + + draw.rectangle( + (2, 2, width - 2, height - 2), fill=config.WHITE, outline=config.BLACK + ) + draw.text( + (40, 20), + messages.wallet_scan_1, + fill=config.BLACK, + font=utils.create_font("freemono", 25), + ) + draw.text( + (40, 45), + messages.wallet_scan_2, + fill=config.BLACK, + font=utils.create_font("freemono", 25), + ) + draw.text( + (40, 70), + messages.wallet_scan_3, + fill=config.BLACK, + font=utils.create_font("freemono", 25), + ) + + config.WAVESHARE.init(config.WAVESHARE.FULL_UPDATE) + config.WAVESHARE.display(config.WAVESHARE.getbuffer(image)) + time.sleep(2) + + +def update_lntxbot_balance(balance): + # initially set all white background + image, width, height, draw = init_screen(color=config.WHITE) + + draw.rectangle( + (2, 2, width - 2, height - 2), fill=config.WHITE, outline=config.BLACK + ) + draw.text( + (50, 15), + messages.lntxbot_balance_1, + fill=config.BLACK, + font=utils.create_font("freemonobold", 26), + ) + draw.text( + (10, 55), + messages.lntxbot_balance_2, + fill=config.BLACK, + font=utils.create_font("freemono", 18), + ) + draw.text( + (45, 75), + str("{:,}".format(balance)) + messages.lntxbot_balance_3, + fill=config.BLACK, + font=utils.create_font("freemono", 24), + ) + + config.WAVESHARE.init(config.WAVESHARE.FULL_UPDATE) + config.WAVESHARE.display(config.WAVESHARE.getbuffer(image)) + time.sleep(3) + + +def update_btcpay_lnd(): + # initially set all white background + image, width, height, draw = init_screen(color=config.WHITE) + + draw.rectangle( + (2, 2, width - 2, height - 2), fill=config.WHITE, outline=config.BLACK + ) + draw.text( + (50, 20), + messages.btcpay_lnd_1, + fill=config.BLACK, + font=utils.create_font("freemonobold", 26), + ) + draw.text( + (10, 55), + messages.btcpay_lnd_2, + fill=config.BLACK, + font=utils.create_font("freemono", 20), + ) + draw.text( + (15, 80), + messages.btcpay_lnd_3, + fill=config.BLACK, + font=utils.create_font("freemono", 20), + ) + + config.WAVESHARE.init(config.WAVESHARE.FULL_UPDATE) + config.WAVESHARE.display(config.WAVESHARE.getbuffer(image)) + time.sleep(3) + + +def draw_lnurl_qr(qr_img): + """Draw a lnurl qr code on the e-ink screen + """ + image, width, height, draw = init_screen(color=config.BLACK) + + qr_img = qr_img.resize((122, 122), resample=0) + + draw = ImageDraw.Draw(image) + draw.bitmap((0, 0), qr_img, fill=config.WHITE) + draw.text( + (140, 35), + messages.lnurl_qr_1, + fill=config.WHITE, + font=utils.create_font("freemonobold", 22), + ) + draw.text( + (140, 55), + messages.lnurl_qr_2, + fill=config.WHITE, + font=utils.create_font("freemonobold", 22), + ) + + config.WAVESHARE.init(config.WAVESHARE.FULL_UPDATE) + config.WAVESHARE.display(config.WAVESHARE.getbuffer(image)) + + +def update_amount_screen(): + """Update the amount screen to reflect new coins inserted + """ + image, width, height, draw = init_screen(color=config.WHITE) + + draw.rectangle( + (2, 2, width - 2, height - 2), fill=config.WHITE, outline=config.BLACK + ) + draw.text( + (11, 15), + str("{:,}".format(math.floor(config.SATS))) + messages.amount_screen_1, + fill=config.BLACK, + font=utils.create_font("dotmbold", 30), + ) + draw.text( + (12, 45), + "%.2f" % round(config.FIAT, 2) + " " + config.conf["atm"]["cur"].upper(), + fill=config.BLACK, + font=utils.create_font("dotmbold", 25), + ) + draw.text( + (11, 70), + messages.amount_screen_2, + fill=config.BLACK, + font=utils.create_font("freemono", 18), + ) + draw.text( + (60, 70), + messages.amount_screen_3 + + str(math.floor(config.SATPRICE)) + + messages.amount_screen_4 + + config.conf["atm"]["centname"], + fill=config.BLACK, + font=utils.create_font("freemono", 18), + ) + draw.text( + (11, 85), + messages.amount_screen_5, + fill=config.BLACK, + font=utils.create_font("freemono", 18), + ) + draw.text( + (60, 85), + messages.amount_screen_6 + + config.conf["atm"]["fee"] + + messages.amount_screen_7 + + str(math.floor(config.SATSFEE)) + + messages.amount_screen_8, + fill=config.BLACK, + font=utils.create_font("freemono", 18), + ) + + if config.COINCOUNT == 1: + config.WAVESHARE.init(config.WAVESHARE.FULL_UPDATE) + config.WAVESHARE.displayPartBaseImage(config.WAVESHARE.getbuffer(image)) + else: + config.WAVESHARE.init(config.WAVESHARE.PART_UPDATE) + config.WAVESHARE.displayPartial(config.WAVESHARE.getbuffer(image)) + + +def update_lnurl_cancel_notice(): + image, width, height, draw = init_screen(color=config.WHITE) + + draw.text( + (16, 20), + messages.lnurl_cancel_notice_1, + fill=config.BLACK, + font=utils.create_font("freemono", 22), + ) + draw.text( + (16, 65), + messages.lnurl_cancel_notice_2, + fill=config.BLACK, + font=utils.create_font("freemono", 17), + ) + draw.text( + (15, 85), + messages.lnurl_cancel_notice_3, + fill=config.BLACK, + font=utils.create_font("freemono", 17), + ) + + config.WAVESHARE.init(config.WAVESHARE.FULL_UPDATE) + config.WAVESHARE.display(config.WAVESHARE.getbuffer(image)) + + +def update_blank_screen(): + image, width, height, draw = init_screen(color=config.WHITE) + + config.WAVESHARE.init(config.WAVESHARE.FULL_UPDATE) + config.WAVESHARE.display(config.WAVESHARE.getbuffer(image)) + + +def init_screen(color): + """Prepare the screen for drawing and return the draw variables + """ + image = Image.new("1", (config.WAVESHARE.height, config.WAVESHARE.width), color) + # Set width and height of screen + width, height = image.size + # prepare for drawing + draw = ImageDraw.Draw(image) + return image, width, height, draw diff --git a/example_config.ini b/example_config.ini index f4a3677..2a99ec2 100644 --- a/example_config.ini +++ b/example_config.ini @@ -20,6 +20,7 @@ dangermode = on # display = papiruszero2in # display = waveshare2in13 # display = waveshare2in13d +# display = waveshare2in66 display = papiruszero2in # Automatically set during initial setup to LND or LNTXBOT From e431fe8eafd3eb4c09d90277491a0e4440e58e18 Mon Sep 17 00:00:00 2001 From: Ingo Date: Sun, 7 Nov 2021 01:52:30 +0100 Subject: [PATCH 2/3] BUG: Fix unknown FULL_UPDATE and PART_UPDATE --- displays/waveshare2in66.py | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/displays/waveshare2in66.py b/displays/waveshare2in66.py index 6381f87..5cf8712 100644 --- a/displays/waveshare2in66.py +++ b/displays/waveshare2in66.py @@ -35,7 +35,7 @@ def update_startup_screen(): font=utils.create_font("freemono", 16), ) - config.WAVESHARE.init(config.WAVESHARE.FULL_UPDATE) + config.WAVESHARE.init(0) config.WAVESHARE.display(config.WAVESHARE.getbuffer(image)) @@ -59,7 +59,7 @@ def update_qr_request(): font=utils.create_font("freemono", 25), ) - config.WAVESHARE.init(config.WAVESHARE.FULL_UPDATE) + config.WAVESHARE.init(0) config.WAVESHARE.displayPartBaseImage(config.WAVESHARE.getbuffer(image)) for i in range(0, 3): @@ -69,7 +69,7 @@ def update_qr_request(): fill=config.BLACK, font=utils.create_font("freemono", 58), ) - config.WAVESHARE.init(config.WAVESHARE.PART_UPDATE) + config.WAVESHARE.init(1) config.WAVESHARE.displayPartial(config.WAVESHARE.getbuffer(image)) draw.rectangle((75, 50, 115, 90), fill=config.WHITE, outline=config.WHITE) time.sleep(0.5) @@ -89,7 +89,7 @@ def update_qr_request(): fill=config.BLACK, font=utils.create_font("freemono", 28), ) - config.WAVESHARE.init(config.WAVESHARE.PART_UPDATE) + config.WAVESHARE.init(1) config.WAVESHARE.displayPartial(config.WAVESHARE.getbuffer(image)) @@ -114,7 +114,7 @@ def update_qr_failed(): font=utils.create_font("freemono", 28), ) - config.WAVESHARE.init(config.WAVESHARE.FULL_UPDATE) + config.WAVESHARE.init(0) config.WAVESHARE.display(config.WAVESHARE.getbuffer(image)) @@ -140,7 +140,7 @@ def update_payout_screen(): font=utils.create_font("freemono", 20), ) - config.WAVESHARE.init(config.WAVESHARE.FULL_UPDATE) + config.WAVESHARE.init(0) config.WAVESHARE.display(config.WAVESHARE.getbuffer(image)) # scan the invoice @@ -171,7 +171,7 @@ def update_payment_failed(): font=utils.create_font("freemono", 21), ) - config.WAVESHARE.init(config.WAVESHARE.FULL_UPDATE) + config.WAVESHARE.init(0) config.WAVESHARE.display(config.WAVESHARE.getbuffer(image)) @@ -197,7 +197,7 @@ def update_thankyou_screen(): font=utils.create_font("freemono", 18), ) - config.WAVESHARE.init(config.WAVESHARE.FULL_UPDATE) + config.WAVESHARE.init(0) config.WAVESHARE.display(config.WAVESHARE.getbuffer(image)) time.sleep(5) @@ -224,7 +224,7 @@ def update_nocoin_screen(): font=utils.create_font("freemono", 22), ) - config.WAVESHARE.init(config.WAVESHARE.FULL_UPDATE) + config.WAVESHARE.init(0) config.WAVESHARE.display(config.WAVESHARE.getbuffer(image)) @@ -247,7 +247,7 @@ def update_lnurl_generation(): font=utils.create_font("freemono", 24), ) - config.WAVESHARE.init(config.WAVESHARE.FULL_UPDATE) + config.WAVESHARE.init(0) config.WAVESHARE.display(config.WAVESHARE.getbuffer(image)) @@ -273,7 +273,7 @@ def update_shutdown_screen(): font=utils.create_font("freemono", 22), ) - config.WAVESHARE.init(config.WAVESHARE.FULL_UPDATE) + config.WAVESHARE.init(0) config.WAVESHARE.display(config.WAVESHARE.getbuffer(image)) @@ -303,7 +303,7 @@ def update_wallet_scan(): font=utils.create_font("freemono", 25), ) - config.WAVESHARE.init(config.WAVESHARE.FULL_UPDATE) + config.WAVESHARE.init(0) config.WAVESHARE.display(config.WAVESHARE.getbuffer(image)) time.sleep(2) @@ -334,7 +334,7 @@ def update_lntxbot_balance(balance): font=utils.create_font("freemono", 24), ) - config.WAVESHARE.init(config.WAVESHARE.FULL_UPDATE) + config.WAVESHARE.init(0) config.WAVESHARE.display(config.WAVESHARE.getbuffer(image)) time.sleep(3) @@ -365,7 +365,7 @@ def update_btcpay_lnd(): font=utils.create_font("freemono", 20), ) - config.WAVESHARE.init(config.WAVESHARE.FULL_UPDATE) + config.WAVESHARE.init(0) config.WAVESHARE.display(config.WAVESHARE.getbuffer(image)) time.sleep(3) @@ -392,7 +392,7 @@ def draw_lnurl_qr(qr_img): font=utils.create_font("freemonobold", 22), ) - config.WAVESHARE.init(config.WAVESHARE.FULL_UPDATE) + config.WAVESHARE.init(0) config.WAVESHARE.display(config.WAVESHARE.getbuffer(image)) @@ -449,10 +449,10 @@ def update_amount_screen(): ) if config.COINCOUNT == 1: - config.WAVESHARE.init(config.WAVESHARE.FULL_UPDATE) + config.WAVESHARE.init(0) config.WAVESHARE.displayPartBaseImage(config.WAVESHARE.getbuffer(image)) else: - config.WAVESHARE.init(config.WAVESHARE.PART_UPDATE) + config.WAVESHARE.init(1) config.WAVESHARE.displayPartial(config.WAVESHARE.getbuffer(image)) @@ -478,14 +478,14 @@ def update_lnurl_cancel_notice(): font=utils.create_font("freemono", 17), ) - config.WAVESHARE.init(config.WAVESHARE.FULL_UPDATE) + config.WAVESHARE.init(0) config.WAVESHARE.display(config.WAVESHARE.getbuffer(image)) def update_blank_screen(): image, width, height, draw = init_screen(color=config.WHITE) - config.WAVESHARE.init(config.WAVESHARE.FULL_UPDATE) + config.WAVESHARE.init(0) config.WAVESHARE.display(config.WAVESHARE.getbuffer(image)) From 5bba5a2a12cddbec7932ab7744c8c258ea594730 Mon Sep 17 00:00:00 2001 From: Ingo Date: Sun, 7 Nov 2021 22:10:32 +0100 Subject: [PATCH 3/3] BUG: Fix unknown displayPartBaseImage and displayPartial CHG: Adjusting the text alignment and text size --- displays/waveshare2in66.py | 199 ++++++++++++++++++------------------- 1 file changed, 99 insertions(+), 100 deletions(-) diff --git a/displays/waveshare2in66.py b/displays/waveshare2in66.py index 5cf8712..3ce06a6 100644 --- a/displays/waveshare2in66.py +++ b/displays/waveshare2in66.py @@ -17,22 +17,22 @@ def update_startup_screen(): image, width, height, draw = init_screen(color=config.WHITE) draw.text( - (18, 13), + (20, 4), messages.startup_screen_1, fill=config.BLACK, - font=utils.create_font("freemono", 25), + font=utils.create_font("freemono", 30), ) draw.text( - (12, 30), + (4, 30), messages.startup_screen_2, fill=config.BLACK, - font=utils.create_font("sawasdee", 37), + font=utils.create_font("sawasdee", 48), ) draw.text( - (9, 92), + (8, 130), messages.startup_screen_3, fill=config.BLACK, - font=utils.create_font("freemono", 16), + font=utils.create_font("freemono", 20), ) config.WAVESHARE.init(0) @@ -47,50 +47,49 @@ def update_qr_request(): (2, 2, width - 2, height - 2), fill=config.WHITE, outline=config.BLACK ) draw.text( - (34, 10), + (46, 4), messages.qr_request_1, fill=config.BLACK, - font=utils.create_font("freemono", 25), + font=utils.create_font("freemono", 30), ) draw.text( - (10, 30), + (16, 34), messages.qr_request_2, fill=config.BLACK, - font=utils.create_font("freemono", 25), + font=utils.create_font("freemono", 30), ) - config.WAVESHARE.init(0) - config.WAVESHARE.displayPartBaseImage(config.WAVESHARE.getbuffer(image)) + config.WAVESHARE.init(1) + config.WAVESHARE.display(config.WAVESHARE.getbuffer(image)) for i in range(0, 3): draw.text( - (90, 55), + (122, 70), str(3 - i), fill=config.BLACK, - font=utils.create_font("freemono", 58), + font=utils.create_font("freemono", 84), ) - config.WAVESHARE.init(1) - config.WAVESHARE.displayPartial(config.WAVESHARE.getbuffer(image)) - draw.rectangle((75, 50, 115, 90), fill=config.WHITE, outline=config.WHITE) + config.WAVESHARE.display(config.WAVESHARE.getbuffer(image)) + draw.rectangle((125, 70, 170, 148), fill=config.WHITE, outline=config.WHITE) time.sleep(0.5) draw.rectangle( (2, 2, width - 2, height - 2), fill=config.WHITE, outline=config.BLACK ) draw.text( - (32, 15), + (16, 35), messages.qr_request_3, fill=config.BLACK, - font=utils.create_font("freemono", 28), + font=utils.create_font("freemono", 30), ) draw.text( - (22, 40), + (16, 65), messages.qr_request_4 + str(math.floor(config.SATS)) + messages.qr_request_5, fill=config.BLACK, - font=utils.create_font("freemono", 28), + font=utils.create_font("freemono", 30), ) config.WAVESHARE.init(1) - config.WAVESHARE.displayPartial(config.WAVESHARE.getbuffer(image)) + config.WAVESHARE.display(config.WAVESHARE.getbuffer(image)) def update_qr_failed(): @@ -102,16 +101,16 @@ def update_qr_failed(): ) draw.text( - (25, 30), + (16, 40), messages.qr_failed_1, fill=config.BLACK, - font=utils.create_font("freemono", 28), + font=utils.create_font("freemono", 30), ) draw.text( - (30, 57), + (16, 70), messages.qr_failed_2, fill=config.BLACK, - font=utils.create_font("freemono", 28), + font=utils.create_font("freemono", 30), ) config.WAVESHARE.init(0) @@ -128,16 +127,16 @@ def update_payout_screen(): (2, 2, width - 2, height - 2), fill=config.WHITE, outline=config.BLACK ) draw.text( - (20, 30), + (16, 40), str(math.floor(config.SATS)) + messages.payout_screen_1, fill=config.BLACK, font=utils.create_font("freemono", 30), ) draw.text( - (20, 60), + (16, 70), messages.payout_screen_2, fill=config.BLACK, - font=utils.create_font("freemono", 20), + font=utils.create_font("freemono", 30), ) config.WAVESHARE.init(0) @@ -153,22 +152,22 @@ def update_payment_failed(): image, width, height, draw = init_screen(color=config.WHITE) draw.text( - (25, 20), + (10, 10), messages.payment_failed_1, fill=config.BLACK, - font=utils.create_font("freemono", 24), + font=utils.create_font("freemono", 32), ) draw.text( - (35, 60), + (10, 90), messages.payment_failed_2, fill=config.BLACK, - font=utils.create_font("freemono", 21), + font=utils.create_font("freemono", 30), ) draw.text( - (60, 80), + (10, 120), messages.payment_failed_3, fill=config.BLACK, - font=utils.create_font("freemono", 21), + font=utils.create_font("freemono", 30), ) config.WAVESHARE.init(0) @@ -179,22 +178,22 @@ def update_thankyou_screen(): image, width, height, draw = init_screen(color=config.WHITE) draw.text( - (15, 15), + (12, 15), messages.thankyou_screen_1, fill=config.BLACK, - font=utils.create_font("freemono", 26), + font=utils.create_font("freemono", 32), ) draw.text( - (40, 45), + (47, 47), messages.thankyou_screen_2, fill=config.BLACK, - font=utils.create_font("freemono", 26), + font=utils.create_font("freemono", 32), ) draw.text( - (15, 80), + (15, 125), messages.thankyou_screen_3, fill=config.BLACK, - font=utils.create_font("freemono", 18), + font=utils.create_font("freemono", 24), ) config.WAVESHARE.init(0) @@ -206,22 +205,22 @@ def update_nocoin_screen(): image, width, height, draw = init_screen(color=config.WHITE) draw.text( - (20, 10), + (15, 15), messages.nocoin_screen_1, fill=config.BLACK, - font=utils.create_font("freemonobold", 24), + font=utils.create_font("freemonobold", 30), ) draw.text( - (50, 50), + (50, 72), messages.nocoin_screen_2, fill=config.BLACK, - font=utils.create_font("freemono", 22), + font=utils.create_font("freemono", 30), ) draw.text( - (50, 75), + (50, 102), messages.nocoin_screen_3, fill=config.BLACK, - font=utils.create_font("freemono", 22), + font=utils.create_font("freemono", 30), ) config.WAVESHARE.init(0) @@ -235,16 +234,16 @@ def update_lnurl_generation(): (2, 2, width - 2, height - 2), fill=config.WHITE, outline=config.BLACK ) draw.text( - (40, 35), + (14, 40), messages.lnurl_generation_1, fill=config.BLACK, - font=utils.create_font("freemono", 24), + font=utils.create_font("freemono", 30), ) draw.text( - (20, 60), + (14, 68), messages.lnurl_generation_2, fill=config.BLACK, - font=utils.create_font("freemono", 24), + font=utils.create_font("freemono", 30), ) config.WAVESHARE.init(0) @@ -255,22 +254,22 @@ def update_shutdown_screen(): image, width, height, draw = init_screen(color=config.WHITE) draw.text( - (20, 10), + (10, 10), messages.shutdown_screen_1, fill=config.BLACK, - font=utils.create_font("freemono", 24), + font=utils.create_font("freemono", 32), ) draw.text( - (30, 50), + (10, 90), messages.shutdown_screen_2, fill=config.BLACK, - font=utils.create_font("freemono", 22), + font=utils.create_font("freemono", 30), ) draw.text( - (55, 75), + (10, 120), messages.shutdown_screen_3, fill=config.BLACK, - font=utils.create_font("freemono", 22), + font=utils.create_font("freemono", 30), ) config.WAVESHARE.init(0) @@ -285,22 +284,22 @@ def update_wallet_scan(): (2, 2, width - 2, height - 2), fill=config.WHITE, outline=config.BLACK ) draw.text( - (40, 20), + (42, 25), messages.wallet_scan_1, fill=config.BLACK, - font=utils.create_font("freemono", 25), + font=utils.create_font("freemono", 30), ) draw.text( - (40, 45), + (42, 55), messages.wallet_scan_2, fill=config.BLACK, - font=utils.create_font("freemono", 25), + font=utils.create_font("freemono", 30), ) draw.text( - (40, 70), + (42, 85), messages.wallet_scan_3, fill=config.BLACK, - font=utils.create_font("freemono", 25), + font=utils.create_font("freemono", 30), ) config.WAVESHARE.init(0) @@ -316,22 +315,22 @@ def update_lntxbot_balance(balance): (2, 2, width - 2, height - 2), fill=config.WHITE, outline=config.BLACK ) draw.text( - (50, 15), + (60, 15), messages.lntxbot_balance_1, fill=config.BLACK, - font=utils.create_font("freemonobold", 26), + font=utils.create_font("freemonobold", 30), ) draw.text( - (10, 55), + (8, 65), messages.lntxbot_balance_2, fill=config.BLACK, - font=utils.create_font("freemono", 18), + font=utils.create_font("freemono", 22), ) draw.text( - (45, 75), + (8, 87), str("{:,}".format(balance)) + messages.lntxbot_balance_3, fill=config.BLACK, - font=utils.create_font("freemono", 24), + font=utils.create_font("freemono", 22), ) config.WAVESHARE.init(0) @@ -347,22 +346,22 @@ def update_btcpay_lnd(): (2, 2, width - 2, height - 2), fill=config.WHITE, outline=config.BLACK ) draw.text( - (50, 20), + (60, 15), messages.btcpay_lnd_1, fill=config.BLACK, - font=utils.create_font("freemonobold", 26), + font=utils.create_font("freemonobold", 30), ) draw.text( - (10, 55), + (10, 65), messages.btcpay_lnd_2, fill=config.BLACK, - font=utils.create_font("freemono", 20), + font=utils.create_font("freemono", 22), ) draw.text( - (15, 80), + (10, 87), messages.btcpay_lnd_3, fill=config.BLACK, - font=utils.create_font("freemono", 20), + font=utils.create_font("freemono", 22), ) config.WAVESHARE.init(0) @@ -375,21 +374,21 @@ def draw_lnurl_qr(qr_img): """ image, width, height, draw = init_screen(color=config.BLACK) - qr_img = qr_img.resize((122, 122), resample=0) + qr_img = qr_img.resize((152, 152), resample=0) draw = ImageDraw.Draw(image) draw.bitmap((0, 0), qr_img, fill=config.WHITE) draw.text( - (140, 35), + (160, 40), messages.lnurl_qr_1, fill=config.WHITE, - font=utils.create_font("freemonobold", 22), + font=utils.create_font("freemonobold", 28), ) draw.text( - (140, 55), + (160, 68), messages.lnurl_qr_2, fill=config.WHITE, - font=utils.create_font("freemonobold", 22), + font=utils.create_font("freemonobold", 28), ) config.WAVESHARE.init(0) @@ -405,77 +404,77 @@ def update_amount_screen(): (2, 2, width - 2, height - 2), fill=config.WHITE, outline=config.BLACK ) draw.text( - (11, 15), + (12, 12), str("{:,}".format(math.floor(config.SATS))) + messages.amount_screen_1, fill=config.BLACK, - font=utils.create_font("dotmbold", 30), + font=utils.create_font("dotmbold", 36), ) draw.text( - (12, 45), + (12, 48), "%.2f" % round(config.FIAT, 2) + " " + config.conf["atm"]["cur"].upper(), fill=config.BLACK, - font=utils.create_font("dotmbold", 25), + font=utils.create_font("dotmbold", 36), ) draw.text( - (11, 70), + (12, 104), messages.amount_screen_2, fill=config.BLACK, - font=utils.create_font("freemono", 18), + font=utils.create_font("freemono", 22), ) draw.text( - (60, 70), + (80, 104), messages.amount_screen_3 + str(math.floor(config.SATPRICE)) + messages.amount_screen_4 + config.conf["atm"]["centname"], fill=config.BLACK, - font=utils.create_font("freemono", 18), + font=utils.create_font("freemono", 22), ) draw.text( - (11, 85), + (12, 126), messages.amount_screen_5, fill=config.BLACK, - font=utils.create_font("freemono", 18), + font=utils.create_font("freemono", 22), ) draw.text( - (60, 85), + (80, 126), messages.amount_screen_6 + config.conf["atm"]["fee"] + messages.amount_screen_7 + str(math.floor(config.SATSFEE)) + messages.amount_screen_8, fill=config.BLACK, - font=utils.create_font("freemono", 18), + font=utils.create_font("freemono", 22), ) if config.COINCOUNT == 1: config.WAVESHARE.init(0) - config.WAVESHARE.displayPartBaseImage(config.WAVESHARE.getbuffer(image)) + config.WAVESHARE.display(config.WAVESHARE.getbuffer(image)) else: config.WAVESHARE.init(1) - config.WAVESHARE.displayPartial(config.WAVESHARE.getbuffer(image)) + config.WAVESHARE.display(config.WAVESHARE.getbuffer(image)) def update_lnurl_cancel_notice(): image, width, height, draw = init_screen(color=config.WHITE) draw.text( - (16, 20), + (12, 10), messages.lnurl_cancel_notice_1, fill=config.BLACK, - font=utils.create_font("freemono", 22), + font=utils.create_font("freemono", 27), ) draw.text( - (16, 65), + (8, 105), messages.lnurl_cancel_notice_2, fill=config.BLACK, - font=utils.create_font("freemono", 17), + font=utils.create_font("freemono", 20), ) draw.text( - (15, 85), + (8, 125), messages.lnurl_cancel_notice_3, fill=config.BLACK, - font=utils.create_font("freemono", 17), + font=utils.create_font("freemono", 20), ) config.WAVESHARE.init(0)