Power subsystem improvements and bug fixes (#353)
* BT: render icon statically. * Move API HAL Power init call to api_hal_init. * API HAL Power: replace stop2 mode with stop1 to ensure usb and lptim2 proper work.
This commit is contained in:
		
							parent
							
								
									a0db2986b5
								
							
						
					
					
						commit
						1b2c31da6f
					
				| @ -8,9 +8,8 @@ Bt* bt_alloc() { | ||||
|     bt->gui = furi_record_open("gui"); | ||||
|     bt->menu = furi_record_open("menu"); | ||||
| 
 | ||||
|     bt->statusbar_icon = assets_icons_get(I_Bluetooth_5x8); | ||||
|     bt->statusbar_view_port = view_port_alloc(); | ||||
|     view_port_set_width(bt->statusbar_view_port, icon_get_width(bt->statusbar_icon)); | ||||
|     view_port_set_width(bt->statusbar_view_port, 5); | ||||
|     view_port_draw_callback_set(bt->statusbar_view_port, bt_draw_statusbar_callback, bt); | ||||
|     view_port_enabled_set(bt->statusbar_view_port, false); | ||||
|     gui_add_view_port(bt->gui, bt->statusbar_view_port, GuiLayerStatusBarLeft); | ||||
| @ -24,9 +23,7 @@ Bt* bt_alloc() { | ||||
| } | ||||
| 
 | ||||
| void bt_draw_statusbar_callback(Canvas* canvas, void* context) { | ||||
|     assert(context); | ||||
|     Bt* bt = context; | ||||
|     canvas_draw_icon(canvas, 0, 0, bt->statusbar_icon); | ||||
|     canvas_draw_icon_name(canvas, 0, 0, I_Bluetooth_5x8); | ||||
| } | ||||
| 
 | ||||
| void bt_cli_info(string_t args, void* context) { | ||||
|  | ||||
| @ -18,7 +18,6 @@ typedef struct { | ||||
|     Gui* gui; | ||||
|     ValueMutex* menu; | ||||
|     // Status bar
 | ||||
|     Icon* statusbar_icon; | ||||
|     ViewPort* statusbar_view_port; | ||||
|     // Menu
 | ||||
|     Icon* menu_icon; | ||||
|  | ||||
| @ -199,8 +199,6 @@ int32_t power_task(void* p) { | ||||
|     with_value_mutex( | ||||
|         power->menu_vm, (Menu * menu) { menu_item_add(menu, power->menu); }); | ||||
| 
 | ||||
|     api_hal_power_init(); | ||||
| 
 | ||||
|     furi_record_create("power", power); | ||||
| 
 | ||||
|     while(1) { | ||||
|  | ||||
| @ -64,7 +64,7 @@ void api_hal_power_deep_sleep() { | ||||
|     LL_HSEM_ReleaseLock(HSEM, CFG_HW_RCC_SEMID, 0); | ||||
| 
 | ||||
|     // Prepare deep sleep
 | ||||
|     LL_PWR_SetPowerMode(LL_PWR_MODE_STOP2); | ||||
|     LL_PWR_SetPowerMode(LL_PWR_MODE_STOP1); | ||||
|     LL_LPM_EnableDeepSleep(); | ||||
| 
 | ||||
| #if defined ( __CC_ARM) | ||||
|  | ||||
| @ -5,5 +5,6 @@ void api_hal_init() { | ||||
|     api_hal_vcp_init(); | ||||
|     api_hal_spi_init(); | ||||
|     api_hal_i2c_init(); | ||||
|     api_hal_power_init(); | ||||
|     api_hal_light_init(); | ||||
| } | ||||
|  | ||||
| @ -64,7 +64,7 @@ void api_hal_power_deep_sleep() { | ||||
|     LL_HSEM_ReleaseLock(HSEM, CFG_HW_RCC_SEMID, 0); | ||||
| 
 | ||||
|     // Prepare deep sleep
 | ||||
|     LL_PWR_SetPowerMode(LL_PWR_MODE_STOP2); | ||||
|     LL_PWR_SetPowerMode(LL_PWR_MODE_STOP1); | ||||
|     LL_LPM_EnableDeepSleep(); | ||||
| 
 | ||||
| #if defined ( __CC_ARM) | ||||
|  | ||||
| @ -5,5 +5,6 @@ void api_hal_init() { | ||||
|     api_hal_vcp_init(); | ||||
|     api_hal_spi_init(); | ||||
|     api_hal_i2c_init(); | ||||
|     api_hal_power_init(); | ||||
|     api_hal_light_init(); | ||||
| } | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 あく
						あく