Skip to content

Commit

Permalink
RollerShutter: add CALCFG recalibrate support. Add "calibration in
Browse files Browse the repository at this point in the history
progress" flag report.
  • Loading branch information
klew committed Oct 9, 2024
1 parent d3c305d commit 3f76b99
Show file tree
Hide file tree
Showing 3 changed files with 258 additions and 140 deletions.
21 changes: 12 additions & 9 deletions extras/test/RollerShutterTests/roller_shutter_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,12 @@ TEST_F(RollerShutterFixture, basicTests) {
SUPLA_CHANNELFNC_CONTROLLINGTHEROLLERSHUTTER);
EXPECT_EQ(rs.getChannel()->getFlags(),
SUPLA_CHANNEL_FLAG_CHANNELSTATE |
SUPLA_CHANNEL_FLAG_RS_SBS_AND_STOP_ACTIONS);
EXPECT_EQ(0, memcmp(Supla::RegisterDevice::getChannelValuePtr(number),
&value,
SUPLA_CHANNELVALUE_SIZE));
SUPLA_CHANNEL_FLAG_RS_SBS_AND_STOP_ACTIONS |
SUPLA_CHANNEL_FLAG_CALCFG_RECALIBRATE);
EXPECT_EQ(0,
memcmp(Supla::RegisterDevice::getChannelValuePtr(number),
&value,
SUPLA_CHANNELVALUE_SIZE));
}

TEST_F(RollerShutterFixture, onInitHighIsOn) {
Expand Down Expand Up @@ -136,23 +138,24 @@ TEST_F(RollerShutterFixture, notCalibratedStartup) {
}

TDSC_RollerShutterValue value = {};
EXPECT_EQ(0, memcmp(Supla::RegisterDevice::getChannelValuePtr(0),
&value,
SUPLA_CHANNELVALUE_SIZE));
value.position = -1;
TDSC_RollerShutterValue *valuePtr =
reinterpret_cast<TDSC_RollerShutterValue *>(
Supla::RegisterDevice::getChannelValuePtr(0));
EXPECT_EQ(0, memcmp(valuePtr, &value, SUPLA_CHANNELVALUE_SIZE));

rs.handleAction(0, Supla::MOVE_DOWN);
for (int i = 0; i < 10; i++) {
rs.onTimer();
time.advance(100);
}

value.position = -1;
EXPECT_EQ(0, memcmp(Supla::RegisterDevice::getChannelValuePtr(0),
&value,
SUPLA_CHANNELVALUE_SIZE));

rs.handleAction(0, Supla::MOVE_UP);
for (int i = 0; i < 10; i++) {
for (int i = 0; i < 100; i++) {
rs.onTimer();
time.advance(100);
}
Expand Down
Loading

0 comments on commit 3f76b99

Please sign in to comment.