Merge remote-tracking branch 'upstream/dev' into shutdown_idle

# Conflicts:
#	firmware/targets/f7/api_symbols.csv
This commit is contained in:
SHxKenzuto
2022-10-21 23:16:29 +02:00
332 changed files with 10688 additions and 1037 deletions

View File

@@ -165,6 +165,11 @@ static uint16_t bt_serial_event_callback(SerialServiceEvent event, void* context
ret = rpc_session_get_available_size(bt->rpc_session);
} else if(event.event == SerialServiceEventTypeDataSent) {
furi_event_flag_set(bt->rpc_event, BT_RPC_EVENT_BUFF_SENT);
} else if(event.event == SerialServiceEventTypesBleResetRequest) {
FURI_LOG_I(TAG, "BLE restart request received");
BtMessage message = {.type = BtMessageTypeSetProfile, .data.profile = BtProfileSerial};
furi_check(
furi_message_queue_put(bt->message_queue, &message, FuriWaitForever) == FuriStatusOk);
}
return ret;
}
@@ -226,6 +231,7 @@ static bool bt_on_gap_event_callback(GapEvent event, void* context) {
rpc_session_set_context(bt->rpc_session, bt);
furi_hal_bt_serial_set_event_callback(
RPC_BUFFER_SIZE, bt_serial_event_callback, bt);
furi_hal_bt_serial_set_rpc_status(FuriHalBtSerialRpcStatusActive);
} else {
FURI_LOG_W(TAG, "RPC is busy, failed to open new session");
}
@@ -241,6 +247,7 @@ static bool bt_on_gap_event_callback(GapEvent event, void* context) {
} else if(event.type == GapEventTypeDisconnected) {
if(bt->profile == BtProfileSerial && bt->rpc_session) {
FURI_LOG_I(TAG, "Close RPC connection");
furi_hal_bt_serial_set_rpc_status(FuriHalBtSerialRpcStatusNotActive);
furi_event_flag_set(bt->rpc_event, BT_RPC_EVENT_DISCONNECTED);
rpc_session_close(bt->rpc_session);
furi_hal_bt_serial_set_event_callback(0, NULL, NULL);
@@ -330,14 +337,20 @@ static void bt_change_profile(Bt* bt, BtMessage* message) {
}
furi_hal_bt_set_key_storage_change_callback(bt_on_key_storage_change_callback, bt);
bt->profile = message->data.profile;
*message->result = true;
if(message->result) {
*message->result = true;
}
} else {
FURI_LOG_E(TAG, "Failed to start Bt App");
*message->result = false;
if(message->result) {
*message->result = false;
}
}
} else {
bt_show_warning(bt, "Radio stack doesn't support this app");
*message->result = false;
if(message->result) {
*message->result = false;
}
}
furi_event_flag_set(bt->api_event, BT_API_UNLOCK_EVENT);
}

View File

@@ -8,7 +8,7 @@
#include <toolbox/saved_struct.h>
#include <storage/storage.h>
#define DESKTOP_SETTINGS_VER (5)
#define DESKTOP_SETTINGS_VER (6)
#define DESKTOP_SETTINGS_PATH INT_PATH(DESKTOP_SETTINGS_FILE_NAME)
#define DESKTOP_SETTINGS_MAGIC (0x17)
@@ -34,6 +34,9 @@
#define MAX_PIN_SIZE 10
#define MIN_PIN_SIZE 4
#define MAX_APP_LENGTH 128
#define FAP_LOADER_APP_NAME "Applications"
typedef struct {
InputKey data[MAX_PIN_SIZE];
@@ -41,8 +44,13 @@ typedef struct {
} PinCode;
typedef struct {
uint16_t favorite_primary;
uint16_t favorite_secondary;
bool is_external;
char name_or_path[MAX_APP_LENGTH];
} FavoriteApp;
typedef struct {
FavoriteApp favorite_primary;
FavoriteApp favorite_secondary;
PinCode pin_code;
uint8_t is_locked;
uint32_t auto_lock_delay_ms;

View File

@@ -114,29 +114,39 @@ bool desktop_scene_main_on_event(void* context, SceneManagerEvent event) {
case DesktopMainEventOpenFavoritePrimary:
DESKTOP_SETTINGS_LOAD(&desktop->settings);
if(desktop->settings.favorite_primary < FLIPPER_APPS_COUNT) {
if(desktop->settings.favorite_primary.is_external) {
LoaderStatus status = loader_start(
desktop->loader, FLIPPER_APPS[desktop->settings.favorite_primary].name, NULL);
desktop->loader,
FAP_LOADER_APP_NAME,
desktop->settings.favorite_primary.name_or_path);
if(status != LoaderStatusOk) {
FURI_LOG_E(TAG, "loader_start failed: %d", status);
}
} else {
FURI_LOG_E(TAG, "Can't find primary favorite application");
LoaderStatus status = loader_start(
desktop->loader, desktop->settings.favorite_primary.name_or_path, NULL);
if(status != LoaderStatusOk) {
FURI_LOG_E(TAG, "loader_start failed: %d", status);
}
}
consumed = true;
break;
case DesktopMainEventOpenFavoriteSecondary:
DESKTOP_SETTINGS_LOAD(&desktop->settings);
if(desktop->settings.favorite_secondary < FLIPPER_APPS_COUNT) {
if(desktop->settings.favorite_secondary.is_external) {
LoaderStatus status = loader_start(
desktop->loader,
FLIPPER_APPS[desktop->settings.favorite_secondary].name,
NULL);
FAP_LOADER_APP_NAME,
desktop->settings.favorite_secondary.name_or_path);
if(status != LoaderStatusOk) {
FURI_LOG_E(TAG, "loader_start failed: %d", status);
}
} else {
FURI_LOG_E(TAG, "Can't find secondary favorite application");
LoaderStatus status = loader_start(
desktop->loader, desktop->settings.favorite_secondary.name_or_path, NULL);
if(status != LoaderStatusOk) {
FURI_LOG_E(TAG, "loader_start failed: %d", status);
}
}
consumed = true;
break;
@@ -166,7 +176,7 @@ bool desktop_scene_main_on_event(void* context, SceneManagerEvent event) {
}
case DesktopMainEventOpenGameMenu: {
LoaderStatus status = loader_start(
desktop->loader, "Applications", EXT_PATH("/apps/Games/snake_game.fap"));
desktop->loader, FAP_LOADER_APP_NAME, EXT_PATH("/apps/Games/snake_game.fap"));
if(status != LoaderStatusOk) {
FURI_LOG_E(TAG, "loader_start failed: %d", status);
}

View File

@@ -18,13 +18,15 @@ static const DolphinDeedWeight dolphin_deed_weights[] = {
{1, DolphinAppNfc}, // DolphinDeedNfcRead
{3, DolphinAppNfc}, // DolphinDeedNfcReadSuccess
{3, DolphinAppNfc}, // DolphinDeedNfcSave
{1, DolphinAppNfc}, // DolphinDeedNfcDetectReader
{2, DolphinAppNfc}, // DolphinDeedNfcEmulate
{2, DolphinAppNfc}, // DolphinDeedNfcAdd
{2, DolphinAppNfc}, // DolphinDeedNfcMfcAdd
{1, DolphinAppNfc}, // DolphinDeedNfcMfulError
{1, DolphinAppNfc}, // DolphinDeedNfcAddSave
{1, DolphinAppIr}, // DolphinDeedIrSend
{3, DolphinAppIr}, // DolphinDeedIrLearnSuccess
{3, DolphinAppIr}, // DolphinDeedIrSave
{2, DolphinAppIr}, // DolphinDeedIrBruteForce
{1, DolphinAppIbutton}, // DolphinDeedIbuttonRead
{3, DolphinAppIbutton}, // DolphinDeedIbuttonReadSuccess
@@ -33,17 +35,23 @@ static const DolphinDeedWeight dolphin_deed_weights[] = {
{2, DolphinAppIbutton}, // DolphinDeedIbuttonAdd
{3, DolphinAppBadusb}, // DolphinDeedBadUsbPlayScript
{3, DolphinAppU2f}, // DolphinDeedU2fAuthorized
{3, DolphinAppPlugin}, // DolphinDeedU2fAuthorized
{1, DolphinAppPlugin}, // DolphinDeedGpioUartBridge
{1, DolphinAppPlugin}, // DolphinDeedPluginStart
{1, DolphinAppPlugin}, // DolphinDeedPluginGameStart
{10, DolphinAppPlugin}, // DolphinDeedPluginGameWin
};
static uint8_t dolphin_deed_limits[] = {
15, // DolphinAppSubGhz
15, // DolphinAppRfid
15, // DolphinAppNfc
15, // DolphinAppIr
15, // DolphinAppIbutton
15, // DolphinAppBadusb
15, // DolphinAppU2f
20, // DolphinAppSubGhz
20, // DolphinAppRfid
20, // DolphinAppNfc
20, // DolphinAppIr
20, // DolphinAppIbutton
20, // DolphinAppBadusb
20, // DolphinAppPlugin
};
_Static_assert(COUNT_OF(dolphin_deed_weights) == DolphinDeedMAX, "dolphin_deed_weights size error");

View File

@@ -13,7 +13,7 @@ typedef enum {
DolphinAppIr,
DolphinAppIbutton,
DolphinAppBadusb,
DolphinAppU2f,
DolphinAppPlugin,
DolphinAppMAX,
} DolphinApp;
@@ -34,13 +34,15 @@ typedef enum {
DolphinDeedNfcRead,
DolphinDeedNfcReadSuccess,
DolphinDeedNfcSave,
DolphinDeedNfcDetectReader,
DolphinDeedNfcEmulate,
DolphinDeedNfcAdd,
DolphinDeedNfcMfcAdd,
DolphinDeedNfcMfulError,
DolphinDeedNfcAddSave,
DolphinDeedIrSend,
DolphinDeedIrLearnSuccess,
DolphinDeedIrSave,
DolphinDeedIrBruteForce,
DolphinDeedIbuttonRead,
DolphinDeedIbuttonReadSuccess,
@@ -51,6 +53,11 @@ typedef enum {
DolphinDeedBadUsbPlayScript,
DolphinDeedU2fAuthorized,
DolphinDeedGpioUartBridge,
DolphinDeedPluginStart,
DolphinDeedPluginGameStart,
DolphinDeedPluginGameWin,
DolphinDeedMAX,

View File

@@ -396,6 +396,10 @@ void variable_item_set_current_value_index(VariableItem* item, uint8_t current_v
item->current_value_index = current_value_index;
}
void variable_item_set_values_count(VariableItem* item, uint8_t values_count) {
item->values_count = values_count;
}
void variable_item_set_current_value_text(VariableItem* item, const char* current_value_text) {
furi_string_set(item->current_value_text, current_value_text);
}

View File

@@ -81,6 +81,13 @@ uint8_t variable_item_list_get_selected_item_index(VariableItemList* variable_it
*/
void variable_item_set_current_value_index(VariableItem* item, uint8_t current_value_index);
/** Set number of values for item
*
* @param item VariableItem* instance
* @param values_count The new values count
*/
void variable_item_set_values_count(VariableItem* item, uint8_t values_count);
/** Set item current selected text
*
* @param item VariableItem* instance