diff --git a/applications/drivers/subghz/cc1101_ext/cc1101_ext.c b/applications/drivers/subghz/cc1101_ext/cc1101_ext.c index 405132a6b..db7dcb3ff 100644 --- a/applications/drivers/subghz/cc1101_ext/cc1101_ext.c +++ b/applications/drivers/subghz/cc1101_ext/cc1101_ext.c @@ -564,7 +564,7 @@ void subghz_device_cc1101_ext_start_async_rx( furi_hal_bus_enable(FuriHalBusTIM17); // Configure TIM - //Set the timer resolution to 2 �s + //Set the timer resolution to 2 us LL_TIM_SetPrescaler(TIM17, (64 << 1) - 1); LL_TIM_SetCounterMode(TIM17, LL_TIM_COUNTERMODE_UP); LL_TIM_SetAutoReload(TIM17, 0xFFFF); @@ -745,7 +745,7 @@ bool subghz_device_cc1101_ext_start_async_tx(SubGhzDeviceCC1101ExtCallback callb furi_hal_bus_enable(FuriHalBusTIM17); // Configure TIM - // Set the timer resolution to 2 �s + // Set the timer resolution to 2 us LL_TIM_SetPrescaler(TIM17, (64 << 1) - 1); LL_TIM_SetCounterMode(TIM17, LL_TIM_COUNTERMODE_UP); LL_TIM_SetAutoReload(TIM17, 0xFFFF); diff --git a/applications/external/hid_app/hid.c b/applications/external/hid_app/hid.c index 7b136e63f..b6a866718 100644 --- a/applications/external/hid_app/hid.c +++ b/applications/external/hid_app/hid.c @@ -1,7 +1,6 @@ #include "hid.h" #include "views.h" #include -#include #define TAG "HidApp" @@ -404,8 +403,6 @@ int32_t hid_usb_app(void* p) { bt_hid_connection_status_changed_callback(BtStatusConnected, app); - dolphin_deed(DolphinDeedPluginStart); - view_dispatcher_run(app->view_dispatcher); furi_hal_usb_set_config(usb_mode_prev, NULL); @@ -444,8 +441,6 @@ int32_t hid_ble_app(void* p) { furi_hal_bt_start_advertising(); bt_set_status_changed_callback(app->bt, bt_hid_connection_status_changed_callback, app); - dolphin_deed(DolphinDeedPluginStart); - view_dispatcher_run(app->view_dispatcher); bt_set_status_changed_callback(app->bt, NULL, NULL); diff --git a/applications/main/infrared/infrared_i.h b/applications/main/infrared/infrared_i.h index 55b70fc5e..089c2c7f8 100644 --- a/applications/main/infrared/infrared_i.h +++ b/applications/main/infrared/infrared_i.h @@ -61,6 +61,8 @@ typedef enum { InfraredEditModeNone, InfraredEditModeRename, InfraredEditModeDelete, + InfraredEditModeMove, + InfraredEditModeMoveSelectDest } InfraredEditMode; typedef struct { @@ -70,6 +72,7 @@ typedef struct { InfraredEditTarget edit_target : 8; InfraredEditMode edit_mode : 8; int32_t current_button_index; + int32_t current_button_index_move_orig; uint32_t last_transmit_time; } InfraredAppState; diff --git a/applications/main/infrared/infrared_remote.c b/applications/main/infrared/infrared_remote.c index d3dfc2cce..a04a338ba 100644 --- a/applications/main/infrared/infrared_remote.c +++ b/applications/main/infrared/infrared_remote.c @@ -108,6 +108,21 @@ bool infrared_remote_delete_button(InfraredRemote* remote, size_t index) { return infrared_remote_store(remote); } +bool infrared_remote_move_button(InfraredRemote* remote, size_t index_orig, size_t index_dest) { + furi_assert(index_orig < InfraredButtonArray_size(remote->buttons)); + furi_assert(index_dest <= InfraredButtonArray_size(remote->buttons)); + if(index_orig == index_dest) { + return true; + } + InfraredRemoteButton* button; + InfraredButtonArray_pop_at(&button, remote->buttons, index_orig); + if(index_orig > index_dest) + InfraredButtonArray_push_at(remote->buttons, index_dest, button); + else + InfraredButtonArray_push_at(remote->buttons, index_dest - 1, button); + return infrared_remote_store(remote); +} + bool infrared_remote_store(InfraredRemote* remote) { Storage* storage = furi_record_open(RECORD_STORAGE); FlipperFormat* ff = flipper_format_file_alloc(storage); diff --git a/applications/main/infrared/infrared_remote.h b/applications/main/infrared/infrared_remote.h index 6eac193d3..2640149a4 100644 --- a/applications/main/infrared/infrared_remote.h +++ b/applications/main/infrared/infrared_remote.h @@ -23,6 +23,7 @@ bool infrared_remote_find_button_by_name(InfraredRemote* remote, const char* nam bool infrared_remote_add_button(InfraredRemote* remote, const char* name, InfraredSignal* signal); bool infrared_remote_rename_button(InfraredRemote* remote, const char* new_name, size_t index); bool infrared_remote_delete_button(InfraredRemote* remote, size_t index); +bool infrared_remote_move_button(InfraredRemote* remote, size_t index_orig, size_t index_dest); bool infrared_remote_store(InfraredRemote* remote); bool infrared_remote_load(InfraredRemote* remote, FuriString* path); diff --git a/applications/main/infrared/scenes/infrared_scene_config.h b/applications/main/infrared/scenes/infrared_scene_config.h index b15974941..77ae82af2 100644 --- a/applications/main/infrared/scenes/infrared_scene_config.h +++ b/applications/main/infrared/scenes/infrared_scene_config.h @@ -7,6 +7,8 @@ ADD_SCENE(infrared, edit_delete_done, EditDeleteDone) ADD_SCENE(infrared, edit_button_select, EditButtonSelect) ADD_SCENE(infrared, edit_rename, EditRename) ADD_SCENE(infrared, edit_rename_done, EditRenameDone) +ADD_SCENE(infrared, edit_move, EditMove) +ADD_SCENE(infrared, edit_move_done, EditMoveDone) ADD_SCENE(infrared, learn, Learn) ADD_SCENE(infrared, learn_done, LearnDone) ADD_SCENE(infrared, learn_enter_name, LearnEnterName) diff --git a/applications/main/infrared/scenes/infrared_scene_edit.c b/applications/main/infrared/scenes/infrared_scene_edit.c index 360ed49b3..79de04bda 100644 --- a/applications/main/infrared/scenes/infrared_scene_edit.c +++ b/applications/main/infrared/scenes/infrared_scene_edit.c @@ -3,6 +3,7 @@ typedef enum { SubmenuIndexAddButton, SubmenuIndexRenameButton, + SubmenuIndexMoveButton, SubmenuIndexDeleteButton, SubmenuIndexRenameRemote, SubmenuIndexDeleteRemote, @@ -30,6 +31,12 @@ void infrared_scene_edit_on_enter(void* context) { SubmenuIndexRenameButton, infrared_scene_edit_submenu_callback, context); + submenu_add_item( + submenu, + "Move Button", + SubmenuIndexMoveButton, + infrared_scene_edit_submenu_callback, + context); submenu_add_item( submenu, "Delete Button", @@ -74,6 +81,11 @@ bool infrared_scene_edit_on_event(void* context, SceneManagerEvent event) { infrared->app_state.edit_mode = InfraredEditModeRename; scene_manager_next_scene(scene_manager, InfraredSceneEditButtonSelect); consumed = true; + } else if(submenu_index == SubmenuIndexMoveButton) { + infrared->app_state.edit_target = InfraredEditTargetButton; + infrared->app_state.edit_mode = InfraredEditModeMove; + scene_manager_next_scene(scene_manager, InfraredSceneEditButtonSelect); + consumed = true; } else if(submenu_index == SubmenuIndexDeleteButton) { infrared->app_state.edit_target = InfraredEditTargetButton; infrared->app_state.edit_mode = InfraredEditModeDelete; diff --git a/applications/main/infrared/scenes/infrared_scene_edit_button_select.c b/applications/main/infrared/scenes/infrared_scene_edit_button_select.c index a7f8a2bf7..7056a2053 100644 --- a/applications/main/infrared/scenes/infrared_scene_edit_button_select.c +++ b/applications/main/infrared/scenes/infrared_scene_edit_button_select.c @@ -11,9 +11,23 @@ void infrared_scene_edit_button_select_on_enter(void* context) { InfraredRemote* remote = infrared->remote; InfraredAppState* app_state = &infrared->app_state; - const char* header = infrared->app_state.edit_mode == InfraredEditModeRename ? - "Rename Button:" : - "Delete Button:"; + const char* header = NULL; + switch(infrared->app_state.edit_mode) { + case InfraredEditModeRename: + header = "Rename Button:"; + break; + case InfraredEditModeDelete: + header = "Delete Button:"; + break; + case InfraredEditModeMove: + header = "Select Button to Move:"; + break; + case InfraredEditModeMoveSelectDest: + case InfraredEditModeNone: + default: + header = "Move Button Before:"; + break; + } submenu_set_header(submenu, header); const size_t button_count = infrared_remote_get_button_count(remote); @@ -26,7 +40,14 @@ void infrared_scene_edit_button_select_on_enter(void* context) { infrared_scene_edit_button_select_submenu_callback, context); } - + if(infrared->app_state.edit_mode == InfraredEditModeMoveSelectDest) { + submenu_add_item( + submenu, + "-- Move to the end --", + button_count, + infrared_scene_edit_button_select_submenu_callback, + context); + } if(button_count && app_state->current_button_index != InfraredButtonIndexNone) { submenu_set_selected_item(submenu, app_state->current_button_index); app_state->current_button_index = InfraredButtonIndexNone; @@ -48,6 +69,12 @@ bool infrared_scene_edit_button_select_on_event(void* context, SceneManagerEvent scene_manager_next_scene(scene_manager, InfraredSceneEditRename); } else if(edit_mode == InfraredEditModeDelete) { scene_manager_next_scene(scene_manager, InfraredSceneEditDelete); + } else if(edit_mode == InfraredEditModeMove) { + app_state->current_button_index_move_orig = event.event; + app_state->edit_mode = InfraredEditModeMoveSelectDest; + scene_manager_next_scene(scene_manager, InfraredSceneEditButtonSelect); + } else if(edit_mode == InfraredEditModeMoveSelectDest) { + scene_manager_next_scene(scene_manager, InfraredSceneEditMove); } else { furi_assert(0); } diff --git a/applications/main/infrared/scenes/infrared_scene_edit_move.c b/applications/main/infrared/scenes/infrared_scene_edit_move.c new file mode 100644 index 000000000..69c7ec41d --- /dev/null +++ b/applications/main/infrared/scenes/infrared_scene_edit_move.c @@ -0,0 +1,103 @@ +#include "../infrared_i.h" + +static void infrared_scene_edit_move_dialog_result_callback(DialogExResult result, void* context) { + Infrared* infrared = context; + view_dispatcher_send_custom_event(infrared->view_dispatcher, result); +} + +void infrared_scene_edit_move_on_enter(void* context) { + Infrared* infrared = context; + DialogEx* dialog_ex = infrared->dialog_ex; + InfraredRemote* remote = infrared->remote; + + const InfraredEditTarget edit_target = infrared->app_state.edit_target; + if(edit_target == InfraredEditTargetButton) { + int32_t current_button_index = infrared->app_state.current_button_index_move_orig; + furi_assert(current_button_index != InfraredButtonIndexNone); + + dialog_ex_set_header(dialog_ex, "Move Button?", 64, 0, AlignCenter, AlignTop); + InfraredRemoteButton* current_button = + infrared_remote_get_button(remote, current_button_index); + InfraredSignal* signal = infrared_remote_button_get_signal(current_button); + + if(infrared_signal_is_raw(signal)) { + const InfraredRawSignal* raw = infrared_signal_get_raw_signal(signal); + infrared_text_store_set( + infrared, + 0, + "%s\nRAW\n%ld samples", + infrared_remote_button_get_name(current_button), + raw->timings_size); + + } else { + const InfraredMessage* message = infrared_signal_get_message(signal); + infrared_text_store_set( + infrared, + 0, + "%s\n%s\nA=0x%0*lX C=0x%0*lX", + infrared_remote_button_get_name(current_button), + infrared_get_protocol_name(message->protocol), + ROUND_UP_TO(infrared_get_protocol_address_length(message->protocol), 4), + message->address, + ROUND_UP_TO(infrared_get_protocol_command_length(message->protocol), 4), + message->command); + } + } else { + furi_assert(0); + } + + dialog_ex_set_text(dialog_ex, infrared->text_store[0], 64, 31, AlignCenter, AlignCenter); + dialog_ex_set_icon(dialog_ex, 0, 0, NULL); + dialog_ex_set_left_button_text(dialog_ex, "Cancel"); + dialog_ex_set_right_button_text(dialog_ex, "Move"); + dialog_ex_set_result_callback(dialog_ex, infrared_scene_edit_move_dialog_result_callback); + dialog_ex_set_context(dialog_ex, context); + + view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewDialogEx); +} + +bool infrared_scene_edit_move_on_event(void* context, SceneManagerEvent event) { + Infrared* infrared = context; + SceneManager* scene_manager = infrared->scene_manager; + bool consumed = false; + + if(event.type == SceneManagerEventTypeCustom) { + if(event.event == DialogExResultLeft) { + scene_manager_previous_scene(scene_manager); + consumed = true; + } else if(event.event == DialogExResultRight) { + bool success = false; + InfraredRemote* remote = infrared->remote; + InfraredAppState* app_state = &infrared->app_state; + const InfraredEditTarget edit_target = app_state->edit_target; + + if(edit_target == InfraredEditTargetButton) { + furi_assert(app_state->current_button_index != InfraredButtonIndexNone); + success = infrared_remote_move_button( + remote, + app_state->current_button_index_move_orig, + app_state->current_button_index); + app_state->current_button_index_move_orig = InfraredButtonIndexNone; + app_state->current_button_index = InfraredButtonIndexNone; + } else { + furi_assert(0); + } + + if(success) { + scene_manager_next_scene(scene_manager, InfraredSceneEditMoveDone); + } else { + const uint32_t possible_scenes[] = {InfraredSceneRemoteList, InfraredSceneStart}; + scene_manager_search_and_switch_to_previous_scene_one_of( + scene_manager, possible_scenes, COUNT_OF(possible_scenes)); + } + consumed = true; + } + } + + return consumed; +} + +void infrared_scene_edit_move_on_exit(void* context) { + Infrared* infrared = context; + UNUSED(infrared); +} diff --git a/applications/main/infrared/scenes/infrared_scene_edit_move_done.c b/applications/main/infrared/scenes/infrared_scene_edit_move_done.c new file mode 100644 index 000000000..9f9b4b80d --- /dev/null +++ b/applications/main/infrared/scenes/infrared_scene_edit_move_done.c @@ -0,0 +1,48 @@ +#include "../infrared_i.h" + +void infrared_scene_edit_move_done_on_enter(void* context) { + Infrared* infrared = context; + Popup* popup = infrared->popup; + + popup_set_icon(popup, 0, 2, &I_DolphinMafia_115x62); + popup_set_header(popup, "Moved", 83, 19, AlignLeft, AlignBottom); + + popup_set_callback(popup, infrared_popup_closed_callback); + popup_set_context(popup, context); + popup_set_timeout(popup, 1500); + popup_enable_timeout(popup); + + view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewPopup); +} + +bool infrared_scene_edit_move_done_on_event(void* context, SceneManagerEvent event) { + Infrared* infrared = context; + SceneManager* scene_manager = infrared->scene_manager; + bool consumed = false; + + if(event.type == SceneManagerEventTypeCustom) { + if(event.event == InfraredCustomEventTypePopupClosed) { + const InfraredEditTarget edit_target = infrared->app_state.edit_target; + if(edit_target == InfraredEditTargetButton) { + scene_manager_search_and_switch_to_previous_scene( + scene_manager, InfraredSceneRemote); + } else if(edit_target == InfraredEditTargetRemote) { + const uint32_t possible_scenes[] = {InfraredSceneStart, InfraredSceneRemoteList}; + if(!scene_manager_search_and_switch_to_previous_scene_one_of( + scene_manager, possible_scenes, COUNT_OF(possible_scenes))) { + view_dispatcher_stop(infrared->view_dispatcher); + } + } else { + furi_assert(0); + } + consumed = true; + } + } + + return consumed; +} + +void infrared_scene_edit_move_done_on_exit(void* context) { + Infrared* infrared = context; + UNUSED(infrared); +} diff --git a/applications/main/u2f/u2f_data.c b/applications/main/u2f/u2f_data.c index 217733c94..f6a8d84d3 100644 --- a/applications/main/u2f/u2f_data.c +++ b/applications/main/u2f/u2f_data.c @@ -7,7 +7,7 @@ #define TAG "U2F" -#define U2F_DATA_FOLDER ANY_PATH("u2f/") +#define U2F_DATA_FOLDER EXT_PATH("u2f/") #define U2F_CERT_FILE U2F_DATA_FOLDER "assets/cert.der" #define U2F_CERT_KEY_FILE U2F_DATA_FOLDER "assets/cert_key.u2f" #define U2F_KEY_FILE U2F_DATA_FOLDER "key.u2f" diff --git a/applications/services/dolphin/helpers/dolphin_deed.c b/applications/services/dolphin/helpers/dolphin_deed.c index 51db56fdf..f1f42b770 100644 --- a/applications/services/dolphin/helpers/dolphin_deed.c +++ b/applications/services/dolphin/helpers/dolphin_deed.c @@ -39,7 +39,7 @@ static const DolphinDeedWeight dolphin_deed_weights[] = { {1, DolphinAppPlugin}, // DolphinDeedGpioUartBridge - {1, DolphinAppPlugin}, // DolphinDeedPluginStart + {2, DolphinAppPlugin}, // DolphinDeedPluginStart {1, DolphinAppPlugin}, // DolphinDeedPluginGameStart {10, DolphinAppPlugin}, // DolphinDeedPluginGameWin }; diff --git a/applications/services/gui/modules/byte_input.c b/applications/services/gui/modules/byte_input.c index 554a7ca5c..cd79fa5d4 100644 --- a/applications/services/gui/modules/byte_input.c +++ b/applications/services/gui/modules/byte_input.c @@ -4,6 +4,7 @@ #include #include +/** ByteInput type */ struct ByteInput { View* view; }; @@ -61,11 +62,11 @@ static const ByteInputKey keyboard_keys_row_2[] = { {enter_symbol, 95, 17}, }; -/** - * @brief Get row size - * - * @param row_index Index of row - * @return uint8_t Row size +/** Get row size + * + * @param row_index Index of row + * + * @return uint8_t Row size */ static uint8_t byte_input_get_row_size(uint8_t row_index) { uint8_t row_size = 0; @@ -84,11 +85,11 @@ static uint8_t byte_input_get_row_size(uint8_t row_index) { return row_size; } -/** - * @brief Get row pointer - * - * @param row_index Index of row - * @return const ByteInputKey* Row pointer +/** Get row pointer + * + * @param row_index Index of row + * + * @return const ByteInputKey* Row pointer */ static const ByteInputKey* byte_input_get_row(uint8_t row_index) { const ByteInputKey* row = NULL; @@ -107,12 +108,12 @@ static const ByteInputKey* byte_input_get_row(uint8_t row_index) { return row; } -/** - * @brief Get text from nibble - * - * @param byte byte value - * @param high_nibble Get from high nibble, otherwise low nibble - * @return char nibble text +/** Get text from nibble + * + * @param byte byte value + * @param high_nibble Get from high nibble, otherwise low nibble + * + * @return char nibble text */ static char byte_input_get_nibble_text(uint8_t byte, bool high_nibble) { if(high_nibble) { @@ -151,11 +152,10 @@ static char byte_input_get_nibble_text(uint8_t byte, bool high_nibble) { const char num_to_char[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}; -/** - * @brief Draw input box (common view) - * - * @param canvas - * @param model +/** Draw input box (common view) + * + * @param canvas The canvas + * @param model The model */ static void byte_input_draw_input(Canvas* canvas, ByteInputModel* model) { const uint8_t text_x = 8; @@ -263,11 +263,10 @@ static void byte_input_draw_input(Canvas* canvas, ByteInputModel* model) { } } -/** - * @brief Draw input box (selected view) - * - * @param canvas - * @param model +/** Draw input box (selected view) + * + * @param canvas The canvas + * @param model The model */ static void byte_input_draw_input_selected(Canvas* canvas, ByteInputModel* model) { const uint8_t text_x = 7; @@ -324,13 +323,12 @@ static void byte_input_draw_input_selected(Canvas* canvas, ByteInputModel* model canvas_invert_color(canvas); } -/** - * @brief Set nibble at position - * - * @param data where to set nibble - * @param position byte position - * @param value char value - * @param high_nibble set high nibble +/** Set nibble at position + * + * @param data where to set nibble + * @param position byte position + * @param value char value + * @param high_nibble set high nibble */ static void byte_input_set_nibble(uint8_t* data, uint8_t position, char value, bool high_nibble) { switch(value) { @@ -368,29 +366,28 @@ static void byte_input_set_nibble(uint8_t* data, uint8_t position, char value, b } } -/** - * @brief What currently selected - * - * @return true - keyboard selected, false - input selected +/** What currently selected + * + * @param model The model + * + * @return true - keyboard selected, false - input selected */ static bool byte_input_keyboard_selected(ByteInputModel* model) { return model->selected_row >= 0; } -/** - * @brief Do transition from keyboard - * - * @param model +/** Do transition from keyboard + * + * @param model The model */ static void byte_input_transition_from_keyboard(ByteInputModel* model) { model->selected_row += 1; model->selected_high_nibble = true; } -/** - * @brief Increase selected byte position - * - * @param model +/** Increase selected byte position + * + * @param model The model */ static void byte_input_inc_selected_byte(ByteInputModel* model) { if(model->selected_byte < model->bytes_count - 1) { @@ -409,18 +406,17 @@ static void byte_input_inc_selected_byte(ByteInputModel* model) { static void byte_input_inc_selected_byte_mini(ByteInputModel* model) { if((model->selected_byte < model->bytes_count - 1) || model->selected_high_nibble) { if(!model->selected_high_nibble) { - model->selected_high_nibble = !model->selected_high_nibble; + model->selected_high_nibble = !model->selected_high_nibble; //-V547 byte_input_inc_selected_byte(model); } else { - model->selected_high_nibble = !model->selected_high_nibble; + model->selected_high_nibble = !model->selected_high_nibble; //-V547 } } } -/** - * @brief Decrease selected byte position - * - * @param model +/** Decrease selected byte position + * + * @param model The model */ static void byte_input_dec_selected_byte(ByteInputModel* model) { if(model->selected_byte > 0) { @@ -438,18 +434,17 @@ static void byte_input_dec_selected_byte(ByteInputModel* model) { static void byte_input_dec_selected_byte_mini(ByteInputModel* model) { if(model->selected_byte > 0 || !model->selected_high_nibble) { if(model->selected_high_nibble) { - model->selected_high_nibble = !model->selected_high_nibble; + model->selected_high_nibble = !model->selected_high_nibble; //-V547 byte_input_dec_selected_byte(model); } else { - model->selected_high_nibble = !model->selected_high_nibble; + model->selected_high_nibble = !model->selected_high_nibble; //-V547 } } } -/** - * @brief Call input callback - * - * @param model +/** Call input callback + * + * @param model The model */ static void byte_input_call_input_callback(ByteInputModel* model) { if(model->input_callback != NULL) { @@ -457,10 +452,9 @@ static void byte_input_call_input_callback(ByteInputModel* model) { } } -/** - * @brief Call changed callback - * - * @param model +/** Call changed callback + * + * @param model The model */ static void byte_input_call_changed_callback(ByteInputModel* model) { if(model->changed_callback != NULL) { @@ -468,8 +462,9 @@ static void byte_input_call_changed_callback(ByteInputModel* model) { } } -/** - * @brief Clear selected byte +/** Clear selected byte + * + * @param model The model */ static void byte_input_clear_selected_byte(ByteInputModel* model) { @@ -479,10 +474,9 @@ static void byte_input_clear_selected_byte(ByteInputModel* model) { byte_input_call_changed_callback(model); } -/** - * @brief Handle up button - * - * @param model +/** Handle up button + * + * @param model The model */ static void byte_input_handle_up(ByteInputModel* model) { if(model->selected_row > -2) { @@ -500,10 +494,9 @@ static void byte_input_handle_up(ByteInputModel* model) { } } -/** - * @brief Handle down button - * - * @param model +/** Handle down button + * + * @param model The model */ static void byte_input_handle_down(ByteInputModel* model) { if(model->selected_row != -2) { @@ -527,10 +520,9 @@ static void byte_input_handle_down(ByteInputModel* model) { } } -/** - * @brief Handle left button - * - * @param model +/** Handle left button + * + * @param model The model */ static void byte_input_handle_left(ByteInputModel* model) { // XXX if(byte_input_keyboard_selected(model)) { @@ -548,10 +540,9 @@ static void byte_input_handle_left(ByteInputModel* model) { // XXX } } -/** - * @brief Handle right button - * - * @param model +/** Handle right button + * + * @param model The model */ static void byte_input_handle_right(ByteInputModel* model) { // XXX if(byte_input_keyboard_selected(model)) { @@ -569,10 +560,9 @@ static void byte_input_handle_right(ByteInputModel* model) { // XXX } } -/** - * @brief Handle OK button - * - * @param model +/** Handle OK button + * + * @param model The model */ static void byte_input_handle_ok(ByteInputModel* model) { if(byte_input_keyboard_selected(model)) { @@ -600,11 +590,10 @@ static void byte_input_handle_ok(ByteInputModel* model) { } } -/** - * @brief Draw callback - * - * @param canvas - * @param _model +/** Draw callback + * + * @param canvas The canvas + * @param _model The model */ static void byte_input_view_draw_callback(Canvas* canvas, void* _model) { ByteInputModel* model = _model; @@ -698,13 +687,13 @@ static void byte_input_view_draw_callback(Canvas* canvas, void* _model) { } } -/** - * @brief Input callback - * - * @param event - * @param context - * @return true - * @return false +/** Input callback + * + * @param event The event + * @param context The context + * + * @return true + * @return false */ static bool byte_input_view_input_callback(InputEvent* event, void* context) { ByteInput* byte_input = context; @@ -773,10 +762,9 @@ static bool byte_input_view_input_callback(InputEvent* event, void* context) { return consumed; } -/** - * @brief Reset all input-related data in model - * - * @param model ByteInputModel +/** Reset all input-related data in model + * + * @param model The model */ static void byte_input_reset_model_input_data(ByteInputModel* model) { model->bytes = NULL; @@ -788,11 +776,6 @@ static void byte_input_reset_model_input_data(ByteInputModel* model) { model->first_visible_byte = 0; } -/** - * @brief Allocate and initialize byte input. This byte input is used to enter bytes. - * - * @return ByteInput instance pointer - */ ByteInput* byte_input_alloc() { ByteInput* byte_input = malloc(sizeof(ByteInput)); byte_input->view = view_alloc(); @@ -816,38 +799,17 @@ ByteInput* byte_input_alloc() { return byte_input; } -/** - * @brief Deinitialize and free byte input - * - * @param byte_input Byte input instance - */ void byte_input_free(ByteInput* byte_input) { furi_assert(byte_input); view_free(byte_input->view); free(byte_input); } -/** - * @brief Get byte input view - * - * @param byte_input byte input instance - * @return View instance that can be used for embedding - */ View* byte_input_get_view(ByteInput* byte_input) { furi_assert(byte_input); return byte_input->view; } -/** - * @brief Deinitialize and free byte input - * - * @param byte_input byte input instance - * @param input_callback input callback fn - * @param changed_callback changed callback fn - * @param callback_context callback context - * @param bytes buffer to use - * @param bytes_count buffer length - */ void byte_input_set_result_callback( ByteInput* byte_input, ByteInputCallback input_callback, @@ -869,12 +831,6 @@ void byte_input_set_result_callback( true); } -/** - * @brief Set byte input header text - * - * @param byte_input byte input instance - * @param text text to be shown - */ void byte_input_set_header_text(ByteInput* byte_input, const char* text) { with_view_model( byte_input->view, ByteInputModel * model, { model->header = text; }, true); diff --git a/applications/services/loader/loader_applications.c b/applications/services/loader/loader_applications.c index 8ae91d764..2e1de6134 100644 --- a/applications/services/loader/loader_applications.c +++ b/applications/services/loader/loader_applications.c @@ -6,6 +6,7 @@ #include #include #include +#include #define TAG "LoaderApplications" @@ -119,6 +120,8 @@ static void loader_pubsub_callback(const void* message, void* context) { static void loader_applications_start_app(LoaderApplicationsApp* app) { const char* name = furi_string_get_cstr(app->fap_path); + dolphin_deed(DolphinDeedPluginStart); + // load app FuriThreadId thread_id = furi_thread_get_current_id(); FuriPubSubSubscription* subscription = diff --git a/applications/services/notification/notification_app.c b/applications/services/notification/notification_app.c index 2f947fe8a..6fa48e7f4 100644 --- a/applications/services/notification/notification_app.c +++ b/applications/services/notification/notification_app.c @@ -5,7 +5,7 @@ #include #include #include - +#include #include "notification.h" #include "notification_messages.h" #include "notification_app.h" @@ -104,7 +104,10 @@ static void notification_reset_notification_led_layer(NotificationLedLayer* laye furi_hal_light_set(layer->light, layer->value[LayerInternal]); } -static void notification_reset_notification_layer(NotificationApp* app, uint8_t reset_mask) { +static void notification_reset_notification_layer( + NotificationApp* app, + uint8_t reset_mask, + float display_brightness_set) { if(reset_mask & reset_blink_mask) { furi_hal_light_blink_stop(); } @@ -124,6 +127,9 @@ static void notification_reset_notification_layer(NotificationApp* app, uint8_t notification_sound_off(); } if(reset_mask & reset_display_mask) { + if(!float_is_equal(display_brightness_set, app->settings.display_brightness)) { + furi_hal_light_set(LightBacklight, app->settings.display_brightness * 0xFF); + } furi_timer_start(app->display_timer, notification_settings_display_off_delay_ticks(app)); } } @@ -212,13 +218,14 @@ static void notification_process_notification_message( notification_apply_notification_led_layer( &app->display, notification_message->data.led.value * display_brightness_setting); + reset_mask |= reset_display_mask; } else { + reset_mask &= ~reset_display_mask; notification_reset_notification_led_layer(&app->display); if(furi_timer_is_running(app->display_timer)) { furi_timer_stop(app->display_timer); } } - reset_mask |= reset_display_mask; break; case NotificationMessageTypeLedDisplayBacklightEnforceOn: furi_assert(app->display_led_lock < UINT8_MAX); @@ -370,7 +377,7 @@ static void notification_process_notification_message( } if(reset_notifications) { - notification_reset_notification_layer(app, reset_mask); + notification_reset_notification_layer(app, reset_mask, display_brightness_setting); } } diff --git a/applications/settings/about/about.c b/applications/settings/about/about.c index f21e234ca..6b7c9f976 100644 --- a/applications/settings/about/about.c +++ b/applications/settings/about/about.c @@ -205,8 +205,6 @@ const AboutDialogScreen about_screens[] = { hw_version_screen, fw_version_screen}; -const size_t about_screens_count = sizeof(about_screens) / sizeof(AboutDialogScreen); - int32_t about_settings_app(void* p) { UNUSED(p); DialogsApp* dialogs = furi_record_open(RECORD_DIALOGS); @@ -227,7 +225,7 @@ int32_t about_settings_app(void* p) { view_dispatcher_switch_to_view(view_dispatcher, empty_screen_index); while(1) { - if(screen_index >= about_screens_count - 1) { + if(screen_index >= COUNT_OF(about_screens) - 1) { dialog_message_set_buttons(message, "Back", NULL, NULL); } else { dialog_message_set_buttons(message, "Back", NULL, "Next"); @@ -242,7 +240,7 @@ int32_t about_settings_app(void* p) { screen_index--; } } else if(screen_result == DialogMessageButtonRight) { - if(screen_index < about_screens_count - 1) { + if(screen_index < COUNT_OF(about_screens) - 1) { screen_index++; } } else if(screen_result == DialogMessageButtonBack) { diff --git a/firmware/targets/f7/furi_hal/furi_hal_info.c b/firmware/targets/f7/furi_hal/furi_hal_info.c index a2c9232c0..cefb6a11b 100644 --- a/firmware/targets/f7/furi_hal/furi_hal_info.c +++ b/firmware/targets/f7/furi_hal/furi_hal_info.c @@ -24,10 +24,10 @@ void furi_hal_info_get(PropertyValueCallback out, char sep, void* context) { // Device Info version if(sep == '.') { property_value_out(&property_context, NULL, 2, "format", "major", "3"); - property_value_out(&property_context, NULL, 2, "format", "minor", "2"); + property_value_out(&property_context, NULL, 2, "format", "minor", "3"); } else { property_value_out(&property_context, NULL, 3, "device", "info", "major", "2"); - property_value_out(&property_context, NULL, 3, "device", "info", "minor", "3"); + property_value_out(&property_context, NULL, 3, "device", "info", "minor", "4"); } // Model name @@ -298,6 +298,7 @@ void furi_hal_info_get(PropertyValueCallback out, char sep, void* context) { property_value_out(&property_context, NULL, 2, "radio", "alive", "false"); } + // RTC flags property_value_out( &property_context, "%u", @@ -305,8 +306,52 @@ void furi_hal_info_get(PropertyValueCallback out, char sep, void* context) { "system", "debug", furi_hal_rtc_is_flag_set(FuriHalRtcFlagDebug)); + property_value_out( + &property_context, "%u", 2, "system", "lock", furi_hal_rtc_is_flag_set(FuriHalRtcFlagLock)); + property_value_out( + &property_context, + "%u", + 2, + "system", + "orient", + furi_hal_rtc_is_flag_set(FuriHalRtcFlagHandOrient)); + property_value_out( + &property_context, + "%u", + 3, + "system", + "sleep", + "legacy", + furi_hal_rtc_is_flag_set(FuriHalRtcFlagLegacySleep)); + property_value_out( + &property_context, + "%u", + 2, + "system", + "stealth", + furi_hal_rtc_is_flag_set(FuriHalRtcFlagStealthMode)); + property_value_out( &property_context, "%u", 3, "system", "heap", "track", furi_hal_rtc_get_heap_track_mode()); + property_value_out(&property_context, "%u", 2, "system", "boot", furi_hal_rtc_get_boot_mode()); + property_value_out( + &property_context, + "%u", + 3, + "system", + "locale", + "time", + furi_hal_rtc_get_locale_timeformat()); + property_value_out( + &property_context, + "%u", + 3, + "system", + "locale", + "date", + furi_hal_rtc_get_locale_dateformat()); + property_value_out( + &property_context, "%u", 3, "system", "locale", "unit", furi_hal_rtc_get_locale_units()); property_value_out( &property_context, "%u", 3, "system", "log", "level", furi_hal_rtc_get_log_level()); diff --git a/firmware/targets/furi_hal_include/furi_hal_version.h b/firmware/targets/furi_hal_include/furi_hal_version.h index 65f5d6d94..62050ddae 100644 --- a/firmware/targets/furi_hal_include/furi_hal_version.h +++ b/firmware/targets/furi_hal_include/furi_hal_version.h @@ -35,6 +35,7 @@ typedef enum { FuriHalVersionColorUnknown = 0x00, FuriHalVersionColorBlack = 0x01, FuriHalVersionColorWhite = 0x02, + FuriHalVersionColorTransparent = 0x03, } FuriHalVersionColor; /** Device Regions */ diff --git a/furi/core/thread.h b/furi/core/thread.h index 022894ee8..692f2a100 100644 --- a/furi/core/thread.h +++ b/furi/core/thread.h @@ -28,7 +28,7 @@ typedef enum { FuriThreadPriorityNormal = 16, /**< Normal */ FuriThreadPriorityHigh = 17, /**< High */ FuriThreadPriorityHighest = 18, /**< Highest */ - FuriThreadPriorityIsr = 32, /**< Deffered Isr (highest possible) */ + FuriThreadPriorityIsr = (configMAX_PRIORITIES - 1), /**< Deferred ISR (highest possible) */ } FuriThreadPriority; /** FuriThread anonymous structure */ diff --git a/scripts/otp.py b/scripts/otp.py index 19b8c4df4..e3f070999 100755 --- a/scripts/otp.py +++ b/scripts/otp.py @@ -17,6 +17,7 @@ OTP_COLORS = { "unknown": 0x00, "black": 0x01, "white": 0x02, + "transparent": 0x03, } OTP_REGIONS = {