From 84caea8a968e44d20c3412f230b90b0823718640 Mon Sep 17 00:00:00 2001 From: Satu Koskinen Date: Tue, 21 Feb 2023 18:51:14 +0200 Subject: [PATCH] Remove led display script, clean up scripts, fix gitignore --- Makefile | 2 +- audio-logger/.gitignore | 2 +- audio-logger/run_test.sh | 2 +- lcd-display/test_lcd.py | 13 ------------- scripts/setup-audio.sh | 1 - scripts/setup-raspberry-pi.sh | 13 +++++++++---- scripts/start-all.sh | 3 ++- 7 files changed, 14 insertions(+), 22 deletions(-) delete mode 100644 lcd-display/test_lcd.py diff --git a/Makefile b/Makefile index 719540d..89482d9 100644 --- a/Makefile +++ b/Makefile @@ -5,4 +5,4 @@ build-audio: cd audio-logger && cargo build --release start-all: - cd scripts && start-all.sh \ No newline at end of file + cd scripts && start-all.sh diff --git a/audio-logger/.gitignore b/audio-logger/.gitignore index 0cd831f..5b3eb2d 100644 --- a/audio-logger/.gitignore +++ b/audio-logger/.gitignore @@ -1,3 +1,3 @@ -taget +target *.wav recordings \ No newline at end of file diff --git a/audio-logger/run_test.sh b/audio-logger/run_test.sh index ebd0a94..a4fdc59 100644 --- a/audio-logger/run_test.sh +++ b/audio-logger/run_test.sh @@ -7,4 +7,4 @@ target/release/audio rec \ --sample-rate 44100 \ --channels 2 \ --buffer-size 1024 \ - alsa \ \ No newline at end of file + alsa \ diff --git a/lcd-display/test_lcd.py b/lcd-display/test_lcd.py deleted file mode 100644 index 4f17595..0000000 --- a/lcd-display/test_lcd.py +++ /dev/null @@ -1,13 +0,0 @@ -from rpi_lcd import LCD -from time import sleep - -lcd = LCD(bus=2) - -lcd.text('Hello World!', 1) -lcd.text('Raspberry Pi', 2) -lcd.text('is really', 3, 'center') -lcd.text('awesome', 4, 'right') - -sleep(5) -lcd.clear() - diff --git a/scripts/setup-audio.sh b/scripts/setup-audio.sh index 3b37d54..f0c5e5b 100755 --- a/scripts/setup-audio.sh +++ b/scripts/setup-audio.sh @@ -29,5 +29,4 @@ if ! grep -q "$config" /etc/asound.conf; then echo "$config" | sudo tee -a /etc/asound.conf fi - cd $HOME/hydrophonitor/audio-logger && cargo build --release diff --git a/scripts/setup-raspberry-pi.sh b/scripts/setup-raspberry-pi.sh index 65faafe..b96dd71 100644 --- a/scripts/setup-raspberry-pi.sh +++ b/scripts/setup-raspberry-pi.sh @@ -3,12 +3,17 @@ set -ex BOOT_DIR_PATH=/boot/hydrophonitor +LOG_FILE=$BOOT_DIR_PATH/$(date +"%Y-%m-%dT%H-%M-%S")-setup-log.txt # Output from commands within the curly braces is written -# to a log file in $BOOT_DIR_PATH +# to $LOG_FILE { DIR_PATH=$HOME +echo +echo "Starting setup, writing logs to $LOG_FILE" +echo + echo echo "### Update file paths in config and start script files" echo @@ -80,9 +85,9 @@ echo echo "### Set up a cron job to start the recordings at boot" echo -# USER=$(whoami) CRON_FILE=/etc/crontab -CRON_COMMAND="@reboot root $DIR_PATH/hydrophonitor/scripts/start-all.sh 2>&1 > $BOOT_DIR_PATH/$(date +"%Y-%m-%dT%H-%M-%S")-log.txt" +CRON_LOG_FILE="$BOOT_DIR_PATH/\$(date +\"%Y-%m-%dT%H-%M-%S\")-cron-log.txt" +CRON_COMMAND="@reboot root $DIR_PATH/hydrophonitor/scripts/start-all.sh 2>&1 > $CRON_LOG_FILE" # Append command to cron file only if it's not there yet if ! grep -q "$CRON_COMMAND" "$CRON_FILE"; then @@ -93,4 +98,4 @@ fi echo echo "### Setup ready, run 'sudo reboot' to apply all changes" echo -} 2>&1 | sudo tee $BOOT_DIR_PATH/$(date +"%Y-%m-%dT%H-%M-%S")-setup-log.txt \ No newline at end of file +} 2>&1 | sudo tee $LOG_FILE \ No newline at end of file diff --git a/scripts/start-all.sh b/scripts/start-all.sh index e2d8307..a1d395e 100755 --- a/scripts/start-all.sh +++ b/scripts/start-all.sh @@ -4,6 +4,7 @@ set -x BOOT_DIR_PATH=/boot/hydrophonitor +LOG_FILE=$BOOT_DIR_PATH/$(date +"%Y-%m-%dT%H-%M-%S")-startup-log.txt { SCRIPT_PATH=/home/pi/hydrophonitor/scripts @@ -20,4 +21,4 @@ mkdir -p "$OUTPUT_DIR"/audio sleep 10 (export OUTPUT_DIR=$OUTPUT_DIR; $SCRIPT_PATH/start-audio.sh & $SCRIPT_PATH/start-gps.sh & $SCRIPT_PATH/start-pressure-depth.sh) 2>&1 | tee "$OUTPUT_DIR"/log.txt -} 2>&1 | tee $BOOT_DIR_PATH/$(date +"%Y-%m-%dT%H-%M-%S")-startup-log.txt +} 2>&1 | tee $LOG_FILE