Update ir_protocols_main.c

RMT write should be non-blocking to wait the correct time for sending the repeat frame
This commit is contained in:
DeeFuse 2020-02-11 19:59:56 +01:00 committed by morris
parent a0ebe4d18c
commit f6c90adb42

View file

@ -99,12 +99,12 @@ static void example_ir_tx_task(void *arg)
ESP_ERROR_CHECK(ir_builder->build_frame(ir_builder, addr, cmd));
ESP_ERROR_CHECK(ir_builder->get_result(ir_builder, &items, &length));
//To send data according to the waveform items.
rmt_write_items(example_tx_channel, items, length, true);
rmt_write_items(example_tx_channel, items, length, false);
// Send repeat code
vTaskDelay(pdMS_TO_TICKS(ir_builder->repeat_period_ms));
ESP_ERROR_CHECK(ir_builder->build_repeat_frame(ir_builder));
ESP_ERROR_CHECK(ir_builder->get_result(ir_builder, &items, &length));
rmt_write_items(example_tx_channel, items, length, true);
rmt_write_items(example_tx_channel, items, length, false);
cmd++;
}
ir_builder->del(ir_builder);