Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cc1101 detection #689

Merged
merged 4 commits into from
Nov 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGED
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
11.11.2019
00_SIGNALduino.pm: fix missing cc1101 get commands
09.11.2019
14_SD_WS.pm: new protocol 53 for weatherstation Lidl AURIOL AHFL 433 B2 IAN 314695
05.11.2019
Expand Down
3 changes: 1 addition & 2 deletions FHEM/00_SIGNALduino.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1201,14 +1201,13 @@ sub SIGNALduino_CheckCmdResp($)
$hash->{DevState} = 'initialized';
delete($hash->{initResetFlag}) if defined($hash->{initResetFlag});
SIGNALduino_SimpleWrite($hash, "XE"); # Enable receiver
#DevIo_SimpleWrite($hash, "XE\n",2);
$hash->{logMethod}->($hash, 3, "$name/init: enable receiver (XE)");
delete($hash->{initretry});
# initialize keepalive
$hash->{keepalive}{ok} = 0;
$hash->{keepalive}{retry} = 0;
InternalTimer(gettimeofday() + SDUINO_KEEPALIVE_TIMEOUT, "SIGNALduino_KeepAlive", $hash, 0);
$hash->{hasCC1101} = 1 if ($ver !~ m/cc1101/);
$hash->{hasCC1101} = 1 if ($ver =~ m/cc1101/);
sidey79 marked this conversation as resolved.
Show resolved Hide resolved
}
}
else {
Expand Down
21 changes: 20 additions & 1 deletion UnitTest/tests/test_sub_CheckCmdResp-definition.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,27 @@ defmod test_sub_CheckCmdResp UnitTest dummyDuino (
is($targetHash->{getcmd}->{cmd},"version","getcmd not removed");
is($targetHash->{DevState},"INACTIVE","check DevState");
};

subtest 'Test with good version without cc1101' => sub {
plan tests => 5;

my $mock = Mock::Sub->new;
my $SD_SimpleWrite = $mock->mock('SIGNALduino_SimpleWrite');

$targetHash->{version} = "V 3.3.1 SIGNALduino - compiled at Sep 22 2019 22:53:27";
$targetHash->{getcmd}->{cmd} = "version";
my $ret=SIGNALduino_CheckCmdResp($targetHash);
is(ReadingsVal($target,"state",undef),"opened","SIGNALDuino firmware version ok");
is($SD_SimpleWrite->called,1,"SIGNALduino_SimpleWrite called");

is($targetHash->{getcmd}->{cmd},"version","getcmd not removed");
is($targetHash->{DevState},"initialized","check DevState");
is($targetHash->{hasCC1101},undef,"check internal hasCC1101");
$SD_SimpleWrite->unmock;
};

subtest 'Test with good version' => sub {
plan tests => 4;
plan tests => 5;

my $mock = Mock::Sub->new;
my $SD_SimpleWrite = $mock->mock('SIGNALduino_SimpleWrite');
Expand All @@ -53,6 +71,7 @@ defmod test_sub_CheckCmdResp UnitTest dummyDuino (

is($targetHash->{getcmd}->{cmd},"version","getcmd not removed");
is($targetHash->{DevState},"initialized","check DevState");
is($targetHash->{hasCC1101},1,"check internal hasCC1101");

$SD_SimpleWrite->unmock;
};
Expand Down
2 changes: 1 addition & 1 deletion controls_signalduino.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
UPD 2019-11-10_20:22:39 206470 FHEM/00_SIGNALduino.pm
UPD 2019-11-11_20:25:02 206430 FHEM/00_SIGNALduino.pm
UPD 2017-06-23_17:43:38 14541 FHEM/10_FS10.pm
UPD 2016-09-18_21:22:06 10111 FHEM/14_BresserTemeo.pm
UPD 2018-11-11_22:35:33 13616 FHEM/14_FLAMINGO.pm
Expand Down