mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 12:49:34 +00:00
enhanced long button press detection. Pressing Phase can now be seperated from press-release-event and press-duration can be counted
updated commandref accordingly git-svn-id: https://svn.fhem.de/fhem/trunk@1394 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
3936fb408e
commit
c3f8301f6c
@ -194,7 +194,7 @@ CUL_HM_Parse($$)
|
|||||||
my $cmdX = $cmd;
|
my $cmdX = $cmd;
|
||||||
$cmdX =~ s/^A4/A0/;
|
$cmdX =~ s/^A4/A0/;
|
||||||
$cmdX =~ s/^0B/0A/;
|
$cmdX =~ s/^0B/0A/;
|
||||||
$cmdX =~ s/^84/A0/;
|
#$cmdX =~ s/^84/A0/;
|
||||||
my $msgX = "$len$msgcnt$cmdX$src$dst$p";
|
my $msgX = "$len$msgcnt$cmdX$src$dst$p";
|
||||||
|
|
||||||
# $shash will be replaced for multichannel commands
|
# $shash will be replaced for multichannel commands
|
||||||
@ -585,10 +585,19 @@ CUL_HM_Parse($$)
|
|||||||
|
|
||||||
if($cmd =~ m/^..4./ && $p =~ m/^(..)(..)$/) {
|
if($cmd =~ m/^..4./ && $p =~ m/^(..)(..)$/) {
|
||||||
my ($button, $bno) = (hex($1), hex($2));
|
my ($button, $bno) = (hex($1), hex($2));
|
||||||
|
if(!(exists($shash->{BNO})) || $shash->{BNO} ne $bno){
|
||||||
|
$shash->{BNO}=$bno;$shash->{BNOCNT}=1;
|
||||||
|
}else{
|
||||||
|
$shash->{BNOCNT}+=1;
|
||||||
|
}
|
||||||
my $btn = int((($button&0x3f)+1)/2);
|
my $btn = int((($button&0x3f)+1)/2);
|
||||||
my $state = ($button&1 ? "off" : "on") . ($button & 0x40 ? "Long" : "");
|
my $state;
|
||||||
|
if($button & 0x40){
|
||||||
|
$state = ($button&1 ? "off" : "on") . "Long" .($cmd=~m/^A04./ ? "Release" : "")." ".$shash->{BNOCNT};
|
||||||
|
}else{
|
||||||
|
$state = ($button&1 ? "off" : "on");
|
||||||
|
}
|
||||||
|
Log 1, $cmd;
|
||||||
push @event, "state:Btn$btn $state$target";
|
push @event, "state:Btn$btn $state$target";
|
||||||
if($id eq $dst && $cmd ne "8002") { # Send Ack
|
if($id eq $dst && $cmd ne "8002") { # Send Ack
|
||||||
CUL_HM_SendCmd($shash, "++8002".$id.$src."0101". # Send Ack.
|
CUL_HM_SendCmd($shash, "++8002".$id.$src."0101". # Send Ack.
|
||||||
@ -1004,8 +1013,9 @@ CUL_HM_Set($@)
|
|||||||
|
|
||||||
} elsif($cmd eq "pct") { ##############################################
|
} elsif($cmd eq "pct") { ##############################################
|
||||||
$a[1] = 100 if ($a[1] > 100);
|
$a[1] = 100 if ($a[1] > 100);
|
||||||
if(@a == 2) {$tval="";$rval="0000";}
|
$tval="FFFF";
|
||||||
if(@a > 2) {
|
$rval="0140";
|
||||||
|
if(@a > 2 && $a[2] !=0) {
|
||||||
($tval,$ret) = CUL_HM_encodeTime16($a[2]);
|
($tval,$ret) = CUL_HM_encodeTime16($a[2]);
|
||||||
Log 1, $ret if($ret);
|
Log 1, $ret if($ret);
|
||||||
}
|
}
|
||||||
|
@ -3081,12 +3081,16 @@ A line ending with \ will be concatenated with the next one, so long lines
|
|||||||
<li>remote/pushButton<br>
|
<li>remote/pushButton<br>
|
||||||
Btn$x on<br>
|
Btn$x on<br>
|
||||||
Btn$x off<br>
|
Btn$x off<br>
|
||||||
Btn$x onLong<br>
|
Btn$x onLong $counter<br>
|
||||||
Btn$x offLong<br>
|
Btn$x offLong $counter<br>
|
||||||
|
Btn$x onLongRelease $counter<br>
|
||||||
|
Btn$x offLongRelease $counter<br>
|
||||||
Btn$x on (to $dest)<br>
|
Btn$x on (to $dest)<br>
|
||||||
Btn$x off (to $dest)<br>
|
Btn$x off (to $dest)<br>
|
||||||
Btn$x onLong (to $dest)<br>
|
Btn$x onLong $counter (to $dest)<br>
|
||||||
Btn$x offLong (to $dest)<br>
|
Btn$x offLong $counter (to $dest)<br>
|
||||||
|
Btn$x onLongRelease $counter (to $dest)<br>
|
||||||
|
Btn$x offLongRelease $counter (to $dest)<br>
|
||||||
<li>motionDetector<br>
|
<li>motionDetector<br>
|
||||||
brightness:$b<br>
|
brightness:$b<br>
|
||||||
alive<br>
|
alive<br>
|
||||||
|
Loading…
Reference in New Issue
Block a user