From faa41e23c68d030ef3f96881374f90c5720810db Mon Sep 17 00:00:00 2001 From: Akiva Cohen Date: Mon, 13 Jan 2025 10:14:49 -0500 Subject: [PATCH 1/4] made new method changes --- applications/main/infrared/infrared_app.c | 2 +- lib/infrared/worker/infrared_worker.c | 29 ++++++++++++++++++----- lib/infrared/worker/infrared_worker.h | 7 ++++++ 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/applications/main/infrared/infrared_app.c b/applications/main/infrared/infrared_app.c index c50039760c3..1aa0f7add42 100644 --- a/applications/main/infrared/infrared_app.c +++ b/applications/main/infrared/infrared_app.c @@ -391,7 +391,7 @@ void infrared_tx_start(InfraredApp* infrared) { dolphin_deed(DolphinDeedIrSend); infrared_play_notification_message(infrared, InfraredNotificationMessageBlinkStartSend); - infrared_worker_tx_set_get_signal_callback( + infrared_worker_tx_ infrared_worker_tx_set_get_signal_callback( infrared->worker, infrared_worker_tx_get_signal_steady_callback, infrared); infrared_worker_tx_start(infrared->worker); diff --git a/lib/infrared/worker/infrared_worker.c b/lib/infrared/worker/infrared_worker.c index cc9361ccf15..95ca32c1b09 100644 --- a/lib/infrared/worker/infrared_worker.c +++ b/lib/infrared/worker/infrared_worker.c @@ -58,7 +58,8 @@ struct InfraredWorker { InfraredEncoderHandler* infrared_encoder; InfraredDecoderHandler* infrared_decoder; NotificationApp* notification; - bool blink_enable; + bool rx_blink_enable; + bool tx_blink_enable; bool decode_enable; union { @@ -172,7 +173,7 @@ static int32_t infrared_worker_rx_thread(void* thread_context) { furi_check(events & INFRARED_WORKER_ALL_RX_EVENTS); /* at least one caught */ if(events & INFRARED_WORKER_RX_RECEIVED) { - if(!instance->rx.overrun && instance->blink_enable && + if(!instance->rx.overrun && instance->rx_blink_enable && ((furi_get_tick() - last_blink_time) > 80)) { last_blink_time = furi_get_tick(); notification_message(instance->notification, &sequence_blink_blue_10); @@ -193,14 +194,14 @@ static int32_t infrared_worker_rx_thread(void* thread_context) { printf("#"); infrared_reset_decoder(instance->infrared_decoder); instance->signal.timings_cnt = 0; - if(instance->blink_enable) + if(instance->rx_blink_enable) notification_message(instance->notification, &sequence_set_red_255); } if(events & INFRARED_WORKER_RX_TIMEOUT_RECEIVED) { if(instance->rx.overrun) { printf("\nOVERRUN, max samples: %d\n", MAX_TIMINGS_AMOUNT); instance->rx.overrun = false; - if(instance->blink_enable) + if(instance->rx_blink_enable) notification_message(instance->notification, &sequence_reset_red); } else { infrared_worker_process_timeout(instance); @@ -234,7 +235,8 @@ InfraredWorker* infrared_worker_alloc(void) { instance->stream = furi_stream_buffer_alloc(buffer_size, sizeof(InfraredWorkerTiming)); instance->infrared_decoder = infrared_alloc_decoder(); instance->infrared_encoder = infrared_alloc_encoder(); - instance->blink_enable = false; + instance->rx_blink_enable = false; + instance->tx_blink_enable = false; instance->decode_enable = true; instance->notification = furi_record_open(RECORD_NOTIFICATION); instance->state = InfraredWorkerStateIdle; @@ -317,7 +319,13 @@ const InfraredMessage* infrared_worker_get_decoded_signal(const InfraredWorkerSi void infrared_worker_rx_enable_blink_on_receiving(InfraredWorker* instance, bool enable) { furi_check(instance); - instance->blink_enable = enable; + instance->rx_blink_enable = enable; +} + +void infrared_worker_tx_enable_blink_on_sending(InfraredWorker* instance, bool enable) { + furi_check(instance); + + instance->tx_blink_enable = enable; } void infrared_worker_rx_enable_signal_decoding(InfraredWorker* instance, bool enable) { @@ -344,6 +352,11 @@ void infrared_worker_tx_start(InfraredWorker* instance) { infrared_worker_furi_hal_message_sent_isr_callback, instance); instance->state = InfraredWorkerStateStartTx; + + if(instance->tx_blink_enable) { + notification_message(instance->notification, &sequence_blink_start_magenta); + } + furi_thread_start(instance->thread); } @@ -588,6 +601,10 @@ void infrared_worker_tx_stop(InfraredWorker* instance) { furi_hal_infrared_async_tx_set_data_isr_callback(NULL, NULL); furi_hal_infrared_async_tx_set_signal_sent_isr_callback(NULL, NULL); + if(instance->tx_blink_enable) { + notification_message(instance->notification, &message_blink_stop); + } + instance->signal.timings_cnt = 0; furi_check(furi_stream_buffer_reset(instance->stream) == FuriStatusOk); diff --git a/lib/infrared/worker/infrared_worker.h b/lib/infrared/worker/infrared_worker.h index 2edb19227f9..8c836f9235a 100644 --- a/lib/infrared/worker/infrared_worker.h +++ b/lib/infrared/worker/infrared_worker.h @@ -76,6 +76,13 @@ void infrared_worker_rx_set_received_signal_callback( */ void infrared_worker_rx_enable_blink_on_receiving(InfraredWorker* instance, bool enable); +/** Enable blinking while sending any signal on IR port + * + * @param[in] instance - instance of InfraredWorker + * @param[in] enable - true if you want to enable blinking /false otherwise + */ +void infrared_worker_tx_enable_blink_on_sending(InfraredWorker* instance, bool enable); + /** Enable decoding of received infrared signals. * * @param[in] instance - instance of InfraredWorker From 21b48a7373d69be2a228c6a7565a706e16976fda Mon Sep 17 00:00:00 2001 From: Akiva Cohen Date: Mon, 13 Jan 2025 10:15:36 -0500 Subject: [PATCH 2/4] remove half line --- applications/main/infrared/infrared_app.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/main/infrared/infrared_app.c b/applications/main/infrared/infrared_app.c index 1aa0f7add42..c50039760c3 100644 --- a/applications/main/infrared/infrared_app.c +++ b/applications/main/infrared/infrared_app.c @@ -391,7 +391,7 @@ void infrared_tx_start(InfraredApp* infrared) { dolphin_deed(DolphinDeedIrSend); infrared_play_notification_message(infrared, InfraredNotificationMessageBlinkStartSend); - infrared_worker_tx_ infrared_worker_tx_set_get_signal_callback( + infrared_worker_tx_set_get_signal_callback( infrared->worker, infrared_worker_tx_get_signal_steady_callback, infrared); infrared_worker_tx_start(infrared->worker); From 259590308e116ca4e302fa555412eb31b10e9086 Mon Sep 17 00:00:00 2001 From: Akiva Cohen Date: Tue, 14 Jan 2025 12:57:10 -0500 Subject: [PATCH 3/4] working --- applications/main/infrared/infrared_app.c | 12 ++---------- lib/infrared/worker/infrared_worker.c | 4 ++++ targets/f7/api_symbols.csv | 5 +++-- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/applications/main/infrared/infrared_app.c b/applications/main/infrared/infrared_app.c index c50039760c3..ab7e0c2f1b8 100644 --- a/applications/main/infrared/infrared_app.c +++ b/applications/main/infrared/infrared_app.c @@ -389,7 +389,8 @@ void infrared_tx_start(InfraredApp* infrared) { } dolphin_deed(DolphinDeedIrSend); - infrared_play_notification_message(infrared, InfraredNotificationMessageBlinkStartSend); + + infrared_worker_tx_enable_blink_on_sending(infrared->worker, true); infrared_worker_tx_set_get_signal_callback( infrared->worker, infrared_worker_tx_get_signal_steady_callback, infrared); @@ -418,8 +419,6 @@ void infrared_tx_stop(InfraredApp* infrared) { infrared_worker_tx_stop(infrared->worker); infrared_worker_tx_set_get_signal_callback(infrared->worker, NULL, NULL); - infrared_play_notification_message(infrared, InfraredNotificationMessageBlinkStop); - infrared->app_state.is_transmitting = false; infrared->app_state.last_transmit_time = furi_get_tick(); } @@ -468,13 +467,6 @@ void infrared_text_store_clear(InfraredApp* infrared, uint32_t bank) { memset(infrared->text_store[bank], 0, INFRARED_TEXT_STORE_SIZE + 1); } -void infrared_play_notification_message( - const InfraredApp* infrared, - InfraredNotificationMessage message) { - furi_assert(message < InfraredNotificationMessageCount); - notification_message(infrared->notifications, infrared_notification_sequences[message]); -} - void infrared_show_error_message(const InfraredApp* infrared, const char* fmt, ...) { va_list args; va_start(args, fmt); diff --git a/lib/infrared/worker/infrared_worker.c b/lib/infrared/worker/infrared_worker.c index 95ca32c1b09..8484ca66374 100644 --- a/lib/infrared/worker/infrared_worker.c +++ b/lib/infrared/worker/infrared_worker.c @@ -601,9 +601,13 @@ void infrared_worker_tx_stop(InfraredWorker* instance) { furi_hal_infrared_async_tx_set_data_isr_callback(NULL, NULL); furi_hal_infrared_async_tx_set_signal_sent_isr_callback(NULL, NULL); +<<<<<<< HEAD + notification_message(instance->notification, &sequence_blink_stop); +======= if(instance->tx_blink_enable) { notification_message(instance->notification, &message_blink_stop); } +>>>>>>> 2e59eb13 (made new method changes) instance->signal.timings_cnt = 0; furi_check(furi_stream_buffer_reset(instance->stream) == FuriStatusOk); diff --git a/targets/f7/api_symbols.csv b/targets/f7/api_symbols.csv index 15f4d70d7d9..202811edca9 100644 --- a/targets/f7/api_symbols.csv +++ b/targets/f7/api_symbols.csv @@ -1,5 +1,5 @@ entry,status,name,type,params -Version,+,79.2,, +Version,+,79.3,, Header,+,applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.h,, Header,+,applications/services/bt/bt_service/bt.h,, Header,+,applications/services/bt/bt_service/bt_keys_storage.h,, @@ -2058,6 +2058,7 @@ Function,+,infrared_worker_rx_stop,void,InfraredWorker* Function,+,infrared_worker_set_decoded_signal,void,"InfraredWorker*, const InfraredMessage*" Function,+,infrared_worker_set_raw_signal,void,"InfraredWorker*, const uint32_t*, size_t, uint32_t, float" Function,+,infrared_worker_signal_is_decoded,_Bool,const InfraredWorkerSignal* +Function,+,infrared_worker_tx_enable_blink_on_sending,void,"InfraredWorker*, _Bool" Function,+,infrared_worker_tx_get_signal_steady_callback,InfraredWorkerGetSignalResponse,"void*, InfraredWorker*" Function,+,infrared_worker_tx_set_get_signal_callback,void,"InfraredWorker*, InfraredWorkerGetSignalCallback, void*" Function,+,infrared_worker_tx_set_signal_sent_callback,void,"InfraredWorker*, InfraredWorkerMessageSentCallback, void*" @@ -2938,9 +2939,9 @@ Function,+,pipe_install_as_stdio,void,PipeSide* Function,+,pipe_receive,size_t,"PipeSide*, void*, size_t, FuriWait" Function,+,pipe_role,PipeRole,PipeSide* Function,+,pipe_send,size_t,"PipeSide*, const void*, size_t, FuriWait" +Function,+,pipe_set_broken_callback,void,"PipeSide*, PipeSideBrokenCallback, FuriEventLoopEvent" Function,+,pipe_set_callback_context,void,"PipeSide*, void*" Function,+,pipe_set_data_arrived_callback,void,"PipeSide*, PipeSideDataArrivedCallback, FuriEventLoopEvent" -Function,+,pipe_set_broken_callback,void,"PipeSide*, PipeSideBrokenCallback, FuriEventLoopEvent" Function,+,pipe_set_space_freed_callback,void,"PipeSide*, PipeSideSpaceFreedCallback, FuriEventLoopEvent" Function,+,pipe_spaces_available,size_t,PipeSide* Function,+,pipe_state,PipeState,PipeSide* From 1b991176947504f70bbca482c5b0ea3de748cb7e Mon Sep 17 00:00:00 2001 From: Akiva Cohen Date: Tue, 14 Jan 2025 13:40:30 -0500 Subject: [PATCH 4/4] remove conflict --- lib/infrared/worker/infrared_worker.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lib/infrared/worker/infrared_worker.c b/lib/infrared/worker/infrared_worker.c index 8484ca66374..117470cd24e 100644 --- a/lib/infrared/worker/infrared_worker.c +++ b/lib/infrared/worker/infrared_worker.c @@ -601,13 +601,7 @@ void infrared_worker_tx_stop(InfraredWorker* instance) { furi_hal_infrared_async_tx_set_data_isr_callback(NULL, NULL); furi_hal_infrared_async_tx_set_signal_sent_isr_callback(NULL, NULL); -<<<<<<< HEAD notification_message(instance->notification, &sequence_blink_stop); -======= - if(instance->tx_blink_enable) { - notification_message(instance->notification, &message_blink_stop); - } ->>>>>>> 2e59eb13 (made new method changes) instance->signal.timings_cnt = 0; furi_check(furi_stream_buffer_reset(instance->stream) == FuriStatusOk);