mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-13 14:58:36 -07:00
fbt format
This commit is contained in:
@@ -478,11 +478,11 @@ SaveNoncesResult_t* mifare_nested_worker_write_nonces(
|
|||||||
for(uint8_t sector = 0; sector < sector_count; sector++) {
|
for(uint8_t sector = 0; sector < sector_count; sector++) {
|
||||||
for(uint8_t key_type = 0; key_type < 2; key_type++) {
|
for(uint8_t key_type = 0; key_type < 2; key_type++) {
|
||||||
if(nonces->nonces[sector][key_type][tries]->invalid) {
|
if(nonces->nonces[sector][key_type][tries]->invalid) {
|
||||||
if (tries == 0) {
|
if(tries == 0) {
|
||||||
result->invalid++;
|
result->invalid++;
|
||||||
}
|
}
|
||||||
} else if(nonces->nonces[sector][key_type][tries]->skipped) {
|
} else if(nonces->nonces[sector][key_type][tries]->skipped) {
|
||||||
if (tries == 0) {
|
if(tries == 0) {
|
||||||
result->skipped++;
|
result->skipped++;
|
||||||
}
|
}
|
||||||
} else if(nonces->nonces[sector][key_type][tries]->collected) {
|
} else if(nonces->nonces[sector][key_type][tries]->collected) {
|
||||||
|
|||||||
@@ -27,28 +27,31 @@ static void wifi_marauder_scene_flasher_callback(void* context, uint32_t index)
|
|||||||
switch(index) {
|
switch(index) {
|
||||||
case SubmenuIndexS3Mode:
|
case SubmenuIndexS3Mode:
|
||||||
// toggle S3 mode
|
// toggle S3 mode
|
||||||
app->selected_flash_options[SelectedFlashS3Mode] = !app->selected_flash_options[SelectedFlashS3Mode];
|
app->selected_flash_options[SelectedFlashS3Mode] =
|
||||||
|
!app->selected_flash_options[SelectedFlashS3Mode];
|
||||||
view_dispatcher_send_custom_event(app->view_dispatcher, WifiMarauderEventRefreshSubmenu);
|
view_dispatcher_send_custom_event(app->view_dispatcher, WifiMarauderEventRefreshSubmenu);
|
||||||
break;
|
break;
|
||||||
case SubmenuIndexBoot:
|
case SubmenuIndexBoot:
|
||||||
app->selected_flash_options[SelectedFlashBoot] = !app->selected_flash_options[SelectedFlashBoot];
|
app->selected_flash_options[SelectedFlashBoot] =
|
||||||
if (app->selected_flash_options[SelectedFlashBoot]) {
|
!app->selected_flash_options[SelectedFlashBoot];
|
||||||
|
if(app->selected_flash_options[SelectedFlashBoot]) {
|
||||||
if(dialog_file_browser_show(
|
if(dialog_file_browser_show(
|
||||||
app->dialogs, selected_filepath, predefined_filepath, &browser_options)) {
|
app->dialogs, selected_filepath, predefined_filepath, &browser_options)) {
|
||||||
strncpy(
|
strncpy(
|
||||||
app->bin_file_path_boot,
|
app->bin_file_path_boot,
|
||||||
furi_string_get_cstr(selected_filepath),
|
furi_string_get_cstr(selected_filepath),
|
||||||
sizeof(app->bin_file_path_boot));
|
sizeof(app->bin_file_path_boot));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (app->bin_file_path_boot[0] == '\0') {
|
if(app->bin_file_path_boot[0] == '\0') {
|
||||||
// if user didn't select a file, leave unselected
|
// if user didn't select a file, leave unselected
|
||||||
app->selected_flash_options[SelectedFlashBoot] = false;
|
app->selected_flash_options[SelectedFlashBoot] = false;
|
||||||
}
|
}
|
||||||
view_dispatcher_send_custom_event(app->view_dispatcher, WifiMarauderEventRefreshSubmenu);
|
view_dispatcher_send_custom_event(app->view_dispatcher, WifiMarauderEventRefreshSubmenu);
|
||||||
break;
|
break;
|
||||||
case SubmenuIndexPart:
|
case SubmenuIndexPart:
|
||||||
app->selected_flash_options[SelectedFlashPart] = !app->selected_flash_options[SelectedFlashPart];
|
app->selected_flash_options[SelectedFlashPart] =
|
||||||
|
!app->selected_flash_options[SelectedFlashPart];
|
||||||
if(dialog_file_browser_show(
|
if(dialog_file_browser_show(
|
||||||
app->dialogs, selected_filepath, predefined_filepath, &browser_options)) {
|
app->dialogs, selected_filepath, predefined_filepath, &browser_options)) {
|
||||||
strncpy(
|
strncpy(
|
||||||
@@ -56,14 +59,15 @@ static void wifi_marauder_scene_flasher_callback(void* context, uint32_t index)
|
|||||||
furi_string_get_cstr(selected_filepath),
|
furi_string_get_cstr(selected_filepath),
|
||||||
sizeof(app->bin_file_path_part));
|
sizeof(app->bin_file_path_part));
|
||||||
}
|
}
|
||||||
if (app->bin_file_path_part[0] == '\0') {
|
if(app->bin_file_path_part[0] == '\0') {
|
||||||
// if user didn't select a file, leave unselected
|
// if user didn't select a file, leave unselected
|
||||||
app->selected_flash_options[SelectedFlashPart] = false;
|
app->selected_flash_options[SelectedFlashPart] = false;
|
||||||
}
|
}
|
||||||
view_dispatcher_send_custom_event(app->view_dispatcher, WifiMarauderEventRefreshSubmenu);
|
view_dispatcher_send_custom_event(app->view_dispatcher, WifiMarauderEventRefreshSubmenu);
|
||||||
break;
|
break;
|
||||||
case SubmenuIndexNvs:
|
case SubmenuIndexNvs:
|
||||||
app->selected_flash_options[SelectedFlashNvs] = !app->selected_flash_options[SelectedFlashNvs];
|
app->selected_flash_options[SelectedFlashNvs] =
|
||||||
|
!app->selected_flash_options[SelectedFlashNvs];
|
||||||
if(dialog_file_browser_show(
|
if(dialog_file_browser_show(
|
||||||
app->dialogs, selected_filepath, predefined_filepath, &browser_options)) {
|
app->dialogs, selected_filepath, predefined_filepath, &browser_options)) {
|
||||||
strncpy(
|
strncpy(
|
||||||
@@ -71,14 +75,15 @@ static void wifi_marauder_scene_flasher_callback(void* context, uint32_t index)
|
|||||||
furi_string_get_cstr(selected_filepath),
|
furi_string_get_cstr(selected_filepath),
|
||||||
sizeof(app->bin_file_path_nvs));
|
sizeof(app->bin_file_path_nvs));
|
||||||
}
|
}
|
||||||
if (app->bin_file_path_nvs[0] == '\0') {
|
if(app->bin_file_path_nvs[0] == '\0') {
|
||||||
// if user didn't select a file, leave unselected
|
// if user didn't select a file, leave unselected
|
||||||
app->selected_flash_options[SelectedFlashNvs] = false;
|
app->selected_flash_options[SelectedFlashNvs] = false;
|
||||||
}
|
}
|
||||||
view_dispatcher_send_custom_event(app->view_dispatcher, WifiMarauderEventRefreshSubmenu);
|
view_dispatcher_send_custom_event(app->view_dispatcher, WifiMarauderEventRefreshSubmenu);
|
||||||
break;
|
break;
|
||||||
case SubmenuIndexBootApp0:
|
case SubmenuIndexBootApp0:
|
||||||
app->selected_flash_options[SelectedFlashBootApp0] = !app->selected_flash_options[SelectedFlashBootApp0];
|
app->selected_flash_options[SelectedFlashBootApp0] =
|
||||||
|
!app->selected_flash_options[SelectedFlashBootApp0];
|
||||||
if(dialog_file_browser_show(
|
if(dialog_file_browser_show(
|
||||||
app->dialogs, selected_filepath, predefined_filepath, &browser_options)) {
|
app->dialogs, selected_filepath, predefined_filepath, &browser_options)) {
|
||||||
strncpy(
|
strncpy(
|
||||||
@@ -86,14 +91,15 @@ static void wifi_marauder_scene_flasher_callback(void* context, uint32_t index)
|
|||||||
furi_string_get_cstr(selected_filepath),
|
furi_string_get_cstr(selected_filepath),
|
||||||
sizeof(app->bin_file_path_boot_app0));
|
sizeof(app->bin_file_path_boot_app0));
|
||||||
}
|
}
|
||||||
if (app->bin_file_path_boot_app0[0] == '\0') {
|
if(app->bin_file_path_boot_app0[0] == '\0') {
|
||||||
// if user didn't select a file, leave unselected
|
// if user didn't select a file, leave unselected
|
||||||
app->selected_flash_options[SelectedFlashBootApp0] = false;
|
app->selected_flash_options[SelectedFlashBootApp0] = false;
|
||||||
}
|
}
|
||||||
view_dispatcher_send_custom_event(app->view_dispatcher, WifiMarauderEventRefreshSubmenu);
|
view_dispatcher_send_custom_event(app->view_dispatcher, WifiMarauderEventRefreshSubmenu);
|
||||||
break;
|
break;
|
||||||
case SubmenuIndexApp:
|
case SubmenuIndexApp:
|
||||||
app->selected_flash_options[SelectedFlashApp] = !app->selected_flash_options[SelectedFlashApp];
|
app->selected_flash_options[SelectedFlashApp] =
|
||||||
|
!app->selected_flash_options[SelectedFlashApp];
|
||||||
if(dialog_file_browser_show(
|
if(dialog_file_browser_show(
|
||||||
app->dialogs, selected_filepath, predefined_filepath, &browser_options)) {
|
app->dialogs, selected_filepath, predefined_filepath, &browser_options)) {
|
||||||
strncpy(
|
strncpy(
|
||||||
@@ -101,14 +107,15 @@ static void wifi_marauder_scene_flasher_callback(void* context, uint32_t index)
|
|||||||
furi_string_get_cstr(selected_filepath),
|
furi_string_get_cstr(selected_filepath),
|
||||||
sizeof(app->bin_file_path_app));
|
sizeof(app->bin_file_path_app));
|
||||||
}
|
}
|
||||||
if (app->bin_file_path_app[0] == '\0') {
|
if(app->bin_file_path_app[0] == '\0') {
|
||||||
// if user didn't select a file, leave unselected
|
// if user didn't select a file, leave unselected
|
||||||
app->selected_flash_options[SelectedFlashApp] = false;
|
app->selected_flash_options[SelectedFlashApp] = false;
|
||||||
}
|
}
|
||||||
view_dispatcher_send_custom_event(app->view_dispatcher, WifiMarauderEventRefreshSubmenu);
|
view_dispatcher_send_custom_event(app->view_dispatcher, WifiMarauderEventRefreshSubmenu);
|
||||||
break;
|
break;
|
||||||
case SubmenuIndexCustom:
|
case SubmenuIndexCustom:
|
||||||
app->selected_flash_options[SelectedFlashCustom] = !app->selected_flash_options[SelectedFlashCustom];
|
app->selected_flash_options[SelectedFlashCustom] =
|
||||||
|
!app->selected_flash_options[SelectedFlashCustom];
|
||||||
if(dialog_file_browser_show(
|
if(dialog_file_browser_show(
|
||||||
app->dialogs, selected_filepath, predefined_filepath, &browser_options)) {
|
app->dialogs, selected_filepath, predefined_filepath, &browser_options)) {
|
||||||
strncpy(
|
strncpy(
|
||||||
@@ -116,7 +123,7 @@ static void wifi_marauder_scene_flasher_callback(void* context, uint32_t index)
|
|||||||
furi_string_get_cstr(selected_filepath),
|
furi_string_get_cstr(selected_filepath),
|
||||||
sizeof(app->bin_file_path_custom));
|
sizeof(app->bin_file_path_custom));
|
||||||
}
|
}
|
||||||
if (app->bin_file_path_custom[0] == '\0') {
|
if(app->bin_file_path_custom[0] == '\0') {
|
||||||
// if user didn't select a file, leave unselected
|
// if user didn't select a file, leave unselected
|
||||||
app->selected_flash_options[SelectedFlashCustom] = false;
|
app->selected_flash_options[SelectedFlashCustom] = false;
|
||||||
}
|
}
|
||||||
@@ -125,12 +132,14 @@ static void wifi_marauder_scene_flasher_callback(void* context, uint32_t index)
|
|||||||
case SubmenuIndexFlash:
|
case SubmenuIndexFlash:
|
||||||
// count how many options are selected
|
// count how many options are selected
|
||||||
app->num_selected_flash_options = 0;
|
app->num_selected_flash_options = 0;
|
||||||
for (bool* option = &app->selected_flash_options[SelectedFlashBoot]; option < &app->selected_flash_options[NUM_FLASH_OPTIONS]; ++option) {
|
for(bool* option = &app->selected_flash_options[SelectedFlashBoot];
|
||||||
if (*option) {
|
option < &app->selected_flash_options[NUM_FLASH_OPTIONS];
|
||||||
|
++option) {
|
||||||
|
if(*option) {
|
||||||
++app->num_selected_flash_options;
|
++app->num_selected_flash_options;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (app->num_selected_flash_options) {
|
if(app->num_selected_flash_options) {
|
||||||
// only start next scene if at least one option is selected
|
// only start next scene if at least one option is selected
|
||||||
scene_manager_next_scene(app->scene_manager, WifiMarauderSceneConsoleOutput);
|
scene_manager_next_scene(app->scene_manager, WifiMarauderSceneConsoleOutput);
|
||||||
}
|
}
|
||||||
@@ -141,17 +150,17 @@ static void wifi_marauder_scene_flasher_callback(void* context, uint32_t index)
|
|||||||
furi_string_free(predefined_filepath);
|
furi_string_free(predefined_filepath);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define STR_SELECT "[x]"
|
#define STR_SELECT "[x]"
|
||||||
#define STR_UNSELECT "[ ]"
|
#define STR_UNSELECT "[ ]"
|
||||||
#define STR_BOOT "Bootloader (" TOSTRING(ESP_ADDR_BOOT) ")"
|
#define STR_BOOT "Bootloader (" TOSTRING(ESP_ADDR_BOOT) ")"
|
||||||
#define STR_BOOT_S3 "Bootloader (" TOSTRING(ESP_ADDR_BOOT_S3) ")"
|
#define STR_BOOT_S3 "Bootloader (" TOSTRING(ESP_ADDR_BOOT_S3) ")"
|
||||||
#define STR_PART "Part Table (" TOSTRING(ESP_ADDR_PART) ")"
|
#define STR_PART "Part Table (" TOSTRING(ESP_ADDR_PART) ")"
|
||||||
#define STR_NVS "NVS (" TOSTRING(ESP_ADDR_NVS) ")"
|
#define STR_NVS "NVS (" TOSTRING(ESP_ADDR_NVS) ")"
|
||||||
#define STR_BOOT_APP0 "boot_app0 (" TOSTRING(ESP_ADDR_BOOT_APP0) ")"
|
#define STR_BOOT_APP0 "boot_app0 (" TOSTRING(ESP_ADDR_BOOT_APP0) ")"
|
||||||
#define STR_APP "Firmware (" TOSTRING(ESP_ADDR_APP) ")"
|
#define STR_APP "Firmware (" TOSTRING(ESP_ADDR_APP) ")"
|
||||||
#define STR_CUSTOM "Custom"
|
#define STR_CUSTOM "Custom"
|
||||||
#define STR_FLASH_S3 "[>] FLASH (ESP32-S3)"
|
#define STR_FLASH_S3 "[>] FLASH (ESP32-S3)"
|
||||||
#define STR_FLASH "[>] FLASH"
|
#define STR_FLASH "[>] FLASH"
|
||||||
static void _refresh_submenu(WifiMarauderApp* app) {
|
static void _refresh_submenu(WifiMarauderApp* app) {
|
||||||
Submenu* submenu = app->submenu;
|
Submenu* submenu = app->submenu;
|
||||||
|
|
||||||
@@ -159,16 +168,21 @@ static void _refresh_submenu(WifiMarauderApp* app) {
|
|||||||
|
|
||||||
submenu_set_header(submenu, "Browse for files to flash");
|
submenu_set_header(submenu, "Browse for files to flash");
|
||||||
submenu_add_item(
|
submenu_add_item(
|
||||||
submenu, app->selected_flash_options[SelectedFlashS3Mode] ? "[x] Using ESP32-S3" : "[ ] Check if using S3", SubmenuIndexS3Mode, wifi_marauder_scene_flasher_callback, app);
|
submenu,
|
||||||
|
app->selected_flash_options[SelectedFlashS3Mode] ? "[x] Using ESP32-S3" :
|
||||||
|
"[ ] Check if using S3",
|
||||||
|
SubmenuIndexS3Mode,
|
||||||
|
wifi_marauder_scene_flasher_callback,
|
||||||
|
app);
|
||||||
const char* strSelectBootloader = STR_UNSELECT " " STR_BOOT;
|
const char* strSelectBootloader = STR_UNSELECT " " STR_BOOT;
|
||||||
if (app->selected_flash_options[SelectedFlashS3Mode]) {
|
if(app->selected_flash_options[SelectedFlashS3Mode]) {
|
||||||
if (app->selected_flash_options[SelectedFlashBoot]) {
|
if(app->selected_flash_options[SelectedFlashBoot]) {
|
||||||
strSelectBootloader = STR_SELECT " " STR_BOOT_S3;
|
strSelectBootloader = STR_SELECT " " STR_BOOT_S3;
|
||||||
} else {
|
} else {
|
||||||
strSelectBootloader = STR_UNSELECT " " STR_BOOT_S3;
|
strSelectBootloader = STR_UNSELECT " " STR_BOOT_S3;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (app->selected_flash_options[SelectedFlashBoot]) {
|
if(app->selected_flash_options[SelectedFlashBoot]) {
|
||||||
strSelectBootloader = STR_SELECT " " STR_BOOT;
|
strSelectBootloader = STR_SELECT " " STR_BOOT;
|
||||||
} else {
|
} else {
|
||||||
strSelectBootloader = STR_UNSELECT " " STR_BOOT;
|
strSelectBootloader = STR_UNSELECT " " STR_BOOT;
|
||||||
@@ -177,18 +191,42 @@ static void _refresh_submenu(WifiMarauderApp* app) {
|
|||||||
submenu_add_item(
|
submenu_add_item(
|
||||||
submenu, strSelectBootloader, SubmenuIndexBoot, wifi_marauder_scene_flasher_callback, app);
|
submenu, strSelectBootloader, SubmenuIndexBoot, wifi_marauder_scene_flasher_callback, app);
|
||||||
submenu_add_item(
|
submenu_add_item(
|
||||||
submenu, app->selected_flash_options[SelectedFlashPart] ? STR_SELECT " " STR_PART : STR_UNSELECT " " STR_PART, SubmenuIndexPart, wifi_marauder_scene_flasher_callback, app);
|
submenu,
|
||||||
|
app->selected_flash_options[SelectedFlashPart] ? STR_SELECT " " STR_PART :
|
||||||
|
STR_UNSELECT " " STR_PART,
|
||||||
|
SubmenuIndexPart,
|
||||||
|
wifi_marauder_scene_flasher_callback,
|
||||||
|
app);
|
||||||
submenu_add_item(
|
submenu_add_item(
|
||||||
submenu, app->selected_flash_options[SelectedFlashNvs] ? STR_SELECT " " STR_NVS : STR_UNSELECT " " STR_NVS, SubmenuIndexNvs, wifi_marauder_scene_flasher_callback, app);
|
submenu,
|
||||||
|
app->selected_flash_options[SelectedFlashNvs] ? STR_SELECT " " STR_NVS :
|
||||||
|
STR_UNSELECT " " STR_NVS,
|
||||||
|
SubmenuIndexNvs,
|
||||||
|
wifi_marauder_scene_flasher_callback,
|
||||||
|
app);
|
||||||
submenu_add_item(
|
submenu_add_item(
|
||||||
submenu, app->selected_flash_options[SelectedFlashBootApp0] ? STR_SELECT " " STR_BOOT_APP0 : STR_UNSELECT " " STR_BOOT_APP0, SubmenuIndexBootApp0, wifi_marauder_scene_flasher_callback, app);
|
submenu,
|
||||||
|
app->selected_flash_options[SelectedFlashBootApp0] ? STR_SELECT " " STR_BOOT_APP0 :
|
||||||
|
STR_UNSELECT " " STR_BOOT_APP0,
|
||||||
|
SubmenuIndexBootApp0,
|
||||||
|
wifi_marauder_scene_flasher_callback,
|
||||||
|
app);
|
||||||
submenu_add_item(
|
submenu_add_item(
|
||||||
submenu, app->selected_flash_options[SelectedFlashApp] ? STR_SELECT " " STR_APP : STR_UNSELECT " " STR_APP, SubmenuIndexApp, wifi_marauder_scene_flasher_callback, app);
|
submenu,
|
||||||
|
app->selected_flash_options[SelectedFlashApp] ? STR_SELECT " " STR_APP :
|
||||||
|
STR_UNSELECT " " STR_APP,
|
||||||
|
SubmenuIndexApp,
|
||||||
|
wifi_marauder_scene_flasher_callback,
|
||||||
|
app);
|
||||||
// TODO: custom addr
|
// TODO: custom addr
|
||||||
//submenu_add_item(
|
//submenu_add_item(
|
||||||
// submenu, app->selected_flash_options[SelectedFlashCustom] ? STR_SELECT " " STR_CUSTOM : STR_UNSELECT " " STR_CUSTOM, SubmenuIndexCustom, wifi_marauder_scene_flasher_callback, app);
|
// submenu, app->selected_flash_options[SelectedFlashCustom] ? STR_SELECT " " STR_CUSTOM : STR_UNSELECT " " STR_CUSTOM, SubmenuIndexCustom, wifi_marauder_scene_flasher_callback, app);
|
||||||
submenu_add_item(
|
submenu_add_item(
|
||||||
submenu, app->selected_flash_options[SelectedFlashS3Mode] ? STR_FLASH_S3 : STR_FLASH, SubmenuIndexFlash, wifi_marauder_scene_flasher_callback, app);
|
submenu,
|
||||||
|
app->selected_flash_options[SelectedFlashS3Mode] ? STR_FLASH_S3 : STR_FLASH,
|
||||||
|
SubmenuIndexFlash,
|
||||||
|
wifi_marauder_scene_flasher_callback,
|
||||||
|
app);
|
||||||
|
|
||||||
submenu_set_selected_item(
|
submenu_set_selected_item(
|
||||||
submenu, scene_manager_get_scene_state(app->scene_manager, WifiMarauderSceneFlasher));
|
submenu, scene_manager_get_scene_state(app->scene_manager, WifiMarauderSceneFlasher));
|
||||||
@@ -212,8 +250,8 @@ void wifi_marauder_scene_flasher_on_enter(void* context) {
|
|||||||
bool wifi_marauder_scene_flasher_on_event(void* context, SceneManagerEvent event) {
|
bool wifi_marauder_scene_flasher_on_event(void* context, SceneManagerEvent event) {
|
||||||
WifiMarauderApp* app = context;
|
WifiMarauderApp* app = context;
|
||||||
bool consumed = false;
|
bool consumed = false;
|
||||||
if (event.type == SceneManagerEventTypeCustom) {
|
if(event.type == SceneManagerEventTypeCustom) {
|
||||||
if (event.event == WifiMarauderEventRefreshSubmenu) {
|
if(event.event == WifiMarauderEventRefreshSubmenu) {
|
||||||
_refresh_submenu(app);
|
_refresh_submenu(app);
|
||||||
consumed = true;
|
consumed = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ static esp_loader_error_t _flash_file(WifiMarauderApp* app, char* filepath, uint
|
|||||||
loader_port_debug_print("Start programming\n");
|
loader_port_debug_print("Start programming\n");
|
||||||
uint64_t last_updated = size;
|
uint64_t last_updated = size;
|
||||||
while(size > 0) {
|
while(size > 0) {
|
||||||
if ((last_updated - size) > 50000) {
|
if((last_updated - size) > 50000) {
|
||||||
// inform user every 50k bytes
|
// inform user every 50k bytes
|
||||||
// TODO: draw a progress bar next update
|
// TODO: draw a progress bar next update
|
||||||
snprintf(user_msg, sizeof(user_msg), "%llu bytes left.\n", size);
|
snprintf(user_msg, sizeof(user_msg), "%llu bytes left.\n", size);
|
||||||
@@ -85,23 +85,33 @@ static void _flash_all_files(WifiMarauderApp* app) {
|
|||||||
esp_loader_error_t err;
|
esp_loader_error_t err;
|
||||||
const int num_steps = app->num_selected_flash_options;
|
const int num_steps = app->num_selected_flash_options;
|
||||||
|
|
||||||
#define NUM_FLASH_ITEMS 6
|
#define NUM_FLASH_ITEMS 6
|
||||||
FlashItem items[NUM_FLASH_ITEMS] = {
|
FlashItem items[NUM_FLASH_ITEMS] = {
|
||||||
{ SelectedFlashBoot, "bootloader", app->bin_file_path_boot, app->selected_flash_options[SelectedFlashS3Mode] ? ESP_ADDR_BOOT_S3 : ESP_ADDR_BOOT },
|
{SelectedFlashBoot,
|
||||||
{ SelectedFlashPart, "partition table", app->bin_file_path_part, ESP_ADDR_PART },
|
"bootloader",
|
||||||
{ SelectedFlashNvs, "NVS", app->bin_file_path_nvs, ESP_ADDR_NVS },
|
app->bin_file_path_boot,
|
||||||
{ SelectedFlashBootApp0, "boot_app0", app->bin_file_path_boot_app0, ESP_ADDR_BOOT_APP0 },
|
app->selected_flash_options[SelectedFlashS3Mode] ? ESP_ADDR_BOOT_S3 : ESP_ADDR_BOOT},
|
||||||
{ SelectedFlashApp, "firmware", app->bin_file_path_app, ESP_ADDR_APP },
|
{SelectedFlashPart, "partition table", app->bin_file_path_part, ESP_ADDR_PART},
|
||||||
{ SelectedFlashCustom, "custom data", app->bin_file_path_custom, 0x0 },
|
{SelectedFlashNvs, "NVS", app->bin_file_path_nvs, ESP_ADDR_NVS},
|
||||||
|
{SelectedFlashBootApp0, "boot_app0", app->bin_file_path_boot_app0, ESP_ADDR_BOOT_APP0},
|
||||||
|
{SelectedFlashApp, "firmware", app->bin_file_path_app, ESP_ADDR_APP},
|
||||||
|
{SelectedFlashCustom, "custom data", app->bin_file_path_custom, 0x0},
|
||||||
/* if you add more entries, update NUM_FLASH_ITEMS above! */
|
/* if you add more entries, update NUM_FLASH_ITEMS above! */
|
||||||
};
|
};
|
||||||
|
|
||||||
char user_msg[256];
|
char user_msg[256];
|
||||||
|
|
||||||
int current_step = 1;
|
int current_step = 1;
|
||||||
for (FlashItem* item = &items[0]; item < &items[NUM_FLASH_ITEMS]; ++item) {
|
for(FlashItem* item = &items[0]; item < &items[NUM_FLASH_ITEMS]; ++item) {
|
||||||
if(app->selected_flash_options[item->selected]) {
|
if(app->selected_flash_options[item->selected]) {
|
||||||
snprintf(user_msg, sizeof(user_msg), "Flashing %s (%d/%d) to address 0x%lx\n", item->description, current_step++, num_steps, item->addr);
|
snprintf(
|
||||||
|
user_msg,
|
||||||
|
sizeof(user_msg),
|
||||||
|
"Flashing %s (%d/%d) to address 0x%lx\n",
|
||||||
|
item->description,
|
||||||
|
current_step++,
|
||||||
|
num_steps,
|
||||||
|
item->addr);
|
||||||
loader_port_debug_print(user_msg);
|
loader_port_debug_print(user_msg);
|
||||||
err = _flash_file(app, item->path, item->addr);
|
err = _flash_file(app, item->path, item->addr);
|
||||||
if(err) {
|
if(err) {
|
||||||
@@ -130,7 +140,7 @@ static int32_t wifi_marauder_flash_bin(void* context) {
|
|||||||
loader_port_debug_print(err_msg);
|
loader_port_debug_print(err_msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0 // still getting packet drops with this
|
#if 0 // still getting packet drops with this
|
||||||
// higher BR
|
// higher BR
|
||||||
if(!err) {
|
if(!err) {
|
||||||
loader_port_debug_print("Increasing speed for faster flash\n");
|
loader_port_debug_print("Increasing speed for faster flash\n");
|
||||||
@@ -146,15 +156,15 @@ static int32_t wifi_marauder_flash_bin(void* context) {
|
|||||||
}
|
}
|
||||||
furi_hal_uart_set_br(FuriHalUartIdUSART1, 230400);
|
furi_hal_uart_set_br(FuriHalUartIdUSART1, 230400);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(!err) {
|
if(!err) {
|
||||||
loader_port_debug_print("Connected\n");
|
loader_port_debug_print("Connected\n");
|
||||||
_flash_all_files(app);
|
_flash_all_files(app);
|
||||||
#if 0
|
#if 0
|
||||||
loader_port_debug_print("Restoring transmission rate\n");
|
loader_port_debug_print("Restoring transmission rate\n");
|
||||||
furi_hal_uart_set_br(FuriHalUartIdUSART1, 115200);
|
furi_hal_uart_set_br(FuriHalUartIdUSART1, 115200);
|
||||||
#endif
|
#endif
|
||||||
loader_port_debug_print("Done flashing. Please reset the board manually.\n");
|
loader_port_debug_print("Done flashing. Please reset the board manually.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,12 +5,12 @@
|
|||||||
#define SERIAL_FLASHER_INTERFACE_UART /* TODO why is application.fam not passing this via cdefines */
|
#define SERIAL_FLASHER_INTERFACE_UART /* TODO why is application.fam not passing this via cdefines */
|
||||||
#include "esp_loader_io.h"
|
#include "esp_loader_io.h"
|
||||||
|
|
||||||
#define ESP_ADDR_BOOT_S3 0x0
|
#define ESP_ADDR_BOOT_S3 0x0
|
||||||
#define ESP_ADDR_BOOT 0x1000
|
#define ESP_ADDR_BOOT 0x1000
|
||||||
#define ESP_ADDR_PART 0x8000
|
#define ESP_ADDR_PART 0x8000
|
||||||
#define ESP_ADDR_NVS 0x9000
|
#define ESP_ADDR_NVS 0x9000
|
||||||
#define ESP_ADDR_BOOT_APP0 0xE000
|
#define ESP_ADDR_BOOT_APP0 0xE000
|
||||||
#define ESP_ADDR_APP 0x10000
|
#define ESP_ADDR_APP 0x10000
|
||||||
|
|
||||||
void wifi_marauder_flash_start_thread(WifiMarauderApp* app);
|
void wifi_marauder_flash_start_thread(WifiMarauderApp* app);
|
||||||
void wifi_marauder_flash_stop_thread(WifiMarauderApp* app);
|
void wifi_marauder_flash_stop_thread(WifiMarauderApp* app);
|
||||||
|
|||||||
Reference in New Issue
Block a user