From 721ce513ada8f695d5950b3a38122c85c8454194 Mon Sep 17 00:00:00 2001 From: AndyHazz <517731+AndyHazz@users.noreply.github.com> Date: Fri, 21 May 2021 21:37:11 +0100 Subject: [PATCH 1/3] Update launch.pre Changes very specific to my cabinet, allowing coin mech to be ready when a game starts --- root/scripts/n247launch/launch.pre | 44 +++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/root/scripts/n247launch/launch.pre b/root/scripts/n247launch/launch.pre index 90bff49..eae118a 100644 --- a/root/scripts/n247launch/launch.pre +++ b/root/scripts/n247launch/launch.pre @@ -1,5 +1,41 @@ #!/usr/bin/bash -clear -#fbv -f -e -d 1 /root/.lemonlauncher/loadingen.png > /dev/null 2>&1 -#fbv -f -e /root/.lemonlauncher/loadingen.png > /dev/null 2>&1 -# -r ignores aspect +# Based on https://github.com/simonprickett/bash-traffic-lights-pi/blob/master/trafficlights.sh +# This script will send a signal to a relay switch that passes machine ready to credit board that tells the coin mech to accept coins + +BASE_GPIO_PATH=/sys/class/gpio + +# Assign names to GPIO pin numbers +COIN=26 + +# Assign names to states +WAIT="1" +READY="0" + +# Utility function to export a pin if not already exported +exportPin() +{ + if [ ! -e $BASE_GPIO_PATH/gpio$1 ]; then + echo "$1" > $BASE_GPIO_PATH/export + fi +} + +# Utility function to set a pin as an output +setOutput() +{ + echo "out" > $BASE_GPIO_PATH/gpio$1/direction +} + +# Utility function to change state +setState() +{ + echo $2 > $BASE_GPIO_PATH/gpio$1/value +} + +# Export pins so that we can use them +exportPin $COIN + +# Set pins as outputs +setOutput $COIN + +# Set state +setState $COIN $READY From 0b42c83ebb6298beca092a0385a920482d51196a Mon Sep 17 00:00:00 2001 From: AndyHazz <517731+AndyHazz@users.noreply.github.com> Date: Sat, 22 May 2021 11:38:59 +0100 Subject: [PATCH 2/3] Update launch.pst --- root/scripts/n247launch/launch.pst | 1 + 1 file changed, 1 insertion(+) diff --git a/root/scripts/n247launch/launch.pst b/root/scripts/n247launch/launch.pst index e69de29..0e708e8 100644 --- a/root/scripts/n247launch/launch.pst +++ b/root/scripts/n247launch/launch.pst @@ -0,0 +1 @@ +setState $COIN $WAIT From 197491644823c18819a7cc812b91504b80583067 Mon Sep 17 00:00:00 2001 From: AndyHazz <517731+AndyHazz@users.noreply.github.com> Date: Sat, 22 May 2021 11:43:30 +0100 Subject: [PATCH 3/3] Update launch.pre Change gpio to pin 27 to avoid clash with CRT rotate --- root/scripts/n247launch/launch.pre | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/root/scripts/n247launch/launch.pre b/root/scripts/n247launch/launch.pre index eae118a..7b2a8cf 100644 --- a/root/scripts/n247launch/launch.pre +++ b/root/scripts/n247launch/launch.pre @@ -5,7 +5,7 @@ BASE_GPIO_PATH=/sys/class/gpio # Assign names to GPIO pin numbers -COIN=26 +COIN=27 # Assign names to states WAIT="1"