mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-06-14 19:53:35 -07:00
Merge branch 'fz-dev' into dev
This commit is contained in:
@@ -594,23 +594,19 @@ static void rpc_system_storage_backup_create_process(const PB_Main* request, voi
|
||||
|
||||
FURI_LOG_D(TAG, "BackupCreate");
|
||||
|
||||
RpcSession* session = (RpcSession*)context;
|
||||
RpcStorageSystem* rpc_storage = context;
|
||||
RpcSession* session = rpc_storage->session;
|
||||
furi_assert(session);
|
||||
|
||||
PB_Main* response = malloc(sizeof(PB_Main));
|
||||
response->command_id = request->command_id;
|
||||
response->has_next = false;
|
||||
|
||||
Storage* fs_api = furi_record_open(RECORD_STORAGE);
|
||||
|
||||
bool backup_ok =
|
||||
lfs_backup_create(fs_api, request->content.storage_backup_create_request.archive_path);
|
||||
response->command_status = backup_ok ? PB_CommandStatus_OK : PB_CommandStatus_ERROR;
|
||||
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
rpc_send_and_release(session, response);
|
||||
free(response);
|
||||
rpc_send_and_release_empty(
|
||||
session, request->command_id, backup_ok ? PB_CommandStatus_OK : PB_CommandStatus_ERROR);
|
||||
}
|
||||
|
||||
static void rpc_system_storage_backup_restore_process(const PB_Main* request, void* context) {
|
||||
@@ -619,24 +615,19 @@ static void rpc_system_storage_backup_restore_process(const PB_Main* request, vo
|
||||
|
||||
FURI_LOG_D(TAG, "BackupRestore");
|
||||
|
||||
RpcSession* session = (RpcSession*)context;
|
||||
RpcStorageSystem* rpc_storage = context;
|
||||
RpcSession* session = rpc_storage->session;
|
||||
furi_assert(session);
|
||||
|
||||
PB_Main* response = malloc(sizeof(PB_Main));
|
||||
response->command_id = request->command_id;
|
||||
response->has_next = false;
|
||||
response->command_status = PB_CommandStatus_OK;
|
||||
|
||||
Storage* fs_api = furi_record_open(RECORD_STORAGE);
|
||||
|
||||
bool backup_ok =
|
||||
lfs_backup_unpack(fs_api, request->content.storage_backup_restore_request.archive_path);
|
||||
response->command_status = backup_ok ? PB_CommandStatus_OK : PB_CommandStatus_ERROR;
|
||||
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
rpc_send_and_release(session, response);
|
||||
free(response);
|
||||
rpc_send_and_release_empty(
|
||||
session, request->command_id, backup_ok ? PB_CommandStatus_OK : PB_CommandStatus_ERROR);
|
||||
}
|
||||
|
||||
void* rpc_system_storage_alloc(RpcSession* session) {
|
||||
|
||||
@@ -26,8 +26,7 @@ static FS_Error storage_ext_parse_error(SDError error);
|
||||
|
||||
static bool sd_mount_card(StorageData* storage, bool notify) {
|
||||
bool result = false;
|
||||
const uint8_t max_init_counts = 10;
|
||||
uint8_t counter = max_init_counts;
|
||||
uint8_t counter = BSP_SD_MaxMountRetryCount();
|
||||
uint8_t bsp_result;
|
||||
SDData* sd_data = storage->data;
|
||||
|
||||
|
||||
@@ -22,6 +22,21 @@ static FATFS* pfs = NULL;
|
||||
} \
|
||||
}
|
||||
|
||||
static bool flipper_update_mount_sd() {
|
||||
for(int i = 0; i < BSP_SD_MaxMountRetryCount(); ++i) {
|
||||
if(BSP_SD_Init((i % 2) == 0) != MSD_OK) {
|
||||
/* Next attempt will be without card reset, let it settle */
|
||||
furi_delay_ms(1000);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(f_mount(pfs, "/", 1) == FR_OK) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool flipper_update_init() {
|
||||
furi_hal_clock_init();
|
||||
furi_hal_rtc_init();
|
||||
@@ -34,13 +49,9 @@ static bool flipper_update_init() {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(BSP_SD_Init(true)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
pfs = malloc(sizeof(FATFS));
|
||||
CHECK_FRESULT(f_mount(pfs, "/", 1));
|
||||
return true;
|
||||
|
||||
return flipper_update_mount_sd();
|
||||
}
|
||||
|
||||
static bool flipper_update_load_stage(const string_t work_dir, UpdateManifest* manifest) {
|
||||
|
||||
@@ -331,6 +331,10 @@ void SD_SPI_Bus_To_Normal_State() {
|
||||
* @{
|
||||
*/
|
||||
|
||||
uint8_t BSP_SD_MaxMountRetryCount() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initializes the SD/SD communication.
|
||||
* @param None
|
||||
|
||||
@@ -198,6 +198,7 @@ typedef struct {
|
||||
/** @defgroup STM32_ADAFRUIT_SD_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
uint8_t BSP_SD_MaxMountRetryCount();
|
||||
uint8_t BSP_SD_Init(bool reset_card);
|
||||
uint8_t
|
||||
BSP_SD_ReadBlocks(uint32_t* pData, uint32_t ReadAddr, uint32_t NumOfBlocks, uint32_t Timeout);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
from SCons.Builder import Builder
|
||||
from SCons.Action import Action
|
||||
from SCons.Errors import UserError
|
||||
|
||||
from SCons.Warnings import warn, WarningOnByDefault
|
||||
import SCons
|
||||
|
||||
from fbt.appmanifest import (
|
||||
FlipperAppType,
|
||||
AppManager,
|
||||
@@ -22,7 +22,7 @@ def LoadApplicationManifests(env):
|
||||
try:
|
||||
appmgr.load_manifest(entry.File("application.fam").abspath, entry.name)
|
||||
except FlipperManifestException as e:
|
||||
raise UserError(e)
|
||||
warn(WarningOnByDefault, str(e))
|
||||
|
||||
|
||||
def PrepareApplicationsBuild(env):
|
||||
|
||||
Reference in New Issue
Block a user