MAX_CUL: warn if CUL does not reply to request for credits

git-svn-id: https://svn.fhem.de/fhem/trunk@4107 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
mgehre
2013-10-24 20:53:55 +00:00
parent a324642141
commit 8943d82632

View File

@@ -429,6 +429,10 @@ CUL_MAX_SendQueueHandler($)
#Send to CUL
my ($credit10ms) = (CommandGet("","$hash->{IODev}{NAME} credit10ms") =~ /[^ ]* [^ ]* => (.*)/);
if($credit10ms eq "No answer") {
Log 1, "Error in CUL_MAX_SendQueueHandler: CUL $hash->{IODev}{NAME} did not answer request for current credits. Waiting 5 seconds.";
$timeout += 5;
} else {
# We need 1000ms for preamble + len in bits (=hex len * 4) ms for payload. Divide by 10 to get credit10ms units
# keep this in sync with culfw's code in clib/rf_moritz.c!
my $necessaryCredit = ceil(100*$needPreamble + (length($packet->{packet})*4)/10);
@@ -451,6 +455,7 @@ CUL_MAX_SendQueueHandler($)
$packet->{sentTime} = gettimeofday();
$timeout += 0.5; #recheck for Ack
}
} # $credit10ms ne "No answer"
} elsif( $packet->{sent} == 1 ) { #Already sent it, got no Ack
if( $packet->{sentTime} + $ackTimeout < gettimeofday() ) {