mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-28 17:12:32 +00:00
FRM: fix 'set frm reset' for network-connected devices
git-svn-id: https://svn.fhem.de/fhem/trunk@5217 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
51188c02d6
commit
1bca9218c9
@ -121,8 +121,24 @@ sub FRM_Set($@) {
|
|||||||
|
|
||||||
COMMAND_HANDLER: {
|
COMMAND_HANDLER: {
|
||||||
$command eq "reset" and do {
|
$command eq "reset" and do {
|
||||||
|
return $hash->{NAME}." is not connected" unless (defined $hash->{FirmataDevice} and (defined $hash->{FD} or ($^O=~/Win/ and defined $hash->{USBDev})));
|
||||||
|
$hash->{FirmataDevice}->system_reset();
|
||||||
|
if (defined $hash->{SERVERSOCKET}) {
|
||||||
|
# dispose preexisting connections
|
||||||
|
foreach my $e ( sort keys %main::defs ) {
|
||||||
|
if ( defined( my $dev = $main::defs{$e} )) {
|
||||||
|
if ( defined( $dev->{SNAME} ) && ( $dev->{SNAME} eq $hash->{NAME} )) {
|
||||||
|
FRM_Tcp_Connection_Close($dev);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FRM_FirmataDevice_Close($hash);
|
||||||
|
last;
|
||||||
|
} else {
|
||||||
DevIo_CloseDev($hash);
|
DevIo_CloseDev($hash);
|
||||||
|
FRM_FirmataDevice_Close($hash);
|
||||||
return DevIo_OpenDev($hash, 0, "FRM_DoInit");
|
return DevIo_OpenDev($hash, 0, "FRM_DoInit");
|
||||||
|
}
|
||||||
};
|
};
|
||||||
$command eq "reinit" and do {
|
$command eq "reinit" and do {
|
||||||
FRM_forall_clients($hash,\&FRM_Init_Client,undef);
|
FRM_forall_clients($hash,\&FRM_Init_Client,undef);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user