mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-12 14:58:36 -07:00
Tweak mass storage creator sizes
This commit is contained in:
@@ -31,7 +31,7 @@ MassStorageApp* mass_storage_app_alloc(char* arg) {
|
|||||||
furi_string_set_str(app->file_path, MASS_STORAGE_APP_PATH_FOLDER);
|
furi_string_set_str(app->file_path, MASS_STORAGE_APP_PATH_FOLDER);
|
||||||
}
|
}
|
||||||
|
|
||||||
app->create_image_size = 100;
|
app->create_image_size = 128;
|
||||||
app->create_size_unit = SizeUnitMb;
|
app->create_size_unit = SizeUnitMb;
|
||||||
|
|
||||||
app->gui = furi_record_open(RECORD_GUI);
|
app->gui = furi_record_open(RECORD_GUI);
|
||||||
|
|||||||
@@ -22,8 +22,6 @@
|
|||||||
#define MASS_STORAGE_FILE_NAME_LEN 40
|
#define MASS_STORAGE_FILE_NAME_LEN 40
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
SizeUnitBytes,
|
|
||||||
SizeUnitKb,
|
|
||||||
SizeUnitMb,
|
SizeUnitMb,
|
||||||
SizeUnitGb,
|
SizeUnitGb,
|
||||||
SizeUnitCount,
|
SizeUnitCount,
|
||||||
|
|||||||
@@ -13,8 +13,7 @@ void mass_storage_scene_create_image_var_item_list_callback(void* context, uint3
|
|||||||
view_dispatcher_send_custom_event(app->view_dispatcher, index);
|
view_dispatcher_send_custom_event(app->view_dispatcher, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint32_t image_size_values[] = {1, 2, 4, 8, 12, 16, 20, 25, 30, 35, 40,
|
const uint32_t image_size_values[] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024};
|
||||||
45, 50, 69, 75, 100, 150, 200, 250, 500, 750};
|
|
||||||
static void mass_storage_scene_create_image_image_size_changed(VariableItem* item) {
|
static void mass_storage_scene_create_image_image_size_changed(VariableItem* item) {
|
||||||
MassStorageApp* app = variable_item_get_context(item);
|
MassStorageApp* app = variable_item_get_context(item);
|
||||||
app->create_image_size = image_size_values[variable_item_get_current_value_index(item)];
|
app->create_image_size = image_size_values[variable_item_get_current_value_index(item)];
|
||||||
@@ -24,10 +23,8 @@ static void mass_storage_scene_create_image_image_size_changed(VariableItem* ite
|
|||||||
}
|
}
|
||||||
|
|
||||||
const char* const size_unit_names[] = {
|
const char* const size_unit_names[] = {
|
||||||
[SizeUnitBytes] = "Bytes",
|
[SizeUnitMb] = "MB",
|
||||||
[SizeUnitKb] = "Kb",
|
[SizeUnitGb] = "GB",
|
||||||
[SizeUnitMb] = "Mb",
|
|
||||||
[SizeUnitGb] = "Gb",
|
|
||||||
};
|
};
|
||||||
static void mass_storage_scene_create_image_size_unit_changed(VariableItem* item) {
|
static void mass_storage_scene_create_image_size_unit_changed(VariableItem* item) {
|
||||||
MassStorageApp* app = variable_item_get_context(item);
|
MassStorageApp* app = variable_item_get_context(item);
|
||||||
@@ -127,7 +124,7 @@ bool mass_storage_scene_create_image_on_event(void* context, SceneManagerEvent e
|
|||||||
if(storage_file_open(
|
if(storage_file_open(
|
||||||
app->file, furi_string_get_cstr(app->file_path), FSAM_WRITE, FSOM_CREATE_NEW)) {
|
app->file, furi_string_get_cstr(app->file_path), FSAM_WRITE, FSOM_CREATE_NEW)) {
|
||||||
uint64_t size = app->create_image_size;
|
uint64_t size = app->create_image_size;
|
||||||
for(size_t i = app->create_size_unit; i > 0; i--) size *= 1024;
|
for(size_t i = app->create_size_unit + 2; i > 0; i--) size *= 1024;
|
||||||
if(!storage_file_expand(app->file, size)) {
|
if(!storage_file_expand(app->file, size)) {
|
||||||
error = "Can't allocate data";
|
error = "Can't allocate data";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user