diff --git a/.vscode/example/settings.json b/.vscode/example/settings.json index 00da3af2f8..a591949013 100644 --- a/.vscode/example/settings.json +++ b/.vscode/example/settings.json @@ -14,7 +14,7 @@ "*.scons": "python", "SConscript": "python", "SConstruct": "python", - "*.fam": "python", + "*.fam": "python" }, "clangd.arguments": [ // We might be able to tighten this a bit more to only include the correct toolchain. diff --git a/SConstruct b/SConstruct index a57714a3ce..532c37b7f5 100644 --- a/SConstruct +++ b/SConstruct @@ -230,6 +230,7 @@ firmware_debug = distenv.PhonyTarget( source=firmware_env["FW_ELF"], GDBOPTS="${GDBOPTS_BASE}", GDBREMOTE="${OPENOCD_GDB_PIPE}", + FBT_FAP_DEBUG_ELF_ROOT=firmware_env["FBT_FAP_DEBUG_ELF_ROOT"], ) distenv.Depends(firmware_debug, firmware_flash) @@ -239,6 +240,7 @@ distenv.PhonyTarget( source=firmware_env["FW_ELF"], GDBOPTS="${GDBOPTS_BASE} ${GDBOPTS_BLACKMAGIC}", GDBREMOTE="${BLACKMAGIC_ADDR}", + FBT_FAP_DEBUG_ELF_ROOT=firmware_env["FBT_FAP_DEBUG_ELF_ROOT"], ) # Debug alien elf diff --git a/applications/debug/unit_tests/furi/furi_test.c b/applications/debug/unit_tests/furi/furi_test.c index 2f271c305c..e287f9927f 100644 --- a/applications/debug/unit_tests/furi/furi_test.c +++ b/applications/debug/unit_tests/furi/furi_test.c @@ -4,11 +4,11 @@ #include "../minunit.h" // v2 tests -void test_furi_create_open(); -void test_furi_concurrent_access(); -void test_furi_pubsub(); +void test_furi_create_open(void); +void test_furi_concurrent_access(void); +void test_furi_pubsub(void); -void test_furi_memmgr(); +void test_furi_memmgr(void); static int foo = 0; diff --git a/applications/debug/unit_tests/test_index.c b/applications/debug/unit_tests/test_index.c index eb475fada4..5d0282bd77 100644 --- a/applications/debug/unit_tests/test_index.c +++ b/applications/debug/unit_tests/test_index.c @@ -8,31 +8,31 @@ #define TAG "UnitTests" -int run_minunit_test_furi(); -int run_minunit_test_furi_hal(); -int run_minunit_test_furi_hal_crypto(); -int run_minunit_test_furi_string(); -int run_minunit_test_infrared(); -int run_minunit_test_rpc(); -int run_minunit_test_manifest(); -int run_minunit_test_flipper_format(); -int run_minunit_test_flipper_format_string(); -int run_minunit_test_stream(); -int run_minunit_test_storage(); -int run_minunit_test_subghz(); -int run_minunit_test_dirwalk(); -int run_minunit_test_power(); -int run_minunit_test_protocol_dict(); -int run_minunit_test_lfrfid_protocols(); -int run_minunit_test_nfc(); -int run_minunit_test_bit_lib(); -int run_minunit_test_datetime(); -int run_minunit_test_float_tools(); -int run_minunit_test_bt(); -int run_minunit_test_dialogs_file_browser_options(); -int run_minunit_test_expansion(); - -typedef int (*UnitTestEntry)(); +int run_minunit_test_furi(void); +int run_minunit_test_furi_hal(void); +int run_minunit_test_furi_hal_crypto(void); +int run_minunit_test_furi_string(void); +int run_minunit_test_infrared(void); +int run_minunit_test_rpc(void); +int run_minunit_test_manifest(void); +int run_minunit_test_flipper_format(void); +int run_minunit_test_flipper_format_string(void); +int run_minunit_test_stream(void); +int run_minunit_test_storage(void); +int run_minunit_test_subghz(void); +int run_minunit_test_dirwalk(void); +int run_minunit_test_power(void); +int run_minunit_test_protocol_dict(void); +int run_minunit_test_lfrfid_protocols(void); +int run_minunit_test_nfc(void); +int run_minunit_test_bit_lib(void); +int run_minunit_test_datetime(void); +int run_minunit_test_float_tools(void); +int run_minunit_test_bt(void); +int run_minunit_test_dialogs_file_browser_options(void); +int run_minunit_test_expansion(void); + +typedef int (*UnitTestEntry)(void); typedef struct { const char* name; diff --git a/applications/main/bad_usb/scenes/bad_usb_scene_config_layout.c b/applications/main/bad_usb/scenes/bad_usb_scene_config_layout.c index 2dbacbe12f..a5d0df94c3 100644 --- a/applications/main/bad_usb/scenes/bad_usb_scene_config_layout.c +++ b/applications/main/bad_usb/scenes/bad_usb_scene_config_layout.c @@ -31,7 +31,6 @@ void bad_usb_scene_config_layout_on_enter(void* context) { BadUsbApp* bad_usb = context; if(bad_usb_layout_select(bad_usb)) { - bad_usb_script_set_keyboard_layout(bad_usb->bad_usb_script, bad_usb->keyboard_layout); scene_manager_search_and_switch_to_previous_scene(bad_usb->scene_manager, BadUsbSceneWork); } else { scene_manager_previous_scene(bad_usb->scene_manager); diff --git a/applications/main/infrared/infrared_app.c b/applications/main/infrared/infrared_app.c index 5a83dfbd75..93311716a1 100644 --- a/applications/main/infrared/infrared_app.c +++ b/applications/main/infrared/infrared_app.c @@ -13,11 +13,12 @@ #define INFRARED_TASK_STACK_SIZE (2048UL) #define INFRARED_SETTINGS_PATH INT_PATH(".infrared.settings") -#define INFRARED_SETTINGS_VERSION (0) +#define INFRARED_SETTINGS_VERSION (1) #define INFRARED_SETTINGS_MAGIC (0x1F) typedef struct { - uint8_t tx_pin; + FuriHalInfraredTxPin tx_pin; + bool otg_enabled; } InfraredSettings; static const NotificationSequence* @@ -488,11 +489,15 @@ static void infrared_load_settings(InfraredApp* infrared) { } infrared_set_tx_pin(infrared, settings.tx_pin); + if(settings.tx_pin < FuriHalInfraredTxPinMax) { + infrared_enable_otg(infrared, settings.otg_enabled); + } } void infrared_save_settings(InfraredApp* infrared) { InfraredSettings settings = { .tx_pin = infrared->app_state.tx_pin, + .otg_enabled = infrared->app_state.is_otg_enabled, }; if(!saved_struct_save( diff --git a/applications/main/lfrfid/lfrfid_i.h b/applications/main/lfrfid/lfrfid_i.h index d94a5f865a..7062315450 100644 --- a/applications/main/lfrfid/lfrfid_i.h +++ b/applications/main/lfrfid/lfrfid_i.h @@ -122,6 +122,13 @@ typedef enum { LfRfidViewRead, } LfRfidView; +typedef enum { + LfRfidMenuIndexRead, + LfRfidMenuIndexSaved, + LfRfidMenuIndexAddManually, + LfRfidMenuIndexExtraActions, +} LfRfidMenuIndex; + bool lfrfid_save_key(LfRfid* app); bool lfrfid_load_key_from_file_select(LfRfid* app); diff --git a/applications/main/lfrfid/scenes/lfrfid_scene_delete_confirm.c b/applications/main/lfrfid/scenes/lfrfid_scene_delete_confirm.c index b7702e2691..17d024d361 100644 --- a/applications/main/lfrfid/scenes/lfrfid_scene_delete_confirm.c +++ b/applications/main/lfrfid/scenes/lfrfid_scene_delete_confirm.c @@ -1,45 +1,50 @@ #include "../lfrfid_i.h" +#define LFRFID_SCENE_DELETE_MAX_HEX_WIDTH (7UL) + void lfrfid_scene_delete_confirm_on_enter(void* context) { LfRfid* app = context; Widget* widget = app->widget; - FuriString* tmp_string; - tmp_string = furi_string_alloc(); + FuriString* display_text = furi_string_alloc_printf( + "\e#Delete %s?\e#\n" + "Hex: ", + furi_string_get_cstr(app->file_name)); - widget_add_button_element(widget, GuiButtonTypeLeft, "Back", lfrfid_widget_callback, app); - widget_add_button_element(widget, GuiButtonTypeRight, "Delete", lfrfid_widget_callback, app); + const size_t data_size = protocol_dict_get_data_size(app->dict, app->protocol_id); + uint8_t* data = malloc(data_size); + + protocol_dict_get_data(app->dict, app->protocol_id, data, data_size); - furi_string_printf(tmp_string, "Delete %s?", furi_string_get_cstr(app->file_name)); - widget_add_string_element( - widget, 64, 0, AlignCenter, AlignTop, FontPrimary, furi_string_get_cstr(tmp_string)); - - furi_string_reset(tmp_string); - size_t size = protocol_dict_get_data_size(app->dict, app->protocol_id); - uint8_t* data = (uint8_t*)malloc(size); - protocol_dict_get_data(app->dict, app->protocol_id, data, size); - for(uint8_t i = 0; i < MIN(size, (size_t)8); i++) { - if(i != 0) { - furi_string_cat_printf(tmp_string, " "); + for(size_t i = 0; i < data_size; i++) { + if(i == LFRFID_SCENE_DELETE_MAX_HEX_WIDTH) { + furi_string_cat(display_text, " ..."); + break; } - furi_string_cat_printf(tmp_string, "%02X", data[i]); + furi_string_cat_printf(display_text, "%s%02X", i != 0 ? " " : "", data[i]); } + + furi_string_push_back(display_text, '\n'); + free(data); - widget_add_string_element( - widget, 64, 19, AlignCenter, AlignTop, FontSecondary, furi_string_get_cstr(tmp_string)); - widget_add_string_element( - widget, - 64, - 49, - AlignCenter, - AlignBottom, - FontSecondary, - protocol_dict_get_name(app->dict, app->protocol_id)); + const char* protocol = protocol_dict_get_name(app->dict, app->protocol_id); + const char* manufacturer = protocol_dict_get_manufacturer(app->dict, app->protocol_id); + + if(strcasecmp(protocol, manufacturer) != 0 && strcasecmp(manufacturer, "N/A") != 0) { + furi_string_cat_printf(display_text, "%s ", manufacturer); + } + + furi_string_cat(display_text, protocol); + + widget_add_text_box_element( + widget, 0, 0, 128, 64, AlignCenter, AlignTop, furi_string_get_cstr(display_text), true); + widget_add_button_element(widget, GuiButtonTypeLeft, "Cancel", lfrfid_widget_callback, app); + widget_add_button_element(widget, GuiButtonTypeRight, "Delete", lfrfid_widget_callback, app); view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewWidget); - furi_string_free(tmp_string); + furi_string_free(display_text); } bool lfrfid_scene_delete_confirm_on_event(void* context, SceneManagerEvent event) { diff --git a/applications/main/lfrfid/scenes/lfrfid_scene_delete_success.c b/applications/main/lfrfid/scenes/lfrfid_scene_delete_success.c index abb173a73d..9c9b39d3d0 100644 --- a/applications/main/lfrfid/scenes/lfrfid_scene_delete_success.c +++ b/applications/main/lfrfid/scenes/lfrfid_scene_delete_success.c @@ -18,10 +18,9 @@ bool lfrfid_scene_delete_success_on_event(void* context, SceneManagerEvent event LfRfid* app = context; bool consumed = false; - if((event.type == SceneManagerEventTypeBack) || - ((event.type == SceneManagerEventTypeCustom) && (event.event == LfRfidEventPopupClosed))) { - scene_manager_search_and_switch_to_previous_scene( - app->scene_manager, LfRfidSceneSelectKey); + if(event.type == SceneManagerEventTypeBack || event.type == SceneManagerEventTypeCustom) { + // Always return to SceneSelectKey from here + scene_manager_search_and_switch_to_another_scene(app->scene_manager, LfRfidSceneSelectKey); consumed = true; } diff --git a/applications/main/lfrfid/scenes/lfrfid_scene_emulate.c b/applications/main/lfrfid/scenes/lfrfid_scene_emulate.c index dc39189942..049c24d002 100644 --- a/applications/main/lfrfid/scenes/lfrfid_scene_emulate.c +++ b/applications/main/lfrfid/scenes/lfrfid_scene_emulate.c @@ -2,27 +2,28 @@ void lfrfid_scene_emulate_on_enter(void* context) { LfRfid* app = context; - Popup* popup = app->popup; + Widget* widget = app->widget; - popup_set_header(popup, "Emulating", 89, 30, AlignCenter, AlignTop); - if(!furi_string_empty(app->file_name)) { - popup_set_text(popup, furi_string_get_cstr(app->file_name), 89, 43, AlignCenter, AlignTop); + FuriString* display_text = furi_string_alloc_set("\e#Emulating\e#\n"); + + if(furi_string_empty(app->file_name)) { + furi_string_cat(display_text, "Unsaved\n"); + furi_string_cat(display_text, protocol_dict_get_name(app->dict, app->protocol_id)); } else { - popup_set_text( - popup, - protocol_dict_get_name(app->dict, app->protocol_id), - 89, - 43, - AlignCenter, - AlignTop); + furi_string_cat(display_text, app->file_name); } - popup_set_icon(popup, 0, 3, &I_RFIDDolphinSend_97x61); + + widget_add_icon_element(widget, 0, 0, &I_NFC_dolphin_emulation_51x64); + widget_add_text_box_element( + widget, 55, 16, 67, 48, AlignCenter, AlignTop, furi_string_get_cstr(display_text), true); + + furi_string_free(display_text); lfrfid_worker_start_thread(app->lfworker); lfrfid_worker_emulate_start(app->lfworker, (LFRFIDProtocol)app->protocol_id); notification_message(app->notifications, &sequence_blink_start_magenta); - view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewPopup); + view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewWidget); } bool lfrfid_scene_emulate_on_event(void* context, SceneManagerEvent event) { @@ -35,7 +36,7 @@ bool lfrfid_scene_emulate_on_event(void* context, SceneManagerEvent event) { void lfrfid_scene_emulate_on_exit(void* context) { LfRfid* app = context; notification_message(app->notifications, &sequence_blink_stop); - popup_reset(app->popup); + widget_reset(app->widget); lfrfid_worker_stop(app->lfworker); lfrfid_worker_stop_thread(app->lfworker); } diff --git a/applications/main/lfrfid/scenes/lfrfid_scene_exit_confirm.c b/applications/main/lfrfid/scenes/lfrfid_scene_exit_confirm.c index e8ab481c6f..55f02d7402 100644 --- a/applications/main/lfrfid/scenes/lfrfid_scene_exit_confirm.c +++ b/applications/main/lfrfid/scenes/lfrfid_scene_exit_confirm.c @@ -7,9 +7,9 @@ void lfrfid_scene_exit_confirm_on_enter(void* context) { widget_add_button_element(widget, GuiButtonTypeLeft, "Exit", lfrfid_widget_callback, app); widget_add_button_element(widget, GuiButtonTypeRight, "Stay", lfrfid_widget_callback, app); widget_add_string_element( - widget, 64, 19, AlignCenter, AlignBottom, FontPrimary, "Exit to RFID Menu?"); + widget, 64, 0, AlignCenter, AlignTop, FontPrimary, "Exit to RFID Menu?"); widget_add_string_element( - widget, 64, 31, AlignCenter, AlignBottom, FontSecondary, "All unsaved data will be lost!"); + widget, 64, 13, AlignCenter, AlignTop, FontSecondary, "All unsaved data will be lost"); view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewWidget); } diff --git a/applications/main/lfrfid/scenes/lfrfid_scene_extra_actions.c b/applications/main/lfrfid/scenes/lfrfid_scene_extra_actions.c index 1aed9a03c3..f2e0998286 100644 --- a/applications/main/lfrfid/scenes/lfrfid_scene_extra_actions.c +++ b/applications/main/lfrfid/scenes/lfrfid_scene_extra_actions.c @@ -70,6 +70,9 @@ bool lfrfid_scene_extra_actions_on_event(void* context, SceneManagerEvent event) consumed = true; } scene_manager_set_scene_state(app->scene_manager, LfRfidSceneExtraActions, event.event); + + } else if(event.type == SceneManagerEventTypeBack) { + scene_manager_set_scene_state(app->scene_manager, LfRfidSceneExtraActions, 0); } return consumed; diff --git a/applications/main/lfrfid/scenes/lfrfid_scene_raw_info.c b/applications/main/lfrfid/scenes/lfrfid_scene_raw_info.c index f403c1f38e..ba85c6ca1f 100644 --- a/applications/main/lfrfid/scenes/lfrfid_scene_raw_info.c +++ b/applications/main/lfrfid/scenes/lfrfid_scene_raw_info.c @@ -4,37 +4,39 @@ void lfrfid_scene_raw_info_on_enter(void* context) { LfRfid* app = context; Widget* widget = app->widget; - // FuriString* tmp_string; - // tmp_string = furi_string_alloc(); - - bool sd_exist = storage_sd_status(app->storage) == FSE_OK; - if(!sd_exist) { - widget_add_icon_element(widget, 0, 0, &I_SDQuestion_35x43); + if(storage_sd_status(app->storage) != FSE_OK) { + widget_add_icon_element(widget, 83, 22, &I_WarningDolphinFlip_45x42); + widget_add_string_element( + widget, 64, 0, AlignCenter, AlignTop, FontPrimary, "No SD Card!"); widget_add_string_multiline_element( widget, - 81, - 4, - AlignCenter, + 0, + 13, + AlignLeft, AlignTop, FontSecondary, - "No SD card found.\nThis function will not\nwork without\nSD card."); + "Insert an SD card\n" + "to use this function"); - widget_add_button_element(widget, GuiButtonTypeLeft, "Back", lfrfid_widget_callback, app); } else { - widget_add_string_multiline_element( + widget_add_text_box_element( widget, 0, - 1, + 0, + 128, + 64, AlignLeft, AlignTop, - FontSecondary, - "RAW RFID data reader\n1) Put the Flipper on your card\n2) Press OK\n3) Wait until data is read"); + "\e#RAW RFID Data Reader\e#\n" + "1. Hold card next to Flipper\n" + "2. Press OK\n" + "3. Wait until data is read", + false); widget_add_button_element(widget, GuiButtonTypeCenter, "OK", lfrfid_widget_callback, app); } view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewWidget); - //furi_string_free(tmp_string); } bool lfrfid_scene_raw_info_on_event(void* context, SceneManagerEvent event) { diff --git a/applications/main/lfrfid/scenes/lfrfid_scene_raw_read.c b/applications/main/lfrfid/scenes/lfrfid_scene_raw_read.c index b2c7c364e1..b86b86b217 100644 --- a/applications/main/lfrfid/scenes/lfrfid_scene_raw_read.c +++ b/applications/main/lfrfid/scenes/lfrfid_scene_raw_read.c @@ -1,6 +1,6 @@ #include "../lfrfid_i.h" -#define RAW_READ_TIME 5000 +#define RAW_READ_TIME_MS (5000UL) typedef struct { FuriString* string_file_name; @@ -29,24 +29,28 @@ void lfrfid_scene_raw_read_on_enter(void* context) { LfRfid* app = context; Popup* popup = app->popup; - LfRfidReadRawState* state = malloc(sizeof(LfRfidReadRawState)); - scene_manager_set_scene_state(app->scene_manager, LfRfidSceneRawRead, (uint32_t)state); - state->string_file_name = furi_string_alloc(); + popup_set_icon(popup, 0, 0, &I_NFC_dolphin_emulation_51x64); + popup_set_header(popup, "Reading ASK", 91, 16, AlignCenter, AlignTop); + popup_set_text(popup, "Don't move\nfor 5 sec.", 91, 29, AlignCenter, AlignTop); - popup_set_icon(popup, 0, 3, &I_RFIDDolphinReceive_97x61); view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewPopup); - lfrfid_worker_start_thread(app->lfworker); - lfrfid_make_app_folder(app); + LfRfidReadRawState* state = malloc(sizeof(LfRfidReadRawState)); + state->string_file_name = furi_string_alloc(); state->timer = furi_timer_alloc(timer_callback, FuriTimerTypeOnce, app); - furi_timer_start(state->timer, RAW_READ_TIME); + + scene_manager_set_scene_state(app->scene_manager, LfRfidSceneRawRead, (uint32_t)state); + furi_string_printf( state->string_file_name, "%s/%s%s", LFRFID_SD_FOLDER, furi_string_get_cstr(app->raw_file_name), LFRFID_APP_RAW_ASK_EXTENSION); - popup_set_header(popup, "Reading\nRAW RFID\nASK", 89, 30, AlignCenter, AlignTop); + + lfrfid_make_app_folder(app); + + lfrfid_worker_start_thread(app->lfworker); lfrfid_worker_read_raw_start( app->lfworker, furi_string_get_cstr(state->string_file_name), @@ -54,6 +58,7 @@ void lfrfid_scene_raw_read_on_enter(void* context) { lfrfid_read_callback, app); + furi_timer_start(state->timer, RAW_READ_TIME_MS); notification_message(app->notifications, &sequence_blink_start_cyan); state->is_psk = false; @@ -70,41 +75,53 @@ bool lfrfid_scene_raw_read_on_event(void* context, SceneManagerEvent event) { furi_assert(state); if(event.type == SceneManagerEventTypeCustom) { - if(event.event == LfRfidEventReadError) { - consumed = true; - state->error = true; - popup_set_header( - popup, "Reading\nRAW RFID\nFile error", 89, 30, AlignCenter, AlignTop); - notification_message(app->notifications, &sequence_blink_start_red); + if(event.event == LfRfidEventReadError || event.event == LfRfidEventReadOverrun) { furi_timer_stop(state->timer); + + popup_set_icon(popup, 83, 22, &I_WarningDolphinFlip_45x42); + popup_set_header(popup, "RAW Reading error!", 64, 0, AlignCenter, AlignTop); + popup_set_text( + popup, "This may be\ncaused by SD\ncard issues", 0, 13, AlignLeft, AlignTop); + + notification_message(app->notifications, &sequence_blink_start_red); + state->error = true; + } else if(event.event == LfRfidEventReadDone) { - consumed = true; if(!state->error) { if(state->is_psk) { notification_message(app->notifications, &sequence_success); scene_manager_next_scene(app->scene_manager, LfRfidSceneRawSuccess); + } else { - popup_set_header( - popup, "Reading\nRAW RFID\nPSK", 89, 30, AlignCenter, AlignTop); - notification_message(app->notifications, &sequence_blink_start_yellow); lfrfid_worker_stop(app->lfworker); + lfrfid_worker_stop_thread(app->lfworker); + + state->is_psk = true; + furi_string_printf( state->string_file_name, "%s/%s%s", LFRFID_SD_FOLDER, furi_string_get_cstr(app->raw_file_name), LFRFID_APP_RAW_PSK_EXTENSION); + + lfrfid_worker_start_thread(app->lfworker); lfrfid_worker_read_raw_start( app->lfworker, furi_string_get_cstr(state->string_file_name), LFRFIDWorkerReadTypePSKOnly, lfrfid_read_callback, app); - furi_timer_start(state->timer, RAW_READ_TIME); - state->is_psk = true; + + furi_timer_start(state->timer, RAW_READ_TIME_MS); + + popup_set_header(popup, "Reading PSK", 91, 16, AlignCenter, AlignTop); + notification_message(app->notifications, &sequence_blink_start_yellow); } } } + + consumed = true; } return consumed; @@ -115,12 +132,13 @@ void lfrfid_scene_raw_read_on_exit(void* context) { LfRfidReadRawState* state = (LfRfidReadRawState*)scene_manager_get_scene_state(app->scene_manager, LfRfidSceneRawRead); - notification_message(app->notifications, &sequence_blink_stop); - popup_reset(app->popup); lfrfid_worker_stop(app->lfworker); lfrfid_worker_stop_thread(app->lfworker); - furi_timer_free(state->timer); + furi_timer_free(state->timer); furi_string_free(state->string_file_name); free(state); + + popup_reset(app->popup); + notification_message(app->notifications, &sequence_blink_stop); } diff --git a/applications/main/lfrfid/scenes/lfrfid_scene_raw_success.c b/applications/main/lfrfid/scenes/lfrfid_scene_raw_success.c index 09a005298f..3fca9e3f12 100644 --- a/applications/main/lfrfid/scenes/lfrfid_scene_raw_success.c +++ b/applications/main/lfrfid/scenes/lfrfid_scene_raw_success.c @@ -4,16 +4,20 @@ void lfrfid_scene_raw_success_on_enter(void* context) { LfRfid* app = context; Widget* widget = app->widget; - widget_add_button_element(widget, GuiButtonTypeCenter, "OK", lfrfid_widget_callback, app); - - widget_add_string_multiline_element( + widget_add_text_box_element( widget, 0, - 1, + 0, + 128, + 64, AlignLeft, AlignTop, - FontSecondary, - "RAW RFID read success!\nNow you can analyze files\nOr send them to developers"); + "\e#RAW RFID Read Success\e#\n" + "Now you can analyze files or\n" + "send them to developers", + false); + + widget_add_button_element(widget, GuiButtonTypeCenter, "OK", lfrfid_widget_callback, app); view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewWidget); } @@ -24,12 +28,16 @@ bool lfrfid_scene_raw_success_on_event(void* context, SceneManagerEvent event) { bool consumed = false; if(event.type == SceneManagerEventTypeCustom) { - consumed = true; if(event.event == GuiButtonTypeCenter) { scene_manager_search_and_switch_to_previous_scene( scene_manager, LfRfidSceneExtraActions); } + consumed = true; + + } else if(event.type == SceneManagerEventTypeBack) { + consumed = true; } + return consumed; } diff --git a/applications/main/lfrfid/scenes/lfrfid_scene_read_key_menu.c b/applications/main/lfrfid/scenes/lfrfid_scene_read_key_menu.c index 36f0d6d93a..22b083c76b 100644 --- a/applications/main/lfrfid/scenes/lfrfid_scene_read_key_menu.c +++ b/applications/main/lfrfid/scenes/lfrfid_scene_read_key_menu.c @@ -48,6 +48,9 @@ bool lfrfid_scene_read_key_menu_on_event(void* context, SceneManagerEvent event) consumed = true; } scene_manager_set_scene_state(app->scene_manager, LfRfidSceneReadKeyMenu, event.event); + + } else if(event.type == SceneManagerEventTypeBack) { + scene_manager_set_scene_state(app->scene_manager, LfRfidSceneReadKeyMenu, 0); } return consumed; diff --git a/applications/main/lfrfid/scenes/lfrfid_scene_read_success.c b/applications/main/lfrfid/scenes/lfrfid_scene_read_success.c index b83ef4a399..dbd3192294 100644 --- a/applications/main/lfrfid/scenes/lfrfid_scene_read_success.c +++ b/applications/main/lfrfid/scenes/lfrfid_scene_read_success.c @@ -1,54 +1,53 @@ #include "../lfrfid_i.h" +#define LFRFID_SCENE_READ_SUCCESS_MAX_HEX_WIDTH (7UL) + void lfrfid_scene_read_success_on_enter(void* context) { LfRfid* app = context; Widget* widget = app->widget; + FuriString* display_text = furi_string_alloc(); - FuriString* tmp_string; - tmp_string = furi_string_alloc(); + const char* protocol = protocol_dict_get_name(app->dict, app->protocol_id); + const char* manufacturer = protocol_dict_get_manufacturer(app->dict, app->protocol_id); - widget_add_button_element(widget, GuiButtonTypeLeft, "Retry", lfrfid_widget_callback, app); - widget_add_button_element(widget, GuiButtonTypeRight, "More", lfrfid_widget_callback, app); + if(strcasecmp(protocol, manufacturer) != 0 && strcasecmp(manufacturer, "N/A") != 0) { + furi_string_printf(display_text, "\e#%s %s\e#", manufacturer, protocol); + } else { + furi_string_printf(display_text, "\e#%s\e#", protocol); + } + + furi_string_cat(display_text, "\nHex: "); + + const size_t data_size = protocol_dict_get_data_size(app->dict, app->protocol_id); + uint8_t* data = malloc(data_size); - furi_string_printf( - tmp_string, - "%s[%s]", - protocol_dict_get_name(app->dict, app->protocol_id), - protocol_dict_get_manufacturer(app->dict, app->protocol_id)); - - widget_add_string_element( - widget, 0, 2, AlignLeft, AlignTop, FontPrimary, furi_string_get_cstr(tmp_string)); - - furi_string_reset(tmp_string); - size_t size = protocol_dict_get_data_size(app->dict, app->protocol_id); - uint8_t* data = (uint8_t*)malloc(size); - protocol_dict_get_data(app->dict, app->protocol_id, data, size); - for(uint8_t i = 0; i < size; i++) { - if(i >= 9) { - furi_string_cat_printf(tmp_string, ".."); + protocol_dict_get_data(app->dict, app->protocol_id, data, data_size); + + for(size_t i = 0; i < data_size; i++) { + if(i == LFRFID_SCENE_READ_SUCCESS_MAX_HEX_WIDTH) { + furi_string_cat(display_text, " ..."); break; - } else { - if(i != 0) { - furi_string_cat_printf(tmp_string, " "); - } - furi_string_cat_printf(tmp_string, "%02X", data[i]); } + + furi_string_cat_printf(display_text, "%s%02X", i != 0 ? " " : "", data[i]); } + free(data); - FuriString* render_data; - render_data = furi_string_alloc(); - protocol_dict_render_brief_data(app->dict, render_data, app->protocol_id); - furi_string_cat_printf(tmp_string, "\r\n%s", furi_string_get_cstr(render_data)); - furi_string_free(render_data); + FuriString* rendered_data = furi_string_alloc(); + protocol_dict_render_brief_data(app->dict, rendered_data, app->protocol_id); + furi_string_cat_printf(display_text, "\n%s", furi_string_get_cstr(rendered_data)); + furi_string_free(rendered_data); - widget_add_string_multiline_element( - widget, 0, 16, AlignLeft, AlignTop, FontSecondary, furi_string_get_cstr(tmp_string)); + widget_add_text_box_element( + widget, 0, 0, 128, 52, AlignLeft, AlignTop, furi_string_get_cstr(display_text), true); + widget_add_button_element(widget, GuiButtonTypeLeft, "Retry", lfrfid_widget_callback, app); + widget_add_button_element(widget, GuiButtonTypeRight, "More", lfrfid_widget_callback, app); notification_message_block(app->notifications, &sequence_set_green_255); view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewWidget); - furi_string_free(tmp_string); + furi_string_free(display_text); } bool lfrfid_scene_read_success_on_event(void* context, SceneManagerEvent event) { diff --git a/applications/main/lfrfid/scenes/lfrfid_scene_retry_confirm.c b/applications/main/lfrfid/scenes/lfrfid_scene_retry_confirm.c index ddac3e8ba5..41ff9afed9 100644 --- a/applications/main/lfrfid/scenes/lfrfid_scene_retry_confirm.c +++ b/applications/main/lfrfid/scenes/lfrfid_scene_retry_confirm.c @@ -4,12 +4,11 @@ void lfrfid_scene_retry_confirm_on_enter(void* context) { LfRfid* app = context; Widget* widget = app->widget; - widget_add_button_element(widget, GuiButtonTypeLeft, "Exit", lfrfid_widget_callback, app); + widget_add_button_element(widget, GuiButtonTypeLeft, "Retry", lfrfid_widget_callback, app); widget_add_button_element(widget, GuiButtonTypeRight, "Stay", lfrfid_widget_callback, app); + widget_add_string_element(widget, 64, 0, AlignCenter, AlignTop, FontPrimary, "Retry Reading?"); widget_add_string_element( - widget, 64, 19, AlignCenter, AlignBottom, FontPrimary, "Retry Reading?"); - widget_add_string_element( - widget, 64, 29, AlignCenter, AlignBottom, FontSecondary, "All unsaved data will be lost!"); + widget, 64, 13, AlignCenter, AlignTop, FontSecondary, "All unsaved data will be lost"); view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewWidget); } diff --git a/applications/main/lfrfid/scenes/lfrfid_scene_save_success.c b/applications/main/lfrfid/scenes/lfrfid_scene_save_success.c index 2f5d5ae9ff..4eb21e9421 100644 --- a/applications/main/lfrfid/scenes/lfrfid_scene_save_success.c +++ b/applications/main/lfrfid/scenes/lfrfid_scene_save_success.c @@ -21,16 +21,9 @@ bool lfrfid_scene_save_success_on_event(void* context, SceneManagerEvent event) LfRfid* app = context; bool consumed = false; - const uint32_t prev_scenes[] = {LfRfidSceneReadKeyMenu, LfRfidSceneSelectKey}; - - if((event.type == SceneManagerEventTypeBack) || - ((event.type == SceneManagerEventTypeCustom) && (event.event == LfRfidEventPopupClosed))) { - bool result = scene_manager_search_and_switch_to_previous_scene_one_of( - app->scene_manager, prev_scenes, COUNT_OF(prev_scenes)); - if(!result) { - scene_manager_search_and_switch_to_another_scene( - app->scene_manager, LfRfidSceneSelectKey); - } + if(event.type == SceneManagerEventTypeBack || event.type == SceneManagerEventTypeCustom) { + // Always return to SceneSelectKey from here + scene_manager_search_and_switch_to_another_scene(app->scene_manager, LfRfidSceneSelectKey); consumed = true; } diff --git a/applications/main/lfrfid/scenes/lfrfid_scene_saved_info.c b/applications/main/lfrfid/scenes/lfrfid_scene_saved_info.c index 3f1c2d400e..a057b7a71a 100644 --- a/applications/main/lfrfid/scenes/lfrfid_scene_saved_info.c +++ b/applications/main/lfrfid/scenes/lfrfid_scene_saved_info.c @@ -4,38 +4,42 @@ void lfrfid_scene_saved_info_on_enter(void* context) { LfRfid* app = context; Widget* widget = app->widget; - FuriString* tmp_string; - tmp_string = furi_string_alloc(); - - furi_string_printf( - tmp_string, - "%s [%s]\r\n", - furi_string_get_cstr(app->file_name), - protocol_dict_get_name(app->dict, app->protocol_id)); - - size_t size = protocol_dict_get_data_size(app->dict, app->protocol_id); - uint8_t* data = (uint8_t*)malloc(size); - protocol_dict_get_data(app->dict, app->protocol_id, data, size); - for(uint8_t i = 0; i < size; i++) { - if(i != 0) { - furi_string_cat_printf(tmp_string, " "); - } - - furi_string_cat_printf(tmp_string, "%02X", data[i]); + FuriString* display_text = furi_string_alloc(); + + furi_string_printf(display_text, "Name: %s\n", furi_string_get_cstr(app->file_name)); + + const char* protocol = protocol_dict_get_name(app->dict, app->protocol_id); + const char* manufacturer = protocol_dict_get_manufacturer(app->dict, app->protocol_id); + + if(strcasecmp(protocol, manufacturer) != 0 && strcasecmp(manufacturer, "N/A") != 0) { + furi_string_cat_printf(display_text, "\e#%s %s", manufacturer, protocol); + } else { + furi_string_cat_printf(display_text, "\e#%s", protocol); } + + furi_string_cat(display_text, "\nHex: "); + + const size_t data_size = protocol_dict_get_data_size(app->dict, app->protocol_id); + uint8_t* data = malloc(data_size); + + protocol_dict_get_data(app->dict, app->protocol_id, data, data_size); + + for(size_t i = 0; i < data_size; i++) { + furi_string_cat_printf(display_text, "%s%02X", i != 0 ? " " : "", data[i]); + } + free(data); - FuriString* render_data; - render_data = furi_string_alloc(); - protocol_dict_render_data(app->dict, render_data, app->protocol_id); - furi_string_cat_printf(tmp_string, "\r\n%s", furi_string_get_cstr(render_data)); - furi_string_free(render_data); + FuriString* rendered_data; + rendered_data = furi_string_alloc(); + protocol_dict_render_data(app->dict, rendered_data, app->protocol_id); + furi_string_cat_printf(display_text, "\n%s", furi_string_get_cstr(rendered_data)); + furi_string_free(rendered_data); - widget_add_string_multiline_element( - widget, 0, 1, AlignLeft, AlignTop, FontSecondary, furi_string_get_cstr(tmp_string)); + widget_add_text_scroll_element(widget, 0, 0, 128, 64, furi_string_get_cstr(display_text)); view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewWidget); - furi_string_free(tmp_string); + furi_string_free(display_text); } bool lfrfid_scene_saved_info_on_event(void* context, SceneManagerEvent event) { diff --git a/applications/main/lfrfid/scenes/lfrfid_scene_saved_key_menu.c b/applications/main/lfrfid/scenes/lfrfid_scene_saved_key_menu.c index 206074e9b0..f687cd0a29 100644 --- a/applications/main/lfrfid/scenes/lfrfid_scene_saved_key_menu.c +++ b/applications/main/lfrfid/scenes/lfrfid_scene_saved_key_menu.c @@ -59,6 +59,9 @@ bool lfrfid_scene_saved_key_menu_on_event(void* context, SceneManagerEvent event consumed = true; } scene_manager_set_scene_state(app->scene_manager, LfRfidSceneSavedKeyMenu, event.event); + + } else if(event.type == SceneManagerEventTypeBack) { + scene_manager_set_scene_state(app->scene_manager, LfRfidSceneSavedKeyMenu, 0); } return consumed; diff --git a/applications/main/lfrfid/scenes/lfrfid_scene_select_key.c b/applications/main/lfrfid/scenes/lfrfid_scene_select_key.c index 2a9cc1c634..505985c26a 100644 --- a/applications/main/lfrfid/scenes/lfrfid_scene_select_key.c +++ b/applications/main/lfrfid/scenes/lfrfid_scene_select_key.c @@ -6,7 +6,9 @@ void lfrfid_scene_select_key_on_enter(void* context) { if(lfrfid_load_key_from_file_select(app)) { scene_manager_next_scene(app->scene_manager, LfRfidSceneSavedKeyMenu); } else { - scene_manager_previous_scene(app->scene_manager); + // Always select "Saved" menu item when returning from this scene + scene_manager_set_scene_state(app->scene_manager, LfRfidSceneStart, LfRfidMenuIndexSaved); + scene_manager_search_and_switch_to_previous_scene(app->scene_manager, LfRfidSceneStart); } } diff --git a/applications/main/lfrfid/scenes/lfrfid_scene_start.c b/applications/main/lfrfid/scenes/lfrfid_scene_start.c index 8a01fc707b..5d0e6112a6 100644 --- a/applications/main/lfrfid/scenes/lfrfid_scene_start.c +++ b/applications/main/lfrfid/scenes/lfrfid_scene_start.c @@ -1,13 +1,6 @@ #include "../lfrfid_i.h" #include -typedef enum { - SubmenuIndexRead, - SubmenuIndexSaved, - SubmenuIndexAddManually, - SubmenuIndexExtraActions, -} SubmenuIndex; - static void lfrfid_scene_start_submenu_callback(void* context, uint32_t index) { LfRfid* app = context; @@ -18,15 +11,20 @@ void lfrfid_scene_start_on_enter(void* context) { LfRfid* app = context; Submenu* submenu = app->submenu; - submenu_add_item(submenu, "Read", SubmenuIndexRead, lfrfid_scene_start_submenu_callback, app); submenu_add_item( - submenu, "Saved", SubmenuIndexSaved, lfrfid_scene_start_submenu_callback, app); + submenu, "Read", LfRfidMenuIndexRead, lfrfid_scene_start_submenu_callback, app); submenu_add_item( - submenu, "Add Manually", SubmenuIndexAddManually, lfrfid_scene_start_submenu_callback, app); + submenu, "Saved", LfRfidMenuIndexSaved, lfrfid_scene_start_submenu_callback, app); + submenu_add_item( + submenu, + "Add Manually", + LfRfidMenuIndexAddManually, + lfrfid_scene_start_submenu_callback, + app); submenu_add_item( submenu, "Extra Actions", - SubmenuIndexExtraActions, + LfRfidMenuIndexExtraActions, lfrfid_scene_start_submenu_callback, app); @@ -46,26 +44,28 @@ bool lfrfid_scene_start_on_event(void* context, SceneManagerEvent event) { bool consumed = false; if(event.type == SceneManagerEventTypeCustom) { - if(event.event == SubmenuIndexRead) { - scene_manager_set_scene_state(app->scene_manager, LfRfidSceneStart, SubmenuIndexRead); + if(event.event == LfRfidMenuIndexRead) { + scene_manager_set_scene_state( + app->scene_manager, LfRfidSceneStart, LfRfidMenuIndexRead); scene_manager_next_scene(app->scene_manager, LfRfidSceneRead); dolphin_deed(DolphinDeedRfidRead); consumed = true; - } else if(event.event == SubmenuIndexSaved) { + } else if(event.event == LfRfidMenuIndexSaved) { // Like in the other apps, explicitly save the scene state // in each branch in case the user cancels loading a file. - scene_manager_set_scene_state(app->scene_manager, LfRfidSceneStart, SubmenuIndexSaved); + scene_manager_set_scene_state( + app->scene_manager, LfRfidSceneStart, LfRfidMenuIndexSaved); furi_string_set(app->file_path, LFRFID_APP_FOLDER); scene_manager_next_scene(app->scene_manager, LfRfidSceneSelectKey); consumed = true; - } else if(event.event == SubmenuIndexAddManually) { + } else if(event.event == LfRfidMenuIndexAddManually) { scene_manager_set_scene_state( - app->scene_manager, LfRfidSceneStart, SubmenuIndexAddManually); + app->scene_manager, LfRfidSceneStart, LfRfidMenuIndexAddManually); scene_manager_next_scene(app->scene_manager, LfRfidSceneSaveType); consumed = true; - } else if(event.event == SubmenuIndexExtraActions) { + } else if(event.event == LfRfidMenuIndexExtraActions) { scene_manager_set_scene_state( - app->scene_manager, LfRfidSceneStart, SubmenuIndexExtraActions); + app->scene_manager, LfRfidSceneStart, LfRfidMenuIndexExtraActions); scene_manager_next_scene(app->scene_manager, LfRfidSceneExtraActions); consumed = true; } diff --git a/applications/main/lfrfid/scenes/lfrfid_scene_write.c b/applications/main/lfrfid/scenes/lfrfid_scene_write.c index f6e762e4d8..55973d09d7 100644 --- a/applications/main/lfrfid/scenes/lfrfid_scene_write.c +++ b/applications/main/lfrfid/scenes/lfrfid_scene_write.c @@ -21,19 +21,19 @@ void lfrfid_scene_write_on_enter(void* context) { LfRfid* app = context; Popup* popup = app->popup; - popup_set_header(popup, "Writing", 89, 30, AlignCenter, AlignTop); + popup_set_icon(popup, 0, 8, &I_NFC_manual_60x50); + popup_set_header(popup, "Writing", 94, 16, AlignCenter, AlignTop); + if(!furi_string_empty(app->file_name)) { - popup_set_text(popup, furi_string_get_cstr(app->file_name), 89, 43, AlignCenter, AlignTop); + popup_set_text(popup, furi_string_get_cstr(app->file_name), 94, 29, AlignCenter, AlignTop); } else { - popup_set_text( - popup, - protocol_dict_get_name(app->dict, app->protocol_id), - 89, - 43, - AlignCenter, - AlignTop); + snprintf( + app->text_store, + LFRFID_TEXT_STORE_SIZE, + "Unsaved\n%s", + protocol_dict_get_name(app->dict, app->protocol_id)); + popup_set_text(popup, app->text_store, 94, 29, AlignCenter, AlignTop); } - popup_set_icon(popup, 0, 3, &I_RFIDDolphinSend_97x61); view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewPopup); @@ -66,12 +66,14 @@ bool lfrfid_scene_write_on_event(void* context, SceneManagerEvent event) { (event.event == LfRfidEventWriteFobCannotBeWritten) || (event.event == LfRfidEventWriteTooLongToWrite)) { popup_set_icon(popup, 83, 22, &I_WarningDolphinFlip_45x42); - popup_set_header(popup, "Still trying to write...", 64, 3, AlignCenter, AlignTop); + popup_set_header(popup, "Still Trying to Write...", 64, 0, AlignCenter, AlignTop); popup_set_text( popup, - "Make sure this\ncard is writable\nand not\nprotected.", - 3, - 17, + "Make sure this\n" + "card is writable\n" + "and not protected", + 0, + 13, AlignLeft, AlignTop); notification_message(app->notifications, &sequence_blink_start_yellow); diff --git a/applications/main/lfrfid/scenes/lfrfid_scene_write_success.c b/applications/main/lfrfid/scenes/lfrfid_scene_write_success.c index 78ba481370..cc407bdcc2 100644 --- a/applications/main/lfrfid/scenes/lfrfid_scene_write_success.c +++ b/applications/main/lfrfid/scenes/lfrfid_scene_write_success.c @@ -19,12 +19,12 @@ bool lfrfid_scene_write_success_on_event(void* context, SceneManagerEvent event) LfRfid* app = context; bool consumed = false; - const uint32_t prev_scenes[] = {LfRfidSceneReadKeyMenu, LfRfidSceneSelectKey}; - - if((event.type == SceneManagerEventTypeBack) || - ((event.type == SceneManagerEventTypeCustom) && (event.event == LfRfidEventPopupClosed))) { - scene_manager_search_and_switch_to_previous_scene_one_of( - app->scene_manager, prev_scenes, COUNT_OF(prev_scenes)); + if(event.type == SceneManagerEventTypeBack || event.type == SceneManagerEventTypeCustom) { + if(!scene_manager_search_and_switch_to_previous_scene( + app->scene_manager, LfRfidSceneReadKeyMenu)) { + scene_manager_search_and_switch_to_another_scene( + app->scene_manager, LfRfidSceneSelectKey); + } consumed = true; } diff --git a/applications/main/nfc/api/mosgortrans/mosgortrans_util.c b/applications/main/nfc/api/mosgortrans/mosgortrans_util.c index f2484a2af5..ef1e18f8d5 100644 --- a/applications/main/nfc/api/mosgortrans/mosgortrans_util.c +++ b/applications/main/nfc/api/mosgortrans/mosgortrans_util.c @@ -464,21 +464,21 @@ void parse_transport_type(BlockData* data_block, FuriString* transport) { bool mosgortrans_parse_transport_block(const MfClassicBlock* block, FuriString* result) { BlockData data_block = {}; const uint16_t valid_departments[] = {0x106, 0x108, 0x10A, 0x10E, 0x110, 0x117}; - uint16_t transport_departament = bit_lib_get_bits_16(block->data, 0, 10); + uint16_t transport_department = bit_lib_get_bits_16(block->data, 0, 10); if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagDebug)) { - furi_string_cat_printf(result, "Transport departament: %x\n", transport_departament); + furi_string_cat_printf(result, "Transport department: %x\n", transport_department); } - bool departament_valid = false; + bool department_valid = false; for(uint8_t i = 0; i < 6; i++) { - if(transport_departament == valid_departments[i]) { - departament_valid = true; + if(transport_department == valid_departments[i]) { + department_valid = true; break; } } - if(!departament_valid) { + if(!department_valid) { return false; } - FURI_LOG_D(TAG, "Transport departament: %x", transport_departament); + FURI_LOG_D(TAG, "Transport department: %x", transport_department); uint16_t layout_type = bit_lib_get_bits_16(block->data, 52, 4); if(layout_type == 0xE) { layout_type = bit_lib_get_bits_16(block->data, 52, 9); diff --git a/applications/main/nfc/helpers/protocol_support/mf_ultralight/mf_ultralight.c b/applications/main/nfc/helpers/protocol_support/mf_ultralight/mf_ultralight.c index c2aaac5bee..bd2015889d 100644 --- a/applications/main/nfc/helpers/protocol_support/mf_ultralight/mf_ultralight.c +++ b/applications/main/nfc/helpers/protocol_support/mf_ultralight/mf_ultralight.c @@ -30,6 +30,8 @@ static void nfc_scene_info_on_enter_mf_ultralight(NfcApp* instance) { furi_string_cat_printf( temp_str, "\e#%s\n", nfc_device_get_name(device, NfcDeviceNameTypeFull)); + furi_string_replace(temp_str, "Mifare", "MIFARE"); + nfc_render_mf_ultralight_info(data, NfcProtocolFormatTypeFull, temp_str); widget_add_text_scroll_element( @@ -245,6 +247,8 @@ static void nfc_scene_read_success_on_enter_mf_ultralight(NfcApp* instance) { furi_string_cat_printf( temp_str, "\e#%s\n", nfc_device_get_name(device, NfcDeviceNameTypeFull)); + furi_string_replace(temp_str, "Mifare", "MIFARE"); + nfc_render_mf_ultralight_info(data, NfcProtocolFormatTypeShort, temp_str); } diff --git a/applications/main/nfc/helpers/protocol_support/st25tb/st25tb_render.c b/applications/main/nfc/helpers/protocol_support/st25tb/st25tb_render.c index e3a0f3c50f..0b5cb08d86 100644 --- a/applications/main/nfc/helpers/protocol_support/st25tb/st25tb_render.c +++ b/applications/main/nfc/helpers/protocol_support/st25tb/st25tb_render.c @@ -1,22 +1,28 @@ #include "st25tb_render.h" #include +#include void nfc_render_st25tb_info( const St25tbData* data, NfcProtocolFormatType format_type, FuriString* str) { - furi_string_cat_printf(str, "UID"); + furi_string_cat_printf(str, "UID:"); for(size_t i = 0; i < ST25TB_UID_SIZE; i++) { furi_string_cat_printf(str, " %02X", data->uid[i]); } if(format_type == NfcProtocolFormatTypeFull) { - furi_string_cat_printf(str, "\nSys. OTP: %08lX", data->system_otp_block); - furi_string_cat_printf(str, "\nBlocks:"); + furi_string_cat_printf( + str, "\nSys. OTP: %08lX", (uint32_t)__bswap32(data->system_otp_block)); + furi_string_cat_printf(str, "\n::::::::::::::::::::::[Blocks]::::::::::::::::::::::"); for(size_t i = 0; i < st25tb_get_block_count(data->type); i += 2) { furi_string_cat_printf( - str, "\n %02X %08lX %08lX", i, data->blocks[i], data->blocks[i + 1]); + str, + "\n %02X %08lX %08lX", + i, + (uint32_t)__bswap32(data->blocks[i]), + (uint32_t)__bswap32(data->blocks[i + 1])); } } } diff --git a/applications/main/nfc/nfc_app.c b/applications/main/nfc/nfc_app.c index 26821c8f71..02f852e346 100644 --- a/applications/main/nfc/nfc_app.c +++ b/applications/main/nfc/nfc_app.c @@ -453,7 +453,7 @@ void nfc_append_filename_string_when_present(NfcApp* instance, FuriString* strin furi_assert(string); if(!furi_string_empty(instance->file_name)) { - furi_string_cat_printf(string, "Name:%s\n", furi_string_get_cstr(instance->file_name)); + furi_string_cat_printf(string, "Name: %s\n", furi_string_get_cstr(instance->file_name)); } } diff --git a/applications/main/nfc/plugins/supported_cards/mykey.c b/applications/main/nfc/plugins/supported_cards/mykey.c index ac5fec97c2..ed4c4cf9a5 100644 --- a/applications/main/nfc/plugins/supported_cards/mykey.c +++ b/applications/main/nfc/plugins/supported_cards/mykey.c @@ -85,11 +85,10 @@ static bool mykey_parse(const NfcDevice* device, FuriString* parsed_data) { bool is_blank = mykey_is_blank(data); furi_string_cat_printf(parsed_data, "Serial#: %08lX\n", (uint32_t)__bswap32(data->blocks[7])); - furi_string_cat_printf(parsed_data, "Blank: %s\n", is_blank ? "yes" : "no"); - furi_string_cat_printf(parsed_data, "LockID: %s\n", mykey_has_lockid(data) ? "maybe" : "no"); - furi_string_cat_printf( - parsed_data, "Prod. date: %02X/%02X/%04X", mfg_day, mfg_month, mfg_year); + parsed_data, "Prod. date: %02X/%02X/%04X\n", mfg_day, mfg_month, mfg_year); + furi_string_cat_printf(parsed_data, "Blank: %s\n", is_blank ? "yes" : "no"); + furi_string_cat_printf(parsed_data, "LockID: %s", mykey_has_lockid(data) ? "maybe" : "no"); if(!is_blank) { furi_string_cat_printf( diff --git a/applications/main/nfc/scenes/nfc_scene_mf_ultralight_unlock_menu.c b/applications/main/nfc/scenes/nfc_scene_mf_ultralight_unlock_menu.c index 4d97040ee2..a23e4b306a 100644 --- a/applications/main/nfc/scenes/nfc_scene_mf_ultralight_unlock_menu.c +++ b/applications/main/nfc/scenes/nfc_scene_mf_ultralight_unlock_menu.c @@ -20,12 +20,17 @@ void nfc_scene_mf_ultralight_unlock_menu_on_enter(void* context) { uint32_t state = scene_manager_get_scene_state(nfc->scene_manager, NfcSceneMfUltralightUnlockMenu); if(nfc_device_get_protocol(nfc->nfc_device) == NfcProtocolMfUltralight) { - submenu_add_item( - submenu, - "Unlock With Reader", - SubmenuIndexMfUlUnlockMenuReader, - nfc_scene_mf_ultralight_unlock_menu_submenu_callback, - nfc); + const MfUltralightData* mfu_data = + nfc_device_get_data(nfc->nfc_device, NfcProtocolMfUltralight); + // Hide for MFU-C since it uses 3DES + if(mfu_data->type != MfUltralightTypeMfulC) { + submenu_add_item( + submenu, + "Unlock With Reader", + SubmenuIndexMfUlUnlockMenuReader, + nfc_scene_mf_ultralight_unlock_menu_submenu_callback, + nfc); + } } submenu_add_item( submenu, diff --git a/applications/services/desktop/desktop.c b/applications/services/desktop/desktop.c index 74979d1284..49aa04e35e 100644 --- a/applications/services/desktop/desktop.c +++ b/applications/services/desktop/desktop.c @@ -34,10 +34,12 @@ static void desktop_loader_callback(const void* message, void* context) { if(event->type == LoaderEventTypeApplicationStarted) { view_dispatcher_send_custom_event(desktop->view_dispatcher, DesktopGlobalBeforeAppStarted); + furi_check(furi_semaphore_acquire(desktop->animation_semaphore, 3000) == FuriStatusOk); } else if(event->type == LoaderEventTypeApplicationStopped) { view_dispatcher_send_custom_event(desktop->view_dispatcher, DesktopGlobalAfterAppFinished); } } + static void desktop_lock_icon_draw_callback(Canvas* canvas, void* context) { UNUSED(context); furi_assert(canvas); @@ -120,8 +122,11 @@ static bool desktop_custom_event_callback(void* context, uint32_t event) { switch(event) { case DesktopGlobalBeforeAppStarted: - animation_manager_unload_and_stall_animation(desktop->animation_manager); + if(animation_manager_is_animation_loaded(desktop->animation_manager)) { + animation_manager_unload_and_stall_animation(desktop->animation_manager); + } desktop_auto_lock_inhibit(desktop); + furi_semaphore_release(desktop->animation_semaphore); return true; case DesktopGlobalAfterAppFinished: animation_manager_load_and_continue_animation(desktop->animation_manager); @@ -270,6 +275,7 @@ void desktop_set_stealth_mode_state(Desktop* desktop, bool enabled) { Desktop* desktop_alloc(void) { Desktop* desktop = malloc(sizeof(Desktop)); + desktop->animation_semaphore = furi_semaphore_alloc(1, 0); desktop->animation_manager = animation_manager_alloc(); desktop->gui = furi_record_open(RECORD_GUI); desktop->scene_thread = furi_thread_alloc(); diff --git a/applications/services/desktop/desktop_i.h b/applications/services/desktop/desktop_i.h index f6eeef6b1b..c0b29f922d 100644 --- a/applications/services/desktop/desktop_i.h +++ b/applications/services/desktop/desktop_i.h @@ -80,6 +80,8 @@ struct Desktop { bool time_format_12 : 1; // 1 - 12 hour, 0 - 24H bool in_transition : 1; + + FuriSemaphore* animation_semaphore; }; Desktop* desktop_alloc(void); diff --git a/applications/services/gui/elements.c b/applications/services/gui/elements.c index d488cbfc6e..06b63fd902 100644 --- a/applications/services/gui/elements.c +++ b/applications/services/gui/elements.c @@ -746,10 +746,9 @@ void elements_text_box( } line[line_num].y = total_height_min; line_num++; - if(text[i + 1]) { + if(!full_text_processed) { line[line_num].text = &text[i + 1]; } - line_leading_min = font_params->leading_min; line_height = font_params->height; line_descender = font_params->descender; @@ -792,29 +791,32 @@ void elements_text_box( for(size_t i = 0; i < line_num; i++) { for(size_t j = 0; j < line[i].len; j++) { // Process format symbols - if(line[i].text[j] == ELEMENTS_BOLD_MARKER) { - if(bold) { - current_font = FontSecondary; - } else { - current_font = FontPrimary; + if(line[i].text[j] == '\e' && j < line[i].len - 1) { + ++j; + if(line[i].text[j] == ELEMENTS_BOLD_MARKER) { + if(bold) { + current_font = FontSecondary; + } else { + current_font = FontPrimary; + } + canvas_set_font(canvas, current_font); + bold = !bold; + continue; } - canvas_set_font(canvas, current_font); - bold = !bold; - continue; - } - if(line[i].text[j] == ELEMENTS_MONO_MARKER) { - if(mono) { - current_font = FontSecondary; - } else { - current_font = FontKeyboard; + if(line[i].text[j] == ELEMENTS_MONO_MARKER) { + if(mono) { + current_font = FontSecondary; + } else { + current_font = FontKeyboard; + } + canvas_set_font(canvas, current_font); + mono = !mono; + continue; + } + if(line[i].text[j] == ELEMENTS_INVERSE_MARKER) { + inverse = !inverse; + continue; } - canvas_set_font(canvas, current_font); - mono = !mono; - continue; - } - if(line[i].text[j] == ELEMENTS_INVERSE_MARKER) { - inverse = !inverse; - continue; } if(inverse) { canvas_draw_box( diff --git a/applications/services/notification/notification_app.c b/applications/services/notification/notification_app.c index 514a37f000..8e183f74e1 100644 --- a/applications/services/notification/notification_app.c +++ b/applications/services/notification/notification_app.c @@ -24,9 +24,9 @@ static const uint8_t reset_display_mask = 1 << 5; static const uint8_t reset_blink_mask = 1 << 6; static void notification_vibro_on(bool force); -static void notification_vibro_off(); +static void notification_vibro_off(void); static void notification_sound_on(float freq, float volume, bool force); -static void notification_sound_off(); +static void notification_sound_off(void); static uint8_t notification_settings_get_display_brightness(NotificationApp* app, uint8_t value); static uint8_t notification_settings_get_rgb_led_brightness(NotificationApp* app, uint8_t value); diff --git a/assets/dolphin/external/L1_Mods_128x64/frame_21.png b/assets/dolphin/external/L1_Mods_128x64/frame_21.png index 900cc7d120..00a7a6e99c 100644 Binary files a/assets/dolphin/external/L1_Mods_128x64/frame_21.png and b/assets/dolphin/external/L1_Mods_128x64/frame_21.png differ diff --git a/assets/dolphin/external/L1_Mods_128x64/frame_22.png b/assets/dolphin/external/L1_Mods_128x64/frame_22.png index de6c511e4f..137d5ddf6e 100644 Binary files a/assets/dolphin/external/L1_Mods_128x64/frame_22.png and b/assets/dolphin/external/L1_Mods_128x64/frame_22.png differ diff --git a/assets/dolphin/external/L1_Mods_128x64/frame_23.png b/assets/dolphin/external/L1_Mods_128x64/frame_23.png index 4f82f63bc9..89690fc038 100644 Binary files a/assets/dolphin/external/L1_Mods_128x64/frame_23.png and b/assets/dolphin/external/L1_Mods_128x64/frame_23.png differ diff --git a/assets/dolphin/external/L1_Mods_128x64/frame_24.png b/assets/dolphin/external/L1_Mods_128x64/frame_24.png index d7c614902b..53d7b07a5e 100644 Binary files a/assets/dolphin/external/L1_Mods_128x64/frame_24.png and b/assets/dolphin/external/L1_Mods_128x64/frame_24.png differ diff --git a/assets/dolphin/external/L1_Mods_128x64/frame_25.png b/assets/dolphin/external/L1_Mods_128x64/frame_25.png index 768030b3c5..2838804e56 100644 Binary files a/assets/dolphin/external/L1_Mods_128x64/frame_25.png and b/assets/dolphin/external/L1_Mods_128x64/frame_25.png differ diff --git a/assets/dolphin/external/L1_Mods_128x64/frame_26.png b/assets/dolphin/external/L1_Mods_128x64/frame_26.png index 12f22abdb9..2af49cf177 100644 Binary files a/assets/dolphin/external/L1_Mods_128x64/frame_26.png and b/assets/dolphin/external/L1_Mods_128x64/frame_26.png differ diff --git a/assets/dolphin/external/L1_Mods_128x64/frame_27.png b/assets/dolphin/external/L1_Mods_128x64/frame_27.png index 9fca976de9..7dc44d061e 100644 Binary files a/assets/dolphin/external/L1_Mods_128x64/frame_27.png and b/assets/dolphin/external/L1_Mods_128x64/frame_27.png differ diff --git a/assets/dolphin/external/L1_Mods_128x64/frame_28.png b/assets/dolphin/external/L1_Mods_128x64/frame_28.png index 4b2ab5863a..87df75ff79 100644 Binary files a/assets/dolphin/external/L1_Mods_128x64/frame_28.png and b/assets/dolphin/external/L1_Mods_128x64/frame_28.png differ diff --git a/assets/dolphin/external/L1_Mods_128x64/frame_29.png b/assets/dolphin/external/L1_Mods_128x64/frame_29.png index 69c709adce..2fdb9d7364 100644 Binary files a/assets/dolphin/external/L1_Mods_128x64/frame_29.png and b/assets/dolphin/external/L1_Mods_128x64/frame_29.png differ diff --git a/assets/dolphin/external/L1_Mods_128x64/frame_30.png b/assets/dolphin/external/L1_Mods_128x64/frame_30.png index 13caae7ca2..785f19fd04 100644 Binary files a/assets/dolphin/external/L1_Mods_128x64/frame_30.png and b/assets/dolphin/external/L1_Mods_128x64/frame_30.png differ diff --git a/assets/dolphin/external/L1_Mods_128x64/frame_31.png b/assets/dolphin/external/L1_Mods_128x64/frame_31.png index b1d1e8bfe4..36310f705a 100644 Binary files a/assets/dolphin/external/L1_Mods_128x64/frame_31.png and b/assets/dolphin/external/L1_Mods_128x64/frame_31.png differ diff --git a/assets/dolphin/external/L1_Mods_128x64/frame_32.png b/assets/dolphin/external/L1_Mods_128x64/frame_32.png index acf000827f..92db8f024d 100644 Binary files a/assets/dolphin/external/L1_Mods_128x64/frame_32.png and b/assets/dolphin/external/L1_Mods_128x64/frame_32.png differ diff --git a/assets/dolphin/external/L1_Mods_128x64/frame_33.png b/assets/dolphin/external/L1_Mods_128x64/frame_33.png index b6c6fbb191..768030b3c5 100644 Binary files a/assets/dolphin/external/L1_Mods_128x64/frame_33.png and b/assets/dolphin/external/L1_Mods_128x64/frame_33.png differ diff --git a/assets/dolphin/external/L1_Mods_128x64/frame_34.png b/assets/dolphin/external/L1_Mods_128x64/frame_34.png index 7d2dcda5d9..12f22abdb9 100644 Binary files a/assets/dolphin/external/L1_Mods_128x64/frame_34.png and b/assets/dolphin/external/L1_Mods_128x64/frame_34.png differ diff --git a/assets/dolphin/external/L1_Mods_128x64/frame_35.png b/assets/dolphin/external/L1_Mods_128x64/frame_35.png index 461270ba4b..9fca976de9 100644 Binary files a/assets/dolphin/external/L1_Mods_128x64/frame_35.png and b/assets/dolphin/external/L1_Mods_128x64/frame_35.png differ diff --git a/assets/dolphin/external/L1_Mods_128x64/frame_36.png b/assets/dolphin/external/L1_Mods_128x64/frame_36.png index b018a94c19..4b2ab5863a 100644 Binary files a/assets/dolphin/external/L1_Mods_128x64/frame_36.png and b/assets/dolphin/external/L1_Mods_128x64/frame_36.png differ diff --git a/assets/dolphin/external/L1_Mods_128x64/frame_37.png b/assets/dolphin/external/L1_Mods_128x64/frame_37.png index fa2b303cca..69c709adce 100644 Binary files a/assets/dolphin/external/L1_Mods_128x64/frame_37.png and b/assets/dolphin/external/L1_Mods_128x64/frame_37.png differ diff --git a/assets/dolphin/external/L1_Mods_128x64/frame_38.png b/assets/dolphin/external/L1_Mods_128x64/frame_38.png index ed38122f52..13caae7ca2 100644 Binary files a/assets/dolphin/external/L1_Mods_128x64/frame_38.png and b/assets/dolphin/external/L1_Mods_128x64/frame_38.png differ diff --git a/assets/dolphin/external/L1_Mods_128x64/frame_39.png b/assets/dolphin/external/L1_Mods_128x64/frame_39.png index 38610bb4b4..b1d1e8bfe4 100644 Binary files a/assets/dolphin/external/L1_Mods_128x64/frame_39.png and b/assets/dolphin/external/L1_Mods_128x64/frame_39.png differ diff --git a/assets/dolphin/external/L1_Mods_128x64/frame_40.png b/assets/dolphin/external/L1_Mods_128x64/frame_40.png index 7f6b4b29a3..acf000827f 100644 Binary files a/assets/dolphin/external/L1_Mods_128x64/frame_40.png and b/assets/dolphin/external/L1_Mods_128x64/frame_40.png differ diff --git a/assets/dolphin/external/L1_Mods_128x64/frame_41.png b/assets/dolphin/external/L1_Mods_128x64/frame_41.png new file mode 100644 index 0000000000..b6c6fbb191 Binary files /dev/null and b/assets/dolphin/external/L1_Mods_128x64/frame_41.png differ diff --git a/assets/dolphin/external/L1_Mods_128x64/frame_42.png b/assets/dolphin/external/L1_Mods_128x64/frame_42.png new file mode 100644 index 0000000000..7d2dcda5d9 Binary files /dev/null and b/assets/dolphin/external/L1_Mods_128x64/frame_42.png differ diff --git a/assets/dolphin/external/L1_Mods_128x64/frame_43.png b/assets/dolphin/external/L1_Mods_128x64/frame_43.png new file mode 100644 index 0000000000..461270ba4b Binary files /dev/null and b/assets/dolphin/external/L1_Mods_128x64/frame_43.png differ diff --git a/assets/dolphin/external/L1_Mods_128x64/frame_44.png b/assets/dolphin/external/L1_Mods_128x64/frame_44.png new file mode 100644 index 0000000000..b018a94c19 Binary files /dev/null and b/assets/dolphin/external/L1_Mods_128x64/frame_44.png differ diff --git a/assets/dolphin/external/L1_Mods_128x64/frame_45.png b/assets/dolphin/external/L1_Mods_128x64/frame_45.png new file mode 100644 index 0000000000..fa2b303cca Binary files /dev/null and b/assets/dolphin/external/L1_Mods_128x64/frame_45.png differ diff --git a/assets/dolphin/external/L1_Mods_128x64/frame_46.png b/assets/dolphin/external/L1_Mods_128x64/frame_46.png new file mode 100644 index 0000000000..ed38122f52 Binary files /dev/null and b/assets/dolphin/external/L1_Mods_128x64/frame_46.png differ diff --git a/assets/dolphin/external/L1_Mods_128x64/frame_47.png b/assets/dolphin/external/L1_Mods_128x64/frame_47.png new file mode 100644 index 0000000000..38610bb4b4 Binary files /dev/null and b/assets/dolphin/external/L1_Mods_128x64/frame_47.png differ diff --git a/assets/dolphin/external/L1_Mods_128x64/frame_48.png b/assets/dolphin/external/L1_Mods_128x64/frame_48.png new file mode 100644 index 0000000000..7f6b4b29a3 Binary files /dev/null and b/assets/dolphin/external/L1_Mods_128x64/frame_48.png differ diff --git a/assets/dolphin/external/L1_Mods_128x64/meta.txt b/assets/dolphin/external/L1_Mods_128x64/meta.txt index 0225c7e559..3164fe8d8b 100644 --- a/assets/dolphin/external/L1_Mods_128x64/meta.txt +++ b/assets/dolphin/external/L1_Mods_128x64/meta.txt @@ -3,12 +3,12 @@ Version: 1 Width: 128 Height: 64 -Passive frames: 23 +Passive frames: 31 Active frames: 18 -Frames order: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 +Frames order: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 Active cycles: 1 Frame rate: 2 Duration: 3600 Active cooldown: 7 -Bubble slots: 0 \ No newline at end of file +Bubble slots: 0 diff --git a/furi/core/memmgr_heap.c b/furi/core/memmgr_heap.c index 24bd327fd2..3f62b518c2 100644 --- a/furi/core/memmgr_heap.c +++ b/furi/core/memmgr_heap.c @@ -486,7 +486,7 @@ void* pvPortMalloc(size_t xWantedSize) { configASSERT((((size_t)pvReturn) & (size_t)portBYTE_ALIGNMENT_MASK) == 0); - furi_check(pvReturn); + furi_check(pvReturn, xWantedSize ? "out of memory" : "malloc(0)"); pvReturn = memset(pvReturn, 0, to_wipe); return pvReturn; } diff --git a/lib/infrared/worker/infrared_worker.c b/lib/infrared/worker/infrared_worker.c index a867542e01..89f351eb92 100644 --- a/lib/infrared/worker/infrared_worker.c +++ b/lib/infrared/worker/infrared_worker.c @@ -612,7 +612,7 @@ void infrared_worker_set_raw_signal( furi_check(timings); furi_check(timings_cnt > 0); furi_check((frequency <= INFRARED_MAX_FREQUENCY) && (frequency >= INFRARED_MIN_FREQUENCY)); - furi_check((duty_cycle < 1.0f) && (duty_cycle > 0.0f)); + furi_check((duty_cycle <= 1.0f) && (duty_cycle > 0.0f)); size_t max_copy_num = COUNT_OF(instance->signal.raw.timings) - 1; furi_check(timings_cnt <= max_copy_num); diff --git a/lib/lfrfid/protocols/protocol_awid.c b/lib/lfrfid/protocols/protocol_awid.c index 914f2f01b7..b3e92245e4 100644 --- a/lib/lfrfid/protocols/protocol_awid.c +++ b/lib/lfrfid/protocols/protocol_awid.c @@ -164,7 +164,8 @@ void protocol_awid_render_data(ProtocolAwid* protocol, FuriString* result) { uint8_t* decoded_data = protocol->data; uint8_t format_length = decoded_data[0]; - furi_string_cat_printf(result, "Format: %d\r\n", format_length); + furi_string_printf(result, "Format: %hhu\n", format_length); + if(format_length == 26) { uint8_t facility; bit_lib_copy_bits(&facility, 0, 8, decoded_data, 9); @@ -172,13 +173,17 @@ void protocol_awid_render_data(ProtocolAwid* protocol, FuriString* result) { uint16_t card_id; bit_lib_copy_bits((uint8_t*)&card_id, 8, 8, decoded_data, 17); bit_lib_copy_bits((uint8_t*)&card_id, 0, 8, decoded_data, 25); - furi_string_cat_printf(result, "Facility: %d\r\n", facility); - furi_string_cat_printf(result, "Card: %d", card_id); + furi_string_cat_printf( + result, + "FC: %hhu\n" + "Card: %hu", + facility, + card_id); } else { // print 66 bits as hex furi_string_cat_printf(result, "Data: "); for(size_t i = 0; i < AWID_DECODED_DATA_SIZE; i++) { - furi_string_cat_printf(result, "%02X", decoded_data[i]); + furi_string_cat_printf(result, "%02hhX", decoded_data[i]); } } }; @@ -187,7 +192,8 @@ void protocol_awid_render_brief_data(ProtocolAwid* protocol, FuriString* result) uint8_t* decoded_data = protocol->data; uint8_t format_length = decoded_data[0]; - furi_string_cat_printf(result, "Format: %d\r\n", format_length); + furi_string_printf(result, "Format: %hhu", format_length); + if(format_length == 26) { uint8_t facility; bit_lib_copy_bits(&facility, 0, 8, decoded_data, 9); @@ -195,9 +201,14 @@ void protocol_awid_render_brief_data(ProtocolAwid* protocol, FuriString* result) uint16_t card_id; bit_lib_copy_bits((uint8_t*)&card_id, 8, 8, decoded_data, 17); bit_lib_copy_bits((uint8_t*)&card_id, 0, 8, decoded_data, 25); - furi_string_cat_printf(result, "ID: %03u,%05u", facility, card_id); + furi_string_cat_printf( + result, + "; FC: %hhu\n" + "Card: %hu", + facility, + card_id); } else { - furi_string_cat_printf(result, "Data: unknown"); + furi_string_cat(result, "\nData: Unknown"); } }; @@ -252,4 +263,4 @@ const ProtocolBase protocol_awid = { .render_data = (ProtocolRenderData)protocol_awid_render_data, .render_brief_data = (ProtocolRenderData)protocol_awid_render_brief_data, .write_data = (ProtocolWriteData)protocol_awid_write_data, -}; \ No newline at end of file +}; diff --git a/lib/lfrfid/protocols/protocol_em4100.c b/lib/lfrfid/protocols/protocol_em4100.c index 38452007f3..055d06d868 100644 --- a/lib/lfrfid/protocols/protocol_em4100.c +++ b/lib/lfrfid/protocols/protocol_em4100.c @@ -330,7 +330,8 @@ void protocol_em4100_render_data(ProtocolEM4100* protocol, FuriString* result) { uint8_t* data = protocol->data; furi_string_printf( result, - "FC: %03u, Card: %05u (RF/%u)", + "FC: %03u\n" + "Card: %05hu (RF/%hhu)", data[2], (uint16_t)((data[3] << 8) | (data[4])), protocol->clock_per_bit); diff --git a/lib/lfrfid/protocols/protocol_fdx_a.c b/lib/lfrfid/protocols/protocol_fdx_a.c index 667c4f88db..f7852eb101 100644 --- a/lib/lfrfid/protocols/protocol_fdx_a.c +++ b/lib/lfrfid/protocols/protocol_fdx_a.c @@ -217,14 +217,10 @@ void protocol_fdx_a_render_data(ProtocolFDXA* protocol, FuriString* result) { furi_string_printf( result, - "ID: %02X%02X%02X%02X%02X\r\n" - "Parity: %s", - data[0], - data[1], - data[2], - data[3], - data[4], - parity_sum == 0 ? "+" : "-"); + "ID: %010llX\n" + "Parity: %c", + bit_lib_get_bits_64(data, 0, 40), + parity_sum == 0 ? '+' : '-'); }; const ProtocolBase protocol_fdx_a = { @@ -249,4 +245,4 @@ const ProtocolBase protocol_fdx_a = { .render_data = (ProtocolRenderData)protocol_fdx_a_render_data, .render_brief_data = (ProtocolRenderData)protocol_fdx_a_render_data, .write_data = (ProtocolWriteData)protocol_fdx_a_write_data, -}; \ No newline at end of file +}; diff --git a/lib/lfrfid/protocols/protocol_fdx_b.c b/lib/lfrfid/protocols/protocol_fdx_b.c index 18ccfa7029..a5af855e48 100644 --- a/lib/lfrfid/protocols/protocol_fdx_b.c +++ b/lib/lfrfid/protocols/protocol_fdx_b.c @@ -288,21 +288,33 @@ void protocol_fdx_b_render_data(ProtocolFDXB* protocol, FuriString* result) { uint8_t replacement_number = bit_lib_get_bits(protocol->data, 60, 3); bool animal_flag = bit_lib_get_bit(protocol->data, 63); - furi_string_printf(result, "ID: %03u-%012llu\r\n", country_code, national_code); - furi_string_cat_printf(result, "Animal: %s, ", animal_flag ? "Yes" : "No"); + furi_string_printf( + result, + "ID: %03hu-%012llu\n" + "Country Code: %hu\n" + "Temperature: ", + country_code, + national_code, + country_code); float temperature; if(protocol_fdx_b_get_temp(protocol->data, &temperature)) { - float temperature_c = (temperature - 32) / 1.8; - furi_string_cat_printf( - result, "T: %.2fF, %.2fC\r\n", (double)temperature, (double)temperature_c); + if(furi_hal_rtc_get_locale_units() == FuriHalRtcLocaleUnitsMetric) { + float temperature_c = (temperature - 32.0f) / 1.8f; + furi_string_cat_printf(result, "%.2fC", (double)temperature_c); + } else { + furi_string_cat_printf(result, "%.2fF", (double)temperature); + } } else { - furi_string_cat_printf(result, "T: ---\r\n"); + furi_string_cat(result, "---"); } furi_string_cat_printf( result, - "Bits: %X-%X-%X-%X-%X", + "\n" + "Animal: %s\n" + "Bits: %hhX-%hhX-%hhX-%hhX-%hhX", + animal_flag ? "Yes" : "No", block_status, rudi_bit, reserved, @@ -317,21 +329,24 @@ void protocol_fdx_b_render_brief_data(ProtocolFDXB* protocol, FuriString* result // 10 bit of country code uint16_t country_code = protocol_fdx_b_get_country_code(protocol->data); - bool animal_flag = bit_lib_get_bit(protocol->data, 63); - - furi_string_printf(result, "ID: %03u-%012llu\r\n", country_code, national_code); - furi_string_cat_printf(result, "Animal: %s, ", animal_flag ? "Yes" : "No"); + furi_string_printf( + result, + "ID: %03hu-%012llu\n" + "Country: %hu; Temp.: ", + country_code, + national_code, + country_code); float temperature; if(protocol_fdx_b_get_temp(protocol->data, &temperature)) { if(furi_hal_rtc_get_locale_units() == FuriHalRtcLocaleUnitsMetric) { float temperature_c = (temperature - 32.0f) / 1.8f; - furi_string_cat_printf(result, "T: %.2fC", (double)temperature_c); + furi_string_cat_printf(result, "%.2fC", (double)temperature_c); } else { - furi_string_cat_printf(result, "T: %.2fF", (double)temperature); + furi_string_cat_printf(result, "%.2fF", (double)temperature); } } else { - furi_string_cat_printf(result, "T: ---"); + furi_string_cat(result, "---"); } }; @@ -380,4 +395,4 @@ const ProtocolBase protocol_fdx_b = { .render_data = (ProtocolRenderData)protocol_fdx_b_render_data, .render_brief_data = (ProtocolRenderData)protocol_fdx_b_render_brief_data, .write_data = (ProtocolWriteData)protocol_fdx_b_write_data, -}; \ No newline at end of file +}; diff --git a/lib/lfrfid/protocols/protocol_gallagher.c b/lib/lfrfid/protocols/protocol_gallagher.c index 15bebb90bd..b00c14acd1 100644 --- a/lib/lfrfid/protocols/protocol_gallagher.c +++ b/lib/lfrfid/protocols/protocol_gallagher.c @@ -268,17 +268,44 @@ bool protocol_gallagher_write_data(ProtocolGallagher* protocol, void* data) { return result; }; -void protocol_gallagher_render_data(ProtocolGallagher* protocol, FuriString* result) { - UNUSED(protocol); - uint8_t rc = bit_lib_get_bits(protocol->data, 0, 4); - uint8_t il = bit_lib_get_bits(protocol->data, 4, 4); +static void protocol_gallagher_render_data_internal( + ProtocolGallagher* protocol, + FuriString* result, + bool brief) { + uint8_t region = bit_lib_get_bits(protocol->data, 0, 4); + uint8_t issue_level = bit_lib_get_bits(protocol->data, 4, 4); uint32_t fc = bit_lib_get_bits_32(protocol->data, 8, 24); uint32_t card_id = bit_lib_get_bits_32(protocol->data, 32, 32); - furi_string_cat_printf(result, "Region: %u, Issue Level: %u\r\n", rc, il); - furi_string_cat_printf(result, "FC: %lu, C: %lu\r\n", fc, card_id); + if(brief) { + furi_string_printf( + result, + "FC: %lu\n" + "Card: %lu", + fc, + card_id); + } else { + furi_string_printf( + result, + "FC: %lu\n" + "Card: %lu\n" + "Region: %u\n" + "Issue Level: %u", + fc, + card_id, + region, + issue_level); + } }; +void protocol_gallagher_render_data(ProtocolGallagher* protocol, FuriString* result) { + protocol_gallagher_render_data_internal(protocol, result, false); +} + +void protocol_gallagher_render_brief_data(ProtocolGallagher* protocol, FuriString* result) { + protocol_gallagher_render_data_internal(protocol, result, true); +} + const ProtocolBase protocol_gallagher = { .name = "Gallagher", .manufacturer = "Gallagher", @@ -299,6 +326,6 @@ const ProtocolBase protocol_gallagher = { .yield = (ProtocolEncoderYield)protocol_gallagher_encoder_yield, }, .render_data = (ProtocolRenderData)protocol_gallagher_render_data, - .render_brief_data = (ProtocolRenderData)protocol_gallagher_render_data, + .render_brief_data = (ProtocolRenderData)protocol_gallagher_render_brief_data, .write_data = (ProtocolWriteData)protocol_gallagher_write_data, -}; \ No newline at end of file +}; diff --git a/lib/lfrfid/protocols/protocol_h10301.c b/lib/lfrfid/protocols/protocol_h10301.c index 2d7a3e669e..6c6d5771ac 100644 --- a/lib/lfrfid/protocols/protocol_h10301.c +++ b/lib/lfrfid/protocols/protocol_h10301.c @@ -359,8 +359,8 @@ void protocol_h10301_render_data(ProtocolH10301* protocol, FuriString* result) { uint8_t* data = protocol->data; furi_string_printf( result, - "FC: %u\r\n" - "Card: %u", + "FC: %hhu\n" + "Card: %hu", data[0], (uint16_t)((data[1] << 8) | (data[2]))); }; @@ -387,4 +387,4 @@ const ProtocolBase protocol_h10301 = { .render_data = (ProtocolRenderData)protocol_h10301_render_data, .render_brief_data = (ProtocolRenderData)protocol_h10301_render_data, .write_data = (ProtocolWriteData)protocol_h10301_write_data, -}; \ No newline at end of file +}; diff --git a/lib/lfrfid/protocols/protocol_hid_ex_generic.c b/lib/lfrfid/protocols/protocol_hid_ex_generic.c index 194e153289..efc7a5190c 100644 --- a/lib/lfrfid/protocols/protocol_hid_ex_generic.c +++ b/lib/lfrfid/protocols/protocol_hid_ex_generic.c @@ -193,9 +193,13 @@ bool protocol_hid_ex_generic_write_data(ProtocolHIDEx* protocol, void* data) { }; void protocol_hid_ex_generic_render_data(ProtocolHIDEx* protocol, FuriString* result) { - // TODO FL-3518: parser and render functions UNUSED(protocol); - furi_string_printf(result, "Generic HID Extended\r\nData: Unknown"); + + // TODO FL-3518: parser and render functions + furi_string_set( + result, + "Type: Generic HID Extended\n" + "Data: Unknown"); }; const ProtocolBase protocol_hid_ex_generic = { @@ -220,4 +224,4 @@ const ProtocolBase protocol_hid_ex_generic = { .render_data = (ProtocolRenderData)protocol_hid_ex_generic_render_data, .render_brief_data = (ProtocolRenderData)protocol_hid_ex_generic_render_data, .write_data = (ProtocolWriteData)protocol_hid_ex_generic_write_data, -}; \ No newline at end of file +}; diff --git a/lib/lfrfid/protocols/protocol_hid_generic.c b/lib/lfrfid/protocols/protocol_hid_generic.c index e24b5ade71..1a95288855 100644 --- a/lib/lfrfid/protocols/protocol_hid_generic.c +++ b/lib/lfrfid/protocols/protocol_hid_generic.c @@ -245,7 +245,7 @@ void protocol_hid_generic_render_data(ProtocolHID* protocol, FuriString* result) if(protocol_size == HID_PROTOCOL_SIZE_UNKNOWN) { furi_string_printf( result, - "Generic HID Proximity\r\n" + "Generic HID Proximity\n" "Data: %02X%02X%02X%02X%02X%X", protocol->data[0], protocol->data[1], @@ -256,7 +256,7 @@ void protocol_hid_generic_render_data(ProtocolHID* protocol, FuriString* result) } else { furi_string_printf( result, - "%hhu-bit HID Proximity\r\n" + "%hhu-bit HID Proximity\n" "Data: ", protocol_size); protocol_hid_generic_string_cat_protocol_bits(protocol, protocol_size, result); diff --git a/lib/lfrfid/protocols/protocol_idteck.c b/lib/lfrfid/protocols/protocol_idteck.c index 6de8de2060..2075576bae 100644 --- a/lib/lfrfid/protocols/protocol_idteck.c +++ b/lib/lfrfid/protocols/protocol_idteck.c @@ -205,26 +205,16 @@ static uint32_t get_card(const uint8_t* data) { return cn; } -void protocol_idteck_render_data_internal(ProtocolIdteck* protocol, FuriString* result, bool brief) { +void protocol_idteck_render_data(ProtocolIdteck* protocol, FuriString* result) { const uint32_t fc = get_fc(protocol->data); const uint32_t card = get_card(protocol->data); - if(brief) { - furi_string_printf(result, "FC: %08lX\r\nCard: %08lX", fc, card); - } else { - furi_string_printf( - result, - "FC: %08lX\r\n" - "Card: %08lX\r\n", - fc, - card); - } -} -void protocol_idteck_render_data(ProtocolIdteck* protocol, FuriString* result) { - protocol_idteck_render_data_internal(protocol, result, false); -} -void protocol_idteck_render_brief_data(ProtocolIdteck* protocol, FuriString* result) { - protocol_idteck_render_data_internal(protocol, result, true); + furi_string_printf( + result, + "FC: %08lX\n" + "Card: %08lX", + fc, + card); } bool protocol_idteck_write_data(ProtocolIdteck* protocol, void* data) { @@ -264,6 +254,6 @@ const ProtocolBase protocol_idteck = { .yield = (ProtocolEncoderYield)protocol_idteck_encoder_yield, }, .render_data = (ProtocolRenderData)protocol_idteck_render_data, - .render_brief_data = (ProtocolRenderData)protocol_idteck_render_brief_data, + .render_brief_data = (ProtocolRenderData)protocol_idteck_render_data, .write_data = (ProtocolWriteData)protocol_idteck_write_data, -}; \ No newline at end of file +}; diff --git a/lib/lfrfid/protocols/protocol_indala26.c b/lib/lfrfid/protocols/protocol_indala26.c index 7ce83af7fa..893361abb2 100644 --- a/lib/lfrfid/protocols/protocol_indala26.c +++ b/lib/lfrfid/protocols/protocol_indala26.c @@ -289,22 +289,21 @@ void protocol_indala26_render_data_internal( if(brief) { furi_string_printf( result, - "FC: %u\r\nCard: %u, Parity:%s%s", + "FC: %u\n" + "Card: %u", fc, - card, - (checksum_correct ? "+" : "-"), - (wiegand_correct ? "+" : "-")); + card); } else { furi_string_printf( result, - "FC: %u\r\n" - "Card: %u\r\n" - "Checksum: %s\r\n" - "W26 Parity: %s", + "FC: %u\n" + "Card: %u\n" + "Parity: %c\n" + "Checksum: %c", fc, card, - (checksum_correct ? "+" : "-"), - (wiegand_correct ? "+" : "-")); + (wiegand_correct ? '+' : '-'), + (checksum_correct ? '+' : '-')); } } void protocol_indala26_render_data(ProtocolIndala* protocol, FuriString* result) { diff --git a/lib/lfrfid/protocols/protocol_io_prox_xsf.c b/lib/lfrfid/protocols/protocol_io_prox_xsf.c index 5cdc9064c7..b41cb66f3d 100644 --- a/lib/lfrfid/protocols/protocol_io_prox_xsf.c +++ b/lib/lfrfid/protocols/protocol_io_prox_xsf.c @@ -236,9 +236,9 @@ void protocol_io_prox_xsf_render_data(ProtocolIOProxXSF* protocol, FuriString* r uint8_t* data = protocol->data; furi_string_printf( result, - "FC: %u\r\n" - "VС: %u\r\n" - "Card: %u", + "FC: %hhu\n" + "V: %hhu\n" + "Card: %hu", data[0], data[1], (uint16_t)((data[2] << 8) | (data[3]))); @@ -248,8 +248,8 @@ void protocol_io_prox_xsf_render_brief_data(ProtocolIOProxXSF* protocol, FuriStr uint8_t* data = protocol->data; furi_string_printf( result, - "FC: %u, VС: %u\r\n" - "Card: %u", + "FC: %hhu, V: %hhu\n" + "Card: %hu", data[0], data[1], (uint16_t)((data[2] << 8) | (data[3]))); @@ -298,4 +298,4 @@ const ProtocolBase protocol_io_prox_xsf = { .render_data = (ProtocolRenderData)protocol_io_prox_xsf_render_data, .render_brief_data = (ProtocolRenderData)protocol_io_prox_xsf_render_brief_data, .write_data = (ProtocolWriteData)protocol_io_prox_xsf_write_data, -}; \ No newline at end of file +}; diff --git a/lib/lfrfid/protocols/protocol_jablotron.c b/lib/lfrfid/protocols/protocol_jablotron.c index 467002c7e0..c2cbb41744 100644 --- a/lib/lfrfid/protocols/protocol_jablotron.c +++ b/lib/lfrfid/protocols/protocol_jablotron.c @@ -162,7 +162,7 @@ LevelDuration protocol_jablotron_encoder_yield(ProtocolJablotron* protocol) { void protocol_jablotron_render_data(ProtocolJablotron* protocol, FuriString* result) { uint64_t id = protocol_jablotron_card_id(protocol->data); - furi_string_printf(result, "ID: %llX\r\n", id); + furi_string_printf(result, "Card: %llX", id); }; bool protocol_jablotron_write_data(ProtocolJablotron* protocol, void* data) { @@ -208,4 +208,4 @@ const ProtocolBase protocol_jablotron = { .render_data = (ProtocolRenderData)protocol_jablotron_render_data, .render_brief_data = (ProtocolRenderData)protocol_jablotron_render_data, .write_data = (ProtocolWriteData)protocol_jablotron_write_data, -}; \ No newline at end of file +}; diff --git a/lib/lfrfid/protocols/protocol_keri.c b/lib/lfrfid/protocols/protocol_keri.c index d994229d99..2cc7e8cdfc 100644 --- a/lib/lfrfid/protocols/protocol_keri.c +++ b/lib/lfrfid/protocols/protocol_keri.c @@ -212,13 +212,40 @@ LevelDuration protocol_keri_encoder_yield(ProtocolKeri* protocol) { return level_duration; }; -void protocol_keri_render_data(ProtocolKeri* protocol, FuriString* result) { +static void + protocol_keri_render_data_internal(ProtocolKeri* protocol, FuriString* result, bool brief) { uint32_t data = bit_lib_get_bits_32(protocol->data, 0, 32); uint32_t internal_id = data & 0x7FFFFFFF; uint32_t fc = 0; uint32_t cn = 0; protocol_keri_descramble(&fc, &cn, &data); - furi_string_printf(result, "Internal ID: %lu\r\nFC: %lu, Card: %lu\r\n", internal_id, fc, cn); + + if(brief) { + furi_string_printf( + result, + "Internal ID: %lu\n" + "FC: %lu; Card: %lu", + internal_id, + fc, + cn); + } else { + furi_string_printf( + result, + "Internal ID: %lu\n" + "FC: %lu\n" + "Card: %lu", + internal_id, + fc, + cn); + } +} + +void protocol_keri_render_data(ProtocolKeri* protocol, FuriString* result) { + protocol_keri_render_data_internal(protocol, result, false); +} + +void protocol_keri_render_brief_data(ProtocolKeri* protocol, FuriString* result) { + protocol_keri_render_data_internal(protocol, result, true); } bool protocol_keri_write_data(ProtocolKeri* protocol, void* data) { @@ -262,6 +289,6 @@ const ProtocolBase protocol_keri = { .yield = (ProtocolEncoderYield)protocol_keri_encoder_yield, }, .render_data = (ProtocolRenderData)protocol_keri_render_data, - .render_brief_data = (ProtocolRenderData)protocol_keri_render_data, + .render_brief_data = (ProtocolRenderData)protocol_keri_render_brief_data, .write_data = (ProtocolWriteData)protocol_keri_write_data, -}; \ No newline at end of file +}; diff --git a/lib/lfrfid/protocols/protocol_nexwatch.c b/lib/lfrfid/protocols/protocol_nexwatch.c index 938ef273d0..3df83be7ac 100644 --- a/lib/lfrfid/protocols/protocol_nexwatch.c +++ b/lib/lfrfid/protocols/protocol_nexwatch.c @@ -263,7 +263,10 @@ LevelDuration protocol_nexwatch_encoder_yield(ProtocolNexwatch* protocol) { return level_duration; }; -void protocol_nexwatch_render_data(ProtocolNexwatch* protocol, FuriString* result) { +static void protocol_nexwatch_render_data_internal( + ProtocolNexwatch* protocol, + FuriString* result, + bool brief) { uint32_t id = 0; uint32_t scrambled = bit_lib_get_bits_32(protocol->data, 8, 32); protocol_nexwatch_descramble(&id, &scrambled); @@ -272,13 +275,42 @@ void protocol_nexwatch_render_data(ProtocolNexwatch* protocol, FuriString* resul uint8_t mode = bit_lib_get_bits(protocol->data, 40, 4); uint8_t parity = bit_lib_get_bits(protocol->data, 44, 4); uint8_t chk = bit_lib_get_bits(protocol->data, 48, 8); - for(m_idx = 0; m_idx < 3; m_idx++) { + + for(m_idx = 0; m_idx < COUNT_OF(magic_items); m_idx++) { magic_items[m_idx].chk = protocol_nexwatch_checksum(magic_items[m_idx].magic, id, parity); if(magic_items[m_idx].chk == chk) { break; } } - furi_string_printf(result, "ID: %lu, M:%u\r\nType: %s\r\n", id, mode, magic_items[m_idx].desc); + + const char* type = m_idx < COUNT_OF(magic_items) ? magic_items[m_idx].desc : "Unknown"; + + if(brief) { + furi_string_printf( + result, + "ID: %lu\n" + "Mode: %hhu; Type: %s", + id, + mode, + type); + } else { + furi_string_printf( + result, + "ID: %lu\n" + "Mode: %hhu\n" + "Type: %s", + id, + mode, + type); + } +} + +void protocol_nexwatch_render_data(ProtocolNexwatch* protocol, FuriString* result) { + protocol_nexwatch_render_data_internal(protocol, result, false); +} + +void protocol_nexwatch_render_brief_data(ProtocolNexwatch* protocol, FuriString* result) { + protocol_nexwatch_render_data_internal(protocol, result, true); } bool protocol_nexwatch_write_data(ProtocolNexwatch* protocol, void* data) { @@ -318,6 +350,6 @@ const ProtocolBase protocol_nexwatch = { .yield = (ProtocolEncoderYield)protocol_nexwatch_encoder_yield, }, .render_data = (ProtocolRenderData)protocol_nexwatch_render_data, - .render_brief_data = (ProtocolRenderData)protocol_nexwatch_render_data, + .render_brief_data = (ProtocolRenderData)protocol_nexwatch_render_brief_data, .write_data = (ProtocolWriteData)protocol_nexwatch_write_data, }; diff --git a/lib/lfrfid/protocols/protocol_pac_stanley.c b/lib/lfrfid/protocols/protocol_pac_stanley.c index dc9eaaf493..67bc3bf48b 100644 --- a/lib/lfrfid/protocols/protocol_pac_stanley.c +++ b/lib/lfrfid/protocols/protocol_pac_stanley.c @@ -202,8 +202,7 @@ bool protocol_pac_stanley_write_data(ProtocolPACStanley* protocol, void* data) { } void protocol_pac_stanley_render_data(ProtocolPACStanley* protocol, FuriString* result) { - uint8_t* data = protocol->data; - furi_string_printf(result, "CIN: %02X%02X%02X%02X", data[0], data[1], data[2], data[3]); + furi_string_printf(result, "CIN: %08lX", bit_lib_get_bits_32(protocol->data, 0, 32)); } const ProtocolBase protocol_pac_stanley = { diff --git a/lib/lfrfid/protocols/protocol_paradox.c b/lib/lfrfid/protocols/protocol_paradox.c index b716acf7a3..bb52f0529c 100644 --- a/lib/lfrfid/protocols/protocol_paradox.c +++ b/lib/lfrfid/protocols/protocol_paradox.c @@ -171,10 +171,20 @@ void protocol_paradox_render_data(ProtocolParadox* protocol, FuriString* result) uint8_t card_crc = bit_lib_get_bits_16(decoded_data, 34, 8); uint8_t calc_crc = protocol_paradox_calculate_checksum(fc, card_id); - furi_string_cat_printf(result, "Facility: %u\r\n", fc); - furi_string_cat_printf(result, "Card: %u\r\n", card_id); - furi_string_cat_printf(result, "CRC: %u Calc CRC: %u\r\n", card_crc, calc_crc); - if(card_crc != calc_crc) furi_string_cat_printf(result, "CRC Mismatch, Invalid Card!\r\n"); + furi_string_printf( + result, + "FC: %hhu\n" + "Card: %hu\n" + "CRC: %hhu\n" + "Calc CRC: %hhu", + fc, + card_id, + card_crc, + calc_crc); + + if(card_crc != calc_crc) { + furi_string_cat(result, "\nCRC Mismatch, Invalid Card!"); + } }; void protocol_paradox_render_brief_data(ProtocolParadox* protocol, FuriString* result) { @@ -185,11 +195,10 @@ void protocol_paradox_render_brief_data(ProtocolParadox* protocol, FuriString* r uint8_t card_crc = bit_lib_get_bits_16(decoded_data, 34, 8); uint8_t calc_crc = protocol_paradox_calculate_checksum(fc, card_id); - furi_string_cat_printf(result, "FC: %03u, Card: %05u\r\n", fc, card_id); - if(calc_crc == card_crc) { - furi_string_cat_printf(result, "CRC : %03u", card_crc); - } else { - furi_string_cat_printf(result, "Card is Invalid!"); + furi_string_printf(result, "FC: %hhu; Card: %hu", fc, card_id); + + if(calc_crc != card_crc) { + furi_string_cat(result, "\nCRC Mismatch, Invalid Card!"); } }; @@ -237,4 +246,4 @@ const ProtocolBase protocol_paradox = { .render_data = (ProtocolRenderData)protocol_paradox_render_data, .render_brief_data = (ProtocolRenderData)protocol_paradox_render_brief_data, .write_data = (ProtocolWriteData)protocol_paradox_write_data, -}; \ No newline at end of file +}; diff --git a/lib/lfrfid/protocols/protocol_pyramid.c b/lib/lfrfid/protocols/protocol_pyramid.c index f0a506eb39..8711fe13a0 100644 --- a/lib/lfrfid/protocols/protocol_pyramid.c +++ b/lib/lfrfid/protocols/protocol_pyramid.c @@ -243,7 +243,7 @@ void protocol_pyramid_render_data(ProtocolPyramid* protocol, FuriString* result) uint8_t* decoded_data = protocol->data; uint8_t format_length = decoded_data[0]; - furi_string_cat_printf(result, "Format: %d\r\n", format_length); + furi_string_printf(result, "Format: %hhu\n", format_length); if(format_length == 26) { uint8_t facility; bit_lib_copy_bits(&facility, 0, 8, decoded_data, 8); @@ -251,9 +251,9 @@ void protocol_pyramid_render_data(ProtocolPyramid* protocol, FuriString* result) uint16_t card_id; bit_lib_copy_bits((uint8_t*)&card_id, 8, 8, decoded_data, 16); bit_lib_copy_bits((uint8_t*)&card_id, 0, 8, decoded_data, 24); - furi_string_cat_printf(result, "FC: %03u, Card: %05u", facility, card_id); + furi_string_cat_printf(result, "FC: %03hhu; Card: %05hu", facility, card_id); } else { - furi_string_cat_printf(result, "Data: unknown"); + furi_string_cat_printf(result, "Data: Unknown"); } }; diff --git a/lib/lfrfid/protocols/protocol_viking.c b/lib/lfrfid/protocols/protocol_viking.c index f5697012af..4989e4e681 100644 --- a/lib/lfrfid/protocols/protocol_viking.c +++ b/lib/lfrfid/protocols/protocol_viking.c @@ -176,8 +176,7 @@ bool protocol_viking_write_data(ProtocolViking* protocol, void* data) { }; void protocol_viking_render_data(ProtocolViking* protocol, FuriString* result) { - uint32_t id = bit_lib_get_bits_32(protocol->data, 0, 32); - furi_string_printf(result, "ID: %08lX\r\n", id); + furi_string_printf(result, "ID: %08lX", bit_lib_get_bits_32(protocol->data, 0, 32)); }; const ProtocolBase protocol_viking = { @@ -202,4 +201,4 @@ const ProtocolBase protocol_viking = { .render_data = (ProtocolRenderData)protocol_viking_render_data, .render_brief_data = (ProtocolRenderData)protocol_viking_render_data, .write_data = (ProtocolWriteData)protocol_viking_write_data, -}; \ No newline at end of file +}; diff --git a/lib/nfc/SConscript b/lib/nfc/SConscript index 41332362c8..82317918bd 100644 --- a/lib/nfc/SConscript +++ b/lib/nfc/SConscript @@ -48,6 +48,7 @@ env.Append( File("helpers/iso14443_crc.h"), File("helpers/iso13239_crc.h"), File("helpers/nfc_data_generator.h"), + File("helpers/crypto1.h"), ], ) diff --git a/lib/nfc/protocols/mf_classic/crypto1.c b/lib/nfc/helpers/crypto1.c similarity index 100% rename from lib/nfc/protocols/mf_classic/crypto1.c rename to lib/nfc/helpers/crypto1.c diff --git a/lib/nfc/protocols/mf_classic/crypto1.h b/lib/nfc/helpers/crypto1.h similarity index 100% rename from lib/nfc/protocols/mf_classic/crypto1.h rename to lib/nfc/helpers/crypto1.h diff --git a/lib/nfc/protocols/mf_classic/mf_classic_listener_i.h b/lib/nfc/protocols/mf_classic/mf_classic_listener_i.h index 5269743b5c..af22b5234f 100644 --- a/lib/nfc/protocols/mf_classic/mf_classic_listener_i.h +++ b/lib/nfc/protocols/mf_classic/mf_classic_listener_i.h @@ -3,7 +3,7 @@ #include "mf_classic_listener.h" #include #include -#include "crypto1.h" +#include #ifdef __cplusplus extern "C" { diff --git a/lib/nfc/protocols/mf_classic/mf_classic_poller_i.h b/lib/nfc/protocols/mf_classic/mf_classic_poller_i.h index a5af315307..14a7c61fd4 100644 --- a/lib/nfc/protocols/mf_classic/mf_classic_poller_i.h +++ b/lib/nfc/protocols/mf_classic/mf_classic_poller_i.h @@ -3,7 +3,7 @@ #include "mf_classic_poller.h" #include #include -#include "crypto1.h" +#include #ifdef __cplusplus extern "C" { diff --git a/lib/nfc/protocols/mf_desfire/mf_desfire_poller.c b/lib/nfc/protocols/mf_desfire/mf_desfire_poller.c index 246107616d..c9d8bbab60 100644 --- a/lib/nfc/protocols/mf_desfire/mf_desfire_poller.c +++ b/lib/nfc/protocols/mf_desfire/mf_desfire_poller.c @@ -225,9 +225,17 @@ static bool mf_desfire_poller_detect(NfcGenericEvent event, void* context) { bool protocol_detected = false; if(iso14443_4a_event->type == Iso14443_4aPollerEventTypeReady) { - MfDesfireKeyVersion key_version = {0}; - MfDesfireError error = mf_desfire_poller_read_key_version(instance, 0, &key_version); - protocol_detected = (error == MfDesfireErrorNone); + do { + MfDesfireKeyVersion key_version = 0; + MfDesfireError error = mf_desfire_poller_read_key_version(instance, 0, &key_version); + if(error != MfDesfireErrorNone) break; + + MfDesfireVersion version = {}; + error = mf_desfire_poller_read_version(instance, &version); + if(error != MfDesfireErrorNone) break; + + protocol_detected = true; + } while(false); } return protocol_detected; diff --git a/scripts/fbt_tools/fbt_apps.py b/scripts/fbt_tools/fbt_apps.py index 7e0aec5ea6..3a17a79a34 100644 --- a/scripts/fbt_tools/fbt_apps.py +++ b/scripts/fbt_tools/fbt_apps.py @@ -44,7 +44,7 @@ def __init__(self, buildset: AppBuildset, autorun_app: str = ""): def get_app_ep_forward(self, app: FlipperApplication): if app.apptype == FlipperAppType.STARTUP: - return f"extern void {app.entry_point}();" + return f"extern void {app.entry_point}(void);" return f"extern int32_t {app.entry_point}(void* p);" def get_app_descr(self, app: FlipperApplication): diff --git a/scripts/fbt_tools/pvsstudio.py b/scripts/fbt_tools/pvsstudio.py index d74aae7686..290531321d 100644 --- a/scripts/fbt_tools/pvsstudio.py +++ b/scripts/fbt_tools/pvsstudio.py @@ -32,7 +32,7 @@ def atexist_handler(): for bf in GetBuildFailures(): for node in Flatten(bf.node): - if node.exists and "pvs" in node.name and node.name.endswith(".html"): + if node.exists and "pvs" in node.path and node.name.endswith(".html"): # macOS if sys.platform == "darwin": subprocess.run(["open", node.abspath]) diff --git a/scripts/ufbt/SConstruct b/scripts/ufbt/SConstruct index 11fefd22b5..784d661612 100644 --- a/scripts/ufbt/SConstruct +++ b/scripts/ufbt/SConstruct @@ -393,7 +393,9 @@ for template_file in project_template_dir.Dir(".vscode").glob("*"): ), "@UFBT_APP_DIR@": PosixPathWrapper.fix_path(original_app_dir.abspath), "@UFBT_ROOT_DIR@": PosixPathWrapper.fix_path(Dir("#").abspath), - "@UFBT_DEBUG_DIR@": dist_env.subst("FBT_DEBUG_DIR"), + "@UFBT_DEBUG_DIR@": PosixPathWrapper.fix_path( + dist_env.subst("$FBT_DEBUG_DIR") + ), "@UFBT_DEBUG_ELF_DIR@": PosixPathWrapper.fix_path( dist_env["FBT_FAP_DEBUG_ELF_ROOT"].abspath ), diff --git a/scripts/ufbt/project_template/.vscode/tasks.json b/scripts/ufbt/project_template/.vscode/tasks.json index 65c749e07b..16ef12836b 100644 --- a/scripts/ufbt/project_template/.vscode/tasks.json +++ b/scripts/ufbt/project_template/.vscode/tasks.json @@ -31,28 +31,22 @@ "command": "ufbt -c" }, { - "label": "Flash FW (ST-Link)", + "label": "Flash FW (SWD)", "group": "build", "type": "shell", "command": "ufbt FORCE=1 flash" }, { - "label": "Flash FW (blackmagic)", - "group": "build", - "type": "shell", - "command": "ufbt flash_blackmagic" - }, - { - "label": "Flash FW (JLink)", + "label": "Flash FW (USB, with resources)", "group": "build", "type": "shell", - "command": "ufbt FORCE=1 jflash" + "command": "ufbt FORCE=1 flash_usb" }, { - "label": "Flash FW (USB, with resources)", + "label": "Open Flipper CLI session", "group": "build", "type": "shell", - "command": "ufbt FORCE=1 flash_usb" + "command": "ufbt cli" }, { "label": "Update uFBT SDK", @@ -61,7 +55,7 @@ "command": "ufbt update" }, { - "label": "Update VSCode config for current SDK", + "label": "Update VSCode config", "group": "build", "type": "shell", "command": "ufbt vscode_dist" diff --git a/site_scons/cc.scons b/site_scons/cc.scons index 507cd2d12c..603ec621c6 100644 --- a/site_scons/cc.scons +++ b/site_scons/cc.scons @@ -4,6 +4,7 @@ Import("ENV") ENV.AppendUnique( CFLAGS=[ "-std=gnu2x", + "-Wstrict-prototypes", ], CXXFLAGS=[ "-std=c++20", diff --git a/site_scons/extapps.scons b/site_scons/extapps.scons index 22d0be8677..b67ce96218 100644 --- a/site_scons/extapps.scons +++ b/site_scons/extapps.scons @@ -48,6 +48,9 @@ appenv.AppendUnique( "stdc++", "supc++", ], + CFLAGS=[ + "-Wno-strict-prototypes", + ], ) diff --git a/targets/f18/api_symbols.csv b/targets/f18/api_symbols.csv index 7a81367059..72116ccfdf 100644 --- a/targets/f18/api_symbols.csv +++ b/targets/f18/api_symbols.csv @@ -1,5 +1,5 @@ entry,status,name,type,params -Version,+,60.3,, +Version,+,60.5,, Header,+,applications/services/bt/bt_service/bt.h,, Header,+,applications/services/cli/cli.h,, Header,+,applications/services/cli/cli_vcp.h,, @@ -2450,7 +2450,7 @@ Function,+,storage_simply_remove,_Bool,"Storage*, const char*" Function,+,storage_simply_remove_recursive,_Bool,"Storage*, const char*" Function,-,stpcpy,char*,"char*, const char*" Function,-,stpncpy,char*,"char*, const char*, size_t" -Function,-,strcasecmp,int,"const char*, const char*" +Function,+,strcasecmp,int,"const char*, const char*" Function,-,strcasecmp_l,int,"const char*, const char*, locale_t" Function,+,strcasestr,char*,"const char*, const char*" Function,-,strcat,char*,"char*, const char*" diff --git a/targets/f7/api_symbols.csv b/targets/f7/api_symbols.csv index bfc0507995..4ddff921bc 100644 --- a/targets/f7/api_symbols.csv +++ b/targets/f7/api_symbols.csv @@ -1,5 +1,5 @@ entry,status,name,type,params -Version,+,60.3,, +Version,+,60.5,, Header,+,applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.h,, Header,+,applications/services/bt/bt_service/bt.h,, Header,+,applications/services/cli/cli.h,, @@ -123,6 +123,7 @@ Header,+,lib/music_worker/music_worker.h,, Header,+,lib/nanopb/pb.h,, Header,+,lib/nanopb/pb_decode.h,, Header,+,lib/nanopb/pb_encode.h,, +Header,+,lib/nfc/helpers/crypto1.h,, Header,+,lib/nfc/helpers/iso13239_crc.h,, Header,+,lib/nfc/helpers/iso14443_crc.h,, Header,+,lib/nfc/helpers/nfc_data_generator.h,, @@ -853,6 +854,16 @@ Function,-,coshl,long double,long double Function,-,cosl,long double,long double Function,+,crc32_calc_buffer,uint32_t,"uint32_t, const void*, size_t" Function,+,crc32_calc_file,uint32_t,"File*, const FileCrcProgressCb, void*" +Function,+,crypto1_alloc,Crypto1*, +Function,+,crypto1_bit,uint8_t,"Crypto1*, uint8_t, int" +Function,+,crypto1_byte,uint8_t,"Crypto1*, uint8_t, int" +Function,+,crypto1_decrypt,void,"Crypto1*, const BitBuffer*, BitBuffer*" +Function,+,crypto1_encrypt,void,"Crypto1*, uint8_t*, const BitBuffer*, BitBuffer*" +Function,+,crypto1_encrypt_reader_nonce,void,"Crypto1*, uint64_t, uint32_t, uint8_t*, uint8_t*, BitBuffer*, _Bool" +Function,+,crypto1_free,void,Crypto1* +Function,+,crypto1_init,void,"Crypto1*, uint64_t" +Function,+,crypto1_reset,void,Crypto1* +Function,+,crypto1_word,uint32_t,"Crypto1*, uint32_t, int" Function,-,ctermid,char*,char* Function,-,cuserid,char*,char* Function,+,datetime_datetime_to_timestamp,uint32_t,DateTime* @@ -2782,6 +2793,7 @@ Function,+,powf,float,"float, float" Function,-,powl,long double,"long double, long double" Function,+,pretty_format_bytes_hex_canonical,void,"FuriString*, size_t, const char*, const uint8_t*, size_t" Function,-,printf,int,"const char*, ..." +Function,+,prng_successor,uint32_t,"uint32_t, uint32_t" Function,+,property_value_out,void,"PropertyValueContext*, const char*, unsigned int, ..." Function,+,protocol_dict_alloc,ProtocolDict*,"const ProtocolBase**, size_t" Function,+,protocol_dict_decoders_feed,ProtocolId,"ProtocolDict*, _Bool, uint32_t" @@ -3058,7 +3070,7 @@ Function,+,storage_simply_remove,_Bool,"Storage*, const char*" Function,+,storage_simply_remove_recursive,_Bool,"Storage*, const char*" Function,-,stpcpy,char*,"char*, const char*" Function,-,stpncpy,char*,"char*, const char*, size_t" -Function,-,strcasecmp,int,"const char*, const char*" +Function,+,strcasecmp,int,"const char*, const char*" Function,-,strcasecmp_l,int,"const char*, const char*, locale_t" Function,+,strcasestr,char*,"const char*, const char*" Function,-,strcat,char*,"char*, const char*" diff --git a/targets/f7/ble_glue/ble_glue.c b/targets/f7/ble_glue/ble_glue.c index ecc2f83c51..c50360361f 100644 --- a/targets/f7/ble_glue/ble_glue.c +++ b/targets/f7/ble_glue/ble_glue.c @@ -49,7 +49,7 @@ static BleGlue* ble_glue = NULL; // static int32_t ble_glue_shci_thread(void* argument); static void ble_sys_status_not_callback(SHCI_TL_CmdStatus_t status); static void ble_sys_user_event_callback(void* pPayload); -static void ble_glue_clear_shared_memory(); +static void ble_glue_clear_shared_memory(void); void ble_glue_set_key_storage_changed_callback( BleGlueKeyStorageChangedCallback callback, diff --git a/targets/f7/ble_glue/gap.c b/targets/f7/ble_glue/gap.c index fded66a9b4..8f4299c701 100644 --- a/targets/f7/ble_glue/gap.c +++ b/targets/f7/ble_glue/gap.c @@ -375,7 +375,7 @@ static void gap_advertise_start(GapState new_state) { uint16_t min_interval; uint16_t max_interval; - FURI_LOG_I(TAG, "Start: %d", new_state); + FURI_LOG_D(TAG, "Start: %d", new_state); if(new_state == GapStateAdvFast) { min_interval = 0x80; // 80 ms @@ -420,7 +420,7 @@ static void gap_advertise_start(GapState new_state) { } static void gap_advertise_stop(void) { - FURI_LOG_I(TAG, "Stop"); + FURI_LOG_D(TAG, "Stop"); tBleStatus ret; if(gap->state > GapStateIdle) { if(gap->state == GapStateConnected) { diff --git a/targets/f7/ble_glue/hw_ipcc.c b/targets/f7/ble_glue/hw_ipcc.c index 6a3aace5a0..4daaa7e49d 100644 --- a/targets/f7/ble_glue/hw_ipcc.c +++ b/targets/f7/ble_glue/hw_ipcc.c @@ -15,14 +15,14 @@ (LL_C2_IPCC_IsActiveFlag_CHx(IPCC, channel) && \ LL_C1_IPCC_IsEnabledReceiveChannel(IPCC, channel)) -static void (*FreeBufCb)(); +static void (*FreeBufCb)(void); -static void HW_IPCC_BLE_EvtHandler(); -static void HW_IPCC_BLE_AclDataEvtHandler(); -static void HW_IPCC_MM_FreeBufHandler(); -static void HW_IPCC_SYS_CmdEvtHandler(); -static void HW_IPCC_SYS_EvtHandler(); -static void HW_IPCC_TRACES_EvtHandler(); +static void HW_IPCC_BLE_EvtHandler(void); +static void HW_IPCC_BLE_AclDataEvtHandler(void); +static void HW_IPCC_MM_FreeBufHandler(void); +static void HW_IPCC_SYS_CmdEvtHandler(void); +static void HW_IPCC_SYS_EvtHandler(void); +static void HW_IPCC_TRACES_EvtHandler(void); void HW_IPCC_Rx_Handler(void) { if(HW_IPCC_RX_PENDING(HW_IPCC_SYSTEM_EVENT_CHANNEL)) { @@ -134,7 +134,7 @@ static void HW_IPCC_SYS_EvtHandler(void) { LL_C1_IPCC_ClearFlag_CHx(IPCC, HW_IPCC_SYSTEM_EVENT_CHANNEL); } -void HW_IPCC_MM_SendFreeBuf(void (*cb)()) { +void HW_IPCC_MM_SendFreeBuf(void (*cb)(void)) { if(LL_C1_IPCC_IsActiveFlag_CHx(IPCC, HW_IPCC_MM_RELEASE_BUFFER_CHANNEL)) { FreeBufCb = cb; LL_C1_IPCC_EnableTransmitChannel(IPCC, HW_IPCC_MM_RELEASE_BUFFER_CHANNEL); diff --git a/targets/f7/furi_hal/furi_hal_infrared.c b/targets/f7/furi_hal/furi_hal_infrared.c index bbb00198e3..a0b166fad4 100644 --- a/targets/f7/furi_hal/furi_hal_infrared.c +++ b/targets/f7/furi_hal/furi_hal_infrared.c @@ -92,8 +92,8 @@ static void furi_hal_infrared_tx_dma_set_polarity(uint8_t buf_num, uint8_t polar static void furi_hal_infrared_tx_dma_set_buffer(uint8_t buf_num); static void furi_hal_infrared_tx_fill_buffer_last(uint8_t buf_num); static uint8_t furi_hal_infrared_get_current_dma_tx_buffer(void); -static void furi_hal_infrared_tx_dma_polarity_isr(); -static void furi_hal_infrared_tx_dma_isr(); +static void furi_hal_infrared_tx_dma_polarity_isr(void*); +static void furi_hal_infrared_tx_dma_isr(void*); static void furi_hal_infrared_tim_rx_isr(void* context) { UNUSED(context); @@ -357,7 +357,7 @@ static void furi_hal_infrared_configure_tim_pwm_tx(uint32_t freq, float duty_cyc if(infrared_tx_output == FuriHalInfraredTxPinInternal) { LL_TIM_OC_SetCompareCH3( INFRARED_DMA_TIMER, - ((LL_TIM_GetAutoReload(INFRARED_DMA_TIMER) + 1) * (1 - duty_cycle))); + ((LL_TIM_GetAutoReload(INFRARED_DMA_TIMER) + 1) * (1.0f - duty_cycle))); LL_TIM_OC_EnablePreload(INFRARED_DMA_TIMER, LL_TIM_CHANNEL_CH3); /* LL_TIM_OCMODE_PWM2 set by DMA */ LL_TIM_OC_SetMode(INFRARED_DMA_TIMER, LL_TIM_CHANNEL_CH3, LL_TIM_OCMODE_FORCED_INACTIVE); @@ -368,7 +368,7 @@ static void furi_hal_infrared_configure_tim_pwm_tx(uint32_t freq, float duty_cyc } else if(infrared_tx_output == FuriHalInfraredTxPinExtPA7) { LL_TIM_OC_SetCompareCH1( INFRARED_DMA_TIMER, - ((LL_TIM_GetAutoReload(INFRARED_DMA_TIMER) + 1) * (1 - duty_cycle))); + ((LL_TIM_GetAutoReload(INFRARED_DMA_TIMER) + 1) * (1.0f - duty_cycle))); LL_TIM_OC_EnablePreload(INFRARED_DMA_TIMER, LL_TIM_CHANNEL_CH1); /* LL_TIM_OCMODE_PWM2 set by DMA */ LL_TIM_OC_SetMode(INFRARED_DMA_TIMER, LL_TIM_CHANNEL_CH1, LL_TIM_OCMODE_FORCED_INACTIVE); @@ -609,7 +609,7 @@ static void furi_hal_infrared_async_tx_free_resources(void) { } void furi_hal_infrared_async_tx_start(uint32_t freq, float duty_cycle) { - if((duty_cycle > 1) || (duty_cycle <= 0) || (freq > INFRARED_MAX_FREQUENCY) || + if((duty_cycle > 1.0f) || (duty_cycle <= 0.0f) || (freq > INFRARED_MAX_FREQUENCY) || (freq < INFRARED_MIN_FREQUENCY) || (infrared_tim_tx.data_callback == NULL)) { furi_crash(); } diff --git a/targets/f7/furi_hal/furi_hal_interrupt.c b/targets/f7/furi_hal/furi_hal_interrupt.c index a0ce2f6656..5c2c315ef4 100644 --- a/targets/f7/furi_hal/furi_hal_interrupt.c +++ b/targets/f7/furi_hal/furi_hal_interrupt.c @@ -305,8 +305,8 @@ void DebugMon_Handler(void) { extern usbd_device udev; -extern void HW_IPCC_Tx_Handler(); -extern void HW_IPCC_Rx_Handler(); +extern void HW_IPCC_Tx_Handler(void); +extern void HW_IPCC_Rx_Handler(void); void SysTick_Handler(void) { furi_hal_os_tick(); diff --git a/targets/f7/furi_hal/furi_hal_os.c b/targets/f7/furi_hal/furi_hal_os.c index 4738faa7cc..ba28a141f3 100644 --- a/targets/f7/furi_hal/furi_hal_os.c +++ b/targets/f7/furi_hal/furi_hal_os.c @@ -51,7 +51,7 @@ void furi_hal_os_timer_callback(void) { } #endif -extern void xPortSysTickHandler(); +extern void xPortSysTickHandler(void); static volatile uint32_t furi_hal_os_skew; diff --git a/targets/furi_hal_include/furi_hal_random.h b/targets/furi_hal_include/furi_hal_random.h index 051b6f928d..fab62083f1 100644 --- a/targets/furi_hal_include/furi_hal_random.h +++ b/targets/furi_hal_include/furi_hal_random.h @@ -6,12 +6,16 @@ extern "C" { #endif +#define FURI_HAL_RANDOM_MAX 0xFFFFFFFFU + /** Initialize random subsystem */ void furi_hal_random_init(void); /** Get random value + * furi_hal_random_get() gives up to FURI_HAL_RANDOM_MAX + * rand() and random() give up to RAND_MAX * - * @return random value + * @return 32 bit random value (up to FURI_HAL_RANDOM_MAX) */ uint32_t furi_hal_random_get(void);