mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-30 12:07:09 +00:00
44_S7: Bugfixes
git-svn-id: https://svn.fhem.de/fhem/trunk@15511 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
64f3b7e9e4
commit
011bb0cbbe
@ -1,5 +1,10 @@
|
|||||||
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
# 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.
|
# 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: 89_FULLY: on-timer implemented
|
||||||
- change: 77_SMAEM: V3.0.1, use abort cause of BlockingCall
|
- change: 77_SMAEM: V3.0.1, use abort cause of BlockingCall
|
||||||
- change: 93_Log2Syslog: V3.2.0, add NOTIFYDEV (if possible)
|
- change: 93_Log2Syslog: V3.2.0, add NOTIFYDEV (if possible)
|
||||||
|
@ -306,7 +306,7 @@ sub S7_ARead_Parse($$) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Log3 $name, 3,
|
Log3 $name, 3,
|
||||||
"$name S7_ARead: Parse unknown type : ("
|
"$n S7_ARead: Parse unknown type : ("
|
||||||
. $h->{DATATYPE} . ")";
|
. $h->{DATATYPE} . ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -333,7 +333,7 @@ sub S7_ARead_Parse($$) {
|
|||||||
my @a;
|
my @a;
|
||||||
if($attreocr) {
|
if($attreocr) {
|
||||||
@a = split(/,/,$attreocr);
|
@a = split(/,/,$attreocr);
|
||||||
$hash->{".attreocr"} = \@a;
|
$h->{".attreocr"} = \@a;
|
||||||
}
|
}
|
||||||
# determine whether the reading is listed in any of the attributes
|
# determine whether the reading is listed in any of the attributes
|
||||||
my @eocrv;
|
my @eocrv;
|
||||||
@ -350,7 +350,7 @@ sub S7_ARead_Parse($$) {
|
|||||||
|
|
||||||
if($myI =~ m/([\d\.\-eE]+)/ && looks_like_number($1)) { #41083, #62190
|
if($myI =~ m/([\d\.\-eE]+)/ && looks_like_number($1)) { #41083, #62190
|
||||||
my $mv = $1;
|
my $mv = $1;
|
||||||
my $last_value = $hash->{".attreocr-threshold$reading"};
|
my $last_value = $h->{".attreocr-threshold$reading"};
|
||||||
if( !defined($last_value) ) {
|
if( !defined($last_value) ) {
|
||||||
$h->{".attreocr-threshold$reading"} = $mv;
|
$h->{".attreocr-threshold$reading"} = $mv;
|
||||||
} elsif( abs($mv - $last_value) < $threshold ) {
|
} elsif( abs($mv - $last_value) < $threshold ) {
|
||||||
|
@ -475,7 +475,7 @@ sub S7_AWrite_Parse($$) {
|
|||||||
my @a;
|
my @a;
|
||||||
if($attreocr) {
|
if($attreocr) {
|
||||||
@a = split(/,/,$attreocr);
|
@a = split(/,/,$attreocr);
|
||||||
$hash->{".attreocr"} = \@a;
|
$h->{".attreocr"} = \@a;
|
||||||
}
|
}
|
||||||
# determine whether the reading is listed in any of the attributes
|
# determine whether the reading is listed in any of the attributes
|
||||||
my @eocrv;
|
my @eocrv;
|
||||||
@ -492,7 +492,7 @@ sub S7_AWrite_Parse($$) {
|
|||||||
|
|
||||||
if($myI =~ m/([\d\.\-eE]+)/ && looks_like_number($1)) { #41083, #62190
|
if($myI =~ m/([\d\.\-eE]+)/ && looks_like_number($1)) { #41083, #62190
|
||||||
my $mv = $1;
|
my $mv = $1;
|
||||||
my $last_value = $hash->{".attreocr-threshold$reading"};
|
my $last_value = $h->{".attreocr-threshold$reading"};
|
||||||
if( !defined($last_value) ) {
|
if( !defined($last_value) ) {
|
||||||
$h->{".attreocr-threshold$reading"} = $mv;
|
$h->{".attreocr-threshold$reading"} = $mv;
|
||||||
} elsif( abs($mv - $last_value) < $threshold ) {
|
} elsif( abs($mv - $last_value) < $threshold ) {
|
||||||
|
@ -402,7 +402,7 @@ sub S7_DRead_Parse($$) {
|
|||||||
my @a;
|
my @a;
|
||||||
if($attreocr) {
|
if($attreocr) {
|
||||||
@a = split(/,/,$attreocr);
|
@a = split(/,/,$attreocr);
|
||||||
$hash->{".attreocr"} = \@a;
|
$h->{".attreocr"} = \@a;
|
||||||
}
|
}
|
||||||
# determine whether the reading is listed in any of the attributes
|
# determine whether the reading is listed in any of the attributes
|
||||||
my @eocrv;
|
my @eocrv;
|
||||||
@ -419,7 +419,7 @@ sub S7_DRead_Parse($$) {
|
|||||||
|
|
||||||
if($valueText =~ m/([\d\.\-eE]+)/ && looks_like_number($1)) { #41083, #62190
|
if($valueText =~ m/([\d\.\-eE]+)/ && looks_like_number($1)) { #41083, #62190
|
||||||
my $mv = $1;
|
my $mv = $1;
|
||||||
my $last_value = $hash->{".attreocr-threshold$reading"};
|
my $last_value = $h->{".attreocr-threshold$reading"};
|
||||||
if( !defined($last_value) ) {
|
if( !defined($last_value) ) {
|
||||||
$h->{".attreocr-threshold$reading"} = $mv;
|
$h->{".attreocr-threshold$reading"} = $mv;
|
||||||
} elsif( abs($mv - $last_value) < $threshold ) {
|
} elsif( abs($mv - $last_value) < $threshold ) {
|
||||||
|
@ -478,7 +478,7 @@ sub S7_DWrite_setABit($$) {
|
|||||||
my @a;
|
my @a;
|
||||||
if($attreocr) {
|
if($attreocr) {
|
||||||
@a = split(/,/,$attreocr);
|
@a = split(/,/,$attreocr);
|
||||||
$hash->{".attreocr"} = \@a;
|
$h->{".attreocr"} = \@a;
|
||||||
}
|
}
|
||||||
# determine whether the reading is listed in any of the attributes
|
# determine whether the reading is listed in any of the attributes
|
||||||
my @eocrv;
|
my @eocrv;
|
||||||
@ -495,7 +495,7 @@ sub S7_DWrite_setABit($$) {
|
|||||||
|
|
||||||
if($valueText =~ m/([\d\.\-eE]+)/ && looks_like_number($1)) { #41083, #62190
|
if($valueText =~ m/([\d\.\-eE]+)/ && looks_like_number($1)) { #41083, #62190
|
||||||
my $mv = $1;
|
my $mv = $1;
|
||||||
my $last_value = $hash->{".attreocr-threshold$reading"};
|
my $last_value = $h->{".attreocr-threshold$reading"};
|
||||||
if( !defined($last_value) ) {
|
if( !defined($last_value) ) {
|
||||||
$h->{".attreocr-threshold$reading"} = $mv;
|
$h->{".attreocr-threshold$reading"} = $mv;
|
||||||
} elsif( abs($mv - $last_value) < $threshold ) {
|
} elsif( abs($mv - $last_value) < $threshold ) {
|
||||||
|
@ -477,13 +477,14 @@ sub S5ConnectPLCAS511($$) {
|
|||||||
my $b1 = "";
|
my $b1 = "";
|
||||||
my $ttyPort;
|
my $ttyPort;
|
||||||
|
|
||||||
if ($^O=~/Win/) {
|
if($^O =~ m/Win/) {
|
||||||
eval ("use Win32::SerialPort;");
|
require Win32::SerialPort;
|
||||||
|
#eval ("use Win32::SerialPort;");
|
||||||
$self->{serial} = new Win32::SerialPort ($portName);
|
$self->{serial} = new Win32::SerialPort ($portName);
|
||||||
}else{
|
}else{
|
||||||
eval ("use Device::SerialPort;");
|
#eval ("use Device::SerialPort;");
|
||||||
|
require Device::SerialPort;
|
||||||
$self->{serial} = new Device::SerialPort ($portName);
|
$self->{serial} = new Device::SerialPort ($portName);
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
main::Log3( undef, 3, "Can't open serial port $portName" )
|
main::Log3( undef, 3, "Can't open serial port $portName" )
|
||||||
|
@ -334,7 +334,7 @@ sub new {
|
|||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 );
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 );
|
||||||
$self->{PDU}->{DATA} = "";
|
$self->{PDU}->{DATA} = "";
|
||||||
|
$self->{TCPClient} = undef;
|
||||||
return bless $self, $class;
|
return bless $self, $class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user