Fix dump/tx of 64 bit codes (#940)

* Fix dump/tx of 64 bit codes

* fixed source format
This commit is contained in:
András Bíró 2020-01-12 16:25:32 +01:00 committed by Otto Winter
parent d33a158585
commit a30d2f291c

View file

@ -56,7 +56,7 @@ void RCSwitchBase::sync(RemoteTransmitData *dst) const {
void RCSwitchBase::transmit(RemoteTransmitData *dst, uint64_t code, uint8_t len) const {
dst->set_carrier_frequency(0);
for (int16_t i = len - 1; i >= 0; i--) {
if (code & (1 << i))
if (code & ((uint64_t) 1 << i))
this->one(dst);
else
this->zero(dst);
@ -237,7 +237,7 @@ bool RCSwitchDumper::dump(RemoteReceiveData src) {
if (protocol->decode(src, &out_data, &out_nbits) && out_nbits >= 3) {
char buffer[65];
for (uint8_t j = 0; j < out_nbits; j++)
buffer[j] = (out_data & (1 << (out_nbits - j - 1))) ? '1' : '0';
buffer[j] = (out_data & ((uint64_t) 1 << (out_nbits - j - 1))) ? '1' : '0';
buffer[out_nbits] = '\0';
ESP_LOGD(TAG, "Received RCSwitch Raw: protocol=%u data='%s'", i, buffer);