Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/release-candidate' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
skotopes committed Oct 2, 2022
2 parents 3481252 + e403493 commit 5c52bb7
Show file tree
Hide file tree
Showing 94 changed files with 3,060 additions and 1,041 deletions.
3 changes: 2 additions & 1 deletion .vscode/example/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@
"servertype": "openocd",
"device": "stlink",
"svdFile": "./debug/STM32WB55_CM4.svd",
// If you're debugging early in the boot process, before OS scheduler is running,
// you have to comment out the following line.
"rtos": "FreeRTOS",
"configFiles": [
"interface/stlink.cfg",
"./debug/stm32wbx.cfg",
],
"postAttachCommands": [
// "attach 1",
// "compare-sections",
"source debug/flipperapps.py",
// "source debug/FreeRTOS/FreeRTOS.py",
Expand Down
8 changes: 4 additions & 4 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Check out details on [how to build firmware](documentation/fbt.md), [write appli

Flipper Zero's firmware consists of two components:

- Core2 firmware set - proprietary components by ST: FUS + radio stack. FUS is flashed at factory and you should never update it.
- Core2 firmware set - proprietary components by ST: FUS + radio stack. FUS is flashed at factory, and you should never update it.
- Core1 Firmware - HAL + OS + Drivers + Applications.

They both must be flashed in the order described.
Expand Down Expand Up @@ -52,7 +52,7 @@ Prerequisites:
- [arm-gcc-none-eabi](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads)
- openocd

One liner: `./fbt firmware_flash`
One-liner: `./fbt firmware_flash`

## With USB DFU

Expand Down Expand Up @@ -128,7 +128,7 @@ Connect your device via ST-Link and run:
- `debug` - Debug tool: GDB-plugins, SVD-file and etc
- `documentation` - Documentation generation system configs and input files
- `firmware` - Firmware source code
- `lib` - Our and 3rd party libraries, drivers and etc...
- `lib` - Our and 3rd party libraries, drivers, etc.
- `scripts` - Supplementary scripts and python libraries home

Also pay attention to `ReadMe.md` files inside of those directories.
Also pay attention to `ReadMe.md` files inside those directories.
4 changes: 2 additions & 2 deletions applications/debug/unit_tests/storage/storage_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ MU_TEST(storage_file_open_lock) {
storage_file_close(file);

// file_locker thread stop
mu_check(furi_thread_join(locker_thread) == FuriStatusOk);
mu_check(furi_thread_join(locker_thread));
furi_thread_free(locker_thread);

// clean data
Expand Down Expand Up @@ -148,7 +148,7 @@ MU_TEST(storage_dir_open_lock) {
storage_dir_close(file);

// file_locker thread stop
mu_check(furi_thread_join(locker_thread) == FuriStatusOk);
mu_check(furi_thread_join(locker_thread));
furi_thread_free(locker_thread);

// clean data
Expand Down
23 changes: 13 additions & 10 deletions applications/main/fap_loader/fap_loader_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ typedef struct {
DialogsApp* dialogs;
Gui* gui;
string_t fap_path;

ViewDispatcher* view_dispatcher;
Loading* loading;
} FapLoader;

static bool
Expand All @@ -25,7 +28,7 @@ static bool
FlipperApplication* app = flipper_application_alloc(loader->storage, &hashtable_api_interface);

FlipperApplicationPreloadStatus preload_res =
flipper_application_preload(app, string_get_cstr(path));
flipper_application_preload_manifest(app, string_get_cstr(path));

bool load_success = false;

Expand Down Expand Up @@ -144,12 +147,12 @@ int32_t fap_loader_app(void* p) {
loader->dialogs = furi_record_open(RECORD_DIALOGS);
loader->gui = furi_record_open(RECORD_GUI);

ViewDispatcher* view_dispatcher = view_dispatcher_alloc();
Loading* loading = loading_alloc();
loader->view_dispatcher = view_dispatcher_alloc();
loader->loading = loading_alloc();

view_dispatcher_enable_queue(view_dispatcher);
view_dispatcher_attach_to_gui(view_dispatcher, loader->gui, ViewDispatcherTypeFullscreen);
view_dispatcher_add_view(view_dispatcher, 0, loading_get_view(loading));
view_dispatcher_attach_to_gui(
loader->view_dispatcher, loader->gui, ViewDispatcherTypeFullscreen);
view_dispatcher_add_view(loader->view_dispatcher, 0, loading_get_view(loader->loading));

if(p) {
string_init_set(loader->fap_path, (const char*)p);
Expand All @@ -158,14 +161,14 @@ int32_t fap_loader_app(void* p) {
string_init_set(loader->fap_path, EXT_PATH("apps"));

while(fap_loader_select_app(loader)) {
view_dispatcher_switch_to_view(view_dispatcher, 0);
view_dispatcher_switch_to_view(loader->view_dispatcher, 0);
fap_loader_run_selected_app(loader);
};
}

view_dispatcher_remove_view(view_dispatcher, 0);
loading_free(loading);
view_dispatcher_free(view_dispatcher);
view_dispatcher_remove_view(loader->view_dispatcher, 0);
loading_free(loader->loading);
view_dispatcher_free(loader->view_dispatcher);

string_clear(loader->fap_path);
furi_record_close(RECORD_GUI);
Expand Down
10 changes: 5 additions & 5 deletions applications/main/ibutton/scenes/ibutton_scene_delete_confirm.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void ibutton_scene_delete_confirm_on_enter(void* context) {

ibutton_text_store_set(ibutton, "\e#Delete %s?\e#", string_get_cstr(key_name));
widget_add_text_box_element(
widget, 0, 0, 128, 27, AlignCenter, AlignCenter, ibutton->text_store, false);
widget, 0, 0, 128, 27, AlignCenter, AlignCenter, ibutton->text_store, true);
widget_add_button_element(
widget, GuiButtonTypeLeft, "Cancel", ibutton_scene_delete_confirm_widget_callback, ibutton);
widget_add_button_element(
Expand All @@ -47,24 +47,24 @@ void ibutton_scene_delete_confirm_on_enter(void* context) {
key_data[6],
key_data[7]);
widget_add_string_element(
widget, 64, 45, AlignCenter, AlignBottom, FontSecondary, "Dallas");
widget, 64, 34, AlignCenter, AlignBottom, FontSecondary, "Dallas");
break;

case iButtonKeyCyfral:
ibutton_text_store_set(ibutton, "%02X %02X", key_data[0], key_data[1]);
widget_add_string_element(
widget, 64, 45, AlignCenter, AlignBottom, FontSecondary, "Cyfral");
widget, 64, 34, AlignCenter, AlignBottom, FontSecondary, "Cyfral");
break;

case iButtonKeyMetakom:
ibutton_text_store_set(
ibutton, "%02X %02X %02X %02X", key_data[0], key_data[1], key_data[2], key_data[3]);
widget_add_string_element(
widget, 64, 45, AlignCenter, AlignBottom, FontSecondary, "Metakom");
widget, 64, 34, AlignCenter, AlignBottom, FontSecondary, "Metakom");
break;
}
widget_add_string_element(
widget, 64, 33, AlignCenter, AlignBottom, FontSecondary, ibutton->text_store);
widget, 64, 46, AlignCenter, AlignBottom, FontSecondary, ibutton->text_store);

view_dispatcher_switch_to_view(ibutton->view_dispatcher, iButtonViewWidget);

Expand Down
45 changes: 12 additions & 33 deletions applications/main/ibutton/scenes/ibutton_scene_emulate.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ static void ibutton_scene_emulate_callback(void* context, bool emulated) {

void ibutton_scene_emulate_on_enter(void* context) {
iButton* ibutton = context;
Popup* popup = ibutton->popup;
Widget* widget = ibutton->widget;
iButtonKey* key = ibutton->key;

const uint8_t* key_data = ibutton_key_get_data_p(key);
Expand All @@ -26,20 +26,18 @@ void ibutton_scene_emulate_on_enter(void* context) {
path_extract_filename(ibutton->file_path, key_name, true);
}

uint8_t line_count = 2;
DOLPHIN_DEED(DolphinDeedIbuttonEmulate);

// check that stored key has name
if(!string_empty_p(key_name)) {
ibutton_text_store_set(ibutton, "emulating\n%s", string_get_cstr(key_name));
line_count = 2;
ibutton_text_store_set(ibutton, "%s", string_get_cstr(key_name));
} else {
// if not, show key data
switch(ibutton_key_get_type(key)) {
case iButtonKeyDS1990:
ibutton_text_store_set(
ibutton,
"emulating\n%02X %02X %02X %02X\n%02X %02X %02X %02X",
"%02X %02X %02X %02X\n%02X %02X %02X %02X",
key_data[0],
key_data[1],
key_data[2],
Expand All @@ -48,40 +46,24 @@ void ibutton_scene_emulate_on_enter(void* context) {
key_data[5],
key_data[6],
key_data[7]);
line_count = 3;
break;
case iButtonKeyCyfral:
ibutton_text_store_set(ibutton, "emulating\n%02X %02X", key_data[0], key_data[1]);
line_count = 2;
ibutton_text_store_set(ibutton, "%02X %02X", key_data[0], key_data[1]);
break;
case iButtonKeyMetakom:
ibutton_text_store_set(
ibutton,
"emulating\n%02X %02X %02X %02X",
key_data[0],
key_data[1],
key_data[2],
key_data[3]);
line_count = 2;
ibutton, "%02X %02X %02X %02X", key_data[0], key_data[1], key_data[2], key_data[3]);
break;
}
}

switch(line_count) {
case 3:
popup_set_header(popup, "iButton", 82, 18, AlignCenter, AlignBottom);
popup_set_text(popup, ibutton->text_store, 82, 22, AlignCenter, AlignTop);
break;

default:
popup_set_header(popup, "iButton", 82, 24, AlignCenter, AlignBottom);
popup_set_text(popup, ibutton->text_store, 82, 28, AlignCenter, AlignTop);
break;
}

popup_set_icon(popup, 2, 10, &I_iButtonKey_49x44);
widget_add_string_multiline_element(
widget, 90, 10, AlignCenter, AlignTop, FontPrimary, "iButton\nemulating");
widget_add_icon_element(widget, 3, 10, &I_iButtonKey_49x44);
widget_add_text_box_element(
widget, 54, 39, 75, 22, AlignCenter, AlignCenter, ibutton->text_store, true);

view_dispatcher_switch_to_view(ibutton->view_dispatcher, iButtonViewPopup);
view_dispatcher_switch_to_view(ibutton->view_dispatcher, iButtonViewWidget);

ibutton_worker_emulate_set_callback(
ibutton->key_worker, ibutton_scene_emulate_callback, ibutton);
Expand Down Expand Up @@ -122,10 +104,7 @@ bool ibutton_scene_emulate_on_event(void* context, SceneManagerEvent event) {

void ibutton_scene_emulate_on_exit(void* context) {
iButton* ibutton = context;
Popup* popup = ibutton->popup;
ibutton_worker_stop(ibutton->key_worker);
popup_set_header(popup, NULL, 0, 0, AlignCenter, AlignBottom);
popup_set_text(popup, NULL, 0, 0, AlignCenter, AlignTop);
popup_set_icon(popup, 0, 0, NULL);
widget_reset(ibutton->widget);
ibutton_notification_message(ibutton, iButtonNotificationMessageBlinkStop);
}
12 changes: 5 additions & 7 deletions applications/main/ibutton/scenes/ibutton_scene_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ void ibutton_scene_info_on_enter(void* context) {

ibutton_text_store_set(ibutton, "%s", string_get_cstr(key_name));
widget_add_text_box_element(
widget, 0, 0, 128, 28, AlignCenter, AlignCenter, ibutton->text_store, false);
widget, 0, 0, 128, 23, AlignCenter, AlignCenter, ibutton->text_store, true);

switch(ibutton_key_get_type(key)) {
case iButtonKeyDS1990:
Expand All @@ -29,26 +29,24 @@ void ibutton_scene_info_on_enter(void* context) {
key_data[5],
key_data[6],
key_data[7]);
widget_add_string_element(
widget, 64, 51, AlignCenter, AlignBottom, FontSecondary, "Dallas");
widget_add_string_element(widget, 64, 36, AlignCenter, AlignBottom, FontPrimary, "Dallas");
break;

case iButtonKeyMetakom:
ibutton_text_store_set(
ibutton, "%02X %02X %02X %02X", key_data[0], key_data[1], key_data[2], key_data[3]);
widget_add_string_element(
widget, 64, 51, AlignCenter, AlignBottom, FontSecondary, "Metakom");
widget, 64, 36, AlignCenter, AlignBottom, FontPrimary, "Metakom");
break;

case iButtonKeyCyfral:
ibutton_text_store_set(ibutton, "%02X %02X", key_data[0], key_data[1]);
widget_add_string_element(
widget, 64, 51, AlignCenter, AlignBottom, FontSecondary, "Cyfral");
widget_add_string_element(widget, 64, 36, AlignCenter, AlignBottom, FontPrimary, "Cyfral");
break;
}

widget_add_string_element(
widget, 64, 35, AlignCenter, AlignBottom, FontPrimary, ibutton->text_store);
widget, 64, 50, AlignCenter, AlignBottom, FontSecondary, ibutton->text_store);

view_dispatcher_switch_to_view(ibutton->view_dispatcher, iButtonViewWidget);

Expand Down
6 changes: 2 additions & 4 deletions applications/main/ibutton/scenes/ibutton_scene_save_success.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@ bool ibutton_scene_save_success_on_event(void* context, SceneManagerEvent event)
if(event.type == SceneManagerEventTypeCustom) {
consumed = true;
if(event.event == iButtonCustomEventBack) {
const uint32_t possible_scenes[] = {
iButtonSceneReadKeyMenu, iButtonSceneSavedKeyMenu, iButtonSceneAddType};
scene_manager_search_and_switch_to_previous_scene_one_of(
ibutton->scene_manager, possible_scenes, COUNT_OF(possible_scenes));
scene_manager_search_and_switch_to_another_scene(
ibutton->scene_manager, iButtonSceneSelectKey);
}
}

Expand Down
46 changes: 12 additions & 34 deletions applications/main/ibutton/scenes/ibutton_scene_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ static void ibutton_scene_write_callback(void* context, iButtonWorkerWriteResult

void ibutton_scene_write_on_enter(void* context) {
iButton* ibutton = context;
Popup* popup = ibutton->popup;
iButtonKey* key = ibutton->key;
Widget* widget = ibutton->widget;
iButtonWorker* worker = ibutton->key_worker;

const uint8_t* key_data = ibutton_key_get_data_p(key);
Expand All @@ -26,19 +26,16 @@ void ibutton_scene_write_on_enter(void* context) {
path_extract_filename(ibutton->file_path, key_name, true);
}

uint8_t line_count = 2;

// check that stored key has name
if(!string_empty_p(key_name)) {
ibutton_text_store_set(ibutton, "writing\n%s", string_get_cstr(key_name));
line_count = 2;
ibutton_text_store_set(ibutton, "%s", string_get_cstr(key_name));
} else {
// if not, show key data
switch(ibutton_key_get_type(key)) {
case iButtonKeyDS1990:
ibutton_text_store_set(
ibutton,
"writing\n%02X %02X %02X %02X\n%02X %02X %02X %02X",
"%02X %02X %02X %02X\n%02X %02X %02X %02X",
key_data[0],
key_data[1],
key_data[2],
Expand All @@ -47,40 +44,24 @@ void ibutton_scene_write_on_enter(void* context) {
key_data[5],
key_data[6],
key_data[7]);
line_count = 3;
break;
case iButtonKeyCyfral:
ibutton_text_store_set(ibutton, "writing\n%02X %02X", key_data[0], key_data[1]);
line_count = 2;
ibutton_text_store_set(ibutton, "%02X %02X", key_data[0], key_data[1]);
break;
case iButtonKeyMetakom:
ibutton_text_store_set(
ibutton,
"writing\n%02X %02X %02X %02X",
key_data[0],
key_data[1],
key_data[2],
key_data[3]);
line_count = 2;
ibutton, "%02X %02X %02X %02X", key_data[0], key_data[1], key_data[2], key_data[3]);
break;
}
}

switch(line_count) {
case 3:
popup_set_header(popup, "iButton", 82, 18, AlignCenter, AlignBottom);
popup_set_text(popup, ibutton->text_store, 82, 22, AlignCenter, AlignTop);
break;

default:
popup_set_header(popup, "iButton", 82, 24, AlignCenter, AlignBottom);
popup_set_text(popup, ibutton->text_store, 82, 28, AlignCenter, AlignTop);
break;
}

popup_set_icon(popup, 2, 10, &I_iButtonKey_49x44);
widget_add_string_multiline_element(
widget, 90, 10, AlignCenter, AlignTop, FontPrimary, "iButton\nwriting");
widget_add_icon_element(widget, 3, 10, &I_iButtonKey_49x44);
widget_add_text_box_element(
widget, 54, 39, 75, 22, AlignCenter, AlignCenter, ibutton->text_store, true);

view_dispatcher_switch_to_view(ibutton->view_dispatcher, iButtonViewPopup);
view_dispatcher_switch_to_view(ibutton->view_dispatcher, iButtonViewWidget);

ibutton_worker_write_set_callback(worker, ibutton_scene_write_callback, ibutton);
ibutton_worker_write_start(worker, key);
Expand Down Expand Up @@ -114,11 +95,8 @@ bool ibutton_scene_write_on_event(void* context, SceneManagerEvent event) {

void ibutton_scene_write_on_exit(void* context) {
iButton* ibutton = context;
Popup* popup = ibutton->popup;
ibutton_worker_stop(ibutton->key_worker);
popup_set_header(popup, NULL, 0, 0, AlignCenter, AlignBottom);
popup_set_text(popup, NULL, 0, 0, AlignCenter, AlignTop);
popup_set_icon(popup, 0, 0, NULL);
widget_reset(ibutton->widget);

ibutton_notification_message(ibutton, iButtonNotificationMessageBlinkStop);
}
Loading

0 comments on commit 5c52bb7

Please sign in to comment.