mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-13 17:26:34 +00:00
20_FRM_AD.pm: stability fix (Forum #81815)
git-svn-id: https://svn.fhem.de/fhem/trunk@15770 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
f205953a81
commit
1e3e315c9b
@ -1,6 +1,37 @@
|
||||
##############################################
|
||||
########################################################################################
|
||||
#
|
||||
# $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;
|
||||
|
||||
use strict;
|
||||
@ -48,8 +79,11 @@ FRM_AD_Init($$)
|
||||
return $ret if (defined $ret);
|
||||
my $firmata = $hash->{IODev}->{FirmataDevice};
|
||||
my $name = $hash->{NAME};
|
||||
$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});
|
||||
eval {
|
||||
$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});
|
||||
};
|
||||
return FRM_Catch($@) if $@;
|
||||
if (! (defined AttrVal($name,"stateFormat",undef))) {
|
||||
$main::attr{$name}{"stateFormat"} = "reading";
|
||||
}
|
||||
@ -139,6 +173,18 @@ FRM_AD_Attr($$$$) {
|
||||
1;
|
||||
|
||||
=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
|
||||
|
||||
<a name="FRM_AD"></a>
|
||||
|
@ -100,7 +100,7 @@ FHEM/17_SIS_PMS.pm painseeker Sonstiges
|
||||
FHEM/18_CUL_HOERMANN.pm rudolfkoenig SlowRF
|
||||
FHEM/19_Revolt.pm martinppp/mehf SlowRF
|
||||
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_I2C.pm ntruchsess Sonstige Systeme
|
||||
FHEM/20_FRM_IN.pm ntruchsess Sonstige Systeme
|
||||
|
Loading…
x
Reference in New Issue
Block a user