mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-30 05:57:08 +00:00
26_KM273.pm:2016-05-31 V0010 KM273_ReadElementList bugfix if expected readCounter isn't reached by read data; delete lists on module reload
git-svn-id: https://svn.fhem.de/fhem/trunk@12036 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
ccebe3afa2
commit
099f6d97ee
@ -69,6 +69,7 @@
|
|||||||
# 0007 01.02.2016 mike3436 KM273_Get,KM273_GetNextValue KM273_Get corrected, KM273_GetNextValue do nothing if attr doNotPoll=1
|
# 0007 01.02.2016 mike3436 KM273_Get,KM273_GetNextValue KM273_Get corrected, KM273_GetNextValue do nothing if attr doNotPoll=1
|
||||||
# 0008 30.05.2016 mike3436 KM273_ReadElementList complete element list is read from heatpump, default list is only used for deliver the 'read' flag
|
# 0008 30.05.2016 mike3436 KM273_ReadElementList complete element list is read from heatpump, default list is only used for deliver the 'read' flag
|
||||||
# 0009 31.05.2016 mike3436 KM273_ReadElementList if expected readCounter isn't reached on second read, and read data has identical length, try to analyse
|
# 0009 31.05.2016 mike3436 KM273_ReadElementList if expected readCounter isn't reached on second read, and read data has identical length, try to analyse
|
||||||
|
# 0010 31.05.2016 mike3436 KM273_ReadElementList bugfix if expected readCounter isn't reached by read data; delete lists on module reload
|
||||||
|
|
||||||
package main;
|
package main;
|
||||||
use strict;
|
use strict;
|
||||||
@ -2001,6 +2002,21 @@ my %KM273_elements = ();
|
|||||||
|
|
||||||
my %KM273_ReadElementListStatus = ( done => 0, wait => 0, readCounter => 0, readIndex => 0, readIndexLast => 0, writeIndex => 0, KM200active => 0, KM200wait => 0, readData => "");
|
my %KM273_ReadElementListStatus = ( done => 0, wait => 0, readCounter => 0, readIndex => 0, readIndexLast => 0, writeIndex => 0, KM200active => 0, KM200wait => 0, readData => "");
|
||||||
my %KM273_ReadElementListElements = ();
|
my %KM273_ReadElementListElements = ();
|
||||||
|
|
||||||
|
sub KM273_ClearElementLists($)
|
||||||
|
{
|
||||||
|
my ($hash) = @_;
|
||||||
|
my $name = $hash->{NAME} . ": KM273_ClearElementLists";
|
||||||
|
Log 3, "$name";
|
||||||
|
|
||||||
|
%KM273_history = ();
|
||||||
|
@KM273_readingsRTR = ();
|
||||||
|
%KM273_writingsTXD = ();
|
||||||
|
%KM273_elements = ();
|
||||||
|
%KM273_ReadElementListStatus = ( done => 0, wait => 0, readCounter => 0, readIndex => 0, readIndexLast => 0, writeIndex => 0, KM200active => 0, KM200wait => 0, readData => "");
|
||||||
|
%KM273_ReadElementListElements = ();
|
||||||
|
}
|
||||||
|
|
||||||
sub KM273_ReadElementList($)
|
sub KM273_ReadElementList($)
|
||||||
{
|
{
|
||||||
my ($hash) = @_;
|
my ($hash) = @_;
|
||||||
@ -2036,20 +2052,12 @@ sub KM273_ReadElementList($)
|
|||||||
CAN_Write($hash,"R01FDBFE00");
|
CAN_Write($hash,"R01FDBFE00");
|
||||||
}
|
}
|
||||||
elsif (--$KM273_ReadElementListStatus{wait} <= 0)
|
elsif (--$KM273_ReadElementListStatus{wait} <= 0)
|
||||||
{
|
|
||||||
if (($KM273_ReadElementListStatus{readIndexLast} > 0) && ($KM273_ReadElementListStatus{readIndexLast} == $KM273_ReadElementListStatus{readIndex}))
|
|
||||||
{
|
|
||||||
#wenn readCounter auch beim 2. Lesen nicht erreicht wird, und gelesene Datenmenge gleich ist, dann readCounter = readIndex
|
|
||||||
$KM273_ReadElementListStatus{readCounter} = $KM273_ReadElementListStatus{readIndex};
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
$KM273_ReadElementListStatus{readIndexLast} = $KM273_ReadElementListStatus{readIndex};
|
$KM273_ReadElementListStatus{readIndexLast} = $KM273_ReadElementListStatus{readIndex};
|
||||||
$KM273_ReadElementListStatus{readIndex} = 0;
|
$KM273_ReadElementListStatus{readIndex} = 0;
|
||||||
$KM273_ReadElementListStatus{writeIndex} = 0;
|
$KM273_ReadElementListStatus{writeIndex} = 0;
|
||||||
$KM273_ReadElementListStatus{readData} = "";
|
$KM273_ReadElementListStatus{readData} = "";
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
my $count = 1;
|
my $count = 1;
|
||||||
while ($count > 0)
|
while ($count > 0)
|
||||||
@ -2074,6 +2082,12 @@ sub KM273_ReadElementList($)
|
|||||||
$KM273_ReadElementListStatus{readData} .= pack("NN",$value1>>32,$value1&0xffffffff);
|
$KM273_ReadElementListStatus{readData} .= pack("NN",$value1>>32,$value1&0xffffffff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (($KM273_ReadElementListStatus{readIndexLast} > 0) && ($KM273_ReadElementListStatus{readIndexLast} == $KM273_ReadElementListStatus{readIndex}))
|
||||||
|
{
|
||||||
|
#wenn readCounter auch beim 2. Lesen nicht erreicht wird, und gelesene Datenmenge gleich ist, dann readCounter = readIndex
|
||||||
|
Log 3, "$name readCounter $KM273_ReadElementListStatus{readCounter} changed to $KM273_ReadElementListStatus{readIndex}";
|
||||||
|
$KM273_ReadElementListStatus{readCounter} = $KM273_ReadElementListStatus{readIndex};
|
||||||
|
}
|
||||||
if (($KM273_ReadElementListStatus{readCounter} > 0) && ($KM273_ReadElementListStatus{readIndex} >= $KM273_ReadElementListStatus{readCounter}))
|
if (($KM273_ReadElementListStatus{readCounter} > 0) && ($KM273_ReadElementListStatus{readIndex} >= $KM273_ReadElementListStatus{readCounter}))
|
||||||
{
|
{
|
||||||
$KM273_ReadElementListStatus{done} = 1;
|
$KM273_ReadElementListStatus{done} = 1;
|
||||||
@ -2111,7 +2125,7 @@ sub KM273_ReadElementList($)
|
|||||||
}
|
}
|
||||||
elsif (hex $canId == 0x09FD7FE0)
|
elsif (hex $canId == 0x09FD7FE0)
|
||||||
{
|
{
|
||||||
my $readCounter = $value1 >> 24;
|
my $readCounter = ($value1 >> 24); # + 10; #+10=Test
|
||||||
$KM273_ReadElementListStatus{readCounter} = $readCounter;
|
$KM273_ReadElementListStatus{readCounter} = $readCounter;
|
||||||
Log 3, "$name read T09FD7FE0 len=$len1 value=$value1 readCounter=$readCounter";
|
Log 3, "$name read T09FD7FE0 len=$len1 value=$value1 readCounter=$readCounter";
|
||||||
}
|
}
|
||||||
@ -2160,7 +2174,7 @@ sub KM273_UpdateElements($)
|
|||||||
{
|
{
|
||||||
my $text1 = (substr $text, 0, $pos) . (substr $text, $pos+1);
|
my $text1 = (substr $text, 0, $pos) . (substr $text, $pos+1);
|
||||||
$elem1 = $KM273_ReadElementListElements{$text1};
|
$elem1 = $KM273_ReadElementListElements{$text1};
|
||||||
Log 3, "$name change $text to $text1";
|
Log 3, "$name change $text1 to $text";
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2188,6 +2202,7 @@ sub KM273_CreatePollingList($)
|
|||||||
my $name = $hash->{NAME} . ": KM273_CreatePollingList";
|
my $name = $hash->{NAME} . ": KM273_CreatePollingList";
|
||||||
Log 3, "$name";
|
Log 3, "$name";
|
||||||
|
|
||||||
|
@KM273_readingsRTR = ();
|
||||||
foreach my $element (keys %KM273_elements)
|
foreach my $element (keys %KM273_elements)
|
||||||
{
|
{
|
||||||
push @KM273_readingsRTR, $KM273_elements{$element}{rtr} if $KM273_elements{$element}{read} == 1;
|
push @KM273_readingsRTR, $KM273_elements{$element}{rtr} if $KM273_elements{$element}{read} == 1;
|
||||||
@ -2198,6 +2213,7 @@ sub KM273_CreatePollingList($)
|
|||||||
}
|
}
|
||||||
$hash->{pollingIndex} = 0;
|
$hash->{pollingIndex} = 0;
|
||||||
|
|
||||||
|
%KM273_writingsTXD = ();
|
||||||
foreach my $element (keys %KM273_elements)
|
foreach my $element (keys %KM273_elements)
|
||||||
{
|
{
|
||||||
foreach my $get (keys %KM273_gets)
|
foreach my $get (keys %KM273_gets)
|
||||||
@ -2257,6 +2273,7 @@ sub KM273_Define($$)
|
|||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
KM273_ClearElementLists($hash);
|
||||||
#KM273_CreatePollingList($hash);
|
#KM273_CreatePollingList($hash);
|
||||||
#InternalTimer(gettimeofday()+10, "KM273_GetReadings", $hash, 0);
|
#InternalTimer(gettimeofday()+10, "KM273_GetReadings", $hash, 0);
|
||||||
|
|
||||||
@ -2270,6 +2287,10 @@ sub KM273_Define($$)
|
|||||||
sub KM273_Undef($$)
|
sub KM273_Undef($$)
|
||||||
{
|
{
|
||||||
my ($hash, $arg) = @_;
|
my ($hash, $arg) = @_;
|
||||||
|
my $name = $hash->{NAME} . ": KM273_Undef";
|
||||||
|
Log 3, "$name";
|
||||||
|
|
||||||
|
RemoveInternalTimer($hash);
|
||||||
CAN_Close($hash);
|
CAN_Close($hash);
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user