mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-25 14:22:27 +03:00
Infrared external output move out of debug and add power option
This commit is contained in:
parent
654a622607
commit
a1fa5224a3
@ -246,6 +246,11 @@ static void infrared_free(Infrared* infrared) {
|
|||||||
|
|
||||||
furi_string_free(infrared->file_path);
|
furi_string_free(infrared->file_path);
|
||||||
|
|
||||||
|
// Disable 5v power if was enabled for external module
|
||||||
|
if(furi_hal_power_is_otg_enabled()) {
|
||||||
|
furi_hal_power_disable_otg();
|
||||||
|
}
|
||||||
|
|
||||||
free(infrared);
|
free(infrared);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,22 @@ static void infrared_scene_debug_settings_changed(VariableItem* item) {
|
|||||||
|
|
||||||
furi_hal_infrared_set_debug_out(value_index_ir);
|
furi_hal_infrared_set_debug_out(value_index_ir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void infrared_scene_debug_settings_power_changed(VariableItem* item) {
|
||||||
|
bool value = variable_item_get_current_value_index(item);
|
||||||
|
if(value) {
|
||||||
|
for(int i = 0; i < 5 && !furi_hal_power_is_otg_enabled(); i++) {
|
||||||
|
furi_hal_power_enable_otg();
|
||||||
|
furi_delay_ms(10);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(furi_hal_power_is_otg_enabled()) {
|
||||||
|
furi_hal_power_disable_otg();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
|
||||||
|
}
|
||||||
|
|
||||||
static void infrared_debug_settings_start_var_list_enter_callback(void* context, uint32_t index) {
|
static void infrared_debug_settings_start_var_list_enter_callback(void* context, uint32_t index) {
|
||||||
Infrared* infrared = context;
|
Infrared* infrared = context;
|
||||||
view_dispatcher_send_custom_event(infrared->view_dispatcher, index);
|
view_dispatcher_send_custom_event(infrared->view_dispatcher, index);
|
||||||
@ -42,6 +58,16 @@ void infrared_scene_debug_settings_on_enter(void* context) {
|
|||||||
variable_item_set_current_value_index(item, value_index_ir);
|
variable_item_set_current_value_index(item, value_index_ir);
|
||||||
variable_item_set_current_value_text(item, infrared_debug_cfg_variables_text[value_index_ir]);
|
variable_item_set_current_value_text(item, infrared_debug_cfg_variables_text[value_index_ir]);
|
||||||
|
|
||||||
|
item = variable_item_list_add(
|
||||||
|
variable_item_list,
|
||||||
|
"Ext Module 5v",
|
||||||
|
2,
|
||||||
|
infrared_scene_debug_settings_power_changed,
|
||||||
|
infrared);
|
||||||
|
bool enabled = furi_hal_power_is_otg_enabled();
|
||||||
|
variable_item_set_current_value_index(item, enabled);
|
||||||
|
variable_item_set_current_value_text(item, enabled ? "ON" : "OFF");
|
||||||
|
|
||||||
view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewVariableItemList);
|
view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewVariableItemList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
enum SubmenuIndex {
|
enum SubmenuIndex {
|
||||||
SubmenuIndexUniversalRemotes,
|
SubmenuIndexUniversalRemotes,
|
||||||
SubmenuIndexLearnNewRemote,
|
SubmenuIndexLearnNewRemote,
|
||||||
SubmenuIndexLearnNewRemoteRaw,
|
|
||||||
SubmenuIndexSavedRemotes,
|
SubmenuIndexSavedRemotes,
|
||||||
SubmenuIndexDebug,
|
SubmenuIndexDebugSettings,
|
||||||
SubmenuIndexDebugSettings
|
SubmenuIndexLearnNewRemoteRaw,
|
||||||
|
SubmenuIndexDebug
|
||||||
};
|
};
|
||||||
|
|
||||||
static void infrared_scene_start_submenu_callback(void* context, uint32_t index) {
|
static void infrared_scene_start_submenu_callback(void* context, uint32_t index) {
|
||||||
@ -37,6 +37,12 @@ void infrared_scene_start_on_enter(void* context) {
|
|||||||
SubmenuIndexSavedRemotes,
|
SubmenuIndexSavedRemotes,
|
||||||
infrared_scene_start_submenu_callback,
|
infrared_scene_start_submenu_callback,
|
||||||
infrared);
|
infrared);
|
||||||
|
submenu_add_item(
|
||||||
|
submenu,
|
||||||
|
"GPIO Settings",
|
||||||
|
SubmenuIndexDebugSettings,
|
||||||
|
infrared_scene_start_submenu_callback,
|
||||||
|
infrared);
|
||||||
|
|
||||||
if(infrared->app_state.is_debug_enabled) {
|
if(infrared->app_state.is_debug_enabled) {
|
||||||
submenu_add_item(
|
submenu_add_item(
|
||||||
@ -51,12 +57,6 @@ void infrared_scene_start_on_enter(void* context) {
|
|||||||
SubmenuIndexDebug,
|
SubmenuIndexDebug,
|
||||||
infrared_scene_start_submenu_callback,
|
infrared_scene_start_submenu_callback,
|
||||||
infrared);
|
infrared);
|
||||||
submenu_add_item(
|
|
||||||
submenu,
|
|
||||||
"Debug Settings",
|
|
||||||
SubmenuIndexDebugSettings,
|
|
||||||
infrared_scene_start_submenu_callback,
|
|
||||||
infrared);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint32_t submenu_index =
|
const uint32_t submenu_index =
|
||||||
|
Loading…
Reference in New Issue
Block a user