From 14271635ea185cf8075b9d5335cdd137725bcfd5 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Sat, 8 Feb 2020 15:09:52 +0100 Subject: [PATCH] die on invalid data --- mh-z19b.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mh-z19b.pl b/mh-z19b.pl index 0c3fbd1..94abb05 100755 --- 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'; +$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'; @@ -16,7 +17,7 @@ $s->databits(8); $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); @@ -30,8 +31,7 @@ while (1) { 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; -- 2.20.1