From: Dobrica Pavlinusic Date: Fri, 12 Dec 2014 08:45:13 +0000 (+0100) Subject: added retry X-Git-Url: http://git.rot13.org/?p=vrDialog;a=commitdiff_plain;h=fa9fec6c18744ffc12865bab7f724b11ddcd5137 added retry --- diff --git a/dialog.pl b/dialog.pl index b0e630d..47bfe21 100755 --- a/dialog.pl +++ b/dialog.pl @@ -36,20 +36,24 @@ sub v { my ($hex,$expect,$desc) = @_; my $bytes = hex2bytes( $hex ); warn "# $desc\n"; +retry: warn ">> ",as_hex( $bytes ); $port->write( $bytes ); my $data = $port->read(1); warn "<< len: ",ord($data); + + goto retry if ord($data) == 0; + $data .= $port->read(ord($data) - 1); warn "<< ",as_hex($data); warn "?? $expect\n" if $expect; } -#v '07 02 00 00 00 04 C4', "hardware version"; +v '07 02 00 00 00 04 C4', "hardware version"; -#v '07 0A 00 00 00 04 44', 'software version'; +v '07 0A 00 00 00 04 44', 'software version'; v '07 00 01 00 06 0E EA', 'temperatures';