projects
/
air-quality
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6009610
)
die on invalid data
author
Dobrica Pavlinusic
<dpavlin@rot13.org>
Sat, 8 Feb 2020 14:09:52 +0000
(15:09 +0100)
committer
Dobrica Pavlinusic
<dpavlin@rot13.org>
Sat, 8 Feb 2020 14:09:52 +0000
(15:09 +0100)
mh-z19b.pl
patch
|
blob
|
history
diff --git
a/mh-z19b.pl
b/mh-z19b.pl
index
0c3fbd1
..
94abb05
100755
(executable)
--- a/
mh-z19b.pl
+++ b/
mh-z19b.pl
@@
-7,6
+7,7
@@
use Time::HiRes;
use Data::Dump qw(dump);
my $port = shift @ARGV || '/dev/ttyUSB0';
use Data::Dump qw(dump);
my $port = shift @ARGV || '/dev/ttyUSB0';
+$port = '/dev/ttyUSB5';
my $influx_url = shift @ARGV || 'http://10.13.37.229:8186/write?db=telegraf';
$influx_url = 'http://10.13.37.92:8086/write?db=rot13';
my $influx_url = shift @ARGV || 'http://10.13.37.229:8186/write?db=telegraf';
$influx_url = 'http://10.13.37.92:8086/write?db=rot13';
@@
-16,7
+17,7
@@
$s->databits(8);
$s->parity('none');
$s->stopbits(1);
$s->handshake('none');
$s->parity('none');
$s->stopbits(1);
$s->handshake('none');
-$s->read_char_time(
0
);
+$s->read_char_time(
1
);
$s->read_const_time(10);
$s->debug(1);
$s->read_const_time(10);
$s->debug(1);
@@
-30,8
+31,7
@@
while (1) {
if ( $len > 0 ) {
my @v = unpack('C*', $string);
if ( $#v < 8 ) {
if ( $len > 0 ) {
my @v = unpack('C*', $string);
if ( $#v < 8 ) {
- warn "# $len ",dump($string), dump( @v ), $/;
- next;
+ die "# $len ",dump($string), dump( @v ), $/;
}
my $sum = 0;
}
my $sum = 0;