Skip to content

Commit

Permalink
00_SIGNALduino.pm - SIGNALduino_Read(), MU-Overflow
Browse files Browse the repository at this point in the history
Damit können bei komprimierten MU-Nachrichten bei einem Überlauf auch die restlichen Daten übertragen werden.
Da die restlichen komprimierten Daten jeweils auch mit einem D anfangen, müssen die Ds beim wieder zusammenfügen entfernt werden.
Falls auch debuginfos wie z.B. die FIFO-Belegung, mit übertragen werden, dann werden diese ins log geschrieben.
z.B. "F64;" ergibt im log "...sduino/msg READredu(o1) FIFO=100"

Hier ist ein Beispiel für ein Teil einer komprimierten MU-Nachricht.
Mu;.....;D.........;D........;F64;d......;
  • Loading branch information
Ralf9 committed Dec 1, 2018
1 parent bd421a6 commit 7cd526e
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions FHEM/00_SIGNALduino.pm
@@ -1,4 +1,4 @@
# $Id: 00_SIGNALduino.pm 10488 2018-10-23 00:22:00Z v3.3.3-dev $
# $Id: 00_SIGNALduino.pm 10488 2018-12-01 13:00:00Z v3.3.3-dev $
#
# v3.3.3 (Development release 3.3)
# The module is inspired by the FHEMduino project and modified in serval ways for processing the incoming messages
Expand Down Expand Up @@ -28,7 +28,7 @@ eval "use Time::HiRes qw(gettimeofday);1" ;


use constant {
SDUINO_VERSION => "v3.3.3-dev_24.11.",
SDUINO_VERSION => "v3.3.3-dev_01.12.",
SDUINO_INIT_WAIT_XQ => 1.5, # wait disable device
SDUINO_INIT_WAIT => 2,
SDUINO_INIT_MAXRETRY => 3,
Expand Down Expand Up @@ -1428,15 +1428,15 @@ SIGNALduino_Read($)
my $debug = AttrVal($name,"debug",0);

my $SIGNALduinodata = $hash->{PARTIAL};
SIGNALduino_Log3 $name, 5, "$name/RAW READ: $SIGNALduinodata/$buf" if ($debug);
Log3 $name, 5, "$name/RAW READ: $SIGNALduinodata/$buf" if ($debug);
$SIGNALduinodata .= $buf;

while($SIGNALduinodata =~ m/\n/) {
my $rmsg;
($rmsg,$SIGNALduinodata) = split("\n", $SIGNALduinodata, 2);
$rmsg =~ s/\r//;

if ($rmsg =~ m/^\002(M(s|u|o);.*;)\003/) {
if ($rmsg =~ m/^\002(M(s|u);.*;)\003/) {
$rmsg =~ s/^\002//; # \002 am Anfang entfernen
my @msg_parts = split(";",$rmsg);
my $m0;
Expand All @@ -1446,6 +1446,7 @@ SIGNALduino_Read($)
my $mH;
my $part = "";
my $partD;
my $dOverfl = 0;

foreach my $msgPart (@msg_parts) {
next if ($msgPart eq "");
Expand All @@ -1472,7 +1473,13 @@ SIGNALduino_Read($)
}
elsif (($m0 eq "D" || $m0 eq "d") && length($m1) > 0) {
my @arrayD = split(//, $m1);
$part .= "D=";
if ($dOverfl == 0) {
$part .= "D=";
}
else {
$part =~ s/;$//; # ; am Ende entfernen
}
$dOverfl++;
$partD = "";
foreach my $D (@arrayD) {
$mH = ord($D) >> 4;
Expand All @@ -1493,6 +1500,10 @@ SIGNALduino_Read($)
elsif ($m0 eq "o" || $m0 eq "m") {
$part .= "$m0$m1;";
}
elsif ($m0 eq "F") {
my $F = hex($m1);
SIGNALduino_Log3 $name, AttrVal($name,"noMsgVerbose",4), "$name/msg READredu(o$dOverfl) FIFO=$F";
}
elsif ($m1 =~ m/^[0-9A-Z]{1,2}$/) { # bei 1 oder 2 Hex Ziffern nach Dez wandeln
$part .= "$m0=" . hex($m1) . ";";
}
Expand All @@ -1504,7 +1515,12 @@ SIGNALduino_Read($)
$part .= ";";
}
}
SIGNALduino_Log3 $name, 4, "$name/msg READredu: $part";
my $MuOverfl = "";
if ($dOverfl > 1) {
$dOverfl--;
$MuOverfl = "(o$dOverfl)";
}
SIGNALduino_Log3 $name, 4, "$name/msg READredu$MuOverfl: $part";
$rmsg = "\002$part\003";
}
else {
Expand Down

0 comments on commit 7cd526e

Please sign in to comment.