X-Git-Url: http://git.techno-innov.fr/?a=blobdiff_plain;f=test%2Ftranslate.pl;fp=test%2Ftranslate.pl;h=8829c72dd6025b4dcf22e7920c8b27cce3d5526f;hb=8d564dbddcd91212537367941b0f386dfb23e87c;hp=0000000000000000000000000000000000000000;hpb=b3366e5a43c4e86f72608404f06e440fbc95af13;p=soft%2Flpc82x%2Fexanh diff --git a/test/translate.pl b/test/translate.pl new file mode 100755 index 0000000..8829c72 --- /dev/null +++ b/test/translate.pl @@ -0,0 +1,63 @@ +#!/usr/bin/perl -w + +use strict; +use warnings; + +# Author : Nathael Pajani +# Copyright 2016 Nathael Pajani +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +my $file = $ARGV[0]; +if (! -e $file) { + print "Need file name as first argument\n"; + exit 1; +} + +my $count = 0; +my $skip = 4000; + +open(LOGFILE, "<", $file); +open(TEMP, ">", "data_temp.log") or die $!; +open(CAP, ">", "data_cap.log") or die $!; +open(RES, ">", "data_res.log") or die $!; + + +foreach my $line () { + if ($skip > 0) { + $skip--; + next; + } + chomp($line); # remove the newline from $line. + my $w = "(.+?)"; + if ($line =~ m/Temp read: $w - raw/) { + my $temp = $1; + $temp =~ s/,/./; + print TEMP "$count $temp\n"; + # Increment counter + $count++; + } elsif ($line =~ m/ADC9: $w, ADC10: (.+)/) { + print CAP "$count $1\n"; + print RES "$count $2\n"; + } +} + + +print "Got $count values\n"; + +close(TEMP); +close(CAP); +close(RES); +