diff --git a/applications/external/avr_isp_programmer/avr_isp_app.c b/applications/external/avr_isp_programmer/avr_isp_app.c index e199f0c12..740dc3610 100644 --- a/applications/external/avr_isp_programmer/avr_isp_app.c +++ b/applications/external/avr_isp_programmer/avr_isp_app.c @@ -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); } diff --git a/applications/external/avr_isp_programmer/helpers/avr_isp_worker_rw.c b/applications/external/avr_isp_programmer/helpers/avr_isp_worker_rw.c index f586e1645..fc8d3b09f 100644 --- a/applications/external/avr_isp_programmer/helpers/avr_isp_worker_rw.c +++ b/applications/external/avr_isp_programmer/helpers/avr_isp_worker_rw.c @@ -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; }