Merge pull request #350 from bachandi/gensens_units

Simplify unit correction in gensens.
This commit is contained in:
Jordi Sanfeliu 2021-09-29 09:12:43 +02:00 committed by GitHub
commit af8dd97e74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 3 deletions

View File

@ -153,9 +153,7 @@ sub gensens_update {
$val = <IN>;
$val = trim($val);
$unit = $gensens->{unit}->{$str} || 0;
$c = () = $unit =~ /0/g;
$val /= 10**$c if $unit > 1;
$val *= 10**$c if $unit > 0 && $unit < 1;
$val /= $unit if $unit != 0;
close(IN);
} else {
logger("$myself: ERROR: unable to open '$gensens->{desc}->{$str}'.");