37 lines
No EOL
790 B
Bash
Executable file
37 lines
No EOL
790 B
Bash
Executable file
#! /bin/bash
|
|
|
|
function pythonGraph {
|
|
echo "DATAEND" >> "$fileName"
|
|
python3 /home/trotfunky/Programmation/Git/Python/extraction_asserv.py "$outFile" "$1"
|
|
exit
|
|
}
|
|
|
|
trap pythonGraph INT
|
|
trap pythonGraph TERM
|
|
|
|
stty -F /dev/ttyACM0 115200 raw -echo -echoe -echok
|
|
|
|
if [ $# -eq 3 ]; then
|
|
fileName="./serialOutput/serialOutput-"$1","$2","$3".csv"
|
|
else
|
|
fileName="./serialOutput/serialOutput.csv"
|
|
fi
|
|
|
|
if [ -e "$fileName" ]; then
|
|
fileName=".""$(echo $fileName | cut -f 2 -d".")""-$(date +'%Y-%m-%d @ %Hh%M').csv"
|
|
fi
|
|
|
|
touch "$fileName"
|
|
outFile=$(echo $fileName | cut -f 3 -d"/")
|
|
|
|
|
|
while true; do
|
|
read line < /dev/ttyACM0
|
|
echo $line >> "$fileName"
|
|
case "$line" in
|
|
*"DATAEND"*)
|
|
break;;
|
|
esac
|
|
done
|
|
|
|
python3 /home/trotfunky/Programmation/Git/Python/extraction_asserv.py "$outFile" "$1" |