Skip to content

Commit

Permalink
Merge pull request #159 from krkeegan/fix_issue_158
Browse files Browse the repository at this point in the history
Fix issue 158
  • Loading branch information
krkeegan committed Apr 17, 2013
2 parents cf82371 + 0f2e11d commit 25d82e7
Showing 1 changed file with 36 additions and 19 deletions.
55 changes: 36 additions & 19 deletions lib/Insteon_PLM.pm
Original file line number Diff line number Diff line change
Expand Up @@ -626,19 +626,24 @@ sub _parse_data {
}
elsif ($parsed_prefix eq $prefix{all_link_clean_failed} and ($message_length == 12))
{ #ALL-Link Cleanup Failure Report
# extract out the pertinent parts of the message for display purposes
# bytes 0-1 - group; 2-7 device address
my $failure_group = substr($message_data,0,2);
my $failure_device = substr($message_data,2,6);

&::print_log("[Insteon_PLM] DEBUG2: Received all-link cleanup failure from device: "
. "$failure_device and group: $failure_group") if $main::Debug{insteon} >= 2;
if ($self->active_message){
# extract out the pertinent parts of the message for display purposes
# bytes 0-1 - group; 2-7 device address
my $failure_group = substr($message_data,0,2);
my $failure_device = substr($message_data,2,6);

&::print_log("[Insteon_PLM] DEBUG2: Received all-link cleanup failure from device: "
. "$failure_device and group: $failure_group") if $main::Debug{insteon} >= 2;

my $failed_object = &Insteon::get_object($failure_device,'01');
my $message = new Insteon::InsteonMessage('all_link_direct_cleanup', $failed_object,
$self->active_message->command, $failure_group);
push(@{$$failed_object{command_stack}}, $message);
$failed_object->_process_command_stack();
my $failed_object = &Insteon::get_object($failure_device,'01');
my $message = new Insteon::InsteonMessage('all_link_direct_cleanup', $failed_object,
$self->active_message->command, $failure_group);
push(@{$$failed_object{command_stack}}, $message);
$failed_object->_process_command_stack();
} else {
&::print_log("[Insteon_PLM] DEBUG2: Received all-link cleanup failure."
. " But there is no pending message.") if $main::Debug{insteon} >= 2;
}

}
elsif ($parsed_prefix eq $prefix{all_link_record} and ($message_length == 20))
Expand Down Expand Up @@ -681,15 +686,27 @@ sub _parse_data {
# so, slow things down
if (!($nack_count))
{
my $nack_delay = ($::config_parms{Insteon_PLM_disable_throttling}) ? 0.3 : 1.0;
&::print_log("[Insteon_PLM] DEBUG3: Interface extremely busy. Resending command"
. " after delaying for $nack_delay second") if $main::Debug{insteon} >= 3;
$self->_set_timeout('xmit',$nack_delay * 1000);
$self->active_message->no_hop_increase(1);
$self->retry_active_message();
$process_next_command = 0;
if ($self->active_message){
my $nack_delay = ($::config_parms{Insteon_PLM_disable_throttling}) ? 0.3 : 1.0;
&::print_log("[Insteon_PLM] DEBUG3: Interface extremely busy. Resending command"
. " after delaying for $nack_delay second") if $main::Debug{insteon} >= 3;
$self->_set_timeout('xmit',$nack_delay * 1000);
$self->active_message->no_hop_increase(1);
$self->retry_active_message();
$process_next_command = 0;
} else {
&::print_log("[Insteon_PLM] DEBUG3: Interface extremely busy."
. " No message to resend.") if $main::Debug{insteon} >= 3;
}
$nack_count++;
}
#Remove the leading NACK bytes and place whatever remains into fragment for next read
$parsed_data =~ s/^(15)*//;
if ($parsed_data ne ''){
$$self{_data_fragment} .= $parsed_data;
::print_log("[Insteon_PLM] DEBUG3: Saving parsed data fragment: "
. $parsed_data) if( $main::Debug{insteon} >= 3);
}
}
else
{
Expand Down

0 comments on commit 25d82e7

Please sign in to comment.