Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makes the camera function optional #66

Merged
merged 22 commits into from
Mar 30, 2022
Merged
Changes from 21 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -21,15 +21,14 @@ Full Version | Pocket Version

### Installation guideline

_Carry out the points step by step as described here. This is the quickest way to succeed._
_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)
- [debugging and tmux](/docs/guide/tmux_monitoring.md)
- [autostart](/docs/guide/autostart.md)
- [aditional information and tips](/docs/guide/information_and_tips.md)
@@ -38,7 +37,9 @@ _Carry out the points step by step as described here. This is the quickest way t
- [option: lockout relay](/docs/guide/relay.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).
If you want to update your ATM version, see this guide: [Update](/docs/guide/we_need_your_help.md)

More information of 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).

To see the Lightning ATM in action, check out this video [LightningATM in action](https://twitter.com/21isenough/status/1170808396955738114?s=20)

15 changes: 12 additions & 3 deletions app.py
Original file line number Diff line number Diff line change
@@ -111,12 +111,13 @@ def button_pushed():

lnurlproxy = config.conf["lnurl"]["lnurlproxy"]
activewallet = config.conf["atm"]["activewallet"]
camera = config.conf["atm"]["camera"]
# Determine if LNURL Withdrawls are possible
if lnurlproxy == "active" or activewallet == "lntxbot":
# 1. Ask if wallet supports LNURL
# 1. Ask if wallet supports LNURL, if camera available
# 2. Offer to cancel and switch to normal scan
# 3. Process payment
if activewallet == "lntxbot":
if activewallet == "lntxbot" and camera == "yes":
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

boolean true or false is more common

display.update_lnurl_cancel_notice()
time.sleep(5)
if config.PUSHES == 1:
@@ -135,6 +136,14 @@ def button_pushed():
softreset()
return

# If no camera is available, process LNURL directly
if activewallet == "lntxbot":
# Process LNURL
logger.info("LNURL process stared")
lntxbot.process_using_lnurl(config.SATS)
softreset()
return

if lnurlproxy == "active":
display.update_lnurl_cancel_notice()
time.sleep(5)
@@ -483,7 +492,7 @@ def main():
except KeyboardInterrupt:
display.update_shutdown_screen()
logger.info("Application finished (Keyboard Interrupt)")
sys.exit("Manually Interrupted")
sys.exit(" Manually Interrupted")
except Exception:
logger.exception("Oh no, something bad happened! Restarting...")
os.execv("/home/pi/LightningATM/app.py", [""])
11 changes: 7 additions & 4 deletions docs/guide/autostart.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Autostart
## Autostart and start/stop the ATM

###### Activate the Service:
###### Install and activate the autostart service:

```
$ cd ~/LightningATM
@@ -9,15 +9,18 @@ $ sudo systemctl enable LightningATM.service
$ sudo reboot
```

###### Other commands to control the service:
- From now on the ATM will start automatically after booting.

###### Commands to control the ATM:

```
$ sudo systemctl status LightningATM.service
$ sudo systemctl stop LightningATM.service
$ sudo systemctl start LightningATM.service
```

- Note: From now on the ATM will start automatically after booting. If you want to observe the app.py in tmux, you should `stop` the "LightningATM.service" manually, bevor you start the app.py in the tmux. Don't forget to `start` the service again afterwards.
- `Note:` When the autostart service is once installed and activated, you only need to "start" the ATM if you previously stopped the ATM.
- `Note:` If you want to observe the app.py in tmux, you musst `stop` the "LightningATM.service" manually, bevor you start the app.py in the tmux. Then restart the ATM with the "start" command or simply restart the entire ATM afterwards by unplugging the power and plugging it back in.

---

34 changes: 0 additions & 34 deletions docs/guide/edit_app.md

This file was deleted.

12 changes: 6 additions & 6 deletions docs/guide/edit_config.md
Original file line number Diff line number Diff line change
@@ -11,14 +11,14 @@ $ cd ~/LightningATM/
$ ./app.py
```

- When you first start you will probably get an "Exiting.." message because the default display type is wrong.
- When you first start you will get an "No display configuration matched. Exiting...".

<img src="../pictures/edit_config_first_call_exiting.png" width="600">
<img src="../pictures/edit_config_first_call_exiting.png" width="500">

- You can ignore the message. The config.ini has now been created in the background.
- Now edit the config.ini as described in the next step.
- The config.ini has now been created in the background.
- Now edit the config.ini as described next step to set the display and other configurations.

`Note:` If the display is correct, the process will not "Exiting..". You have to stop it with `CTRL+C`. After a short time, `Manually Interrupted` is shown in the terminal window.
`Note:` If the display is already set correctly, the process will not "Exiting..". You have to stop it with `CTRL+C`.

### Open the config.ini file

@@ -120,7 +120,7 @@ display ATM turned off!

---

#### [display](/docs/guide/display.md) ᐊ previous | next ᐅ [edit_app](/docs/guide/edit_app.md)
#### [display](/docs/guide/display.md) ᐊ previous | next ᐅ [debugging and tmux](/docs/guide/tmux_monitoring.md)



2 changes: 1 addition & 1 deletion docs/guide/tmux_monitoring.md
Original file line number Diff line number Diff line change
@@ -55,5 +55,5 @@ Two withdrawals were made here. Once 5 cents and once 1.60 euros (10 cents + 50

---

#### [edit_app](/docs/guide/edit_app.md) ᐊ previous | next ᐅ [autostart](/docs/guide/autostart.md)
#### [edit_config](/docs/guide/edit_config.md) ᐊ previous | next ᐅ [autostart](/docs/guide/autostart.md)

36 changes: 30 additions & 6 deletions docs/guide/we_need_your_help.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,48 @@
## Would you like to help test the new version? 📖🧐
## Would you like to help test the new version? 📜🧐

With this update comes a change of the GPIO inputs and outputs. This makes the inputs less sensitive to EMI interference that could lead to unwanted pulses. So if you had sporadic problems with your ATM, you should definitely try this update.

In addition, the function of a lockout relay for the coin acceptor was also implemented with the update. A useful function that one or the other has certainly wished for after the coin impulses were lost or the coin value was incorrectly recognized. A detailed documentation can be found in the new chapter [option: lockout relay](/docs/guide/relay.md).

Also coming with this update is the option to enable or disable a camera. This has the advantage that you don't have to edit the app.py file to get rid of the LNURL query display, if you don't have a camera or a button. The option to set different languages will be added later. The implementation will take place in the next update.

And finally, as a bit of service, the ATM briefly shows the Out of Service display once when it starts up.

To participate, you must update your AMT software once with this new version. Don't worry, we have written a step-by-step instructions for this that really anyone can use and all your configuration data such as wallet and settings will be retained. You can easily undo the whole thing afterwards

---

### 1. Update to the new version
### 1. Expand the config.ini

Log into the RPi and then stop the ATM service once, make a backup from directory LightningATM, clone the new Github to "temp", sync once from "temp" to "LightningAMT" and then delete the "temp" directory that is no longer needed.
Because we are also expanding the config.ini with this update, we unfortunately have to expand config.ini manually, otherwise we get an error message when starting the ATM. Expanding is not difficult and does not have to be undone later. First we log in again via SSH and stop the LightningATM service and call up the config.ini.

$ sudo systemctl stop LightningATM.service
$ nano ~/.lightningATM/config.ini

Then we add the following text between `centname = cent` and `# Set the Fee in %`

# Set language: "en", "de", "fr", "it", "es", "pt", "tr" currently available
# Code 2 from https://www.science.co.il/language/Codes.php
language = en

# Do you have a camera? "no" or "yes"
camera = no

<img src="../pictures/we_need_your_help_config.ini.png" width="600">

- When you finshed with changings in the config.ini, save and exit the editor: `CTRL+x -> y -> ENTER`
- `Help:` If you want to copy and paste the text, take the text to the clipboard and then place the cursor where you want to paste the text and right-click to paste. But important is just `language = en` and `camera = no`.

### 2. Update to the new version

Make a backup from directory LightningATM, clone the new Github to "temp", sync once from "temp" to "LightningAMT" and then delete the "temp" directory that is no longer needed.

$ mv LightningATM LightningATM_Backup
$ git clone --branch master https://github.com/21isenough/LightningATM.git temp
$ rsync -a temp/ LightningATM/
$ sudo rm -r temp

### 2. Start and test the version
### 3. Start and test the version

$ cd LightningATM
$ ./app.py
@@ -27,7 +51,7 @@ Log into the RPi and then stop the ATM service once, make a backup from director
- The ATM has started and you can use it normally or test the functions.
- Stop the ATM with `CTRL+C`

### 3. If you don't like this version and want to get rid of it
### 4. If you don't like this version and want to get rid of it

Make the backup the major version again and then delete the backup.

@@ -38,7 +62,7 @@ Make the backup the major version again and then delete the backup.
- Everthing should now be as befor. Even the wallat data.
- Check if you have set a temporary button and reset it with `payoutdelay = 12` in the `config.ini`

### 4. Final step
### 5. Final step

Restart the LightningATM service

Binary file modified docs/pictures/edit_config_first_call_exiting.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/pictures/we_need_your_help_config.ini.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 8 additions & 1 deletion example_config.ini
Original file line number Diff line number Diff line change
@@ -7,6 +7,13 @@ cur = eur
# of your choice for price display (singular).
centname = cent

# Set language: "en", "de", "fr", "it", "es", "pt", "tr" currently available
# Code 2 from https://www.science.co.il/language/Codes.php
language = en

# Do you have a camera? "False" or "True"
camera = False

# Set the Fee in %
fee = 2

@@ -24,7 +31,7 @@ dangermode = on
# display = waveshare2in7
# display = inkyphat

display = papiruszero2in
display =

# Automatically set during initial setup to LND or LNTXBOT
# Current options are: