Skip to content

Commit 7aaa847

Browse files
committed
Merge branch 'nfcrefactoring' into dev
2 parents ac5abdb + 1837718 commit 7aaa847

File tree

999 files changed

+44955
-70668
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

999 files changed

+44955
-70668
lines changed

.drone.yml

+11-11
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ steps:
2323
- export WORKFLOW_BRANCH_OR_TAG=release-cfw
2424
- export FORCE_NO_DIRTY=yes
2525
- export FBT_GIT_SUBMODULE_SHALLOW=1
26-
- rm -rf assets/resources/apps/
26+
- rm -rf applications/main/clock_app/resources/apps/
2727
- rm -rf build/
2828
- rm -rf dist/
2929
- rm -rf .sconsign.dblite
@@ -46,8 +46,8 @@ steps:
4646
- export FBT_GIT_SUBMODULE_SHALLOW=1
4747
- wget https://github.com/xMasterX/all-the-plugins/releases/latest/download/all-the-apps-base.tgz
4848
- tar zxvf all-the-apps-base.tgz
49-
- cp -R base_pack_build/artifacts-base/* assets/resources/apps/
50-
- cp -R base_pack_build/apps_data/* assets/resources/apps_data/
49+
- cp -R base_pack_build/artifacts-base/* applications/main/clock_app/resources/apps/
50+
- cp -R base_pack_build/apps_data/* applications/main/clock_app/resources/apps_data/
5151
- rm -rf base_pack_build
5252
- rm -rf all-the-apps-base.tgz
5353
- rm -f build/f7-firmware-C/toolbox/version.*
@@ -66,7 +66,7 @@ steps:
6666
commands:
6767
- wget https://github.com/xMasterX/all-the-plugins/releases/latest/download/all-the-apps-extra.tgz
6868
- tar zxvf all-the-apps-extra.tgz
69-
- cp -R extra_pack_build/artifacts-extra/* assets/resources/apps/
69+
- cp -R extra_pack_build/artifacts-extra/* applications/main/clock_app/resources/apps/
7070
- rm -rf extra_pack_build
7171
- export DIST_SUFFIX=${DRONE_TAG}e
7272
- export WORKFLOW_BRANCH_OR_TAG=release-cfw
@@ -109,7 +109,7 @@ steps:
109109
- git checkout -- .
110110
- rm -f assets/dolphin/external/manifest.txt
111111
- cp .ci_files/anims_ofw.txt assets/dolphin/external/manifest.txt
112-
- rm -rf assets/resources/apps/
112+
- rm -rf applications/main/clock_app/resources/apps/
113113
- export DIST_SUFFIX=${DRONE_TAG}n
114114
- export WORKFLOW_BRANCH_OR_TAG=no-custom-anims
115115
- export FORCE_NO_DIRTY=yes
@@ -118,8 +118,8 @@ steps:
118118
- ./fbt COMPACT=1 DEBUG=0 updater_package
119119
- wget https://github.com/xMasterX/all-the-plugins/releases/latest/download/all-the-apps-base.tgz
120120
- tar zxvf all-the-apps-base.tgz
121-
- cp -R base_pack_build/artifacts-base/* assets/resources/apps/
122-
- cp -R base_pack_build/apps_data/* assets/resources/apps_data/
121+
- cp -R base_pack_build/artifacts-base/* applications/main/clock_app/resources/apps/
122+
- cp -R base_pack_build/apps_data/* applications/main/clock_app/resources/apps_data/
123123
- rm -rf base_pack_build
124124
- rm -rf all-the-apps-base.tgz
125125
- rm -f build/f7-firmware-C/toolbox/version.*
@@ -397,7 +397,7 @@ steps:
397397
- export WORKFLOW_BRANCH_OR_TAG=dev-cfw
398398
- export FORCE_NO_DIRTY=yes
399399
- export FBT_GIT_SUBMODULE_SHALLOW=1
400-
- rm -rf assets/resources/apps/
400+
- rm -rf applications/main/clock_app/resources/apps/
401401
- rm -rf build/
402402
- rm -rf dist/
403403
- rm -rf .sconsign.dblite
@@ -421,8 +421,8 @@ steps:
421421
- export FBT_GIT_SUBMODULE_SHALLOW=1
422422
- wget https://github.com/xMasterX/all-the-plugins/releases/latest/download/all-the-apps-base.tgz
423423
- tar zxvf all-the-apps-base.tgz
424-
- cp -R base_pack_build/artifacts-base/* assets/resources/apps/
425-
- cp -R base_pack_build/apps_data/* assets/resources/apps_data/
424+
- cp -R base_pack_build/artifacts-base/* applications/main/clock_app/resources/apps/
425+
- cp -R base_pack_build/apps_data/* applications/main/clock_app/resources/apps_data/
426426
- rm -rf base_pack_build
427427
- rm -rf all-the-apps-base.tgz
428428
- rm -f build/f7-firmware-C/toolbox/version.*
@@ -441,7 +441,7 @@ steps:
441441
commands:
442442
- wget https://github.com/xMasterX/all-the-plugins/releases/latest/download/all-the-apps-extra.tgz
443443
- tar zxvf all-the-apps-extra.tgz
444-
- cp -R extra_pack_build/artifacts-extra/* assets/resources/apps/
444+
- cp -R extra_pack_build/artifacts-extra/* applications/main/clock_app/resources/apps/
445445
- rm -rf extra_pack_build
446446
- export DIST_SUFFIX=${DRONE_BUILD_NUMBER}e
447447
- export WORKFLOW_BRANCH_OR_TAG=dev-cfw

.pvsoptions

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
--ignore-ccache -C gccarm --rules-config .pvsconfig -e lib/cmsis_core -e lib/fatfs -e lib/fnv1a-hash -e lib/FreeRTOS-Kernel -e lib/heatshrink -e lib/libusb_stm32 -e lib/littlefs -e lib/mbedtls -e lib/micro-ecc -e lib/microtar -e lib/mlib -e lib/qrcode -e lib/ST25RFAL002 -e lib/stm32wb_cmsis -e lib/stm32wb_copro -e lib/stm32wb_hal -e lib/u8g2 -e lib/nanopb -e */arm-none-eabi/*
1+
--ignore-ccache -C gccarm --rules-config .pvsconfig -e lib/cmsis_core -e lib/fatfs -e lib/fnv1a-hash -e lib/FreeRTOS-Kernel -e lib/heatshrink -e lib/libusb_stm32 -e lib/littlefs -e lib/mbedtls -e lib/micro-ecc -e lib/microtar -e lib/mlib -e lib/qrcode -e lib/stm32wb_cmsis -e lib/stm32wb_copro -e lib/stm32wb_hal -e lib/u8g2 -e lib/nanopb -e */arm-none-eabi/*

SConstruct

+21-14
Original file line numberDiff line numberDiff line change
@@ -67,22 +67,22 @@ if GetOption("fullenv") or any(
6767
# Target for self-update package
6868
dist_basic_arguments = [
6969
"--bundlever",
70-
'"${UPDATE_VERSION_STRING}"',
70+
"${UPDATE_VERSION_STRING}",
7171
]
7272
dist_radio_arguments = [
7373
"--radio",
74-
'"${ROOT_DIR.abspath}/${COPRO_STACK_BIN_DIR}/${COPRO_STACK_BIN}"',
74+
"${ROOT_DIR.abspath}/${COPRO_STACK_BIN_DIR}/${COPRO_STACK_BIN}",
7575
"--radiotype",
7676
"${COPRO_STACK_TYPE}",
7777
"${COPRO_DISCLAIMER}",
7878
"--obdata",
79-
'"${ROOT_DIR.abspath}/${COPRO_OB_DATA}"',
79+
"${ROOT_DIR.abspath}/${COPRO_OB_DATA}",
8080
"--stackversion",
8181
"${COPRO_CUBE_VERSION}",
8282
]
8383
dist_resource_arguments = [
8484
"-r",
85-
'"${ROOT_DIR.abspath}/assets/resources"',
85+
firmware_env.subst("${RESOURCES_ROOT}"),
8686
]
8787
dist_splash_arguments = (
8888
[
@@ -95,7 +95,7 @@ if GetOption("fullenv") or any(
9595

9696
selfupdate_dist = distenv.DistCommand(
9797
"updater_package",
98-
(distenv["DIST_DEPENDS"], firmware_env["FW_RESOURCES"]),
98+
(distenv["DIST_DEPENDS"], firmware_env["FW_RESOURCES_MANIFEST"]),
9999
DIST_EXTRA=[
100100
*dist_basic_arguments,
101101
*dist_radio_arguments,
@@ -128,7 +128,8 @@ if GetOption("fullenv") or any(
128128

129129
# Installation over USB & CLI
130130
usb_update_package = distenv.AddUsbFlashTarget(
131-
"#build/usbinstall.flag", (firmware_env["FW_RESOURCES"], selfupdate_dist)
131+
"#build/usbinstall.flag",
132+
(firmware_env["FW_RESOURCES_MANIFEST"], selfupdate_dist),
132133
)
133134
distenv.Alias("flash_usb_full", usb_update_package)
134135

@@ -166,17 +167,25 @@ Depends(
166167
list(app_artifact.validator for app_artifact in external_app_list),
167168
)
168169
Alias("fap_dist", fap_dist)
169-
# distenv.Default(fap_dist)
170-
171-
distenv.Depends(firmware_env["FW_RESOURCES"], external_apps_artifacts.resources_dist)
172170

173171
# Copy all faps to device
174172

175173
fap_deploy = distenv.PhonyTarget(
176174
"fap_deploy",
177-
"${PYTHON3} ${FBT_SCRIPT_DIR}/storage.py -p ${FLIP_PORT} send ${SOURCE} /ext/apps",
178-
source=Dir("#/assets/resources/apps"),
175+
[
176+
[
177+
"${PYTHON3}",
178+
"${FBT_SCRIPT_DIR}/storage.py",
179+
"-p",
180+
"${FLIP_PORT}",
181+
"send",
182+
"${SOURCE}",
183+
"/ext/apps",
184+
]
185+
],
186+
source=firmware_env.Dir(("${RESOURCES_ROOT}/apps")),
179187
)
188+
Depends(fap_deploy, firmware_env["FW_RESOURCES_MANIFEST"])
180189

181190

182191
# Target for bundling core2 package for qFlipper
@@ -314,9 +323,7 @@ distenv.PhonyTarget(
314323
)
315324

316325
# Start Flipper CLI via PySerial's miniterm
317-
distenv.PhonyTarget(
318-
"cli", "${PYTHON3} ${FBT_SCRIPT_DIR}/serial_cli.py -p ${FLIP_PORT}"
319-
)
326+
distenv.PhonyTarget("cli", "${PYTHON3} ${FBT_SCRIPT_DIR}/serial_cli.py -p ${FLIP_PORT}")
320327

321328
# Update WiFi devboard firmware
322329
distenv.PhonyTarget("devboard_flash", "${PYTHON3} ${FBT_SCRIPT_DIR}/wifi_board.py")

applications/debug/direct_draw/direct_draw.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static void direct_draw_run(DirectDraw* instance) {
7171
size_t counter = 0;
7272
float fps = 0;
7373

74-
vTaskPrioritySet(furi_thread_get_current_id(), FuriThreadPriorityIdle);
74+
furi_thread_set_current_priority(FuriThreadPriorityIdle);
7575

7676
do {
7777
size_t elapsed = DWT->CYCCNT - start;

applications/debug/rpc_debug_app/rpc_debug_app.c

+34-5
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,51 @@ static void rpc_debug_app_tick_event_callback(void* context) {
2121
scene_manager_handle_tick_event(app->scene_manager);
2222
}
2323

24-
static void rpc_debug_app_rpc_command_callback(RpcAppSystemEvent event, void* context) {
24+
static void
25+
rpc_debug_app_format_hex(const uint8_t* data, size_t data_size, char* buf, size_t buf_size) {
26+
if(data == NULL || data_size == 0) {
27+
strncpy(buf, "<Data empty>", buf_size);
28+
return;
29+
}
30+
31+
const size_t byte_width = 3;
32+
const size_t line_width = 7;
33+
34+
data_size = MIN(data_size, buf_size / (byte_width + 1));
35+
36+
for(size_t i = 0; i < data_size; ++i) {
37+
char* p = buf + (i * byte_width);
38+
char sep = !((i + 1) % line_width) ? '\n' : ' ';
39+
snprintf(p, byte_width + 1, "%02X%c", data[i], sep);
40+
}
41+
42+
buf[buf_size - 1] = '\0';
43+
}
44+
45+
static void rpc_debug_app_rpc_command_callback(const RpcAppSystemEvent* event, void* context) {
2546
furi_assert(context);
2647
RpcDebugApp* app = context;
2748
furi_assert(app->rpc);
2849

29-
if(event == RpcAppEventSessionClose) {
50+
if(event->type == RpcAppEventTypeSessionClose) {
3051
scene_manager_stop(app->scene_manager);
3152
view_dispatcher_stop(app->view_dispatcher);
3253
rpc_system_app_set_callback(app->rpc, NULL, NULL);
3354
app->rpc = NULL;
34-
} else if(event == RpcAppEventAppExit) {
55+
} else if(event->type == RpcAppEventTypeAppExit) {
3556
scene_manager_stop(app->scene_manager);
3657
view_dispatcher_stop(app->view_dispatcher);
37-
rpc_system_app_confirm(app->rpc, RpcAppEventAppExit, true);
58+
rpc_system_app_confirm(app->rpc, true);
59+
} else if(event->type == RpcAppEventTypeDataExchange) {
60+
furi_assert(event->data.type == RpcAppSystemEventDataTypeBytes);
61+
62+
rpc_debug_app_format_hex(
63+
event->data.bytes.ptr, event->data.bytes.size, app->text_store, TEXT_STORE_SIZE);
64+
65+
view_dispatcher_send_custom_event(
66+
app->view_dispatcher, RpcDebugAppCustomEventRpcDataExchange);
3867
} else {
39-
rpc_system_app_confirm(app->rpc, event, false);
68+
rpc_system_app_confirm(app->rpc, false);
4069
}
4170
}
4271

Original file line numberDiff line numberDiff line change
@@ -1,49 +1,12 @@
11
#include "../rpc_debug_app.h"
22

3-
static void rpc_debug_app_scene_start_format_hex(
4-
const uint8_t* data,
5-
size_t data_size,
6-
char* buf,
7-
size_t buf_size) {
8-
furi_assert(data);
9-
furi_assert(buf);
10-
11-
const size_t byte_width = 3;
12-
const size_t line_width = 7;
13-
14-
data_size = MIN(data_size, buf_size / (byte_width + 1));
15-
16-
for(size_t i = 0; i < data_size; ++i) {
17-
char* p = buf + (i * byte_width);
18-
char sep = !((i + 1) % line_width) ? '\n' : ' ';
19-
snprintf(p, byte_width + 1, "%02X%c", data[i], sep);
20-
}
21-
22-
buf[buf_size - 1] = '\0';
23-
}
24-
25-
static void rpc_debug_app_scene_receive_data_exchange_callback(
26-
const uint8_t* data,
27-
size_t data_size,
28-
void* context) {
29-
RpcDebugApp* app = context;
30-
if(data) {
31-
rpc_debug_app_scene_start_format_hex(data, data_size, app->text_store, TEXT_STORE_SIZE);
32-
} else {
33-
strncpy(app->text_store, "<Data empty>", TEXT_STORE_SIZE);
34-
}
35-
view_dispatcher_send_custom_event(app->view_dispatcher, RpcDebugAppCustomEventRpcDataExchange);
36-
}
37-
383
void rpc_debug_app_scene_receive_data_exchange_on_enter(void* context) {
394
RpcDebugApp* app = context;
405
strncpy(app->text_store, "Received data will appear here...", TEXT_STORE_SIZE);
416

427
text_box_set_text(app->text_box, app->text_store);
438
text_box_set_font(app->text_box, TextBoxFontHex);
449

45-
rpc_system_app_set_data_exchange_callback(
46-
app->rpc, rpc_debug_app_scene_receive_data_exchange_callback, app);
4710
view_dispatcher_switch_to_view(app->view_dispatcher, RpcDebugAppViewTextBox);
4811
}
4912

@@ -53,6 +16,7 @@ bool rpc_debug_app_scene_receive_data_exchange_on_event(void* context, SceneMana
5316

5417
if(event.type == SceneManagerEventTypeCustom) {
5518
if(event.event == RpcDebugAppCustomEventRpcDataExchange) {
19+
rpc_system_app_confirm(app->rpc, true);
5620
notification_message(app->notifications, &sequence_blink_cyan_100);
5721
notification_message(app->notifications, &sequence_display_backlight_on);
5822
text_box_set_text(app->text_box, app->text_store);
@@ -66,5 +30,4 @@ bool rpc_debug_app_scene_receive_data_exchange_on_event(void* context, SceneMana
6630
void rpc_debug_app_scene_receive_data_exchange_on_exit(void* context) {
6731
RpcDebugApp* app = context;
6832
text_box_reset(app->text_box);
69-
rpc_system_app_set_data_exchange_callback(app->rpc, NULL, NULL);
7033
}

applications/debug/unit_tests/application.fam

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ App(
55
cdefines=["APP_UNIT_TESTS"],
66
requires=["system_settings"],
77
provides=["delay_test"],
8+
resources="resources",
89
order=100,
910
)
1011

applications/debug/unit_tests/bt/bt_test.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ void bt_test_alloc() {
2828
}
2929

3030
void bt_test_free() {
31-
furi_assert(bt_test);
31+
furi_check(bt_test);
3232
free(bt_test->nvm_ram_buff_ref);
3333
free(bt_test->nvm_ram_buff_dut);
3434
bt_keys_storage_free(bt_test->bt_keys_storage);
@@ -89,7 +89,7 @@ static void bt_test_keys_remove_test_file() {
8989
}
9090

9191
MU_TEST(bt_test_keys_storage_serial_profile) {
92-
furi_assert(bt_test);
92+
furi_check(bt_test);
9393

9494
bt_test_keys_remove_test_file();
9595
bt_test_keys_storage_profile();

applications/debug/unit_tests/infrared/infrared_test.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ static void infrared_test_alloc() {
2727
}
2828

2929
static void infrared_test_free() {
30-
furi_assert(test);
30+
furi_check(test);
3131
infrared_free_decoder(test->decoder_handler);
3232
infrared_free_encoder(test->encoder_handler);
3333
flipper_format_free(test->ff);

applications/debug/unit_tests/manifest/manifest.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ MU_TEST(manifest_iteration_test) {
2222
ResourceManifestReader* manifest_reader = resource_manifest_reader_alloc(storage);
2323
do {
2424
// Open manifest file
25-
if(!resource_manifest_reader_open(manifest_reader, EXT_PATH("unit_tests/Manifest"))) {
25+
if(!resource_manifest_reader_open(manifest_reader, EXT_PATH("unit_tests/Manifest_test"))) {
2626
result = false;
2727
break;
2828
}

0 commit comments

Comments
 (0)