mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
20_FRM_AD.pm: stability fix (Forum #81815)
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@15770 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
4dc6140fc4
commit
ece7b0ce35
@ -1,6 +1,37 @@
|
|||||||
##############################################
|
########################################################################################
|
||||||
|
#
|
||||||
# $Id$
|
# $Id$
|
||||||
##############################################
|
#
|
||||||
|
# FHEM module for one Firmata analog input pin
|
||||||
|
#
|
||||||
|
########################################################################################
|
||||||
|
#
|
||||||
|
# LICENSE AND COPYRIGHT
|
||||||
|
#
|
||||||
|
# Copyright (C) 2013 ntruchess
|
||||||
|
# Copyright (C) 2016 jensb
|
||||||
|
#
|
||||||
|
# All rights reserved
|
||||||
|
#
|
||||||
|
# This script is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# The GNU General Public License can be found at
|
||||||
|
# http://www.gnu.org/copyleft/gpl.html.
|
||||||
|
# A copy is found in the textfile GPL.txt and important notices to the license
|
||||||
|
# from the author is found in LICENSE.txt distributed with these scripts.
|
||||||
|
#
|
||||||
|
# This script is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# This copyright notice MUST APPEAR in all copies of the script!
|
||||||
|
#
|
||||||
|
########################################################################################
|
||||||
|
|
||||||
package main;
|
package main;
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
@ -48,8 +79,11 @@ FRM_AD_Init($$)
|
|||||||
return $ret if (defined $ret);
|
return $ret if (defined $ret);
|
||||||
my $firmata = $hash->{IODev}->{FirmataDevice};
|
my $firmata = $hash->{IODev}->{FirmataDevice};
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
|
eval {
|
||||||
$firmata->observe_analog($hash->{PIN},\&FRM_AD_observer,$hash);
|
$firmata->observe_analog($hash->{PIN},\&FRM_AD_observer,$hash);
|
||||||
$main::defs{$name}{resolution}=$firmata->{metadata}{analog_resolutions}{$hash->{PIN}} if (defined $firmata->{metadata}{analog_resolutions});
|
$main::defs{$name}{resolution}=$firmata->{metadata}{analog_resolutions}{$hash->{PIN}} if (defined $firmata->{metadata}{analog_resolutions});
|
||||||
|
};
|
||||||
|
return FRM_Catch($@) if $@;
|
||||||
if (! (defined AttrVal($name,"stateFormat",undef))) {
|
if (! (defined AttrVal($name,"stateFormat",undef))) {
|
||||||
$main::attr{$name}{"stateFormat"} = "reading";
|
$main::attr{$name}{"stateFormat"} = "reading";
|
||||||
}
|
}
|
||||||
@ -139,6 +173,18 @@ FRM_AD_Attr($$$$) {
|
|||||||
1;
|
1;
|
||||||
|
|
||||||
=pod
|
=pod
|
||||||
|
|
||||||
|
CHANGES
|
||||||
|
|
||||||
|
2016 jensb
|
||||||
|
o modified sub FRM_AD_Init to catch exceptions and return error message
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
=pod
|
||||||
|
=item device
|
||||||
|
=item summary Firmata: analog input
|
||||||
|
=item summary_DE Firmata: analog Eingang
|
||||||
=begin html
|
=begin html
|
||||||
|
|
||||||
<a name="FRM_AD"></a>
|
<a name="FRM_AD"></a>
|
||||||
|
@ -100,7 +100,7 @@ FHEM/17_SIS_PMS.pm painseeker Sonstiges
|
|||||||
FHEM/18_CUL_HOERMANN.pm rudolfkoenig SlowRF
|
FHEM/18_CUL_HOERMANN.pm rudolfkoenig SlowRF
|
||||||
FHEM/19_Revolt.pm martinppp/mehf SlowRF
|
FHEM/19_Revolt.pm martinppp/mehf SlowRF
|
||||||
FHEM/19_VBUSIF.pm Tobias/pejonp Sonstige Systeme
|
FHEM/19_VBUSIF.pm Tobias/pejonp Sonstige Systeme
|
||||||
FHEM/20_FRM_AD.pm ntruchsess Sonstige Systeme
|
FHEM/20_FRM_AD.pm jensb Sonstige Systeme
|
||||||
FHEM/20_FRM_ROTENC.pm ntruchsess Sonstige Systeme
|
FHEM/20_FRM_ROTENC.pm ntruchsess Sonstige Systeme
|
||||||
FHEM/20_FRM_I2C.pm ntruchsess Sonstige Systeme
|
FHEM/20_FRM_I2C.pm ntruchsess Sonstige Systeme
|
||||||
FHEM/20_FRM_IN.pm ntruchsess Sonstige Systeme
|
FHEM/20_FRM_IN.pm ntruchsess Sonstige Systeme
|
||||||
|
Loading…
x
Reference in New Issue
Block a user