X-Git-Url: http://git.rot13.org/?p=air-quality;a=blobdiff_plain;f=mh-z19b.pl;h=8edaa3fa7993834c723b8d7943c62b9697b6fa63;hp=0c3fbd10a90a2e7a7db6d94d58427eff96bba3ee;hb=42b7874fd94e776acce9f6fcbea694474d848368;hpb=d60ec903ff3334d644377bff1f682ede2941a28a diff --git a/mh-z19b.pl b/mh-z19b.pl index 0c3fbd1..8edaa3f 100755 --- a/mh-z19b.pl +++ b/mh-z19b.pl @@ -6,9 +6,8 @@ use Device::SerialPort; use Time::HiRes; use Data::Dump qw(dump); -my $port = shift @ARGV || '/dev/ttyUSB0'; -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 $port = shift @ARGV || '/dev/serial/by-path/pci-0000:00:1a.7-usb-0:5.3.4:1.2'; +my $influx_url = shift @ARGV || 'http://10.13.37.92:8086/write?consistency=any&db=rot13'; my $s = new Device::SerialPort( $port ) || die $!; $s->baudrate(9600); @@ -16,7 +15,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 +29,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;