6 # Author : Nathael Pajani
7 # Copyright 2016 Nathael Pajani <nathael.pajani@techno-innov.fr>
9 # This program is free software: you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation, either version 2 of the License, or
12 # (at your option) any later version.
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program. If not, see <http://www.gnu.org/licenses/>.
23 # How to use this script/programm
29 my $debug = 1; # 0: no debug
33 print "Need file name as first argument\n";
43 open(LOGFILE, "<", $file);
44 foreach my $line (<LOGFILE>) {
45 chomp($line); # remove the newline from $line.
47 if ($line =~ m/Temp read: $w - raw/) {
52 } elsif ($line =~ m/ADC9: $w, ADC10: $w/) {
59 print "Got ".$#stime." values\n";
62 my $tempgraph = GD::Graph::bars->new(($#stime*2), 800);
66 title => 'Temp sensor vs time',
68 ) or warn $tempgraph->error;
69 my @tempdata = (\@stime, \@stempdata);
70 my $temp_gd = $tempgraph->plot(\@tempdata) or die $tempgraph->error();
72 open(IMG, '>filetemp.png') or die $!;
74 print IMG $temp_gd->png;
78 my $capgraph = GD::Graph::bars->new(($#stime*2), 800);
82 title => 'Temp sensor vs time',
84 ) or warn $capgraph->error;
85 my @capdata = (\@stime, \@scapdata);
86 my $cap_gd = $capgraph->plot(\@capdata) or die $capgraph->error();
88 open(IMG, '>filecap.png') or die $!;
90 print IMG $cap_gd->png;
94 my $resgraph = GD::Graph::bars->new(($#stime*2), 800);
98 title => 'Temp sensor vs time',
100 ) or warn $resgraph->error;
101 my @resdata = (\@stime, \@sresdata);
102 my $res_gd = $resgraph->plot(\@resdata) or die $resgraph->error();
104 open(IMG, '>fileres.png') or die $!;
106 print IMG $res_gd->png;