From 8954c989f4866ad3d72c59a00bc5296084596ecd Mon Sep 17 00:00:00 2001 From: DeeFuse <7376678+Dee-Fuse@users.noreply.github.com> Date: Tue, 11 Feb 2020 20:17:57 +0100 Subject: [PATCH] Update ir_builder_rmt_nec.c fixes standard protocol mode wich would fail due to integer promotion in inversion Merges https://github.com/espressif/esp-idf/pull/4750 --- .../components/infrared_tools/src/ir_builder_rmt_nec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/peripherals/rmt/ir_protocols/components/infrared_tools/src/ir_builder_rmt_nec.c b/examples/peripherals/rmt/ir_protocols/components/infrared_tools/src/ir_builder_rmt_nec.c index 571d7eab4..3b41e9eeb 100644 --- a/examples/peripherals/rmt/ir_protocols/components/infrared_tools/src/ir_builder_rmt_nec.c +++ b/examples/peripherals/rmt/ir_protocols/components/infrared_tools/src/ir_builder_rmt_nec.c @@ -102,10 +102,10 @@ static esp_err_t nec_build_frame(ir_builder_t *builder, uint32_t address, uint32 if (!nec_builder->flags & IR_TOOLS_FLAGS_PROTO_EXT) { uint8_t low_byte = address & 0xFF; uint8_t high_byte = (address >> 8) & 0xFF; - NEC_CHECK(low_byte == ~high_byte, "address not match standard NEC protocol", err, ESP_ERR_INVALID_ARG); + NEC_CHECK(low_byte == (~high_byte & 0xFF), "address not match standard NEC protocol", err, ESP_ERR_INVALID_ARG); low_byte = command & 0xFF; high_byte = (command >> 8) & 0xFF; - NEC_CHECK(low_byte == ~high_byte, "command not match standard NEC protocol", err, ESP_ERR_INVALID_ARG); + NEC_CHECK(low_byte == (~high_byte & 0xFF), "command not match standard NEC protocol", err, ESP_ERR_INVALID_ARG); } builder->make_head(builder); // LSB -> MSB