44_S7: Bugfixes

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@15511 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
charlie71 2017-11-27 21:13:16 +00:00
parent 60b5349b3e
commit 84c4c72f0e
7 changed files with 20 additions and 14 deletions

View File

@ -1,5 +1,10 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it.
- bugfix: 44_S7_ARead: event-on-change-reading
- bugfix: 44_S7_AWrite: event-on-change-reading
- bugfix: 44_S7_DRead: event-on-change-reading
- bugfix: 44_S7_DWrite: event-on-change-reading
- bugfix: 44_S7_S5Client.pm: loading serial modul
- change: 89_FULLY: on-timer implemented
- change: 77_SMAEM: V3.0.1, use abort cause of BlockingCall
- change: 93_Log2Syslog: V3.2.0, add NOTIFYDEV (if possible)

View File

@ -306,7 +306,7 @@ sub S7_ARead_Parse($$) {
}
else {
Log3 $name, 3,
"$name S7_ARead: Parse unknown type : ("
"$n S7_ARead: Parse unknown type : ("
. $h->{DATATYPE} . ")";
}
@ -333,7 +333,7 @@ sub S7_ARead_Parse($$) {
my @a;
if($attreocr) {
@a = split(/,/,$attreocr);
$hash->{".attreocr"} = \@a;
$h->{".attreocr"} = \@a;
}
# determine whether the reading is listed in any of the attributes
my @eocrv;
@ -350,7 +350,7 @@ sub S7_ARead_Parse($$) {
if($myI =~ m/([\d\.\-eE]+)/ && looks_like_number($1)) { #41083, #62190
my $mv = $1;
my $last_value = $hash->{".attreocr-threshold$reading"};
my $last_value = $h->{".attreocr-threshold$reading"};
if( !defined($last_value) ) {
$h->{".attreocr-threshold$reading"} = $mv;
} elsif( abs($mv - $last_value) < $threshold ) {

View File

@ -475,7 +475,7 @@ sub S7_AWrite_Parse($$) {
my @a;
if($attreocr) {
@a = split(/,/,$attreocr);
$hash->{".attreocr"} = \@a;
$h->{".attreocr"} = \@a;
}
# determine whether the reading is listed in any of the attributes
my @eocrv;
@ -492,7 +492,7 @@ sub S7_AWrite_Parse($$) {
if($myI =~ m/([\d\.\-eE]+)/ && looks_like_number($1)) { #41083, #62190
my $mv = $1;
my $last_value = $hash->{".attreocr-threshold$reading"};
my $last_value = $h->{".attreocr-threshold$reading"};
if( !defined($last_value) ) {
$h->{".attreocr-threshold$reading"} = $mv;
} elsif( abs($mv - $last_value) < $threshold ) {

View File

@ -402,7 +402,7 @@ sub S7_DRead_Parse($$) {
my @a;
if($attreocr) {
@a = split(/,/,$attreocr);
$hash->{".attreocr"} = \@a;
$h->{".attreocr"} = \@a;
}
# determine whether the reading is listed in any of the attributes
my @eocrv;
@ -419,7 +419,7 @@ sub S7_DRead_Parse($$) {
if($valueText =~ m/([\d\.\-eE]+)/ && looks_like_number($1)) { #41083, #62190
my $mv = $1;
my $last_value = $hash->{".attreocr-threshold$reading"};
my $last_value = $h->{".attreocr-threshold$reading"};
if( !defined($last_value) ) {
$h->{".attreocr-threshold$reading"} = $mv;
} elsif( abs($mv - $last_value) < $threshold ) {

View File

@ -478,7 +478,7 @@ sub S7_DWrite_setABit($$) {
my @a;
if($attreocr) {
@a = split(/,/,$attreocr);
$hash->{".attreocr"} = \@a;
$h->{".attreocr"} = \@a;
}
# determine whether the reading is listed in any of the attributes
my @eocrv;
@ -495,7 +495,7 @@ sub S7_DWrite_setABit($$) {
if($valueText =~ m/([\d\.\-eE]+)/ && looks_like_number($1)) { #41083, #62190
my $mv = $1;
my $last_value = $hash->{".attreocr-threshold$reading"};
my $last_value = $h->{".attreocr-threshold$reading"};
if( !defined($last_value) ) {
$h->{".attreocr-threshold$reading"} = $mv;
} elsif( abs($mv - $last_value) < $threshold ) {

View File

@ -477,13 +477,14 @@ sub S5ConnectPLCAS511($$) {
my $b1 = "";
my $ttyPort;
if ($^O=~/Win/) {
eval ("use Win32::SerialPort;");
if($^O =~ m/Win/) {
require Win32::SerialPort;
#eval ("use Win32::SerialPort;");
$self->{serial} = new Win32::SerialPort ($portName);
}else{
eval ("use Device::SerialPort;");
#eval ("use Device::SerialPort;");
require Device::SerialPort;
$self->{serial} = new Device::SerialPort ($portName);
}
main::Log3( undef, 3, "Can't open serial port $portName" )

View File

@ -334,7 +334,7 @@ sub new {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 );
$self->{PDU}->{DATA} = "";
$self->{TCPClient} = undef;
return bless $self, $class;
}