Skip to content

Commit 9a10372

Browse files
committed
Merge remote-tracking branch 'origin/dev' into release-candidate
2 parents 0d42b64 + d8ef099 commit 9a10372

File tree

33 files changed

+459
-164
lines changed

33 files changed

+459
-164
lines changed

applications/debug/unit_tests/tests/furi/furi_event_loop.c

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
#include <furi.h>
33
#include <furi_hal.h>
44

5+
#include <FreeRTOS.h>
6+
#include <task.h>
7+
58
#define TAG "TestFuriEventLoop"
69

710
#define EVENT_LOOP_EVENT_COUNT (256u)
@@ -53,11 +56,31 @@ bool test_furi_event_loop_producer_mq_callback(FuriMessageQueue* queue, void* co
5356
int32_t test_furi_event_loop_producer(void* p) {
5457
furi_check(p);
5558

56-
FURI_LOG_I(TAG, "producer start");
57-
5859
TestFuriData* data = p;
5960

61+
FURI_LOG_I(TAG, "producer start 1st run");
62+
63+
data->producer_event_loop = furi_event_loop_alloc();
64+
furi_event_loop_message_queue_subscribe(
65+
data->producer_event_loop,
66+
data->mq,
67+
FuriEventLoopEventOut,
68+
test_furi_event_loop_producer_mq_callback,
69+
data);
70+
71+
furi_event_loop_run(data->producer_event_loop);
72+
73+
// 2 EventLoop index, 0xFFFFFFFF - all possible flags, emulate uncleared flags
74+
xTaskNotifyIndexed(xTaskGetCurrentTaskHandle(), 2, 0xFFFFFFFF, eSetBits);
75+
76+
furi_event_loop_message_queue_unsubscribe(data->producer_event_loop, data->mq);
77+
furi_event_loop_free(data->producer_event_loop);
78+
79+
FURI_LOG_I(TAG, "producer start 2nd run");
80+
81+
data->producer_counter = 0;
6082
data->producer_event_loop = furi_event_loop_alloc();
83+
6184
furi_event_loop_message_queue_subscribe(
6285
data->producer_event_loop,
6386
data->mq,
@@ -109,10 +132,29 @@ bool test_furi_event_loop_consumer_mq_callback(FuriMessageQueue* queue, void* co
109132
int32_t test_furi_event_loop_consumer(void* p) {
110133
furi_check(p);
111134

112-
FURI_LOG_I(TAG, "consumer start");
113-
114135
TestFuriData* data = p;
115136

137+
FURI_LOG_I(TAG, "consumer start 1st run");
138+
139+
data->consumer_event_loop = furi_event_loop_alloc();
140+
furi_event_loop_message_queue_subscribe(
141+
data->consumer_event_loop,
142+
data->mq,
143+
FuriEventLoopEventIn,
144+
test_furi_event_loop_consumer_mq_callback,
145+
data);
146+
147+
furi_event_loop_run(data->consumer_event_loop);
148+
149+
// 2 EventLoop index, 0xFFFFFFFF - all possible flags, emulate uncleared flags
150+
xTaskNotifyIndexed(xTaskGetCurrentTaskHandle(), 2, 0xFFFFFFFF, eSetBits);
151+
152+
furi_event_loop_message_queue_unsubscribe(data->consumer_event_loop, data->mq);
153+
furi_event_loop_free(data->consumer_event_loop);
154+
155+
FURI_LOG_I(TAG, "consumer start 2nd run");
156+
157+
data->consumer_counter = 0;
116158
data->consumer_event_loop = furi_event_loop_alloc();
117159
furi_event_loop_message_queue_subscribe(
118160
data->consumer_event_loop,
@@ -156,6 +198,7 @@ void test_furi_event_loop(void) {
156198

157199
// The test itself
158200
mu_assert_int_eq(data.producer_counter, data.consumer_counter);
201+
mu_assert_int_eq(data.producer_counter, EVENT_LOOP_EVENT_COUNT);
159202

160203
// Release memory
161204
furi_thread_free(consumer_thread);

applications/debug/unit_tests/unit_test_api_table_i.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <nfc/protocols/iso15693_3/iso15693_3_poller_i.h>
44
#include <FreeRTOS.h>
55
#include <FreeRTOS-Kernel/include/queue.h>
6+
#include <task.h>
67

78
#include <rpc/rpc_i.h>
89
#include <flipper.pb.h>
@@ -18,6 +19,11 @@ static constexpr auto unit_tests_api_table = sort(create_array_t<sym_entry>(
1819
API_METHOD(iso15693_3_poller_get_data, const Iso15693_3Data*, (Iso15693_3Poller*)),
1920
API_METHOD(rpc_system_storage_get_error, PB_CommandStatus, (FS_Error)),
2021
API_METHOD(xQueueSemaphoreTake, BaseType_t, (QueueHandle_t, TickType_t)),
22+
API_METHOD(
23+
xTaskGenericNotify,
24+
BaseType_t,
25+
(TaskHandle_t, UBaseType_t, uint32_t, eNotifyAction, uint32_t*)),
26+
API_METHOD(xTaskGetCurrentTaskHandle, TaskHandle_t, ()),
2127
API_METHOD(vQueueDelete, void, (QueueHandle_t)),
2228
API_METHOD(
2329
xQueueGenericCreateStatic,

applications/main/archive/helpers/archive_files.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ void archive_file_append(const char* path, const char* format, ...) {
6969
storage_file_write(file, furi_string_get_cstr(string), furi_string_size(string));
7070
}
7171

72+
furi_string_free(string);
7273
storage_file_close(file);
7374
storage_file_free(file);
7475
furi_record_close(RECORD_STORAGE);

applications/main/nfc/helpers/protocol_support/mf_plus/mf_plus.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ static NfcCommand nfc_scene_read_poller_callback_mf_plus(NfcGenericEvent event,
4141
view_dispatcher_send_custom_event(instance->view_dispatcher, NfcCustomEventPollerSuccess);
4242
command = NfcCommandStop;
4343
} else if(mf_plus_event->type == MfPlusPollerEventTypeReadFailed) {
44-
view_dispatcher_send_custom_event(instance->view_dispatcher, NfcCustomEventPollerFailure);
45-
command = NfcCommandStop;
44+
command = NfcCommandReset;
4645
}
4746

4847
return command;

applications/main/nfc/helpers/protocol_support/mf_ultralight/mf_ultralight.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ static void nfc_scene_read_and_saved_menu_on_enter_mf_ultralight(NfcApp* instanc
192192
} else if(
193193
data->type == MfUltralightTypeNTAG213 || data->type == MfUltralightTypeNTAG215 ||
194194
data->type == MfUltralightTypeNTAG216 || data->type == MfUltralightTypeUL11 ||
195-
data->type == MfUltralightTypeUL21) {
195+
data->type == MfUltralightTypeUL21 || data->type == MfUltralightTypeOrigin) {
196196
submenu_add_item(
197197
submenu,
198198
"Write",

applications/main/nfc/nfc_app.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -464,13 +464,10 @@ static bool nfc_is_hal_ready(void) {
464464
// No connection to the chip, show an error screen
465465
DialogsApp* dialogs = furi_record_open(RECORD_DIALOGS);
466466
DialogMessage* message = dialog_message_alloc();
467+
dialog_message_set_header(message, "Error: NFC Chip Failed", 64, 0, AlignCenter, AlignTop);
467468
dialog_message_set_text(
468-
message,
469-
"Error!\nNFC chip failed to start\n\n\nSend a photo of this to:\[email protected]",
470-
0,
471-
0,
472-
AlignLeft,
473-
AlignTop);
469+
message, "Send error photo via\nsupport.flipper.net", 0, 63, AlignLeft, AlignBottom);
470+
dialog_message_set_icon(message, &I_err_09, 128 - 25, 64 - 25);
474471
dialog_message_show(dialogs, message);
475472
dialog_message_free(message);
476473
furi_record_close(RECORD_DIALOGS);

applications/main/subghz/scenes/subghz_scene_delete_raw.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,7 @@ bool subghz_scene_delete_raw_on_event(void* context, SceneManagerEvent event) {
5858
if(event.event == SubGhzCustomEventSceneDeleteRAW) {
5959
furi_string_set(subghz->file_path_tmp, subghz->file_path);
6060
if(subghz_delete_file(subghz)) {
61-
if(subghz_rx_key_state_get(subghz) != SubGhzRxKeyStateRAWLoad) {
62-
subghz_rx_key_state_set(subghz, SubGhzRxKeyStateIDLE);
63-
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneDeleteSuccess);
64-
} else {
65-
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneSaved);
66-
}
67-
61+
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneDeleteSuccess);
6862
} else {
6963
scene_manager_search_and_switch_to_previous_scene(
7064
subghz->scene_manager, SubGhzSceneStart);

applications/main/subghz/scenes/subghz_scene_delete_success.c

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,24 @@ bool subghz_scene_delete_success_on_event(void* context, SceneManagerEvent event
2626

2727
if(event.type == SceneManagerEventTypeCustom) {
2828
if(event.event == SubGhzCustomEventSceneDeleteSuccess) {
29-
if(scene_manager_search_and_switch_to_previous_scene(
30-
subghz->scene_manager, SubGhzSceneReadRAW)) {
31-
} else if(scene_manager_search_and_switch_to_previous_scene(
32-
subghz->scene_manager, SubGhzSceneSaved)) {
29+
if(subghz_rx_key_state_get(subghz) == SubGhzRxKeyStateRAWLoad) {
30+
if(scene_manager_search_and_switch_to_previous_scene(
31+
subghz->scene_manager, SubGhzSceneSaved)) {
32+
} else {
33+
scene_manager_search_and_switch_to_previous_scene(
34+
subghz->scene_manager, SubGhzSceneStart);
35+
}
3336
} else {
34-
scene_manager_search_and_switch_to_previous_scene(
35-
subghz->scene_manager, SubGhzSceneStart);
37+
subghz_rx_key_state_set(subghz, SubGhzRxKeyStateIDLE);
38+
39+
if(scene_manager_search_and_switch_to_previous_scene(
40+
subghz->scene_manager, SubGhzSceneReadRAW)) {
41+
} else {
42+
scene_manager_search_and_switch_to_previous_scene(
43+
subghz->scene_manager, SubGhzSceneStart);
44+
}
3645
}
46+
3747
return true;
3848
}
3949
}

applications/main/subghz/scenes/subghz_scene_saved.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ void subghz_scene_saved_on_enter(void* context) {
88
subghz_rx_key_state_set(subghz, SubGhzRxKeyStateRAWLoad);
99
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneReadRAW);
1010
} else {
11+
subghz_rx_key_state_set(subghz, SubGhzRxKeyStateRAWLoad);
1112
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneSavedMenu);
1213
}
1314
} else {

0 commit comments

Comments
 (0)