From 3b9073aad24b56f8ec4ba65041f70dbff811a4c9 Mon Sep 17 00:00:00 2001 From: ntruchsess Date: Fri, 22 Nov 2013 17:39:06 +0100 Subject: [PATCH] swap calls to set_pin_mode and report_digital/analog to trigger a message with latest ConfigurableFirmata --- lib/Device/Firmata/Platform.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Device/Firmata/Platform.pm b/lib/Device/Firmata/Platform.pm index bba7c36..ddd4e6c 100644 --- a/lib/Device/Firmata/Platform.pm +++ b/lib/Device/Firmata/Platform.pm @@ -398,15 +398,15 @@ sub pin_mode { ( $mode == PIN_INPUT or $mode == PIN_OUTPUT ) and do { my $port_number = $pin >> 3; - $self->{io}->data_write($self->{protocol}->message_prepare( REPORT_DIGITAL => $port_number, 1 )); $self->{io}->data_write($self->{protocol}->message_prepare( SET_PIN_MODE => 0, $pin, $mode )); + $self->{io}->data_write($self->{protocol}->message_prepare( REPORT_DIGITAL => $port_number, 1 )); last; }; $mode == PIN_ANALOG and do { my $port_number = $pin >> 3; - $self->{io}->data_write($self->{protocol}->message_prepare( REPORT_ANALOG => $port_number, 1 )); $self->{io}->data_write($self->{protocol}->message_prepare( SET_PIN_MODE => 0, $pin, $mode )); + $self->{io}->data_write($self->{protocol}->message_prepare( REPORT_ANALOG => $port_number, 1 )); last; };