mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 09:16:53 +00:00
00_HMUARTLGW: resend cleanup
git-svn-id: https://svn.fhem.de/fhem/trunk@12271 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
daa773baf8
commit
fc7cef4bf2
@ -1609,15 +1609,17 @@ sub HMUARTLGW_CheckCmdResp($)
|
|||||||
RemoveInternalTimer("HMUARTLGW_CheckCredits:$name");
|
RemoveInternalTimer("HMUARTLGW_CheckCredits:$name");
|
||||||
InternalTimer(gettimeofday()+1, "HMUARTLGW_CheckCredits", "HMUARTLGW_CheckCredits:$name", 1);
|
InternalTimer(gettimeofday()+1, "HMUARTLGW_CheckCredits", "HMUARTLGW_CheckCredits:$name", 1);
|
||||||
} elsif ($hash->{DevState} != HMUARTLGW_STATE_RUNNING) {
|
} elsif ($hash->{DevState} != HMUARTLGW_STATE_RUNNING) {
|
||||||
if ((!defined($hash->{Helper}{LastSendFrame})) ||
|
if ((!defined($hash->{Helper}{AckPending}{$hash->{CNT}}{frame})) ||
|
||||||
(defined($hash->{Helper}{Resend}) &&
|
(defined($hash->{Helper}{AckPending}{$hash->{CNT}}{resend}) &&
|
||||||
$hash->{Helper}{Resend} >= HMUARTLGW_CMD_RETRY_CNT)) {
|
$hash->{Helper}{AckPending}{$hash->{CNT}}{resend} >= HMUARTLGW_CMD_RETRY_CNT)) {
|
||||||
Log3($hash, 1, "HMUARTLGW ${name} did not respond after all, reopening");
|
Log3($hash, 1, "HMUARTLGW ${name} did not respond after all, reopening");
|
||||||
HMUARTLGW_Reopen($hash);
|
HMUARTLGW_Reopen($hash);
|
||||||
} else {
|
} else {
|
||||||
$hash->{Helper}{Resend}++;
|
$hash->{Helper}{AckPending}{$hash->{CNT}}{resend}++;
|
||||||
Log3($hash, 1, "HMUARTLGW ${name} did not respond for the " . $hash->{Helper}{Resend} . ". time, resending");
|
Log3($hash, 1, "HMUARTLGW ${name} did not respond for the " .
|
||||||
HMUARTLGW_send_frame($hash, pack("H*", $hash->{Helper}{LastSendFrame}));
|
$hash->{Helper}{AckPending}{$hash->{CNT}}{resend} .
|
||||||
|
". time, resending");
|
||||||
|
HMUARTLGW_send_frame($hash, pack("H*", $hash->{Helper}{AckPending}{$hash->{CNT}}{frame}));
|
||||||
InternalTimer(gettimeofday()+HMUARTLGW_CMD_TIMEOUT, "HMUARTLGW_CheckCmdResp", $hash, 0);
|
InternalTimer(gettimeofday()+HMUARTLGW_CMD_TIMEOUT, "HMUARTLGW_CheckCmdResp", $hash, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2000,13 +2002,13 @@ sub HMUARTLGW_send($$$)
|
|||||||
}
|
}
|
||||||
$hash->{Helper}{AckPending}{$hash->{CNT}} = {
|
$hash->{Helper}{AckPending}{$hash->{CNT}} = {
|
||||||
cmd => uc($msg),
|
cmd => uc($msg),
|
||||||
|
frame => uc(unpack("H*", $frame)),
|
||||||
dst => $dst,
|
dst => $dst,
|
||||||
time => $sendtime,
|
time => $sendtime,
|
||||||
};
|
};
|
||||||
|
|
||||||
push @{$hash->{Helper}{LastSendLen}}, (length($hash->{Helper}{AckPending}{$hash->{CNT}}->{cmd}) / 2) + 2;
|
push @{$hash->{Helper}{LastSendLen}}, (length($hash->{Helper}{AckPending}{$hash->{CNT}}->{cmd}) / 2) + 2;
|
||||||
shift @{$hash->{Helper}{LastSendLen}} if (scalar(@{$hash->{Helper}{LastSendLen}}) > 2);
|
shift @{$hash->{Helper}{LastSendLen}} if (scalar(@{$hash->{Helper}{LastSendLen}}) > 2);
|
||||||
$hash->{Helper}{LastSendFrame} = unpack("H*", $frame);
|
|
||||||
delete($hash->{Helper}{Resend});
|
delete($hash->{Helper}{Resend});
|
||||||
|
|
||||||
return $hash->{CNT};
|
return $hash->{CNT};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user