Merge branch 'fz-dev' into dev

This commit is contained in:
MX 2023-04-06 07:22:53 +03:00
commit 8aed2375f3
No known key found for this signature in database
GPG Key ID: 7CCC66B7DBDD1C83
2 changed files with 14 additions and 14 deletions

View File

@ -21,13 +21,6 @@ static void avr_isp_app_tick_event_callback(void* context) {
AvrIspApp* avr_isp_app_alloc() {
AvrIspApp* app = malloc(sizeof(AvrIspApp));
// Enable 5v power, multiple attempts to avoid issues with power chip protection false triggering
uint8_t attempts = 0;
while(!furi_hal_power_is_otg_enabled() && attempts++ < 5) {
furi_hal_power_enable_otg();
furi_delay_ms(10);
}
app->file_path = furi_string_alloc();
furi_string_set(app->file_path, STORAGE_APP_DATA_PATH_PREFIX);
app->error = AvrIspErrorNoError;
@ -102,6 +95,13 @@ AvrIspApp* avr_isp_app_alloc() {
AvrIspViewChipDetect,
avr_isp_chip_detect_view_get_view(app->avr_isp_chip_detect_view));
// Enable 5v power, multiple attempts to avoid issues with power chip protection false triggering
uint8_t attempts = 0;
while(!furi_hal_power_is_otg_enabled() && attempts++ < 5) {
furi_hal_power_enable_otg();
furi_delay_ms(10);
}
scene_manager_next_scene(app->scene_manager, AvrIspSceneStart);
return app;
@ -110,6 +110,11 @@ AvrIspApp* avr_isp_app_alloc() {
void avr_isp_app_free(AvrIspApp* app) {
furi_assert(app);
// Disable 5v power
if(furi_hal_power_is_otg_enabled()) {
furi_hal_power_disable_otg();
}
// Submenu
view_dispatcher_remove_view(app->view_dispatcher, AvrIspViewSubmenu);
submenu_free(app->submenu);
@ -159,11 +164,6 @@ void avr_isp_app_free(AvrIspApp* app) {
// Path strings
furi_string_free(app->file_path);
// Disable 5v power
if(furi_hal_power_is_otg_enabled()) {
furi_hal_power_disable_otg();
}
free(app);
}

View File

@ -338,12 +338,12 @@ static void avr_isp_worker_rw_get_dump_flash(AvrIspWorkerRW* instance, const cha
sizeof(data));
flipper_i32hex_file_bin_to_i32hex_set_data(
flipper_hex_flash, data, avr_isp_chip_arr[instance->chip_arr_ind].pagesize);
//FURI_LOG_D(TAG, "%s", flipper_i32hex_file_get_string(flipper_hex_flash));
FURI_LOG_D(TAG, "%s", flipper_i32hex_file_get_string(flipper_hex_flash));
instance->progress_flash =
(float)(i) / ((float)avr_isp_chip_arr[instance->chip_arr_ind].flashsize / 2.0f);
}
flipper_i32hex_file_bin_to_i32hex_set_end_line(flipper_hex_flash);
//FURI_LOG_D(TAG, "%s", flipper_i32hex_file_get_string(flipper_hex_flash));
FURI_LOG_D(TAG, "%s", flipper_i32hex_file_get_string(flipper_hex_flash));
flipper_i32hex_file_close(flipper_hex_flash);
instance->progress_flash = 1.0f;
}