mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-20 01:06:04 +00:00
34_SWAP.pm: fixed handling of mixed single bit / mulity byte endpoints, see forum: 34_SWAP.pm: fixed handling of single bit endpoints
git-svn-id: https://svn.fhem.de/fhem/trunk@8301 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
480de70d42
commit
75f90d4650
@ -506,19 +506,21 @@ SWAP_Set($@)
|
|||||||
} else {
|
} else {
|
||||||
my $len = $register->{size};
|
my $len = $register->{size};
|
||||||
if( !$len ) {
|
if( !$len ) {
|
||||||
my $max_position = 0;
|
my $max_pos = 0;
|
||||||
|
my $max_pos_size = 1;
|
||||||
foreach my $endpoint ( @{$register->{endpoints}} ) {
|
foreach my $endpoint ( @{$register->{endpoints}} ) {
|
||||||
if( !defined($endpoint->{position}) ) {
|
if( !defined($endpoint->{position}) ) {
|
||||||
$len = $endpoint->{size};
|
$len = $endpoint->{size};
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
|
|
||||||
$max_position = maxNum( $max_position, int($endpoint->{position}) );
|
$max_pos = maxNum( $max_pos, int($endpoint->{position}) );
|
||||||
|
$max_pos_size = int($endpoint->{size} + 0.9 );
|
||||||
|
|
||||||
$len += $endpoint->{size};
|
$len += $endpoint->{size};
|
||||||
}
|
}
|
||||||
|
|
||||||
$len = maxNum( $len, $max_position+1 );
|
$len = maxNum( $len, $max_pos+$max_pos_size );
|
||||||
}
|
}
|
||||||
|
|
||||||
return "value has to be ". $len ." byte(s) in size" if( $len*2 != length( $arg2 ) );
|
return "value has to be ". $len ." byte(s) in size" if( $len*2 != length( $arg2 ) );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user