2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-19 18:56:03 +00:00

51_RPI_GPIO: fixed "Use of uninitialized value in subtraction (-) at ./FHEM/51_RPI_GPIO.pm line 524" again

git-svn-id: https://svn.fhem.de/fhem/trunk@12129 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
klauswitt 2016-09-06 21:47:53 +00:00
parent f2613a388f
commit f224014b75

View File

@ -62,6 +62,7 @@ sub RPI_GPIO_Initialize($) {
" interrupt:none,falling,rising,both" .
" toggletostate:no,yes active_low:no,yes" .
" debounce_in_ms restoreOnStartup:no,yes,on,off,last" .
" dblclicklevel:0,1 dblclicktime" .
" unexportpin:no,yes longpressinterval" .
" $readingFnAttributes";
}
@ -507,9 +508,11 @@ sub RPI_GPIO_Except($) { #called from main if an interrupt occured
Log3 $hash, 5, "Zaehler ist jetzt $valcnt";
}
#Doppelklick (noch im Teststatus)
if (defined($hash->{lasttrg})) {
my $testtt = (gettimeofday() - $hash->{lasttrg} );
$hash->{lasttrg} = gettimeofday();
readingsSingleUpdate($hash, 'Dblclick', "on", 1) if $testtt < 2;
}
$hash->{lasttrg} = gettimeofday();
#langer Testendruck
} elsif ($eval eq "both") {
if ( $val == 1 ) {
@ -521,9 +524,11 @@ sub RPI_GPIO_Except($) { #called from main if an interrupt occured
}
#Doppelklick (noch im Teststatus)
if ( $val == AttrVal($hash->{NAME}, "dblclicklevel", "1") ) {
if (defined $hash->{lasttrg}) {
my $testtt = (gettimeofday() - $hash->{lasttrg} );
readingsSingleUpdate($hash, 'Dblclick', "on", 1) if $testtt < int(AttrVal($hash->{NAME}, "dblclicktime", 2));
}
$hash->{lasttrg} = gettimeofday();
readingsSingleUpdate($hash, 'Dblclick', "on", 1) if $testtt < 2;
} else {
readingsSingleUpdate($hash, 'Dblclick', "off", 1);
}