From ff785ed8debfa65b8f11306f50687dafca00512e Mon Sep 17 00:00:00 2001 From: trotFunky Date: Fri, 12 Jan 2018 00:56:53 +0100 Subject: [PATCH] =?UTF-8?q?Modifications=20pour=20conserver=20les=20diff?= =?UTF-8?q?=C3=A9rentes=20sorties,=20si=20elles=20sont=20multiples?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Perso/serialToCSV.sh | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/Perso/serialToCSV.sh b/Perso/serialToCSV.sh index 97f99c6..19db0b8 100755 --- a/Perso/serialToCSV.sh +++ b/Perso/serialToCSV.sh @@ -1,7 +1,12 @@ #! /bin/bash -trap "python3 /home/trotfunky/Programmation/Git/Python/extraction_asserv.py $1 $2 $3 ; exit" INT -trap "python3 /home/trotfunky/Programmation/Git/Python/extraction_asserv.py $1 $2 $3 ; exit" TERM +function pythonGraph { + 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 @@ -11,16 +16,21 @@ else fileName="./serialOutput/serialOutput.csv" fi -rm -f $fileName -touch $fileName +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 + echo $line >> "$fileName" case "$line" in *"DATAEND"*) break;; esac done -python3 /home/trotfunky/Programmation/Git/Python/extraction_asserv.py $1 $2 $3 \ No newline at end of file +python3 /home/trotfunky/Programmation/Git/Python/extraction_asserv.py "$outFile" $1 \ No newline at end of file