Skip to content

Commit

Permalink
Merge pull request #8 from jamisonderek/jamisonderek/singlehit
Browse files Browse the repository at this point in the history
Clear IR queue when user is hit.
  • Loading branch information
RocketGod-git authored Sep 12, 2024
2 parents 0d10c68 + 4d442f9 commit 85e43b1
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion infrared_controller.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@ void update_infrared_board_status(InfraredController* controller) {
}
}

static int32_t infrared_reset(void* context) {
InfraredController* controller = (InfraredController*)context;
// furi_stream_buffer_reset(instance->stream) not exposed to the API.
// infrared_worker_rx_stop calls it internally.
infrared_worker_rx_stop(controller->worker);
infrared_worker_rx_start(controller->worker);
controller->processing_signal = false;
return 0;
}

static void infrared_rx_callback(void* context, InfraredWorkerSignal* received_signal) {
FURI_LOG_I(TAG, "RX callback triggered");

Expand Down Expand Up @@ -99,7 +109,8 @@ static void infrared_rx_callback(void* context, InfraredWorkerSignal* received_s
}

FURI_LOG_I(TAG, "RX callback completed");
controller->processing_signal = false;
FuriThread* thread = furi_thread_alloc_ex("InfraredReset", 512, infrared_reset, controller);
furi_thread_start(thread);
}

InfraredController* infrared_controller_alloc() {
Expand Down

0 comments on commit 85e43b1

Please sign in to comment.