fixed to include conversion to Fahrenheit in 'gensens.pm' #280

This commit is contained in:
Jordi Sanfeliu 2020-05-25 15:35:27 +02:00
parent 8d596807b2
commit e573601c28
1 changed files with 42 additions and 8 deletions

View File

@ -351,7 +351,6 @@ sub gensens_cgi {
push(@output, "Time$line2\n"); push(@output, "Time$line2\n");
push(@output, "----$line3 \n"); push(@output, "----$line3 \n");
my $line; my $line;
my @row;
my $time; my $time;
my $n2; my $n2;
my $from; my $from;
@ -366,8 +365,10 @@ sub gensens_cgi {
$from = $sg * 9 + $n2++; $from = $sg * 9 + $n2++;
$to = $from + 1; $to = $from + 1;
my ($j) = @$line[$from..$to]; my ($j) = @$line[$from..$to];
@row = ($j || 0); if(index($sg, "temp")) {
push(@output, sprintf("%12d ", @row)); $j = celsius_to($config, $j || 0);
}
push(@output, sprintf("%12d ", $j || 0));
} }
$n2++; $n2++;
} }
@ -450,11 +451,11 @@ sub gensens_cgi {
if($str) { if($str) {
$str = $gensens->{map}->{$str} ? $gensens->{map}->{$str} : $str; $str = $gensens->{map}->{$str} ? $gensens->{map}->{$str} : $str;
$str = sprintf("%-20s", substr($str, 0, 20)); $str = sprintf("%-20s", substr($str, 0, 20));
push(@tmp, "LINE2:gsen" . $n . $LC[$n] . ":$str"); push(@tmp, "LINE2:gsen_" . $n . $LC[$n] . ":$str");
push(@tmp, "GPRINT:gsen" . $n . ":LAST: Cur\\:%5.1lf%s"); push(@tmp, "GPRINT:gsen_" . $n . ":LAST: Cur\\:%5.1lf%s");
push(@tmp, "GPRINT:gsen" . $n . ":MIN: Min\\:%5.1lf%s"); push(@tmp, "GPRINT:gsen_" . $n . ":MIN: Min\\:%5.1lf%s");
push(@tmp, "GPRINT:gsen" . $n . ":MAX: Max\\:%5.1lf%s\\n"); push(@tmp, "GPRINT:gsen_" . $n . ":MAX: Max\\:%5.1lf%s\\n");
push(@tmpz, "LINE2:gsen" . $n . $LC[$n] . ":$str"); push(@tmpz, "LINE2:gsen_" . $n . $LC[$n] . ":$str");
next; next;
} }
last; last;
@ -467,6 +468,39 @@ sub gensens_cgi {
if($title) { if($title) {
push(@output, " <td bgcolor='$colors->{title_bg_color}'>\n"); push(@output, " <td bgcolor='$colors->{title_bg_color}'>\n");
} }
if(index($ls[0], "temp") == 0) {
if(lc($config->{temperature_scale}) eq "f") {
push(@CDEF, "CDEF:gsen_0=9,5,/,gsen0,*,32,+");
push(@CDEF, "CDEF:gsen_1=9,5,/,gsen1,*,32,+");
push(@CDEF, "CDEF:gsen_2=9,5,/,gsen2,*,32,+");
push(@CDEF, "CDEF:gsen_3=9,5,/,gsen3,*,32,+");
push(@CDEF, "CDEF:gsen_4=9,5,/,gsen4,*,32,+");
push(@CDEF, "CDEF:gsen_5=9,5,/,gsen5,*,32,+");
push(@CDEF, "CDEF:gsen_6=9,5,/,gsen6,*,32,+");
push(@CDEF, "CDEF:gsen_7=9,5,/,gsen7,*,32,+");
push(@CDEF, "CDEF:gsen_8=9,5,/,gsen8,*,32,+");
} else {
push(@CDEF, "CDEF:gsen_0=gsen0");
push(@CDEF, "CDEF:gsen_1=gsen1");
push(@CDEF, "CDEF:gsen_2=gsen2");
push(@CDEF, "CDEF:gsen_3=gsen3");
push(@CDEF, "CDEF:gsen_4=gsen4");
push(@CDEF, "CDEF:gsen_5=gsen5");
push(@CDEF, "CDEF:gsen_6=gsen6");
push(@CDEF, "CDEF:gsen_7=gsen7");
push(@CDEF, "CDEF:gsen_8=gsen8");
}
} else {
push(@CDEF, "CDEF:gsen_0=gsen0");
push(@CDEF, "CDEF:gsen_1=gsen1");
push(@CDEF, "CDEF:gsen_2=gsen2");
push(@CDEF, "CDEF:gsen_3=gsen3");
push(@CDEF, "CDEF:gsen_4=gsen4");
push(@CDEF, "CDEF:gsen_5=gsen5");
push(@CDEF, "CDEF:gsen_6=gsen6");
push(@CDEF, "CDEF:gsen_7=gsen7");
push(@CDEF, "CDEF:gsen_8=gsen8");
}
if(lc($config->{show_gaps}) eq "y") { if(lc($config->{show_gaps}) eq "y") {
push(@tmp, "AREA:wrongdata#$colors->{gap}:"); push(@tmp, "AREA:wrongdata#$colors->{gap}:");
push(@tmpz, "AREA:wrongdata#$colors->{gap}:"); push(@tmpz, "AREA:wrongdata#$colors->{gap}:");