mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-22 02:10:32 +00:00
changed: improved port reading
git-svn-id: https://svn.fhem.de/fhem/trunk@4052 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
0bfa50910b
commit
6517b21422
@ -124,17 +124,8 @@ sub PIFACE_Get($@){
|
|||||||
"25:noArg 26:noArg 27:noArg 28:noArg ";
|
"25:noArg 26:noArg 27:noArg 28:noArg ";
|
||||||
return $usage if $port eq "?";
|
return $usage if $port eq "?";
|
||||||
|
|
||||||
if ($port eq "0") {
|
if ($port ~~ [11..18]) {
|
||||||
# read all inports and outports
|
Log3($name, 3, "PIFACE $name: get inports with internal pullups is DEPRECATED and may be removed in further versions!");
|
||||||
PI_read_allports($hash);
|
|
||||||
} elsif ($port ~~ [1..8]) {
|
|
||||||
# read single inport
|
|
||||||
$adr = $base + $port;
|
|
||||||
$cmd = '/usr/local/bin/gpio -p read '.$adr;
|
|
||||||
$val = `$cmd`;
|
|
||||||
readingsSingleUpdate($hash, 'in'.$port, $val, 1);
|
|
||||||
} elsif ($port ~~ [11..18]) {
|
|
||||||
Log3($name, 3, "PIFACE $name: get inports with internal pullups is DEPRECATED and will be removed in further versions!");
|
|
||||||
# read single inport with pullup
|
# read single inport with pullup
|
||||||
$pin = $port - 10;
|
$pin = $port - 10;
|
||||||
$adr = $base + $pin;
|
$adr = $base + $pin;
|
||||||
@ -143,14 +134,9 @@ sub PIFACE_Get($@){
|
|||||||
$cmd = '/usr/local/bin/gpio -p read '.$adr;
|
$cmd = '/usr/local/bin/gpio -p read '.$adr;
|
||||||
$val = `$cmd`;
|
$val = `$cmd`;
|
||||||
readingsSingleUpdate($hash, 'in'.$port, $val, 1);
|
readingsSingleUpdate($hash, 'in'.$port, $val, 1);
|
||||||
} elsif ($port ~~ [21..28]) {
|
} else {
|
||||||
# read single outport
|
# read all inports and outports
|
||||||
$pin = $port - 12;
|
PI_read_allports($hash);
|
||||||
$port -= 20;
|
|
||||||
$adr = $base + $pin;
|
|
||||||
$cmd = '/usr/local/bin/gpio -p read '.$adr;
|
|
||||||
$val = `$cmd`;
|
|
||||||
readingsSingleUpdate($hash, 'out'.$port, $val, 1);
|
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user