register set bugfix for partial bytes

git-svn-id: https://fhem.svn.sourceforge.net/svnroot/fhem/trunk/fhem@2395 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
martinp876
2012-12-30 19:01:15 +00:00
parent 10201ab40b
commit f0aa626df1

View File

@@ -2110,10 +2110,13 @@ CUL_HM_Set($@)
my $addrData;
if ($dLen < 8){# fractional byte see whether we have stored the register
#read full 8 bit!!!
my $curVal = CUL_HM_getRegFromStore(CUL_HM_id2Name($dst.$lChn),
my $rName = CUL_HM_id2Name($dst.$lChn);
$rName =~ s/_chn:.*//;
my $curVal = CUL_HM_getRegFromStore($rName,
$addr,$list,$peerID.$peerChn);
return "cannot read current value for Bitfield - retrieve Data first"
if (!$curVal);
$curVal =~ s/set_//; # set is not relevant, we take it as given
$data = ($curVal & (~($mask<<$bit)))|($data<<$bit);
$addrData.=sprintf("%02X%02X",$addr,$data);
}