Mercurial > hg > beaglert
changeset 363:6e428d6b57ef prerelease
updated set_startup
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Thu, 09 Jun 2016 01:25:32 +0100 |
parents | 0372fb8e8309 |
children | ab6d78e18e85 |
files | examples/basic_libpd/render.cpp scripts/set_startup.sh scripts/stop_running.sh |
diffstat | 3 files changed, 35 insertions(+), 35 deletions(-) [+] |
line wrap: on
line diff
--- a/examples/basic_libpd/render.cpp Thu Jun 09 01:11:55 2016 +0100 +++ b/examples/basic_libpd/render.cpp Thu Jun 09 01:25:32 2016 +0100 @@ -60,7 +60,7 @@ void Bela_messageHook(const char *source, const char *symbol, int argc, t_atom *argv){ if(strcmp(source, "bela_setDigital") == 0){ // symbol is the direction, argv[0] is the channel, argv[1] (optional) - // is signal(\"sig\" or \"~\") or message(\"mess\", default) rate + // is signal("sig" or "~") or message("message", default) rate bool isMessageRate = true; // defaults to message rate bool direction = 0; // initialize it just to avoid the compiler's warning bool disable = false;
--- a/scripts/set_startup.sh Thu Jun 09 01:11:55 2016 +0100 +++ b/scripts/set_startup.sh Thu Jun 09 01:25:32 2016 +0100 @@ -3,14 +3,20 @@ # This script enables or disables running BeagleRT when the board starts # up. -BBB_ADDRESS="root@192.168.7.2" -BBB_PATH="/root/BeagleRT" +[ -z "$BBB_ADDRESS" ] && BBB_ADDRESS="root@192.168.7.2" +[ -z "$BBB_BELA_HOME" ] && BBB_BELA_HOME="~/BeagleRT/" +[ -z "$BBB_SCREEN_NAME" ] && BBB_SCREEN_NAME="BeagleRT" +[ -z "$RUN_PROJECT" ] && RUN_PROJECT=1 +[ -z "$COMMAND_ARGS" ] && COMMAND_ARGS= +[ -z "$RUN_IN_FOREGROUND" ] && RUN_IN_FOREGROUND=1 +[ -z "$RUN_WITHOUT_SCREEN" ] && RUN_WITHOUT_SCREEN=0 +[ -z "$BBB_PROJECT_HOME" ] && BBB_PROJECT_HOME="${BBB_BELA_HOME}/projects/" +[ -z "$BBB_DEFAULT_PROJECT_NAME" ] && BBB_DEFAULT_PROJECT_NAME="scriptUploadedProject" +[ -z "$BBB_PROJECT_NAME" ] && BBB_PROJECT_NAME=$BBB_DEFAULT_PROJECT_NAME ENABLE_STARTUP=1 -COMMAND_ARGS= RUN_IN_LOOP=0 # This path is hard-coded in the BeagleRT image at present. -BBB_STARTUP_SCRIPT="/root/BeagleRT_startup.sh" function usage { @@ -20,9 +26,10 @@ echo " This script enables (by default) or disables running the BeagleRT project at startup. The -n option disables auto-startup, otherwise - auto-startup is enabled. The -b option changes the default path, which - is otherwise $BBB_PATH. The -c option passes command-line arguments to - the BeagleRT program; enclose the argument string in quotes. + auto-startup is enabled. The -b option changes the name of the project to + set on startup, which is otherwise $BBB_DEFAULT_PROJECT_NAME. The -c option + passes command-line arguments to the BeagleRT program; enclose the argument + string in quotes. The -l option runs the BeagleRT program in a loop, restarting automatically in the event of a crash." } @@ -31,7 +38,7 @@ while getopts "b:c:nlh" opt; do case $opt in - b) BBB_PATH=$OPTARG + b) BBB_PROJECT_NAME=$OPTARG ;; c) COMMAND_ARGS=$OPTARG ;; @@ -46,31 +53,16 @@ shift $((OPTIND-1)) +MAKE_COMMAND="make -C $BBB_BELA_HOME PROJECT=$BBB_PROJECT_NAME CL=\"$OPTARG\"" if [ $ENABLE_STARTUP -eq 0 ] then echo "Disabling BeagleRT at startup..." - - ssh $BBB_ADDRESS "echo \"#!/bin/sh -# -# This file is autogenerated by BeagleRT. Do not edit! - -# Run on startup disabled -- nothing to do here\" > $BBB_STARTUP_SCRIPT" - -else + ssh $BBB_ADDRESS "$MAKE_COMMAND nostartup" +elif [ $RUN_IN_LOOP -eq 1 ] +then echo "Enabling BeagleRT at startup..." - - SCRIPT_PRERUN= - SCRIPT_POSTRUN= - if [ $RUN_IN_LOOP -ne 0 ] ; then - SCRIPT_PRERUN="bash -c \\\"while sleep 0.5 ; do" - SCRIPT_POSTRUN=" ; done \\\" " - fi - - ssh $BBB_ADDRESS "echo \"#!/bin/sh -# -# This file is autogenerated by BeagleRT. Do not edit! - -echo Running BeagleRT... -screen -S BeagleRT -d -m $SCRIPT_PRERUN $BBB_PATH/BeagleRT $COMMAND_ARGS $SCRIPT_POSTRUN\" > $BBB_STARTUP_SCRIPT" - + ssh $BBB_ADDRESS "$MAKE_COMMAND startuploop" +else + echo "Enabling BeagleRT at startup..." + ssh $BBB_ADDRESS "$MAKE_COMMAND startup" fi
--- a/scripts/stop_running.sh Thu Jun 09 01:11:55 2016 +0100 +++ b/scripts/stop_running.sh Thu Jun 09 01:25:32 2016 +0100 @@ -2,10 +2,18 @@ # # This script stops the BeagleRT program running on the BeagleBone. -BBB_ADDRESS="root@192.168.7.2" -BBB_SCREEN_NAME="BeagleRT" +[ -z "$BBB_ADDRESS" ] && BBB_ADDRESS="root@192.168.7.2" +[ -z "$BBB_BELA_HOME" ] && BBB_BELA_HOME="~/BeagleRT/" +[ -z "$BBB_SCREEN_NAME" ] && BBB_SCREEN_NAME="BeagleRT" +[ -z "$RUN_PROJECT" ] && RUN_PROJECT=1 +[ -z "$COMMAND_ARGS" ] && COMMAND_ARGS= +[ -z "$RUN_IN_FOREGROUND" ] && RUN_IN_FOREGROUND=1 +[ -z "$RUN_WITHOUT_SCREEN" ] && RUN_WITHOUT_SCREEN=0 +[ -z "$BBB_PROJECT_HOME" ] && BBB_PROJECT_HOME="${BBB_BELA_HOME}/projects/" +[ -z "$BBB_DEFAULT_PROJECT_NAME" ] && BBB_DEFAULT_PROJECT_NAME="scriptUploadedProject" +[ -z "$BBB_PROJECT_NAME" ] && BBB_PROJECT_NAME=$BBB_DEFAULT_PROJECT_NAME # The first command should be sufficient to stop any BeagleRT run with # these scripts; the second will catch any leftovers run other ways BELA_AUDIO_THREAD_NAME=beaglert-audio -ssh $BBB_ADDRESS 'screen -X -S '"$BBB_SCREEN_NAME"' quit > /dev/null; PID=`grep '"$BELA_AUDIO_THREAD_NAME"' /proc/xenomai/stat | cut -d " " -f 5 | sed s/\s//g`; if [ -z $PID ]; then printf ""; else echo "Killing old Bela process $PID"; kill -2 $PID; fi' +ssh $BBB_ADDRESS make -C $BBB_BELA_HOME stop