diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/misc.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/apps/misc.c b/apps/misc.c index 2f3251431b..4ea8568018 100644 --- a/apps/misc.c +++ b/apps/misc.c | |||
@@ -578,6 +578,9 @@ static bool clean_shutdown(void (*callback)(void *), void *parameter) | |||
578 | if(!charger_inserted()) | 578 | if(!charger_inserted()) |
579 | #endif | 579 | #endif |
580 | { | 580 | { |
581 | bool batt_crit = battery_level_critical(); | ||
582 | int audio_stat = audio_status(); | ||
583 | |||
581 | FOR_NB_SCREENS(i) | 584 | FOR_NB_SCREENS(i) |
582 | screens[i].clear_display(); | 585 | screens[i].clear_display(); |
583 | #ifdef X5_BACKLIGHT_SHUTDOWN | 586 | #ifdef X5_BACKLIGHT_SHUTDOWN |
@@ -604,11 +607,23 @@ static bool clean_shutdown(void (*callback)(void *), void *parameter) | |||
604 | } | 607 | } |
605 | 608 | ||
606 | if (global_settings.fade_on_stop | 609 | if (global_settings.fade_on_stop |
607 | && (audio_status() & AUDIO_STATUS_PLAY)) | 610 | && (audio_stat & AUDIO_STATUS_PLAY)) |
608 | { | 611 | { |
609 | fade(0); | 612 | fade(0); |
610 | } | 613 | } |
611 | 614 | ||
615 | #if defined(HAVE_RECORDING) && CONFIG_CODEC == SWCODEC | ||
616 | if (!batt_crit && (audio_stat & AUDIO_STATUS_RECORD)) | ||
617 | { | ||
618 | audio_stop_recording(); | ||
619 | while(audio_status() & AUDIO_STATUS_RECORD) | ||
620 | sleep(1); | ||
621 | } | ||
622 | |||
623 | audio_close_recording(); | ||
624 | #endif | ||
625 | /* audio_stop_recording == audio_stop for HWCODEC */ | ||
626 | |||
612 | audio_stop(); | 627 | audio_stop(); |
613 | while (audio_status()) | 628 | while (audio_status()) |
614 | sleep(1); | 629 | sleep(1); |
@@ -616,7 +631,7 @@ static bool clean_shutdown(void (*callback)(void *), void *parameter) | |||
616 | if (callback != NULL) | 631 | if (callback != NULL) |
617 | callback(parameter); | 632 | callback(parameter); |
618 | 633 | ||
619 | if (!battery_level_critical()) /* do not save on critical battery */ | 634 | if (!batt_crit) /* do not save on critical battery */ |
620 | system_flush(); | 635 | system_flush(); |
621 | #ifdef HAVE_EEPROM_SETTINGS | 636 | #ifdef HAVE_EEPROM_SETTINGS |
622 | if (firmware_settings.initialized) | 637 | if (firmware_settings.initialized) |