[FL-3226] Deep Sleep Idle (#2569)
* Improve RNG error handling * Sync RTC shadow registers on Stop mode exit * Implement working STOP2 mode * Fix formatting * FuriHal: disable SWD pins if debug is disabled * Power: cleanup battery info view, handle zero current report from gauge * Fbt: add command line argument for extra global defines * FuriHal: cleanup debug defines in power and os, drop deep_insomnia counter. * Add a setting to disable deep sleep * Clean up furi_hal_power * FuriHal,FapLoader,Debug: implement debug in stop mode, workaround resume in stop * FuriHal: document OS and power subsystems debugging * Furi: enable debug interface on crash --------- Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
		@@ -141,6 +141,21 @@ static void hand_orient_changed(VariableItem* item) {
 | 
			
		||||
    loader_update_menu();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const char* const sleep_method[] = {
 | 
			
		||||
    "Default",
 | 
			
		||||
    "Legacy",
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static void sleep_method_changed(VariableItem* item) {
 | 
			
		||||
    uint8_t index = variable_item_get_current_value_index(item);
 | 
			
		||||
    variable_item_set_current_value_text(item, sleep_method[index]);
 | 
			
		||||
    if(index) {
 | 
			
		||||
        furi_hal_rtc_set_flag(FuriHalRtcFlagLegacySleep);
 | 
			
		||||
    } else {
 | 
			
		||||
        furi_hal_rtc_reset_flag(FuriHalRtcFlagLegacySleep);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static uint32_t system_settings_exit(void* context) {
 | 
			
		||||
    UNUSED(context);
 | 
			
		||||
    return VIEW_NONE;
 | 
			
		||||
@@ -218,6 +233,12 @@ SystemSettings* system_settings_alloc() {
 | 
			
		||||
    variable_item_set_current_value_index(item, value_index);
 | 
			
		||||
    variable_item_set_current_value_text(item, heap_trace_mode_text[value_index]);
 | 
			
		||||
 | 
			
		||||
    item = variable_item_list_add(
 | 
			
		||||
        app->var_item_list, "Sleep Method", COUNT_OF(sleep_method), sleep_method_changed, app);
 | 
			
		||||
    value_index = furi_hal_rtc_is_flag_set(FuriHalRtcFlagLegacySleep) ? 1 : 0;
 | 
			
		||||
    variable_item_set_current_value_index(item, value_index);
 | 
			
		||||
    variable_item_set_current_value_text(item, sleep_method[value_index]);
 | 
			
		||||
 | 
			
		||||
    view_set_previous_callback(
 | 
			
		||||
        variable_item_list_get_view(app->var_item_list), system_settings_exit);
 | 
			
		||||
    view_dispatcher_add_view(
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user