Skip to content

Commit

Permalink
Update display functions and documentation
Browse files Browse the repository at this point in the history
* Added two new display messages
* Extension by two display pages
* Add display test function
* set mulitiligual
* update button.md
* Add we_need_you_help.md
  • Loading branch information
AxelHamburch authored Mar 29, 2022
1 parent 21401ea commit f376a3e
Show file tree
Hide file tree
Showing 25 changed files with 640 additions and 110 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,21 @@ Full Version | Pocket Version

### Installation guideline

_Carry out the points step by step as described here. This is the quickest way to succeed._

- [voltage converter](/docs/guide/voltage_converter.md)
- [coin validator](/docs/guide/coin_validator.md)
- [wiring](/docs/guide/wiring.md)
- [sd card and wifi](/docs/guide/sdcard_and_wifi.md)
- [display](/docs/guide/display.md)
- [edit config.ini](/docs/guide/edit_config.md)
- [edit app.py](/docs/guide/edit_app.md)
- [tmux monitoring](/docs/guide/tmux_monitoring.md)
- [debugging and tmux](/docs/guide/tmux_monitoring.md)
- [autostart](/docs/guide/autostart.md)
- [button](/docs/guide/button.md)
- [camera](/docs/guide/camera.md)
- [aditional information and tips](/docs/guide/information_and_tips.md)
- [RPi image from scratch](/docs/guide/add_on_zero2.md)
- [option: button](/docs/guide/button.md)
- [option: camera](/docs/guide/camera.md)
- [option: RPi image from scratch](/docs/guide/add_on_zero2.md)

A comprehensive guide on how to setup the LightningATM can be found here https://docs.lightningatm.me. Also join the Telegram group of LightningATM builders here https://t.me/lightningatm_building or contact 21isenough on Twitter (https://twitter.com/21isenough).

Expand Down
102 changes: 101 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import utils
import importlib
from PIL import Image

display_config = config.conf["atm"]["display"]
display = getattr(__import__("displays", fromlist=[display_config]), display_config)
Expand Down Expand Up @@ -89,7 +90,9 @@ def button_pushed():
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
# "no wallet setup" message
display.update_wallet_fault()
time.sleep(5)

# Softreset and startup screen
softreset()
Expand Down Expand Up @@ -220,6 +223,8 @@ def button_pushed():
logger.info("Simulate coin for test with pulses (3 times button)")
print("Simulate coin for test with pulses (3 times button)")
config.PULSES = 2
config.PUSHES = 0
return

if config.PUSHES == 5:
"""Shutdown the host machine
Expand All @@ -229,6 +234,101 @@ def button_pushed():
logger.warning("ATM shutdown (5 times button)")
os.system("sudo shutdown -h now")

if config.PUSHES == 9:
"""Show all displays once
"""
logger.info("Show all displays once (9 times button)")

print("1. display.error_screen(message=ERROR)")
display.error_screen(message="ERROR")
time.sleep(2)

print("2. display.update_qr_request()")
display.update_qr_request()
time.sleep(2)

print("3. display.update_qr_failed()")
display.update_qr_failed()
time.sleep(2)

print("4. display.update_payout_screen()")
display.update_payout_screen()
time.sleep(2)

print("5. display.update_payment_failed()")
display.update_payment_failed()
time.sleep(2)

print("6. display.update_thankyou_screen()")
display.update_thankyou_screen()
time.sleep(2)

print("7. display.update_nocoin_screen()")
display.update_nocoin_screen()
time.sleep(2)

print("8. display.update_lnurl_generation()")
display.update_lnurl_generation()
time.sleep(2)

print("9. display.update_shutdown_screen()")
display.update_shutdown_screen()
time.sleep(2)

print("10. display.update_wallet_scan()")
display.update_wallet_scan()
time.sleep(2)

print("11. display.update_lntxbot_balance(balance)")
display.update_lntxbot_balance(123)
time.sleep(2)

print("12. display.update_btcpay_lnd()")
display.update_btcpay_lnd()
time.sleep(2)

print("13. display.draw_lnurl_qr(qr_img)")
qrImage = Image.new('1', (122, 122), 255)
display.draw_lnurl_qr(qrImage)
time.sleep(2)

print("14. display.update_amount_screen()")
display.update_amount_screen()
time.sleep(2)

print("15. display.update_lnurl_cancel_notice()")
display.update_lnurl_cancel_notice()
time.sleep(2)

print("16. display.update_button_fault()")
display.update_button_fault()
time.sleep(2)

print("17. display.update_wallet_fault()")
display.update_wallet_fault()
time.sleep(2)

print("18. init_screent()")
display.init_screen(0)
time.sleep(2)

print("19. display.update_startup_screen()")
display.update_startup_screen()
time.sleep(2)

print("That's it!")

config.PUSHES = 0
return

else:
# If pushes not defined
logger.info("Show pushes not defined (x times button)")
display.update_button_fault()
time.sleep(3)
display.update_startup_screen()

# Reset pulses
config.PUSHES = 0


Expand Down
9 changes: 8 additions & 1 deletion config.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ def create_config(config_file=None):
PAPIRUS = Papirus(rotation=PAPIRUSROT)
except ImportError:
logger.warning("Papirus display library not installed.")
print("Papirus library not installed.")
sys.exit("Exiting...")

# Display - Waveshare 2.13 is 250 * 122 pixels
Expand All @@ -132,6 +133,7 @@ def create_config(config_file=None):
WAVESHARE = epd2in13_V2.EPD()
except ImportError:
logger.warning("Waveshare display library not installed.")
print("Waveshare2in13v2 library not installed.")
sys.exit("Exiting...")

# Display - Waveshare 2.13 (D) is 212 * 104 pixels
Expand All @@ -141,6 +143,7 @@ def create_config(config_file=None):
WAVESHARE = epd2in13d.EPD()
except ImportError:
logger.warning("Waveshare display library not installed.")
print("Waveshare2in13d library not installed.")
sys.exit("Exiting...")

# Display - Waveshare 2.66 is 296 * 152 pixels
Expand All @@ -150,6 +153,7 @@ def create_config(config_file=None):
WAVESHARE = epd2in66.EPD()
except ImportError:
logger.warning("Waveshare display library not installed.")
print("Waveshare2in66 library not installed.")
sys.exit("Exiting...")

# Display - Waveshare 2.7 is 264 * 176 pixels
Expand All @@ -159,6 +163,7 @@ def create_config(config_file=None):
WAVESHARE = epd2in7.EPD()
except ImportError:
logger.warning("Waveshare display library not installed.")
print("Waveshare2in7 library not installed.")
sys.exit("Exiting...")

# Display - Inky pHAT
Expand All @@ -172,11 +177,13 @@ def create_config(config_file=None):
INKY.set_border(INKY.WHITE)
except ImportError:
logger.warning("Inky display library not installed.")
print("Inkyphat library not installed.")
sys.exit("Exiting...")

# Display - No configuration match
else:
logger.warning("No display configuration match.")
print("No display configuration matched.")
sys.exit("Exiting...")

# API URL for coingecko
Expand Down Expand Up @@ -209,6 +216,6 @@ def create_config(config_file=None):
coin_type_pulses,coin_type_fiat,coin_type_name=coin_type.split(',')
COINTYPES[int(coin_type_pulses)]={'fiat': coin_type_fiat, 'name': coin_type_name}
except:
print("Pulses not set in the new way, please update config")
print("Pulses not set in the new way, please update config.")
sys.exit(2)

52 changes: 52 additions & 0 deletions displays/inkyphat.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,58 @@ def update_lnurl_cancel_notice():
config.INKY.show()


def update_button_fault():
image, width, height, draw = init_screen(color=config.WHITE)

draw.text(
(15, 10),
messages.button_fault_1,
fill=config.BLACK,
font=utils.create_font("freemonobold", 18),
)
draw.text(
(15, 40),
messages.button_fault_2,
fill=config.BLACK,
font=utils.create_font("freemono", 20),
)
draw.text(
(15, 65),
messages.button_fault_3,
fill=config.BLACK,
font=utils.create_font("freemono", 20),
)

config.INKY.set_image(image)
config.INKY.show()


def update_wallet_fault():
image, width, height, draw = init_screen(color=config.WHITE)

draw.text(
(15, 10),
messages.wallet_fault_1,
fill=config.BLACK,
font=utils.create_font("freemonobold", 18),
)
draw.text(
(15, 40),
messages.wallet_fault_2,
fill=config.BLACK,
font=utils.create_font("freemono", 20),
)
draw.text(
(15, 65),
messages.wallet_fault_3,
fill=config.BLACK,
font=utils.create_font("freemono", 20),
)

config.INKY.set_image(image)
config.INKY.show()


def update_blank_screen():
image, width, height, draw = init_screen(color=config.WHITE)

Expand Down
10 changes: 10 additions & 0 deletions displays/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,13 @@
lnurl_cancel_notice_1 = "Prepare for LNURL"
lnurl_cancel_notice_2 = "(Not LNURL compatible?"
lnurl_cancel_notice_3 = "Press button to cancel)"

# Text for update_button_fault()
button_fault_1 = "Oh Sorry.."
button_fault_2 = "Button fault.."
button_fault_3 = "Try again!"

# Text for update_wallet_fault()
wallet_fault_1 = "Wallet fault.."
wallet_fault_2 = "No wallet data."
wallet_fault_3 = "Set it first!"
16 changes: 13 additions & 3 deletions displays/messages_de.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,16 @@
amount_screen_8 = " sats)"

# Text for update_lnurl_cancel_notice
lnurl_cancel_notice_1 = "Prepare for LNURL"
lnurl_cancel_notice_2 = "(Not LNURL compatible?"
lnurl_cancel_notice_3 = "Press button to cancel)"
lnurl_cancel_notice_1 = "Vorbereitung LNURL"
lnurl_cancel_notice_2 = "Nicht LNURL kompatibel?"
lnurl_cancel_notice_3 = "Abbrechen Taste drücken!"

# Text for update_button_fault()
button_fault_1 = "Oh Nein.."
button_fault_2 = "Taster Fehler.."
button_fault_3 = "Versuchs nochmal!"

# Text for update_wallet_fault()
wallet_fault_1 = "Wallet Fehler.."
wallet_fault_2 = "Keine Daten."
wallet_fault_3 = "Bitte setzten!"
10 changes: 10 additions & 0 deletions displays/messages_fr.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,13 @@
lnurl_cancel_notice_1 = "Preparation au LNURL"
lnurl_cancel_notice_2 = "(Non compatible LNURL?"
lnurl_cancel_notice_3 = "Appuyer sur le bouton pour annuler)"

# Text for update_button_fault()
button_fault_1 = "Oh Sorry.."
button_fault_2 = "Button fault.."
button_screen_3 = "Try again!"

# Text for update_wallet_fault()
wallet_fault_1 = "Wallet fault.."
wallet_fault_2 = "No wallet data."
wallet_fault_3 = "Set it first!"
Loading

0 comments on commit f376a3e

Please sign in to comment.