Merge remote-tracking branch 'origin/dev' into release-candidate
This commit is contained in:
		
						commit
						ae95d75d2e
					
				| @ -5,7 +5,7 @@ | |||||||
| #include <stdbool.h> | #include <stdbool.h> | ||||||
| #include <toolbox/saved_struct.h> | #include <toolbox/saved_struct.h> | ||||||
| 
 | 
 | ||||||
| #define DESKTOP_SETTINGS_VER (3) | #define DESKTOP_SETTINGS_VER (4) | ||||||
| #define DESKTOP_SETTINGS_PATH "/int/desktop.settings" | #define DESKTOP_SETTINGS_PATH "/int/desktop.settings" | ||||||
| #define DESKTOP_SETTINGS_MAGIC (0x17) | #define DESKTOP_SETTINGS_MAGIC (0x17) | ||||||
| #define PIN_MAX_LENGTH 12 | #define PIN_MAX_LENGTH 12 | ||||||
| @ -37,7 +37,8 @@ typedef struct { | |||||||
| } PinCode; | } PinCode; | ||||||
| 
 | 
 | ||||||
| typedef struct { | typedef struct { | ||||||
|     uint16_t favorite; |     uint16_t favorite_primary; | ||||||
|  |     uint16_t favorite_secondary; | ||||||
|     PinCode pin_code; |     PinCode pin_code; | ||||||
|     uint8_t is_locked; |     uint8_t is_locked; | ||||||
|     uint32_t auto_lock_delay_ms; |     uint32_t auto_lock_delay_ms; | ||||||
|  | |||||||
| @ -38,5 +38,4 @@ typedef struct { | |||||||
|     bool pincode_buffer_filled; |     bool pincode_buffer_filled; | ||||||
| 
 | 
 | ||||||
|     uint8_t menu_idx; |     uint8_t menu_idx; | ||||||
| 
 |  | ||||||
| } DesktopSettingsApp; | } DesktopSettingsApp; | ||||||
|  | |||||||
| @ -21,8 +21,17 @@ void desktop_settings_scene_favorite_on_enter(void* context) { | |||||||
|             app); |             app); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     submenu_set_header(app->submenu, "Quick access app:"); |     uint32_t primary_favorite = | ||||||
|     submenu_set_selected_item(app->submenu, app->settings.favorite); |         scene_manager_get_scene_state(app->scene_manager, DesktopSettingsAppSceneFavorite); | ||||||
|  | 
 | ||||||
|  |     submenu_set_header( | ||||||
|  |         app->submenu, primary_favorite ? "Primary favorite app:" : "Secondary favorite app:"); | ||||||
|  | 
 | ||||||
|  |     if(primary_favorite) { | ||||||
|  |         submenu_set_selected_item(app->submenu, app->settings.favorite_primary); | ||||||
|  |     } else { | ||||||
|  |         submenu_set_selected_item(app->submenu, app->settings.favorite_secondary); | ||||||
|  |     } | ||||||
|     view_dispatcher_switch_to_view(app->view_dispatcher, DesktopSettingsAppViewMenu); |     view_dispatcher_switch_to_view(app->view_dispatcher, DesktopSettingsAppViewMenu); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -30,14 +39,17 @@ bool desktop_settings_scene_favorite_on_event(void* context, SceneManagerEvent e | |||||||
|     DesktopSettingsApp* app = context; |     DesktopSettingsApp* app = context; | ||||||
|     bool consumed = false; |     bool consumed = false; | ||||||
| 
 | 
 | ||||||
|  |     uint32_t primary_favorite = | ||||||
|  |         scene_manager_get_scene_state(app->scene_manager, DesktopSettingsAppSceneFavorite); | ||||||
|  | 
 | ||||||
|     if(event.type == SceneManagerEventTypeCustom) { |     if(event.type == SceneManagerEventTypeCustom) { | ||||||
|         switch(event.event) { |         if(primary_favorite) { | ||||||
|         default: |             app->settings.favorite_primary = event.event; | ||||||
|             app->settings.favorite = event.event; |         } else { | ||||||
|             scene_manager_previous_scene(app->scene_manager); |             app->settings.favorite_secondary = event.event; | ||||||
|             consumed = true; |  | ||||||
|             break; |  | ||||||
|         } |         } | ||||||
|  |         scene_manager_previous_scene(app->scene_manager); | ||||||
|  |         consumed = true; | ||||||
|     } |     } | ||||||
|     return consumed; |     return consumed; | ||||||
| } | } | ||||||
|  | |||||||
| @ -4,9 +4,10 @@ | |||||||
| #include "../desktop_settings_app.h" | #include "../desktop_settings_app.h" | ||||||
| #include "desktop_settings_scene.h" | #include "desktop_settings_scene.h" | ||||||
| 
 | 
 | ||||||
| #define SCENE_EVENT_SELECT_FAVORITE 0 | #define SCENE_EVENT_SELECT_FAVORITE_PRIMARY 0 | ||||||
| #define SCENE_EVENT_SELECT_PIN_SETUP 1 | #define SCENE_EVENT_SELECT_FAVORITE_SECONDARY 1 | ||||||
| #define SCENE_EVENT_SELECT_AUTO_LOCK_DELAY 2 | #define SCENE_EVENT_SELECT_PIN_SETUP 2 | ||||||
|  | #define SCENE_EVENT_SELECT_AUTO_LOCK_DELAY 3 | ||||||
| 
 | 
 | ||||||
| #define AUTO_LOCK_DELAY_COUNT 6 | #define AUTO_LOCK_DELAY_COUNT 6 | ||||||
| const char* const auto_lock_delay_text[AUTO_LOCK_DELAY_COUNT] = { | const char* const auto_lock_delay_text[AUTO_LOCK_DELAY_COUNT] = { | ||||||
| @ -41,7 +42,9 @@ void desktop_settings_scene_start_on_enter(void* context) { | |||||||
|     VariableItem* item; |     VariableItem* item; | ||||||
|     uint8_t value_index; |     uint8_t value_index; | ||||||
| 
 | 
 | ||||||
|     variable_item_list_add(variable_item_list, "Favorite App", 1, NULL, NULL); |     variable_item_list_add(variable_item_list, "Primary Favorite App", 1, NULL, NULL); | ||||||
|  | 
 | ||||||
|  |     variable_item_list_add(variable_item_list, "Secondary Favorite App", 1, NULL, NULL); | ||||||
| 
 | 
 | ||||||
|     variable_item_list_add(variable_item_list, "PIN Setup", 1, NULL, NULL); |     variable_item_list_add(variable_item_list, "PIN Setup", 1, NULL, NULL); | ||||||
| 
 | 
 | ||||||
| @ -68,7 +71,13 @@ bool desktop_settings_scene_start_on_event(void* context, SceneManagerEvent even | |||||||
| 
 | 
 | ||||||
|     if(event.type == SceneManagerEventTypeCustom) { |     if(event.type == SceneManagerEventTypeCustom) { | ||||||
|         switch(event.event) { |         switch(event.event) { | ||||||
|         case SCENE_EVENT_SELECT_FAVORITE: |         case SCENE_EVENT_SELECT_FAVORITE_PRIMARY: | ||||||
|  |             scene_manager_set_scene_state(app->scene_manager, DesktopSettingsAppSceneFavorite, 1); | ||||||
|  |             scene_manager_next_scene(app->scene_manager, DesktopSettingsAppSceneFavorite); | ||||||
|  |             consumed = true; | ||||||
|  |             break; | ||||||
|  |         case SCENE_EVENT_SELECT_FAVORITE_SECONDARY: | ||||||
|  |             scene_manager_set_scene_state(app->scene_manager, DesktopSettingsAppSceneFavorite, 0); | ||||||
|             scene_manager_next_scene(app->scene_manager, DesktopSettingsAppSceneFavorite); |             scene_manager_next_scene(app->scene_manager, DesktopSettingsAppSceneFavorite); | ||||||
|             consumed = true; |             consumed = true; | ||||||
|             break; |             break; | ||||||
|  | |||||||
| @ -103,16 +103,40 @@ bool desktop_scene_main_on_event(void* context, SceneManagerEvent event) { | |||||||
|             consumed = true; |             consumed = true; | ||||||
|             break; |             break; | ||||||
| 
 | 
 | ||||||
|         case DesktopMainEventOpenFavorite: |         case DesktopMainEventOpenPowerOff: { | ||||||
|  |             LoaderStatus status = loader_start(desktop->loader, "Power", "off"); | ||||||
|  |             if(status != LoaderStatusOk) { | ||||||
|  |                 FURI_LOG_E(TAG, "loader_start failed: %d", status); | ||||||
|  |             } | ||||||
|  |             consumed = true; | ||||||
|  |             break; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         case DesktopMainEventOpenFavoritePrimary: | ||||||
|             LOAD_DESKTOP_SETTINGS(&desktop->settings); |             LOAD_DESKTOP_SETTINGS(&desktop->settings); | ||||||
|             if(desktop->settings.favorite < FLIPPER_APPS_COUNT) { |             if(desktop->settings.favorite_primary < FLIPPER_APPS_COUNT) { | ||||||
|                 LoaderStatus status = loader_start( |                 LoaderStatus status = loader_start( | ||||||
|                     desktop->loader, FLIPPER_APPS[desktop->settings.favorite].name, NULL); |                     desktop->loader, FLIPPER_APPS[desktop->settings.favorite_primary].name, NULL); | ||||||
|                 if(status != LoaderStatusOk) { |                 if(status != LoaderStatusOk) { | ||||||
|                     FURI_LOG_E(TAG, "loader_start failed: %d", status); |                     FURI_LOG_E(TAG, "loader_start failed: %d", status); | ||||||
|                 } |                 } | ||||||
|             } else { |             } else { | ||||||
|                 FURI_LOG_E(TAG, "Can't find favorite application"); |                 FURI_LOG_E(TAG, "Can't find primary favorite application"); | ||||||
|  |             } | ||||||
|  |             consumed = true; | ||||||
|  |             break; | ||||||
|  |         case DesktopMainEventOpenFavoriteSecondary: | ||||||
|  |             LOAD_DESKTOP_SETTINGS(&desktop->settings); | ||||||
|  |             if(desktop->settings.favorite_secondary < FLIPPER_APPS_COUNT) { | ||||||
|  |                 LoaderStatus status = loader_start( | ||||||
|  |                     desktop->loader, | ||||||
|  |                     FLIPPER_APPS[desktop->settings.favorite_secondary].name, | ||||||
|  |                     NULL); | ||||||
|  |                 if(status != LoaderStatusOk) { | ||||||
|  |                     FURI_LOG_E(TAG, "loader_start failed: %d", status); | ||||||
|  |                 } | ||||||
|  |             } else { | ||||||
|  |                 FURI_LOG_E(TAG, "Can't find secondary favorite application"); | ||||||
|             } |             } | ||||||
|             consumed = true; |             consumed = true; | ||||||
|             break; |             break; | ||||||
|  | |||||||
| @ -3,10 +3,12 @@ | |||||||
| typedef enum { | typedef enum { | ||||||
|     DesktopMainEventOpenLockMenu, |     DesktopMainEventOpenLockMenu, | ||||||
|     DesktopMainEventOpenArchive, |     DesktopMainEventOpenArchive, | ||||||
|     DesktopMainEventOpenFavorite, |     DesktopMainEventOpenFavoritePrimary, | ||||||
|  |     DesktopMainEventOpenFavoriteSecondary, | ||||||
|     DesktopMainEventOpenMenu, |     DesktopMainEventOpenMenu, | ||||||
|     DesktopMainEventOpenDebug, |     DesktopMainEventOpenDebug, | ||||||
|     DesktopMainEventOpenPassport, /**< Broken, don't use it */ |     DesktopMainEventOpenPassport, /**< Broken, don't use it */ | ||||||
|  |     DesktopMainEventOpenPowerOff, | ||||||
| 
 | 
 | ||||||
|     DesktopLockedEventUnlocked, |     DesktopLockedEventUnlocked, | ||||||
|     DesktopLockedEventUpdate, |     DesktopLockedEventUpdate, | ||||||
|  | |||||||
| @ -13,8 +13,16 @@ struct DesktopMainView { | |||||||
|     View* view; |     View* view; | ||||||
|     DesktopMainViewCallback callback; |     DesktopMainViewCallback callback; | ||||||
|     void* context; |     void* context; | ||||||
|  |     TimerHandle_t poweroff_timer; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
|  | #define DESKTOP_MAIN_VIEW_POWEROFF_TIMEOUT 5000 | ||||||
|  | 
 | ||||||
|  | static void desktop_main_poweroff_timer_callback(TimerHandle_t timer) { | ||||||
|  |     DesktopMainView* main_view = pvTimerGetTimerID(timer); | ||||||
|  |     main_view->callback(DesktopMainEventOpenPowerOff, main_view->context); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void desktop_main_set_callback( | void desktop_main_set_callback( | ||||||
|     DesktopMainView* main_view, |     DesktopMainView* main_view, | ||||||
|     DesktopMainViewCallback callback, |     DesktopMainViewCallback callback, | ||||||
| @ -44,13 +52,26 @@ bool desktop_main_input(InputEvent* event, void* context) { | |||||||
|         } else if(event->key == InputKeyDown) { |         } else if(event->key == InputKeyDown) { | ||||||
|             main_view->callback(DesktopMainEventOpenArchive, main_view->context); |             main_view->callback(DesktopMainEventOpenArchive, main_view->context); | ||||||
|         } else if(event->key == InputKeyLeft) { |         } else if(event->key == InputKeyLeft) { | ||||||
|             main_view->callback(DesktopMainEventOpenFavorite, main_view->context); |             main_view->callback(DesktopMainEventOpenFavoritePrimary, main_view->context); | ||||||
|         } else if(event->key == InputKeyRight) { |         } else if(event->key == InputKeyRight) { | ||||||
|             main_view->callback(DesktopMainEventOpenPassport, main_view->context); |             main_view->callback(DesktopMainEventOpenPassport, main_view->context); | ||||||
|         } |         } | ||||||
|     } else if(event->type == InputTypeLong) { |     } else if(event->type == InputTypeLong) { | ||||||
|         if(event->key == InputKeyDown) { |         if(event->key == InputKeyDown) { | ||||||
|             main_view->callback(DesktopMainEventOpenDebug, main_view->context); |             main_view->callback(DesktopMainEventOpenDebug, main_view->context); | ||||||
|  |         } else if(event->key == InputKeyLeft) { | ||||||
|  |             main_view->callback(DesktopMainEventOpenFavoriteSecondary, main_view->context); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     if(event->key == InputKeyBack) { | ||||||
|  |         if(event->type == InputTypePress) { | ||||||
|  |             xTimerChangePeriod( | ||||||
|  |                 main_view->poweroff_timer, | ||||||
|  |                 pdMS_TO_TICKS(DESKTOP_MAIN_VIEW_POWEROFF_TIMEOUT), | ||||||
|  |                 portMAX_DELAY); | ||||||
|  |         } else if(event->type == InputTypeRelease) { | ||||||
|  |             xTimerStop(main_view->poweroff_timer, portMAX_DELAY); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| @ -65,11 +86,19 @@ DesktopMainView* desktop_main_alloc() { | |||||||
|     view_set_context(main_view->view, main_view); |     view_set_context(main_view->view, main_view); | ||||||
|     view_set_input_callback(main_view->view, desktop_main_input); |     view_set_input_callback(main_view->view, desktop_main_input); | ||||||
| 
 | 
 | ||||||
|  |     main_view->poweroff_timer = xTimerCreate( | ||||||
|  |         NULL, | ||||||
|  |         pdMS_TO_TICKS(DESKTOP_MAIN_VIEW_POWEROFF_TIMEOUT), | ||||||
|  |         pdFALSE, | ||||||
|  |         main_view, | ||||||
|  |         desktop_main_poweroff_timer_callback); | ||||||
|  | 
 | ||||||
|     return main_view; |     return main_view; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void desktop_main_free(DesktopMainView* main_view) { | void desktop_main_free(DesktopMainView* main_view) { | ||||||
|     furi_assert(main_view); |     furi_assert(main_view); | ||||||
|     view_free(main_view->view); |     view_free(main_view->view); | ||||||
|  |     osTimerDelete(main_view->poweroff_timer); | ||||||
|     free(main_view); |     free(main_view); | ||||||
| } | } | ||||||
|  | |||||||
| @ -6,16 +6,47 @@ | |||||||
| #include <toolbox/path.h> | #include <toolbox/path.h> | ||||||
| #include <flipper_format/flipper_format.h> | #include <flipper_format/flipper_format.h> | ||||||
| 
 | 
 | ||||||
|  | static const NotificationSequence sequence_blink_start_cyan = { | ||||||
|  |     &message_blink_start_10, | ||||||
|  |     &message_blink_set_color_cyan, | ||||||
|  |     &message_do_not_reset, | ||||||
|  |     NULL, | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | static const NotificationSequence sequence_blink_start_magenta = { | ||||||
|  |     &message_blink_start_10, | ||||||
|  |     &message_blink_set_color_magenta, | ||||||
|  |     &message_do_not_reset, | ||||||
|  |     NULL, | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | static const NotificationSequence sequence_blink_set_yellow = { | ||||||
|  |     &message_blink_set_color_yellow, | ||||||
|  |     NULL, | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | static const NotificationSequence sequence_blink_set_magenta = { | ||||||
|  |     &message_blink_set_color_magenta, | ||||||
|  |     NULL, | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | static const NotificationSequence sequence_blink_stop = { | ||||||
|  |     &message_blink_stop, | ||||||
|  |     NULL, | ||||||
|  | }; | ||||||
|  | 
 | ||||||
| static const NotificationSequence* ibutton_notification_sequences[] = { | static const NotificationSequence* ibutton_notification_sequences[] = { | ||||||
|     &sequence_error, |     &sequence_error, | ||||||
|     &sequence_success, |     &sequence_success, | ||||||
|     &sequence_blink_cyan_10, |     &sequence_blink_start_cyan, | ||||||
|     &sequence_blink_magenta_10, |     &sequence_blink_start_magenta, | ||||||
|     &sequence_blink_yellow_10, |     &sequence_blink_set_yellow, | ||||||
|  |     &sequence_blink_set_magenta, | ||||||
|     &sequence_set_red_255, |     &sequence_set_red_255, | ||||||
|     &sequence_reset_red, |     &sequence_reset_red, | ||||||
|     &sequence_set_green_255, |     &sequence_set_green_255, | ||||||
|     &sequence_reset_green, |     &sequence_reset_green, | ||||||
|  |     &sequence_blink_stop, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| static void ibutton_make_app_folder(iButton* ibutton) { | static void ibutton_make_app_folder(iButton* ibutton) { | ||||||
|  | |||||||
| @ -64,13 +64,15 @@ typedef enum { | |||||||
| typedef enum { | typedef enum { | ||||||
|     iButtonNotificationMessageError, |     iButtonNotificationMessageError, | ||||||
|     iButtonNotificationMessageSuccess, |     iButtonNotificationMessageSuccess, | ||||||
|     iButtonNotificationMessageRead, |     iButtonNotificationMessageReadStart, | ||||||
|     iButtonNotificationMessageEmulate, |     iButtonNotificationMessageEmulateStart, | ||||||
|     iButtonNotificationMessageYellowBlink, |     iButtonNotificationMessageYellowBlink, | ||||||
|  |     iButtonNotificationMessageEmulateBlink, | ||||||
|     iButtonNotificationMessageRedOn, |     iButtonNotificationMessageRedOn, | ||||||
|     iButtonNotificationMessageRedOff, |     iButtonNotificationMessageRedOff, | ||||||
|     iButtonNotificationMessageGreenOn, |     iButtonNotificationMessageGreenOn, | ||||||
|     iButtonNotificationMessageGreenOff, |     iButtonNotificationMessageGreenOff, | ||||||
|  |     iButtonNotificationMessageBlinkStop, | ||||||
| } iButtonNotificationMessage; | } iButtonNotificationMessage; | ||||||
| 
 | 
 | ||||||
| bool ibutton_file_select(iButton* ibutton); | bool ibutton_file_select(iButton* ibutton); | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| #include "../ibutton_i.h" | #include "../ibutton_i.h" | ||||||
|  | #include "furi/log.h" | ||||||
| #include <dolphin/dolphin.h> | #include <dolphin/dolphin.h> | ||||||
| #include <toolbox/path.h> | #include <toolbox/path.h> | ||||||
| 
 | 
 | ||||||
| @ -85,6 +86,8 @@ void ibutton_scene_emulate_on_enter(void* context) { | |||||||
|     ibutton_worker_emulate_start(ibutton->key_worker, key); |     ibutton_worker_emulate_start(ibutton->key_worker, key); | ||||||
| 
 | 
 | ||||||
|     string_clear(key_name); |     string_clear(key_name); | ||||||
|  | 
 | ||||||
|  |     ibutton_notification_message(ibutton, iButtonNotificationMessageEmulateStart); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool ibutton_scene_emulate_on_event(void* context, SceneManagerEvent event) { | bool ibutton_scene_emulate_on_event(void* context, SceneManagerEvent event) { | ||||||
| @ -93,7 +96,6 @@ bool ibutton_scene_emulate_on_event(void* context, SceneManagerEvent event) { | |||||||
| 
 | 
 | ||||||
|     if(event.type == SceneManagerEventTypeTick) { |     if(event.type == SceneManagerEventTypeTick) { | ||||||
|         consumed = true; |         consumed = true; | ||||||
|         ibutton_notification_message(ibutton, iButtonNotificationMessageEmulate); |  | ||||||
|     } else if(event.type == SceneManagerEventTypeCustom) { |     } else if(event.type == SceneManagerEventTypeCustom) { | ||||||
|         consumed = true; |         consumed = true; | ||||||
|         if(event.event == iButtonCustomEventWorkerEmulated) { |         if(event.event == iButtonCustomEventWorkerEmulated) { | ||||||
| @ -111,4 +113,5 @@ void ibutton_scene_emulate_on_exit(void* context) { | |||||||
|     popup_set_header(popup, NULL, 0, 0, AlignCenter, AlignBottom); |     popup_set_header(popup, NULL, 0, 0, AlignCenter, AlignBottom); | ||||||
|     popup_set_text(popup, NULL, 0, 0, AlignCenter, AlignTop); |     popup_set_text(popup, NULL, 0, 0, AlignCenter, AlignTop); | ||||||
|     popup_set_icon(popup, 0, 0, NULL); |     popup_set_icon(popup, 0, 0, NULL); | ||||||
|  |     ibutton_notification_message(ibutton, iButtonNotificationMessageBlinkStop); | ||||||
| } | } | ||||||
|  | |||||||
| @ -22,6 +22,8 @@ void ibutton_scene_read_on_enter(void* context) { | |||||||
| 
 | 
 | ||||||
|     ibutton_worker_read_set_callback(worker, ibutton_scene_read_callback, ibutton); |     ibutton_worker_read_set_callback(worker, ibutton_scene_read_callback, ibutton); | ||||||
|     ibutton_worker_read_start(worker, key); |     ibutton_worker_read_start(worker, key); | ||||||
|  | 
 | ||||||
|  |     ibutton_notification_message(ibutton, iButtonNotificationMessageReadStart); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool ibutton_scene_read_on_event(void* context, SceneManagerEvent event) { | bool ibutton_scene_read_on_event(void* context, SceneManagerEvent event) { | ||||||
| @ -31,7 +33,6 @@ bool ibutton_scene_read_on_event(void* context, SceneManagerEvent event) { | |||||||
| 
 | 
 | ||||||
|     if(event.type == SceneManagerEventTypeTick) { |     if(event.type == SceneManagerEventTypeTick) { | ||||||
|         consumed = true; |         consumed = true; | ||||||
|         ibutton_notification_message(ibutton, iButtonNotificationMessageRead); |  | ||||||
|     } else if(event.type == SceneManagerEventTypeCustom) { |     } else if(event.type == SceneManagerEventTypeCustom) { | ||||||
|         consumed = true; |         consumed = true; | ||||||
|         if(event.event == iButtonCustomEventWorkerRead) { |         if(event.event == iButtonCustomEventWorkerRead) { | ||||||
| @ -69,4 +70,6 @@ void ibutton_scene_read_on_exit(void* context) { | |||||||
|     popup_set_header(popup, NULL, 0, 0, AlignCenter, AlignBottom); |     popup_set_header(popup, NULL, 0, 0, AlignCenter, AlignBottom); | ||||||
|     popup_set_text(popup, NULL, 0, 0, AlignCenter, AlignTop); |     popup_set_text(popup, NULL, 0, 0, AlignCenter, AlignTop); | ||||||
|     popup_set_icon(popup, 0, 0, NULL); |     popup_set_icon(popup, 0, 0, NULL); | ||||||
|  | 
 | ||||||
|  |     ibutton_notification_message(ibutton, iButtonNotificationMessageBlinkStop); | ||||||
| } | } | ||||||
|  | |||||||
| @ -80,14 +80,14 @@ void ibutton_scene_write_on_enter(void* context) { | |||||||
| 
 | 
 | ||||||
|     popup_set_icon(popup, 2, 10, &I_iButtonKey_49x44); |     popup_set_icon(popup, 2, 10, &I_iButtonKey_49x44); | ||||||
| 
 | 
 | ||||||
|     scene_manager_set_scene_state( |  | ||||||
|         ibutton->scene_manager, iButtonSceneWrite, iButtonSceneWriteStateDefault); |  | ||||||
|     view_dispatcher_switch_to_view(ibutton->view_dispatcher, iButtonViewPopup); |     view_dispatcher_switch_to_view(ibutton->view_dispatcher, iButtonViewPopup); | ||||||
| 
 | 
 | ||||||
|     ibutton_worker_write_set_callback(worker, ibutton_scene_write_callback, ibutton); |     ibutton_worker_write_set_callback(worker, ibutton_scene_write_callback, ibutton); | ||||||
|     ibutton_worker_write_start(worker, key); |     ibutton_worker_write_start(worker, key); | ||||||
| 
 | 
 | ||||||
|     string_clear(key_name); |     string_clear(key_name); | ||||||
|  | 
 | ||||||
|  |     ibutton_notification_message(ibutton, iButtonNotificationMessageEmulateStart); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool ibutton_scene_write_on_event(void* context, SceneManagerEvent event) { | bool ibutton_scene_write_on_event(void* context, SceneManagerEvent event) { | ||||||
| @ -100,21 +100,13 @@ bool ibutton_scene_write_on_event(void* context, SceneManagerEvent event) { | |||||||
|         if((event.event == iButtonWorkerWriteOK) || (event.event == iButtonWorkerWriteSameKey)) { |         if((event.event == iButtonWorkerWriteOK) || (event.event == iButtonWorkerWriteSameKey)) { | ||||||
|             scene_manager_next_scene(scene_manager, iButtonSceneWriteSuccess); |             scene_manager_next_scene(scene_manager, iButtonSceneWriteSuccess); | ||||||
|         } else if(event.event == iButtonWorkerWriteNoDetect) { |         } else if(event.event == iButtonWorkerWriteNoDetect) { | ||||||
|             scene_manager_set_scene_state( |             ibutton_notification_message(ibutton, iButtonNotificationMessageEmulateBlink); | ||||||
|                 scene_manager, iButtonSceneWrite, iButtonSceneWriteStateDefault); |  | ||||||
|         } else if(event.event == iButtonWorkerWriteCannotWrite) { |         } else if(event.event == iButtonWorkerWriteCannotWrite) { | ||||||
|             scene_manager_set_scene_state( |             ibutton_notification_message(ibutton, iButtonNotificationMessageYellowBlink); | ||||||
|                 scene_manager, iButtonSceneWrite, iButtonSceneWriteStateBlinkYellow); |  | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|     } else if(event.type == SceneManagerEventTypeTick) { |     } else if(event.type == SceneManagerEventTypeTick) { | ||||||
|         consumed = true; |         consumed = true; | ||||||
|         if(scene_manager_get_scene_state(scene_manager, iButtonSceneWrite) == |  | ||||||
|            iButtonSceneWriteStateBlinkYellow) { |  | ||||||
|             ibutton_notification_message(ibutton, iButtonNotificationMessageYellowBlink); |  | ||||||
|         } else { |  | ||||||
|             ibutton_notification_message(ibutton, iButtonNotificationMessageEmulate); |  | ||||||
|         } |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     return consumed; |     return consumed; | ||||||
| @ -127,4 +119,6 @@ void ibutton_scene_write_on_exit(void* context) { | |||||||
|     popup_set_header(popup, NULL, 0, 0, AlignCenter, AlignBottom); |     popup_set_header(popup, NULL, 0, 0, AlignCenter, AlignBottom); | ||||||
|     popup_set_text(popup, NULL, 0, 0, AlignCenter, AlignTop); |     popup_set_text(popup, NULL, 0, 0, AlignCenter, AlignTop); | ||||||
|     popup_set_icon(popup, 0, 0, NULL); |     popup_set_icon(popup, 0, 0, NULL); | ||||||
|  | 
 | ||||||
|  |     ibutton_notification_message(ibutton, iButtonNotificationMessageBlinkStop); | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,6 +1,19 @@ | |||||||
| #include "lfrfid_app_scene_emulate.h" | #include "lfrfid_app_scene_emulate.h" | ||||||
|  | #include "furi/common_defines.h" | ||||||
| #include <dolphin/dolphin.h> | #include <dolphin/dolphin.h> | ||||||
| 
 | 
 | ||||||
|  | static const NotificationSequence sequence_blink_start_magenta = { | ||||||
|  |     &message_blink_start_10, | ||||||
|  |     &message_blink_set_color_magenta, | ||||||
|  |     &message_do_not_reset, | ||||||
|  |     NULL, | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | static const NotificationSequence sequence_blink_stop = { | ||||||
|  |     &message_blink_stop, | ||||||
|  |     NULL, | ||||||
|  | }; | ||||||
|  | 
 | ||||||
| void LfRfidAppSceneEmulate::on_enter(LfRfidApp* app, bool /* need_restore */) { | void LfRfidAppSceneEmulate::on_enter(LfRfidApp* app, bool /* need_restore */) { | ||||||
|     string_init(data_string); |     string_init(data_string); | ||||||
| 
 | 
 | ||||||
| @ -23,15 +36,14 @@ void LfRfidAppSceneEmulate::on_enter(LfRfidApp* app, bool /* need_restore */) { | |||||||
| 
 | 
 | ||||||
|     app->view_controller.switch_to<PopupVM>(); |     app->view_controller.switch_to<PopupVM>(); | ||||||
|     app->worker.start_emulate(); |     app->worker.start_emulate(); | ||||||
|  | 
 | ||||||
|  |     notification_message(app->notification, &sequence_blink_start_magenta); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool LfRfidAppSceneEmulate::on_event(LfRfidApp* app, LfRfidApp::Event* event) { | bool LfRfidAppSceneEmulate::on_event(LfRfidApp* app, LfRfidApp::Event* event) { | ||||||
|  |     UNUSED(app); | ||||||
|  |     UNUSED(event); | ||||||
|     bool consumed = false; |     bool consumed = false; | ||||||
| 
 |  | ||||||
|     if(event->type == LfRfidApp::EventType::Tick) { |  | ||||||
|         notification_message(app->notification, &sequence_blink_magenta_10); |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     return consumed; |     return consumed; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -39,4 +51,5 @@ void LfRfidAppSceneEmulate::on_exit(LfRfidApp* app) { | |||||||
|     app->view_controller.get<PopupVM>()->clean(); |     app->view_controller.get<PopupVM>()->clean(); | ||||||
|     app->worker.stop_emulate(); |     app->worker.stop_emulate(); | ||||||
|     string_clear(data_string); |     string_clear(data_string); | ||||||
|  |     notification_message(app->notification, &sequence_blink_stop); | ||||||
| } | } | ||||||
|  | |||||||
| @ -164,6 +164,26 @@ void nfc_text_store_clear(Nfc* nfc) { | |||||||
|     memset(nfc->text_store, 0, sizeof(nfc->text_store)); |     memset(nfc->text_store, 0, sizeof(nfc->text_store)); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | static const NotificationSequence sequence_blink_start_blue = { | ||||||
|  |     &message_blink_start_10, | ||||||
|  |     &message_blink_set_color_blue, | ||||||
|  |     &message_do_not_reset, | ||||||
|  |     NULL, | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | static const NotificationSequence sequence_blink_stop = { | ||||||
|  |     &message_blink_stop, | ||||||
|  |     NULL, | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | void nfc_blink_start(Nfc* nfc) { | ||||||
|  |     notification_message(nfc->notifications, &sequence_blink_start_blue); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void nfc_blink_stop(Nfc* nfc) { | ||||||
|  |     notification_message(nfc->notifications, &sequence_blink_stop); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| int32_t nfc_app(void* p) { | int32_t nfc_app(void* p) { | ||||||
|     Nfc* nfc = nfc_alloc(); |     Nfc* nfc = nfc_alloc(); | ||||||
|     char* args = p; |     char* args = p; | ||||||
|  | |||||||
| @ -76,3 +76,7 @@ int32_t nfc_task(void* p); | |||||||
| void nfc_text_store_set(Nfc* nfc, const char* text, ...); | void nfc_text_store_set(Nfc* nfc, const char* text, ...); | ||||||
| 
 | 
 | ||||||
| void nfc_text_store_clear(Nfc* nfc); | void nfc_text_store_clear(Nfc* nfc); | ||||||
|  | 
 | ||||||
|  | void nfc_blink_start(Nfc* nfc); | ||||||
|  | 
 | ||||||
|  | void nfc_blink_stop(Nfc* nfc); | ||||||
|  | |||||||
| @ -491,7 +491,6 @@ void nfc_worker_mifare_classic_dict_attack(NfcWorker* nfc_worker) { | |||||||
| 
 | 
 | ||||||
| void nfc_worker_emulate_mifare_classic(NfcWorker* nfc_worker) { | void nfc_worker_emulate_mifare_classic(NfcWorker* nfc_worker) { | ||||||
|     FuriHalNfcTxRxContext tx_rx = {}; |     FuriHalNfcTxRxContext tx_rx = {}; | ||||||
|     nfc_debug_pcap_prepare_tx_rx(&tx_rx, nfc_worker->storage, true); |  | ||||||
|     FuriHalNfcDevData* nfc_data = &nfc_worker->dev_data->nfc_data; |     FuriHalNfcDevData* nfc_data = &nfc_worker->dev_data->nfc_data; | ||||||
|     MfClassicEmulator emulator = { |     MfClassicEmulator emulator = { | ||||||
|         .cuid = nfc_util_bytes2num(&nfc_data->uid[nfc_data->uid_len - 4], 4), |         .cuid = nfc_util_bytes2num(&nfc_data->uid[nfc_data->uid_len - 4], 4), | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| #include "../nfc_i.h" | #include "../nfc_i.h" | ||||||
|  | #include "furi/common_defines.h" | ||||||
| 
 | 
 | ||||||
| void nfc_scene_emulate_apdu_sequence_on_enter(void* context) { | void nfc_scene_emulate_apdu_sequence_on_enter(void* context) { | ||||||
|     Nfc* nfc = context; |     Nfc* nfc = context; | ||||||
| @ -10,17 +11,14 @@ void nfc_scene_emulate_apdu_sequence_on_enter(void* context) { | |||||||
|     // Setup and start worker
 |     // Setup and start worker
 | ||||||
|     view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewPopup); |     view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewPopup); | ||||||
|     nfc_worker_start(nfc->worker, NfcWorkerStateEmulateApdu, &nfc->dev->dev_data, NULL, nfc); |     nfc_worker_start(nfc->worker, NfcWorkerStateEmulateApdu, &nfc->dev->dev_data, NULL, nfc); | ||||||
|  | 
 | ||||||
|  |     nfc_blink_start(nfc); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool nfc_scene_emulate_apdu_sequence_on_event(void* context, SceneManagerEvent event) { | bool nfc_scene_emulate_apdu_sequence_on_event(void* context, SceneManagerEvent event) { | ||||||
|     Nfc* nfc = context; |     UNUSED(context); | ||||||
|  |     UNUSED(event); | ||||||
|     bool consumed = false; |     bool consumed = false; | ||||||
| 
 |  | ||||||
|     if(event.type == SceneManagerEventTypeTick) { |  | ||||||
|         notification_message(nfc->notifications, &sequence_blink_blue_10); |  | ||||||
|         consumed = true; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     return consumed; |     return consumed; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -31,4 +29,6 @@ void nfc_scene_emulate_apdu_sequence_on_exit(void* context) { | |||||||
|     nfc_worker_stop(nfc->worker); |     nfc_worker_stop(nfc->worker); | ||||||
|     // Clear view
 |     // Clear view
 | ||||||
|     popup_reset(nfc->popup); |     popup_reset(nfc->popup); | ||||||
|  | 
 | ||||||
|  |     nfc_blink_stop(nfc); | ||||||
| } | } | ||||||
|  | |||||||
| @ -32,6 +32,7 @@ void nfc_scene_emulate_mifare_classic_on_enter(void* context) { | |||||||
|         &nfc->dev->dev_data, |         &nfc->dev->dev_data, | ||||||
|         nfc_emulate_mifare_classic_worker_callback, |         nfc_emulate_mifare_classic_worker_callback, | ||||||
|         nfc); |         nfc); | ||||||
|  |     nfc_blink_start(nfc); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool nfc_scene_emulate_mifare_classic_on_event(void* context, SceneManagerEvent event) { | bool nfc_scene_emulate_mifare_classic_on_event(void* context, SceneManagerEvent event) { | ||||||
| @ -39,7 +40,6 @@ bool nfc_scene_emulate_mifare_classic_on_event(void* context, SceneManagerEvent | |||||||
|     bool consumed = false; |     bool consumed = false; | ||||||
| 
 | 
 | ||||||
|     if(event.type == SceneManagerEventTypeTick) { |     if(event.type == SceneManagerEventTypeTick) { | ||||||
|         notification_message(nfc->notifications, &sequence_blink_blue_10); |  | ||||||
|         consumed = true; |         consumed = true; | ||||||
|     } else if(event.type == SceneManagerEventTypeBack) { |     } else if(event.type == SceneManagerEventTypeBack) { | ||||||
|         // Stop worker
 |         // Stop worker
 | ||||||
| @ -61,4 +61,6 @@ void nfc_scene_emulate_mifare_classic_on_exit(void* context) { | |||||||
| 
 | 
 | ||||||
|     // Clear view
 |     // Clear view
 | ||||||
|     popup_reset(nfc->popup); |     popup_reset(nfc->popup); | ||||||
|  | 
 | ||||||
|  |     nfc_blink_stop(nfc); | ||||||
| } | } | ||||||
|  | |||||||
| @ -32,6 +32,7 @@ void nfc_scene_emulate_mifare_ul_on_enter(void* context) { | |||||||
|         &nfc->dev->dev_data, |         &nfc->dev->dev_data, | ||||||
|         nfc_emulate_mifare_ul_worker_callback, |         nfc_emulate_mifare_ul_worker_callback, | ||||||
|         nfc); |         nfc); | ||||||
|  |     nfc_blink_start(nfc); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool nfc_scene_emulate_mifare_ul_on_event(void* context, SceneManagerEvent event) { | bool nfc_scene_emulate_mifare_ul_on_event(void* context, SceneManagerEvent event) { | ||||||
| @ -39,7 +40,6 @@ bool nfc_scene_emulate_mifare_ul_on_event(void* context, SceneManagerEvent event | |||||||
|     bool consumed = false; |     bool consumed = false; | ||||||
| 
 | 
 | ||||||
|     if(event.type == SceneManagerEventTypeTick) { |     if(event.type == SceneManagerEventTypeTick) { | ||||||
|         notification_message(nfc->notifications, &sequence_blink_blue_10); |  | ||||||
|         consumed = true; |         consumed = true; | ||||||
|     } else if(event.type == SceneManagerEventTypeBack) { |     } else if(event.type == SceneManagerEventTypeBack) { | ||||||
|         // Stop worker
 |         // Stop worker
 | ||||||
| @ -61,4 +61,6 @@ void nfc_scene_emulate_mifare_ul_on_exit(void* context) { | |||||||
| 
 | 
 | ||||||
|     // Clear view
 |     // Clear view
 | ||||||
|     popup_reset(nfc->popup); |     popup_reset(nfc->popup); | ||||||
|  | 
 | ||||||
|  |     nfc_blink_stop(nfc); | ||||||
| } | } | ||||||
|  | |||||||
| @ -80,6 +80,8 @@ void nfc_scene_emulate_uid_on_enter(void* context) { | |||||||
|         &nfc->dev->dev_data, |         &nfc->dev->dev_data, | ||||||
|         nfc_emulate_uid_worker_callback, |         nfc_emulate_uid_worker_callback, | ||||||
|         nfc); |         nfc); | ||||||
|  | 
 | ||||||
|  |     nfc_blink_start(nfc); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool nfc_scene_emulate_uid_on_event(void* context, SceneManagerEvent event) { | bool nfc_scene_emulate_uid_on_event(void* context, SceneManagerEvent event) { | ||||||
| @ -89,7 +91,6 @@ bool nfc_scene_emulate_uid_on_event(void* context, SceneManagerEvent event) { | |||||||
|     bool consumed = false; |     bool consumed = false; | ||||||
| 
 | 
 | ||||||
|     if(event.type == SceneManagerEventTypeTick) { |     if(event.type == SceneManagerEventTypeTick) { | ||||||
|         notification_message(nfc->notifications, &sequence_blink_blue_10); |  | ||||||
|         consumed = true; |         consumed = true; | ||||||
|     } else if(event.type == SceneManagerEventTypeCustom) { |     } else if(event.type == SceneManagerEventTypeCustom) { | ||||||
|         if(event.event == NfcCustomEventWorkerExit) { |         if(event.event == NfcCustomEventWorkerExit) { | ||||||
| @ -141,4 +142,6 @@ void nfc_scene_emulate_uid_on_exit(void* context) { | |||||||
|     widget_reset(nfc->widget); |     widget_reset(nfc->widget); | ||||||
|     text_box_reset(nfc->text_box); |     text_box_reset(nfc->text_box); | ||||||
|     string_reset(nfc->text_box_store); |     string_reset(nfc->text_box_store); | ||||||
|  | 
 | ||||||
|  |     nfc_blink_stop(nfc); | ||||||
| } | } | ||||||
|  | |||||||
| @ -20,6 +20,8 @@ void nfc_scene_read_card_on_enter(void* context) { | |||||||
|     view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewPopup); |     view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewPopup); | ||||||
|     nfc_worker_start( |     nfc_worker_start( | ||||||
|         nfc->worker, NfcWorkerStateDetect, &nfc->dev->dev_data, nfc_read_card_worker_callback, nfc); |         nfc->worker, NfcWorkerStateDetect, &nfc->dev->dev_data, nfc_read_card_worker_callback, nfc); | ||||||
|  | 
 | ||||||
|  |     nfc_blink_start(nfc); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool nfc_scene_read_card_on_event(void* context, SceneManagerEvent event) { | bool nfc_scene_read_card_on_event(void* context, SceneManagerEvent event) { | ||||||
| @ -32,7 +34,6 @@ bool nfc_scene_read_card_on_event(void* context, SceneManagerEvent event) { | |||||||
|             consumed = true; |             consumed = true; | ||||||
|         } |         } | ||||||
|     } else if(event.type == SceneManagerEventTypeTick) { |     } else if(event.type == SceneManagerEventTypeTick) { | ||||||
|         notification_message(nfc->notifications, &sequence_blink_blue_10); |  | ||||||
|         consumed = true; |         consumed = true; | ||||||
|     } |     } | ||||||
|     return consumed; |     return consumed; | ||||||
| @ -45,4 +46,6 @@ void nfc_scene_read_card_on_exit(void* context) { | |||||||
|     nfc_worker_stop(nfc->worker); |     nfc_worker_stop(nfc->worker); | ||||||
|     // Clear view
 |     // Clear view
 | ||||||
|     popup_reset(nfc->popup); |     popup_reset(nfc->popup); | ||||||
|  | 
 | ||||||
|  |     nfc_blink_stop(nfc); | ||||||
| } | } | ||||||
|  | |||||||
| @ -24,6 +24,7 @@ void nfc_scene_read_emv_app_on_enter(void* context) { | |||||||
|         &nfc->dev->dev_data, |         &nfc->dev->dev_data, | ||||||
|         nfc_read_emv_app_worker_callback, |         nfc_read_emv_app_worker_callback, | ||||||
|         nfc); |         nfc); | ||||||
|  |     nfc_blink_start(nfc); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool nfc_scene_read_emv_app_on_event(void* context, SceneManagerEvent event) { | bool nfc_scene_read_emv_app_on_event(void* context, SceneManagerEvent event) { | ||||||
| @ -38,7 +39,6 @@ bool nfc_scene_read_emv_app_on_event(void* context, SceneManagerEvent event) { | |||||||
|             consumed = true; |             consumed = true; | ||||||
|         } |         } | ||||||
|     } else if(event.type == SceneManagerEventTypeTick) { |     } else if(event.type == SceneManagerEventTypeTick) { | ||||||
|         notification_message(nfc->notifications, &sequence_blink_blue_10); |  | ||||||
|         consumed = true; |         consumed = true; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| @ -53,4 +53,6 @@ void nfc_scene_read_emv_app_on_exit(void* context) { | |||||||
| 
 | 
 | ||||||
|     // Clear view
 |     // Clear view
 | ||||||
|     popup_reset(nfc->popup); |     popup_reset(nfc->popup); | ||||||
|  | 
 | ||||||
|  |     nfc_blink_stop(nfc); | ||||||
| } | } | ||||||
|  | |||||||
| @ -26,6 +26,8 @@ void nfc_scene_read_emv_data_on_enter(void* context) { | |||||||
|         &nfc->dev->dev_data, |         &nfc->dev->dev_data, | ||||||
|         nfc_read_emv_data_worker_callback, |         nfc_read_emv_data_worker_callback, | ||||||
|         nfc); |         nfc); | ||||||
|  | 
 | ||||||
|  |     nfc_blink_start(nfc); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool nfc_scene_read_emv_data_on_event(void* context, SceneManagerEvent event) { | bool nfc_scene_read_emv_data_on_event(void* context, SceneManagerEvent event) { | ||||||
| @ -40,7 +42,6 @@ bool nfc_scene_read_emv_data_on_event(void* context, SceneManagerEvent event) { | |||||||
|             consumed = true; |             consumed = true; | ||||||
|         } |         } | ||||||
|     } else if(event.type == SceneManagerEventTypeTick) { |     } else if(event.type == SceneManagerEventTypeTick) { | ||||||
|         notification_message(nfc->notifications, &sequence_blink_blue_10); |  | ||||||
|         consumed = true; |         consumed = true; | ||||||
|     } |     } | ||||||
|     return consumed; |     return consumed; | ||||||
| @ -53,4 +54,6 @@ void nfc_scene_read_emv_data_on_exit(void* context) { | |||||||
|     nfc_worker_stop(nfc->worker); |     nfc_worker_stop(nfc->worker); | ||||||
|     // Clear view
 |     // Clear view
 | ||||||
|     popup_reset(nfc->popup); |     popup_reset(nfc->popup); | ||||||
|  | 
 | ||||||
|  |     nfc_blink_stop(nfc); | ||||||
| } | } | ||||||
|  | |||||||
| @ -33,17 +33,15 @@ void nfc_scene_read_mifare_classic_on_enter(void* context) { | |||||||
|         &nfc->dev->dev_data, |         &nfc->dev->dev_data, | ||||||
|         nfc_read_mifare_classic_worker_callback, |         nfc_read_mifare_classic_worker_callback, | ||||||
|         nfc); |         nfc); | ||||||
|  | 
 | ||||||
|  |     nfc_blink_start(nfc); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool nfc_scene_read_mifare_classic_on_event(void* context, SceneManagerEvent event) { | bool nfc_scene_read_mifare_classic_on_event(void* context, SceneManagerEvent event) { | ||||||
|     Nfc* nfc = context; |     Nfc* nfc = context; | ||||||
|     bool consumed = false; |     bool consumed = false; | ||||||
| 
 | 
 | ||||||
|     uint32_t state = scene_manager_get_scene_state(nfc->scene_manager, NfcSceneReadMifareClassic); |  | ||||||
|     if(event.type == SceneManagerEventTypeTick) { |     if(event.type == SceneManagerEventTypeTick) { | ||||||
|         if(state == NfcSceneReadMifareClassicStateInProgress) { |  | ||||||
|             notification_message(nfc->notifications, &sequence_blink_blue_10); |  | ||||||
|         } |  | ||||||
|         consumed = true; |         consumed = true; | ||||||
|     } else if(event.type == SceneManagerEventTypeCustom) { |     } else if(event.type == SceneManagerEventTypeCustom) { | ||||||
|         if(event.event == NfcCustomEventDictAttackDone) { |         if(event.event == NfcCustomEventDictAttackDone) { | ||||||
| @ -70,12 +68,14 @@ bool nfc_scene_read_mifare_classic_on_event(void* context, SceneManagerEvent eve | |||||||
|         } else if(event.event == NfcWorkerEventSuccess) { |         } else if(event.event == NfcWorkerEventSuccess) { | ||||||
|             scene_manager_set_scene_state( |             scene_manager_set_scene_state( | ||||||
|                 nfc->scene_manager, NfcSceneReadMifareClassic, NfcSceneReadMifareClassicStateDone); |                 nfc->scene_manager, NfcSceneReadMifareClassic, NfcSceneReadMifareClassicStateDone); | ||||||
|  |             nfc_blink_stop(nfc); | ||||||
|             notification_message(nfc->notifications, &sequence_success); |             notification_message(nfc->notifications, &sequence_success); | ||||||
|             dict_attack_set_result(nfc->dict_attack, true); |             dict_attack_set_result(nfc->dict_attack, true); | ||||||
|             consumed = true; |             consumed = true; | ||||||
|         } else if(event.event == NfcWorkerEventFail) { |         } else if(event.event == NfcWorkerEventFail) { | ||||||
|             scene_manager_set_scene_state( |             scene_manager_set_scene_state( | ||||||
|                 nfc->scene_manager, NfcSceneReadMifareClassic, NfcSceneReadMifareClassicStateDone); |                 nfc->scene_manager, NfcSceneReadMifareClassic, NfcSceneReadMifareClassicStateDone); | ||||||
|  |             nfc_blink_stop(nfc); | ||||||
|             dict_attack_set_result(nfc->dict_attack, false); |             dict_attack_set_result(nfc->dict_attack, false); | ||||||
|             consumed = true; |             consumed = true; | ||||||
|         } else if(event.event == NfcWorkerEventNoDictFound) { |         } else if(event.event == NfcWorkerEventNoDictFound) { | ||||||
| @ -91,4 +91,6 @@ void nfc_scene_read_mifare_classic_on_exit(void* context) { | |||||||
|     // Stop worker
 |     // Stop worker
 | ||||||
|     nfc_worker_stop(nfc->worker); |     nfc_worker_stop(nfc->worker); | ||||||
|     dict_attack_reset(nfc->dict_attack); |     dict_attack_reset(nfc->dict_attack); | ||||||
|  | 
 | ||||||
|  |     nfc_blink_stop(nfc); | ||||||
| } | } | ||||||
|  | |||||||
| @ -24,6 +24,7 @@ void nfc_scene_read_mifare_desfire_on_enter(void* context) { | |||||||
|         &nfc->dev->dev_data, |         &nfc->dev->dev_data, | ||||||
|         nfc_read_mifare_desfire_worker_callback, |         nfc_read_mifare_desfire_worker_callback, | ||||||
|         nfc); |         nfc); | ||||||
|  |     nfc_blink_start(nfc); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool nfc_scene_read_mifare_desfire_on_event(void* context, SceneManagerEvent event) { | bool nfc_scene_read_mifare_desfire_on_event(void* context, SceneManagerEvent event) { | ||||||
| @ -33,12 +34,11 @@ bool nfc_scene_read_mifare_desfire_on_event(void* context, SceneManagerEvent eve | |||||||
|     if(event.type == SceneManagerEventTypeCustom) { |     if(event.type == SceneManagerEventTypeCustom) { | ||||||
|         if(event.event == NfcCustomEventWorkerExit) { |         if(event.event == NfcCustomEventWorkerExit) { | ||||||
|             notification_message(nfc->notifications, &sequence_success); |             notification_message(nfc->notifications, &sequence_success); | ||||||
|  |             DOLPHIN_DEED(DolphinDeedNfcReadSuccess); | ||||||
|             scene_manager_next_scene(nfc->scene_manager, NfcSceneReadMifareDesfireSuccess); |             scene_manager_next_scene(nfc->scene_manager, NfcSceneReadMifareDesfireSuccess); | ||||||
|             consumed = true; |             consumed = true; | ||||||
|         } |         } | ||||||
|     } else if(event.type == SceneManagerEventTypeTick) { |     } else if(event.type == SceneManagerEventTypeTick) { | ||||||
|         notification_message(nfc->notifications, &sequence_blink_blue_10); |  | ||||||
|         DOLPHIN_DEED(DolphinDeedNfcReadSuccess); |  | ||||||
|         consumed = true; |         consumed = true; | ||||||
|     } |     } | ||||||
|     return consumed; |     return consumed; | ||||||
| @ -51,4 +51,6 @@ void nfc_scene_read_mifare_desfire_on_exit(void* context) { | |||||||
|     nfc_worker_stop(nfc->worker); |     nfc_worker_stop(nfc->worker); | ||||||
|     // Clear view
 |     // Clear view
 | ||||||
|     popup_reset(nfc->popup); |     popup_reset(nfc->popup); | ||||||
|  | 
 | ||||||
|  |     nfc_blink_stop(nfc); | ||||||
| } | } | ||||||
|  | |||||||
| @ -24,6 +24,7 @@ void nfc_scene_read_mifare_ul_on_enter(void* context) { | |||||||
|         &nfc->dev->dev_data, |         &nfc->dev->dev_data, | ||||||
|         nfc_read_mifare_ul_worker_callback, |         nfc_read_mifare_ul_worker_callback, | ||||||
|         nfc); |         nfc); | ||||||
|  |     nfc_blink_start(nfc); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool nfc_scene_read_mifare_ul_on_event(void* context, SceneManagerEvent event) { | bool nfc_scene_read_mifare_ul_on_event(void* context, SceneManagerEvent event) { | ||||||
| @ -36,7 +37,6 @@ bool nfc_scene_read_mifare_ul_on_event(void* context, SceneManagerEvent event) { | |||||||
|             consumed = true; |             consumed = true; | ||||||
|         } |         } | ||||||
|     } else if(event.type == SceneManagerEventTypeTick) { |     } else if(event.type == SceneManagerEventTypeTick) { | ||||||
|         notification_message(nfc->notifications, &sequence_blink_blue_10); |  | ||||||
|         consumed = true; |         consumed = true; | ||||||
|     } |     } | ||||||
|     return consumed; |     return consumed; | ||||||
| @ -49,4 +49,6 @@ void nfc_scene_read_mifare_ul_on_exit(void* context) { | |||||||
|     nfc_worker_stop(nfc->worker); |     nfc_worker_stop(nfc->worker); | ||||||
|     // Clear view
 |     // Clear view
 | ||||||
|     popup_reset(nfc->popup); |     popup_reset(nfc->popup); | ||||||
|  | 
 | ||||||
|  |     nfc_blink_stop(nfc); | ||||||
| } | } | ||||||
|  | |||||||
							
								
								
									
										11
									
								
								applications/power/power_settings_app/power_settings_app.c
									
									
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										11
									
								
								applications/power/power_settings_app/power_settings_app.c
									
									
									
									
									
										
										
										Executable file → Normal file
									
								
							| @ -18,7 +18,7 @@ static void power_settings_tick_event_callback(void* context) { | |||||||
|     scene_manager_handle_tick_event(app->scene_manager); |     scene_manager_handle_tick_event(app->scene_manager); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| PowerSettingsApp* power_settings_app_alloc() { | PowerSettingsApp* power_settings_app_alloc(uint32_t first_scene) { | ||||||
|     PowerSettingsApp* app = malloc(sizeof(PowerSettingsApp)); |     PowerSettingsApp* app = malloc(sizeof(PowerSettingsApp)); | ||||||
| 
 | 
 | ||||||
|     // Records
 |     // Records
 | ||||||
| @ -52,7 +52,7 @@ PowerSettingsApp* power_settings_app_alloc() { | |||||||
|         app->view_dispatcher, PowerSettingsAppViewDialog, dialog_ex_get_view(app->dialog)); |         app->view_dispatcher, PowerSettingsAppViewDialog, dialog_ex_get_view(app->dialog)); | ||||||
| 
 | 
 | ||||||
|     // Set first scene
 |     // Set first scene
 | ||||||
|     scene_manager_next_scene(app->scene_manager, PowerSettingsAppSceneStart); |     scene_manager_next_scene(app->scene_manager, first_scene); | ||||||
|     return app; |     return app; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -75,8 +75,11 @@ void power_settings_app_free(PowerSettingsApp* app) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| int32_t power_settings_app(void* p) { | int32_t power_settings_app(void* p) { | ||||||
|     UNUSED(p); |     uint32_t first_scene = PowerSettingsAppSceneStart; | ||||||
|     PowerSettingsApp* app = power_settings_app_alloc(); |     if(p && !strcmp(p, "off")) { | ||||||
|  |         first_scene = PowerSettingsAppScenePowerOff; | ||||||
|  |     } | ||||||
|  |     PowerSettingsApp* app = power_settings_app_alloc(first_scene); | ||||||
|     view_dispatcher_run(app->view_dispatcher); |     view_dispatcher_run(app->view_dispatcher); | ||||||
|     power_settings_app_free(app); |     power_settings_app_free(app); | ||||||
|     return 0; |     return 0; | ||||||
|  | |||||||
							
								
								
									
										5
									
								
								applications/power/power_settings_app/scenes/power_settings_scene_power_off.c
									
									
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										5
									
								
								applications/power/power_settings_app/scenes/power_settings_scene_power_off.c
									
									
									
									
									
										
										
										Executable file → Normal file
									
								
							| @ -28,7 +28,10 @@ bool power_settings_scene_power_off_on_event(void* context, SceneManagerEvent ev | |||||||
| 
 | 
 | ||||||
|     if(event.type == SceneManagerEventTypeCustom) { |     if(event.type == SceneManagerEventTypeCustom) { | ||||||
|         if(event.event == DialogExResultLeft) { |         if(event.event == DialogExResultLeft) { | ||||||
|             scene_manager_previous_scene(app->scene_manager); |             if(!scene_manager_previous_scene(app->scene_manager)) { | ||||||
|  |                 scene_manager_stop(app->scene_manager); | ||||||
|  |                 view_dispatcher_stop(app->view_dispatcher); | ||||||
|  |             } | ||||||
|         } else if(event.event == DialogExResultRight) { |         } else if(event.event == DialogExResultRight) { | ||||||
|             power_off(app->power); |             power_off(app->power); | ||||||
|         } |         } | ||||||
|  | |||||||
| @ -113,11 +113,14 @@ void storage_settings_scene_benchmark_on_enter(void* context) { | |||||||
|     StorageSettings* app = context; |     StorageSettings* app = context; | ||||||
|     DialogEx* dialog_ex = app->dialog_ex; |     DialogEx* dialog_ex = app->dialog_ex; | ||||||
| 
 | 
 | ||||||
|  |     FS_Error sd_status = storage_sd_status(app->fs_api); | ||||||
|  |     scene_manager_set_scene_state(app->scene_manager, StorageSettingsBenchmark, sd_status); | ||||||
|  | 
 | ||||||
|     dialog_ex_set_context(dialog_ex, app); |     dialog_ex_set_context(dialog_ex, app); | ||||||
|     dialog_ex_set_result_callback(dialog_ex, storage_settings_scene_benchmark_dialog_callback); |     dialog_ex_set_result_callback(dialog_ex, storage_settings_scene_benchmark_dialog_callback); | ||||||
|     view_dispatcher_switch_to_view(app->view_dispatcher, StorageSettingsViewDialogEx); |     view_dispatcher_switch_to_view(app->view_dispatcher, StorageSettingsViewDialogEx); | ||||||
| 
 | 
 | ||||||
|     if(storage_sd_status(app->fs_api) != FSE_OK) { |     if(sd_status != FSE_OK) { | ||||||
|         dialog_ex_set_header(dialog_ex, "SD card not mounted", 64, 10, AlignCenter, AlignCenter); |         dialog_ex_set_header(dialog_ex, "SD card not mounted", 64, 10, AlignCenter, AlignCenter); | ||||||
|         dialog_ex_set_text( |         dialog_ex_set_text( | ||||||
|             dialog_ex, |             dialog_ex, | ||||||
| @ -126,7 +129,7 @@ void storage_settings_scene_benchmark_on_enter(void* context) { | |||||||
|             32, |             32, | ||||||
|             AlignCenter, |             AlignCenter, | ||||||
|             AlignCenter); |             AlignCenter); | ||||||
|         dialog_ex_set_left_button_text(dialog_ex, "Back"); |         dialog_ex_set_center_button_text(dialog_ex, "Ok"); | ||||||
|     } else { |     } else { | ||||||
|         storage_settings_scene_benchmark(app); |         storage_settings_scene_benchmark(app); | ||||||
|         notification_message(app->notification, &sequence_blink_green_100); |         notification_message(app->notification, &sequence_blink_green_100); | ||||||
| @ -137,13 +140,19 @@ bool storage_settings_scene_benchmark_on_event(void* context, SceneManagerEvent | |||||||
|     StorageSettings* app = context; |     StorageSettings* app = context; | ||||||
|     bool consumed = false; |     bool consumed = false; | ||||||
| 
 | 
 | ||||||
|  |     FS_Error sd_status = | ||||||
|  |         scene_manager_get_scene_state(app->scene_manager, StorageSettingsBenchmark); | ||||||
|  | 
 | ||||||
|     if(event.type == SceneManagerEventTypeCustom) { |     if(event.type == SceneManagerEventTypeCustom) { | ||||||
|         switch(event.event) { |         switch(event.event) { | ||||||
|         case DialogExResultLeft: |         case DialogExResultCenter: | ||||||
|             consumed = scene_manager_previous_scene(app->scene_manager); |             consumed = scene_manager_previous_scene(app->scene_manager); | ||||||
|             break; |             break; | ||||||
|         } |         } | ||||||
|  |     } else if(event.type == SceneManagerEventTypeBack && sd_status != FSE_OK) { | ||||||
|  |         consumed = true; | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|     return consumed; |     return consumed; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -9,9 +9,9 @@ static void | |||||||
| 
 | 
 | ||||||
| void storage_settings_scene_format_confirm_on_enter(void* context) { | void storage_settings_scene_format_confirm_on_enter(void* context) { | ||||||
|     StorageSettings* app = context; |     StorageSettings* app = context; | ||||||
|     FS_Error sd_status = storage_sd_status(app->fs_api); |  | ||||||
|     DialogEx* dialog_ex = app->dialog_ex; |     DialogEx* dialog_ex = app->dialog_ex; | ||||||
|     dialog_ex_set_left_button_text(dialog_ex, "Cancel"); | 
 | ||||||
|  |     FS_Error sd_status = storage_sd_status(app->fs_api); | ||||||
| 
 | 
 | ||||||
|     if(sd_status == FSE_NOT_READY) { |     if(sd_status == FSE_NOT_READY) { | ||||||
|         dialog_ex_set_header(dialog_ex, "SD card not mounted", 64, 10, AlignCenter, AlignCenter); |         dialog_ex_set_header(dialog_ex, "SD card not mounted", 64, 10, AlignCenter, AlignCenter); | ||||||
| @ -22,10 +22,12 @@ void storage_settings_scene_format_confirm_on_enter(void* context) { | |||||||
|             32, |             32, | ||||||
|             AlignCenter, |             AlignCenter, | ||||||
|             AlignCenter); |             AlignCenter); | ||||||
|  |         dialog_ex_set_center_button_text(dialog_ex, "Ok"); | ||||||
|     } else { |     } else { | ||||||
|         dialog_ex_set_right_button_text(dialog_ex, "Format"); |  | ||||||
|         dialog_ex_set_header(dialog_ex, "Format SD card?", 64, 10, AlignCenter, AlignCenter); |         dialog_ex_set_header(dialog_ex, "Format SD card?", 64, 10, AlignCenter, AlignCenter); | ||||||
|         dialog_ex_set_text(dialog_ex, "All data will be lost", 64, 32, AlignCenter, AlignCenter); |         dialog_ex_set_text(dialog_ex, "All data will be lost", 64, 32, AlignCenter, AlignCenter); | ||||||
|  |         dialog_ex_set_left_button_text(dialog_ex, "Cancel"); | ||||||
|  |         dialog_ex_set_right_button_text(dialog_ex, "Format"); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     dialog_ex_set_context(dialog_ex, app); |     dialog_ex_set_context(dialog_ex, app); | ||||||
| @ -44,12 +46,18 @@ bool storage_settings_scene_format_confirm_on_event(void* context, SceneManagerE | |||||||
|         case DialogExResultLeft: |         case DialogExResultLeft: | ||||||
|             consumed = scene_manager_previous_scene(app->scene_manager); |             consumed = scene_manager_previous_scene(app->scene_manager); | ||||||
|             break; |             break; | ||||||
|  |         case DialogExResultCenter: | ||||||
|  |             consumed = scene_manager_previous_scene(app->scene_manager); | ||||||
|  |             break; | ||||||
|         case DialogExResultRight: |         case DialogExResultRight: | ||||||
|             scene_manager_next_scene(app->scene_manager, StorageSettingsFormatting); |             scene_manager_next_scene(app->scene_manager, StorageSettingsFormatting); | ||||||
|             consumed = true; |             consumed = true; | ||||||
|             break; |             break; | ||||||
|         } |         } | ||||||
|  |     } else if(event.type == SceneManagerEventTypeBack) { | ||||||
|  |         consumed = true; | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|     return consumed; |     return consumed; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -8,9 +8,11 @@ static void storage_settings_scene_sd_info_dialog_callback(DialogExResult result | |||||||
| 
 | 
 | ||||||
| void storage_settings_scene_sd_info_on_enter(void* context) { | void storage_settings_scene_sd_info_on_enter(void* context) { | ||||||
|     StorageSettings* app = context; |     StorageSettings* app = context; | ||||||
|  |     DialogEx* dialog_ex = app->dialog_ex; | ||||||
|  | 
 | ||||||
|     SDInfo sd_info; |     SDInfo sd_info; | ||||||
|     FS_Error sd_status = storage_sd_info(app->fs_api, &sd_info); |     FS_Error sd_status = storage_sd_info(app->fs_api, &sd_info); | ||||||
|     DialogEx* dialog_ex = app->dialog_ex; |     scene_manager_set_scene_state(app->scene_manager, StorageSettingsSDInfo, sd_status); | ||||||
| 
 | 
 | ||||||
|     dialog_ex_set_context(dialog_ex, app); |     dialog_ex_set_context(dialog_ex, app); | ||||||
|     dialog_ex_set_result_callback(dialog_ex, storage_settings_scene_sd_info_dialog_callback); |     dialog_ex_set_result_callback(dialog_ex, storage_settings_scene_sd_info_dialog_callback); | ||||||
| @ -24,6 +26,7 @@ void storage_settings_scene_sd_info_on_enter(void* context) { | |||||||
|             32, |             32, | ||||||
|             AlignCenter, |             AlignCenter, | ||||||
|             AlignCenter); |             AlignCenter); | ||||||
|  |         dialog_ex_set_center_button_text(dialog_ex, "Ok"); | ||||||
|     } else { |     } else { | ||||||
|         string_printf( |         string_printf( | ||||||
|             app->text_string, |             app->text_string, | ||||||
| @ -43,17 +46,25 @@ bool storage_settings_scene_sd_info_on_event(void* context, SceneManagerEvent ev | |||||||
|     StorageSettings* app = context; |     StorageSettings* app = context; | ||||||
|     bool consumed = false; |     bool consumed = false; | ||||||
| 
 | 
 | ||||||
|  |     FS_Error sd_status = scene_manager_get_scene_state(app->scene_manager, StorageSettingsSDInfo); | ||||||
|  | 
 | ||||||
|     if(event.type == SceneManagerEventTypeCustom) { |     if(event.type == SceneManagerEventTypeCustom) { | ||||||
|         switch(event.event) { |         switch(event.event) { | ||||||
|         case DialogExResultLeft: |         case DialogExResultLeft: | ||||||
|             consumed = scene_manager_previous_scene(app->scene_manager); |             consumed = scene_manager_previous_scene(app->scene_manager); | ||||||
|             break; |             break; | ||||||
|  |         case DialogExResultCenter: | ||||||
|  |             consumed = scene_manager_previous_scene(app->scene_manager); | ||||||
|  |             break; | ||||||
|         case DialogExResultRight: |         case DialogExResultRight: | ||||||
|             scene_manager_next_scene(app->scene_manager, StorageSettingsUnmounted); |             scene_manager_next_scene(app->scene_manager, StorageSettingsUnmounted); | ||||||
|             consumed = true; |             consumed = true; | ||||||
|             break; |             break; | ||||||
|         } |         } | ||||||
|  |     } else if(event.type == SceneManagerEventTypeBack && sd_status != FSE_OK) { | ||||||
|  |         consumed = true; | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|     return consumed; |     return consumed; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -9,11 +9,11 @@ static void | |||||||
| 
 | 
 | ||||||
| void storage_settings_scene_unmount_confirm_on_enter(void* context) { | void storage_settings_scene_unmount_confirm_on_enter(void* context) { | ||||||
|     StorageSettings* app = context; |     StorageSettings* app = context; | ||||||
|     FS_Error sd_status = storage_sd_status(app->fs_api); |  | ||||||
|     DialogEx* dialog_ex = app->dialog_ex; |     DialogEx* dialog_ex = app->dialog_ex; | ||||||
| 
 | 
 | ||||||
|  |     FS_Error sd_status = storage_sd_status(app->fs_api); | ||||||
|  | 
 | ||||||
|     if(sd_status == FSE_NOT_READY) { |     if(sd_status == FSE_NOT_READY) { | ||||||
|         dialog_ex_set_center_button_text(dialog_ex, "OK"); |  | ||||||
|         dialog_ex_set_header(dialog_ex, "SD card not mounted", 64, 10, AlignCenter, AlignCenter); |         dialog_ex_set_header(dialog_ex, "SD card not mounted", 64, 10, AlignCenter, AlignCenter); | ||||||
|         dialog_ex_set_text( |         dialog_ex_set_text( | ||||||
|             dialog_ex, |             dialog_ex, | ||||||
| @ -22,12 +22,13 @@ void storage_settings_scene_unmount_confirm_on_enter(void* context) { | |||||||
|             32, |             32, | ||||||
|             AlignCenter, |             AlignCenter, | ||||||
|             AlignCenter); |             AlignCenter); | ||||||
|  |         dialog_ex_set_center_button_text(dialog_ex, "OK"); | ||||||
|     } else { |     } else { | ||||||
|         dialog_ex_set_left_button_text(dialog_ex, "Cancel"); |  | ||||||
|         dialog_ex_set_right_button_text(dialog_ex, "Unmount"); |  | ||||||
|         dialog_ex_set_header(dialog_ex, "Unmount SD card?", 64, 10, AlignCenter, AlignCenter); |         dialog_ex_set_header(dialog_ex, "Unmount SD card?", 64, 10, AlignCenter, AlignCenter); | ||||||
|         dialog_ex_set_text( |         dialog_ex_set_text( | ||||||
|             dialog_ex, "SD card will be\nunavailable", 64, 32, AlignCenter, AlignCenter); |             dialog_ex, "SD card will be\nunavailable", 64, 32, AlignCenter, AlignCenter); | ||||||
|  |         dialog_ex_set_left_button_text(dialog_ex, "Cancel"); | ||||||
|  |         dialog_ex_set_right_button_text(dialog_ex, "Unmount"); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     dialog_ex_set_context(dialog_ex, app); |     dialog_ex_set_context(dialog_ex, app); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Aleksandr Kutuzov
						Aleksandr Kutuzov