2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 18:59:33 +00:00

FRM: fix a crucial bug in perl-firmata parser skipping single 0x30 bytes on fast machines

git-svn-id: https://svn.fhem.de/fhem/trunk@6169 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
ntruchsess 2014-06-26 21:59:33 +00:00
parent ee4be3246f
commit dd27510cbb
2 changed files with 22 additions and 19 deletions

View File

@ -15,33 +15,36 @@ Device::Firmata - Perl interface to Firmata for the arduino platform.
=head1 VERSION
Version 0.56
Version 0.59
=cut
our $VERSION = '0.56';
our $VERSION = '0.59';
our $DEBUG = 0;
=head1 SYNOPSIS
use strict;
use warnings;
use Device::Firmata::Constants qw/ :all /;
use Device::Firmata;
$|++;
use Time::HiRes 'sleep';
use strict;
use warnings;
my $led_pin = 13;
use Device::Firmata::Constants qw/ :all /;
use Device::Firmata;
my $device = Device::Firmata->open('/dev/ttyUSB0') or die "Could not connect to Firmata Server";
$device->pin_mode($led_pin=>PIN_OUTPUT);
my $iteration = 0;
while (1) {
my $strobe_state = $iteration++%2;
$device->digital_write($led_pin=>$strobe_state);
sleep 0.5;
}
use Time::HiRes 'sleep';
$|++;
my $led_pin = 13;
my $device = Device::Firmata->open('/dev/ttyUSB0') or die "Could not connect to Firmata Server";
$device->pin_mode($led_pin=>PIN_OUTPUT);
my $iteration = 0;
while (1) {
my $strobe_state = $iteration++%2;
$device->digital_write($led_pin=>$strobe_state);
sleep 0.5;
}
=head1 SUBROUTINES/METHODS

View File

@ -843,8 +843,8 @@ sub poll {
# --------------------------------------------------
my $self = shift;
my $buf = $self->{io}->data_read(2048) or return;
my $messages = $self->{protocol}->message_data_receive($buf);
my $buf = $self->{io}->data_read(2048);
my $messages = $self->{protocol}->message_data_receive($buf) or return;
$self->messages_handle($messages);
return $messages;
}