From 08d6f356bad67129d597a78ffc2e358f43a55978 Mon Sep 17 00:00:00 2001 From: Lincoln Lorenz Date: Fri, 4 Sep 2020 16:09:43 -0400 Subject: [PATCH] Add development documentation --- README.md | 18 +++++++++++++++++- util/copy_python_to_board.sh | 26 ++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100755 util/copy_python_to_board.sh diff --git a/README.md b/README.md index 9692534c5..8e86c48cc 100644 --- a/README.md +++ b/README.md @@ -3,5 +3,21 @@ Implementation of the EthAudio Controller on the Raspberry Pi ## configuration Download Raspberry Pi OS from [here](https://www.raspberrypi.org/downloads/raspberry-pi-os/) we are currently using the "Raspberry Pi OS (32-bit) with desktop and recommended software" Follow steps on [rpi](https://www.raspberrypi.org/documentation/hardware/computemodule/cm-emmc-flashing.md) to flash the eMMC on the device + +## Development setup +1. Use vscode with its python plugin, this should highlight errors +2. In a bash terminal you should setup an ssh key for interacting with the pi checkout this [guide](https://www.raspberrypi.org/documentation/remote-access/ssh/passwordless.md) + +### Deploying code for testing +1. Find the rpi's ip address and set the variable expected by the copy_python_to_board.sh script +2. Copy the python files over +From the base of the git repo in bash +```./util/copy_python_to_board.sh``` +3. ssh into the pi and run the files +``` +ssh $RPI_IP_ADDRESS +export DISPLAY=:0 # use the connected display, this is set weird over ssh by default +``` + ## TODO add howto configure USB audio for shairport -## TODO follow strategy for handling 7.1 channel audio -> 4 stereo outputs \ No newline at end of file +## TODO follow strategy for handling 7.1 channel audio -> 4 stereo output diff --git a/util/copy_python_to_board.sh b/util/copy_python_to_board.sh new file mode 100755 index 000000000..f4b5ea877 --- /dev/null +++ b/util/copy_python_to_board.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +# get directory that the script exists in +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# check if RPI_IP_ADDRESS is set +if [[ -z "${RPI_IP_ADDRESS}" ]]; then + echo "" + echo "Please set RPI_IP_ADDRESS, for example:" + echo -e '\033[1;32mexport RPI_IP_ADDRESS=192.168.0.140\033[0m' + echo "for ssh key access" + echo -e '\033[1;32mexport RPI_IP_ADDRESS=pi@192.168.0.140\033[0m' + echo "" + exit 1 +fi + +# Python folder on EthAudio controller +RPI_PYTHON_FOLDER=/home/pi/python + +# create directories if they don't exists +ssh $RPI_IP_ADDRESS "mkdir -p ${RPI_PYTHON_FOLDER}/ethaudio" +ssh $RPI_IP_ADDRESS "mkdir -p ${RPI_PYTHON_FOLDER}/tests" + +# copy stuff to board +scp $SCRIPT_DIR/../python/ethaudio/*.py $RPI_IP_ADDRESS:${RPI_PYTHON_FOLDER}/ethaudio +scp $SCRIPT_DIR/../python/tests/*.py $RPI_IP_ADDRESS:${RPI_PYTHON_FOLDER}/tests