Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/flipperzero-firmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorgii Surkov <37121527+gsurkov@users.noreply.github.com>2022-08-04 15:11:01 +0300
committerGitHub <noreply@github.com>2022-08-04 15:11:01 +0300
commit8a370d70dc15ee90892d55232e9a3709c39cf8b6 (patch)
tree294c699498f9797b2329f13fc86d0f5ae134d1c3
parent4460010e76fba3626e0ef2c7e3e5c8149dda25c3 (diff)
[FL-2700] Fix IR hangup with short signals (#1535)
* Do not use infrared worker callback for notifications * Remove tx callback * Port Infrared notifications to hardware blinker * Move all blink message definitions to notification_messages.h * Fix potential hangup after leaving debug scene
-rw-r--r--applications/ibutton/ibutton.c19
-rw-r--r--applications/infrared/infrared.c18
-rw-r--r--applications/infrared/infrared_i.h6
-rw-r--r--applications/infrared/scenes/common/infrared_scene_universal_common.c5
-rw-r--r--applications/infrared/scenes/infrared_scene_debug.c1
-rw-r--r--applications/infrared/scenes/infrared_scene_learn.c7
-rw-r--r--applications/infrared/scenes/infrared_scene_learn_success.c7
-rw-r--r--applications/infrared/scenes/infrared_scene_remote.c4
-rw-r--r--applications/infrared/scenes/infrared_scene_rpc.c3
-rw-r--r--applications/lfrfid/scene/lfrfid_app_scene_emulate.cpp12
-rw-r--r--applications/lfrfid/scene/lfrfid_app_scene_rpc.cpp12
-rw-r--r--applications/nfc/nfc.c12
-rw-r--r--applications/notification/notification_messages.c48
-rw-r--r--applications/notification/notification_messages.h9
-rw-r--r--applications/subghz/subghz.c12
15 files changed, 81 insertions, 94 deletions
diff --git a/applications/ibutton/ibutton.c b/applications/ibutton/ibutton.c
index 6f690fce..304c057a 100644
--- a/applications/ibutton/ibutton.c
+++ b/applications/ibutton/ibutton.c
@@ -9,20 +9,6 @@
#define TAG "iButtonApp"
-static const NotificationSequence sequence_blink_start_cyan = {
- &message_blink_start_10,
- &message_blink_set_color_cyan,
- &message_do_not_reset,
- NULL,
-};
-
-static const NotificationSequence sequence_blink_start_magenta = {
- &message_blink_start_10,
- &message_blink_set_color_magenta,
- &message_do_not_reset,
- NULL,
-};
-
static const NotificationSequence sequence_blink_set_yellow = {
&message_blink_set_color_yellow,
NULL,
@@ -33,11 +19,6 @@ static const NotificationSequence sequence_blink_set_magenta = {
NULL,
};
-static const NotificationSequence sequence_blink_stop = {
- &message_blink_stop,
- NULL,
-};
-
static const NotificationSequence* ibutton_notification_sequences[] = {
&sequence_error,
&sequence_success,
diff --git a/applications/infrared/infrared.c b/applications/infrared/infrared.c
index ddeaeecf..aef14f9b 100644
--- a/applications/infrared/infrared.c
+++ b/applications/infrared/infrared.c
@@ -7,10 +7,12 @@ static const NotificationSequence* infrared_notification_sequences[] = {
&sequence_success,
&sequence_set_only_green_255,
&sequence_reset_green,
- &sequence_blink_cyan_10,
- &sequence_blink_magenta_10,
&sequence_solid_yellow,
- &sequence_reset_rgb};
+ &sequence_reset_rgb,
+ &sequence_blink_start_cyan,
+ &sequence_blink_start_magenta,
+ &sequence_blink_stop,
+};
static void infrared_make_app_folder(Infrared* infrared) {
if(!storage_simply_mkdir(infrared->storage, INFRARED_APP_FOLDER)) {
@@ -301,6 +303,7 @@ void infrared_tx_start_signal(Infrared* infrared, InfraredSignal* signal) {
DOLPHIN_DEED(DolphinDeedIrSend);
infrared_worker_tx_start(infrared->worker);
+ infrared_play_notification_message(infrared, InfraredNotificationMessageBlinkStartSend);
}
void infrared_tx_start_button_index(Infrared* infrared, size_t button_index) {
@@ -310,14 +313,17 @@ void infrared_tx_start_button_index(Infrared* infrared, size_t button_index) {
InfraredSignal* signal = infrared_remote_button_get_signal(button);
infrared_tx_start_signal(infrared, signal);
+ infrared_play_notification_message(infrared, InfraredNotificationMessageBlinkStartSend);
}
void infrared_tx_start_received(Infrared* infrared) {
infrared_tx_start_signal(infrared, infrared->received_signal);
+ infrared_play_notification_message(infrared, InfraredNotificationMessageBlinkStartSend);
}
void infrared_tx_stop(Infrared* infrared) {
infrared_worker_tx_stop(infrared->worker);
+ infrared_play_notification_message(infrared, InfraredNotificationMessageBlinkStop);
}
void infrared_text_store_set(Infrared* infrared, uint32_t bank, const char* text, ...) {
@@ -354,12 +360,6 @@ void infrared_show_loading_popup(Infrared* infrared, bool show) {
}
}
-void infrared_signal_sent_callback(void* context) {
- furi_assert(context);
- Infrared* infrared = context;
- infrared_play_notification_message(infrared, InfraredNotificationMessageBlinkSend);
-}
-
void infrared_signal_received_callback(void* context, InfraredWorkerSignal* received_signal) {
furi_assert(context);
Infrared* infrared = context;
diff --git a/applications/infrared/infrared_i.h b/applications/infrared/infrared_i.h
index d24cab06..4e9c79d5 100644
--- a/applications/infrared/infrared_i.h
+++ b/applications/infrared/infrared_i.h
@@ -115,10 +115,11 @@ typedef enum {
InfraredNotificationMessageSuccess,
InfraredNotificationMessageGreenOn,
InfraredNotificationMessageGreenOff,
- InfraredNotificationMessageBlinkRead,
- InfraredNotificationMessageBlinkSend,
InfraredNotificationMessageYellowOn,
InfraredNotificationMessageYellowOff,
+ InfraredNotificationMessageBlinkStartRead,
+ InfraredNotificationMessageBlinkStartSend,
+ InfraredNotificationMessageBlinkStop,
} InfraredNotificationMessage;
bool infrared_add_remote_with_button(Infrared* infrared, const char* name, InfraredSignal* signal);
@@ -132,7 +133,6 @@ void infrared_text_store_clear(Infrared* infrared, uint32_t bank);
void infrared_play_notification_message(Infrared* infrared, uint32_t message);
void infrared_show_loading_popup(Infrared* infrared, bool show);
-void infrared_signal_sent_callback(void* context);
void infrared_signal_received_callback(void* context, InfraredWorkerSignal* received_signal);
void infrared_text_input_callback(void* context);
void infrared_popup_closed_callback(void* context);
diff --git a/applications/infrared/scenes/common/infrared_scene_universal_common.c b/applications/infrared/scenes/common/infrared_scene_universal_common.c
index 7eff81ee..57ac8116 100644
--- a/applications/infrared/scenes/common/infrared_scene_universal_common.c
+++ b/applications/infrared/scenes/common/infrared_scene_universal_common.c
@@ -21,12 +21,14 @@ static void infrared_scene_universal_common_show_popup(Infrared* infrared, uint3
infrared_progress_view_set_back_callback(
progress, infrared_scene_universal_common_progress_back_callback, infrared);
view_stack_add_view(view_stack, infrared_progress_view_get_view(progress));
+ infrared_play_notification_message(infrared, InfraredNotificationMessageBlinkStartSend);
}
static void infrared_scene_universal_common_hide_popup(Infrared* infrared) {
ViewStack* view_stack = infrared->view_stack;
InfraredProgressView* progress = infrared->progress;
view_stack_remove_view(view_stack, infrared_progress_view_get_view(progress));
+ infrared_play_notification_message(infrared, InfraredNotificationMessageBlinkStop);
}
void infrared_scene_universal_common_on_enter(void* context) {
@@ -42,7 +44,6 @@ bool infrared_scene_universal_common_on_event(void* context, SceneManagerEvent e
if(infrared_brute_force_is_started(brute_force)) {
if(event.type == SceneManagerEventTypeTick) {
- infrared_play_notification_message(infrared, InfraredNotificationMessageBlinkSend);
bool success = infrared_brute_force_send_next(brute_force);
if(success) {
success = infrared_progress_view_increase_progress(infrared->progress);
@@ -71,8 +72,6 @@ bool infrared_scene_universal_common_on_event(void* context, SceneManagerEvent e
brute_force, infrared_custom_event_get_value(event.event), &record_count)) {
DOLPHIN_DEED(DolphinDeedIrBruteForce);
infrared_scene_universal_common_show_popup(infrared, record_count);
- infrared_play_notification_message(
- infrared, InfraredNotificationMessageBlinkSend);
} else {
scene_manager_next_scene(scene_manager, InfraredSceneErrorDatabases);
}
diff --git a/applications/infrared/scenes/infrared_scene_debug.c b/applications/infrared/scenes/infrared_scene_debug.c
index ddb85644..dd0609b5 100644
--- a/applications/infrared/scenes/infrared_scene_debug.c
+++ b/applications/infrared/scenes/infrared_scene_debug.c
@@ -65,4 +65,5 @@ void infrared_scene_debug_on_exit(void* context) {
InfraredWorker* worker = infrared->worker;
infrared_worker_rx_stop(worker);
infrared_worker_rx_enable_blink_on_receiving(worker, false);
+ infrared_worker_rx_set_received_signal_callback(worker, NULL, NULL);
}
diff --git a/applications/infrared/scenes/infrared_scene_learn.c b/applications/infrared/scenes/infrared_scene_learn.c
index d91b8676..0edb74ca 100644
--- a/applications/infrared/scenes/infrared_scene_learn.c
+++ b/applications/infrared/scenes/infrared_scene_learn.c
@@ -8,6 +8,7 @@ void infrared_scene_learn_on_enter(void* context) {
infrared_worker_rx_set_received_signal_callback(
worker, infrared_signal_received_callback, context);
infrared_worker_rx_start(worker);
+ infrared_play_notification_message(infrared, InfraredNotificationMessageBlinkStartRead);
popup_set_icon(popup, 0, 32, &I_InfraredLearnShort_128x31);
popup_set_header(popup, NULL, 0, 0, AlignCenter, AlignCenter);
@@ -22,10 +23,7 @@ bool infrared_scene_learn_on_event(void* context, SceneManagerEvent event) {
Infrared* infrared = context;
bool consumed = false;
- if(event.type == SceneManagerEventTypeTick) {
- infrared_play_notification_message(infrared, InfraredNotificationMessageBlinkRead);
- consumed = true;
- } else if(event.type == SceneManagerEventTypeCustom) {
+ if(event.type == SceneManagerEventTypeCustom) {
if(event.event == InfraredCustomEventTypeSignalReceived) {
infrared_worker_rx_set_received_signal_callback(infrared->worker, NULL, NULL);
infrared_play_notification_message(infrared, InfraredNotificationMessageSuccess);
@@ -41,6 +39,7 @@ void infrared_scene_learn_on_exit(void* context) {
Infrared* infrared = context;
Popup* popup = infrared->popup;
infrared_worker_rx_stop(infrared->worker);
+ infrared_play_notification_message(infrared, InfraredNotificationMessageBlinkStop);
popup_set_icon(popup, 0, 0, NULL);
popup_set_text(popup, NULL, 0, 0, AlignCenter, AlignCenter);
}
diff --git a/applications/infrared/scenes/infrared_scene_learn_success.c b/applications/infrared/scenes/infrared_scene_learn_success.c
index 1297ebcf..49e2f45f 100644
--- a/applications/infrared/scenes/infrared_scene_learn_success.c
+++ b/applications/infrared/scenes/infrared_scene_learn_success.c
@@ -23,8 +23,6 @@ void infrared_scene_learn_success_on_enter(void* context) {
infrared_worker_tx_set_get_signal_callback(
infrared->worker, infrared_worker_tx_get_signal_steady_callback, context);
- infrared_worker_tx_set_signal_sent_callback(
- infrared->worker, infrared_signal_sent_callback, context);
if(infrared_signal_is_raw(signal)) {
InfraredRawSignal* raw = infrared_signal_get_raw_signal(signal);
@@ -104,6 +102,8 @@ bool infrared_scene_learn_success_on_event(void* context, SceneManagerEvent even
InfraredSceneLearnSuccess,
InfraredSceneLearnSuccessStateSending);
infrared_tx_start_received(infrared);
+ infrared_play_notification_message(
+ infrared, InfraredNotificationMessageBlinkStartSend);
}
consumed = true;
} else if(event.event == DialogExReleaseCenter) {
@@ -111,6 +111,7 @@ bool infrared_scene_learn_success_on_event(void* context, SceneManagerEvent even
scene_manager_set_scene_state(
scene_manager, InfraredSceneLearnSuccess, InfraredSceneLearnSuccessStateIdle);
infrared_tx_stop(infrared);
+ infrared_play_notification_message(infrared, InfraredNotificationMessageBlinkStop);
infrared_play_notification_message(infrared, InfraredNotificationMessageGreenOff);
}
consumed = true;
@@ -124,7 +125,7 @@ void infrared_scene_learn_success_on_exit(void* context) {
Infrared* infrared = context;
InfraredWorker* worker = infrared->worker;
dialog_ex_reset(infrared->dialog_ex);
+ infrared_play_notification_message(infrared, InfraredNotificationMessageBlinkStop);
infrared_play_notification_message(infrared, InfraredNotificationMessageGreenOff);
infrared_worker_tx_set_get_signal_callback(worker, NULL, NULL);
- infrared_worker_tx_set_signal_sent_callback(worker, NULL, NULL);
}
diff --git a/applications/infrared/scenes/infrared_scene_remote.c b/applications/infrared/scenes/infrared_scene_remote.c
index 50f71488..3cd5a9aa 100644
--- a/applications/infrared/scenes/infrared_scene_remote.c
+++ b/applications/infrared/scenes/infrared_scene_remote.c
@@ -33,8 +33,6 @@ void infrared_scene_remote_on_enter(void* context) {
infrared_worker_tx_set_get_signal_callback(
infrared->worker, infrared_worker_tx_get_signal_steady_callback, infrared);
- infrared_worker_tx_set_signal_sent_callback(
- infrared->worker, infrared_signal_sent_callback, infrared);
size_t button_count = infrared_remote_get_button_count(remote);
for(size_t i = 0; i < button_count; ++i) {
@@ -112,7 +110,7 @@ bool infrared_scene_remote_on_event(void* context, SceneManagerEvent event) {
void infrared_scene_remote_on_exit(void* context) {
Infrared* infrared = context;
+ infrared_tx_stop(infrared);
infrared_worker_tx_set_get_signal_callback(infrared->worker, NULL, NULL);
- infrared_worker_tx_set_signal_sent_callback(infrared->worker, NULL, NULL);
button_menu_reset(infrared->button_menu);
}
diff --git a/applications/infrared/scenes/infrared_scene_rpc.c b/applications/infrared/scenes/infrared_scene_rpc.c
index 1d970f6a..bc9c8652 100644
--- a/applications/infrared/scenes/infrared_scene_rpc.c
+++ b/applications/infrared/scenes/infrared_scene_rpc.c
@@ -36,8 +36,6 @@ bool infrared_scene_rpc_on_event(void* context, SceneManagerEvent event) {
result = infrared_remote_load(infrared->remote, infrared->file_path);
infrared_worker_tx_set_get_signal_callback(
infrared->worker, infrared_worker_tx_get_signal_steady_callback, infrared);
- infrared_worker_tx_set_signal_sent_callback(
- infrared->worker, infrared_signal_sent_callback, infrared);
}
const char* remote_name = infrared_remote_get_name(infrared->remote);
@@ -74,5 +72,6 @@ bool infrared_scene_rpc_on_event(void* context, SceneManagerEvent event) {
void infrared_scene_rpc_on_exit(void* context) {
Infrared* infrared = context;
+ infrared_tx_stop(infrared);
popup_reset(infrared->popup);
}
diff --git a/applications/lfrfid/scene/lfrfid_app_scene_emulate.cpp b/applications/lfrfid/scene/lfrfid_app_scene_emulate.cpp
index 183361a0..cad4f17c 100644
--- a/applications/lfrfid/scene/lfrfid_app_scene_emulate.cpp
+++ b/applications/lfrfid/scene/lfrfid_app_scene_emulate.cpp
@@ -2,18 +2,6 @@
#include <core/common_defines.h>
#include <dolphin/dolphin.h>
-static const NotificationSequence sequence_blink_start_magenta = {
- &message_blink_start_10,
- &message_blink_set_color_magenta,
- &message_do_not_reset,
- NULL,
-};
-
-static const NotificationSequence sequence_blink_stop = {
- &message_blink_stop,
- NULL,
-};
-
void LfRfidAppSceneEmulate::on_enter(LfRfidApp* app, bool /* need_restore */) {
string_init(data_string);
diff --git a/applications/lfrfid/scene/lfrfid_app_scene_rpc.cpp b/applications/lfrfid/scene/lfrfid_app_scene_rpc.cpp
index a32982af..43b23628 100644
--- a/applications/lfrfid/scene/lfrfid_app_scene_rpc.cpp
+++ b/applications/lfrfid/scene/lfrfid_app_scene_rpc.cpp
@@ -3,18 +3,6 @@
#include <dolphin/dolphin.h>
#include <rpc/rpc_app.h>
-static const NotificationSequence sequence_blink_start_magenta = {
- &message_blink_start_10,
- &message_blink_set_color_magenta,
- &message_do_not_reset,
- NULL,
-};
-
-static const NotificationSequence sequence_blink_stop = {
- &message_blink_stop,
- NULL,
-};
-
void LfRfidAppSceneRpc::on_enter(LfRfidApp* app, bool /* need_restore */) {
auto popup = app->view_controller.get<PopupVM>();
diff --git a/applications/nfc/nfc.c b/applications/nfc/nfc.c
index 93645cc1..9d32e871 100644
--- a/applications/nfc/nfc.c
+++ b/applications/nfc/nfc.c
@@ -199,18 +199,6 @@ void nfc_text_store_clear(Nfc* nfc) {
memset(nfc->text_store, 0, sizeof(nfc->text_store));
}
-static const NotificationSequence sequence_blink_start_blue = {
- &message_blink_start_10,
- &message_blink_set_color_blue,
- &message_do_not_reset,
- NULL,
-};
-
-static const NotificationSequence sequence_blink_stop = {
- &message_blink_stop,
- NULL,
-};
-
void nfc_blink_start(Nfc* nfc) {
notification_message(nfc->notifications, &sequence_blink_start_blue);
}
diff --git a/applications/notification/notification_messages.c b/applications/notification/notification_messages.c
index b469cb5f..d795c55d 100644
--- a/applications/notification/notification_messages.c
+++ b/applications/notification/notification_messages.c
@@ -431,6 +431,54 @@ const NotificationSequence sequence_blink_white_100 = {
NULL,
};
+// Hardware blink
+const NotificationSequence sequence_blink_start_blue = {
+ &message_blink_start_10,
+ &message_blink_set_color_blue,
+ &message_do_not_reset,
+ NULL,
+};
+
+const NotificationSequence sequence_blink_start_red = {
+ &message_blink_start_10,
+ &message_blink_set_color_red,
+ &message_do_not_reset,
+ NULL,
+};
+
+const NotificationSequence sequence_blink_start_green = {
+ &message_blink_start_10,
+ &message_blink_set_color_green,
+ &message_do_not_reset,
+ NULL,
+};
+
+const NotificationSequence sequence_blink_start_yellow = {
+ &message_blink_start_10,
+ &message_blink_set_color_yellow,
+ &message_do_not_reset,
+ NULL,
+};
+
+const NotificationSequence sequence_blink_start_cyan = {
+ &message_blink_start_10,
+ &message_blink_set_color_cyan,
+ &message_do_not_reset,
+ NULL,
+};
+
+const NotificationSequence sequence_blink_start_magenta = {
+ &message_blink_start_10,
+ &message_blink_set_color_magenta,
+ &message_do_not_reset,
+ NULL,
+};
+
+const NotificationSequence sequence_blink_stop = {
+ &message_blink_stop,
+ NULL,
+};
+
//General
const NotificationSequence sequence_single_vibro = {
&message_vibro_on,
diff --git a/applications/notification/notification_messages.h b/applications/notification/notification_messages.h
index 92a105f6..10079691 100644
--- a/applications/notification/notification_messages.h
+++ b/applications/notification/notification_messages.h
@@ -122,6 +122,15 @@ extern const NotificationSequence sequence_blink_cyan_100;
extern const NotificationSequence sequence_blink_magenta_100;
extern const NotificationSequence sequence_blink_white_100;
+// Hardware blink
+extern const NotificationSequence sequence_blink_start_blue;
+extern const NotificationSequence sequence_blink_start_red;
+extern const NotificationSequence sequence_blink_start_green;
+extern const NotificationSequence sequence_blink_start_yellow;
+extern const NotificationSequence sequence_blink_start_cyan;
+extern const NotificationSequence sequence_blink_start_magenta;
+extern const NotificationSequence sequence_blink_stop;
+
// General
extern const NotificationSequence sequence_single_vibro;
extern const NotificationSequence sequence_double_vibro;
diff --git a/applications/subghz/subghz.c b/applications/subghz/subghz.c
index 6edcd96d..3770d52c 100644
--- a/applications/subghz/subghz.c
+++ b/applications/subghz/subghz.c
@@ -5,18 +5,6 @@
#include "subghz_i.h"
#include <lib/toolbox/path.h>
-static const NotificationSequence sequence_blink_start_magenta = {
- &message_blink_start_10,
- &message_blink_set_color_magenta,
- &message_do_not_reset,
- NULL,
-};
-
-static const NotificationSequence sequence_blink_stop = {
- &message_blink_stop,
- NULL,
-};
-
bool subghz_custom_event_callback(void* context, uint32_t event) {
furi_assert(context);
SubGhz* subghz = context;