Fixed rc_switch dump off by one bit (#652)

* Fixed rc_switch dump off by one bit

* Proper fix per review comments
This commit is contained in:
mtl010957 2019-06-26 14:42:50 -05:00 committed by Otto Winter
parent 5cd7f23065
commit 0dfab4d93c

View file

@ -113,7 +113,7 @@ bool RCSwitchBase::decode(RemoteReceiveData &src, uint32_t *out_data, uint8_t *o
this->expect_sync(src);
*out_data = 0;
for (*out_nbits = 1; *out_nbits < 32; *out_nbits += 1) {
for (*out_nbits = 0; *out_nbits < 32; *out_nbits += 1) {
if (this->expect_zero(src)) {
*out_data <<= 1;
*out_data |= 0;
@ -121,7 +121,6 @@ bool RCSwitchBase::decode(RemoteReceiveData &src, uint32_t *out_data, uint8_t *o
*out_data <<= 1;
*out_data |= 1;
} else {
*out_nbits -= 1;
return *out_nbits >= 8;
}
}