mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
Support ext module in IR Remote
This commit is contained in:
1
applications/system/ir_remote/infrared_last_settings.c
Normal file
1
applications/system/ir_remote/infrared_last_settings.c
Normal file
@@ -0,0 +1 @@
|
||||
#include <applications/main/infrared/infrared_last_settings.c>
|
||||
1
applications/system/ir_remote/infrared_last_settings.h
Normal file
1
applications/system/ir_remote/infrared_last_settings.h
Normal file
@@ -0,0 +1 @@
|
||||
#include <applications/main/infrared/infrared_last_settings.h>
|
||||
@@ -8,6 +8,8 @@
|
||||
#include <dialogs/dialogs.h>
|
||||
#include <ir_remote_icons.h>
|
||||
#include <assets_icons.h>
|
||||
#include "infrared_last_settings.h"
|
||||
#include <furi_hal_infrared.h>
|
||||
|
||||
#include <notification/notification.h>
|
||||
#include <notification/notification_messages.h>
|
||||
@@ -400,6 +402,26 @@ int32_t infrared_remote_app(char* p) {
|
||||
flipper_format_free(ff);
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
bool otg_was_enabled = furi_hal_power_is_otg_enabled();
|
||||
InfraredLastSettings* last_settings = infrared_last_settings_alloc();
|
||||
infrared_last_settings_load(last_settings);
|
||||
|
||||
furi_hal_infrared_set_auto_detect(last_settings->auto_detect);
|
||||
if(!last_settings->auto_detect) {
|
||||
furi_hal_infrared_set_debug_out(last_settings->ext_out);
|
||||
if(last_settings->ext_5v) {
|
||||
uint8_t attempts = 0;
|
||||
while(!furi_hal_power_is_otg_enabled() && attempts++ < 5) {
|
||||
furi_hal_power_enable_otg();
|
||||
furi_delay_ms(10);
|
||||
}
|
||||
} else if(furi_hal_power_is_otg_enabled()) {
|
||||
furi_hal_power_disable_otg();
|
||||
}
|
||||
} else if(furi_hal_power_is_otg_enabled()) {
|
||||
furi_hal_power_disable_otg();
|
||||
}
|
||||
|
||||
bool running = true;
|
||||
NotificationApp* notification = furi_record_open(RECORD_NOTIFICATION);
|
||||
|
||||
@@ -541,6 +563,19 @@ int32_t infrared_remote_app(char* p) {
|
||||
}
|
||||
}
|
||||
|
||||
if(otg_was_enabled != furi_hal_power_is_otg_enabled()) {
|
||||
if(otg_was_enabled) {
|
||||
uint8_t attempts = 0;
|
||||
while(!furi_hal_power_is_otg_enabled() && attempts++ < 5) {
|
||||
furi_hal_power_enable_otg();
|
||||
furi_delay_ms(10);
|
||||
}
|
||||
} else {
|
||||
furi_hal_power_disable_otg();
|
||||
}
|
||||
}
|
||||
infrared_last_settings_free(last_settings);
|
||||
|
||||
// Free all things
|
||||
furi_string_free(app->up_button);
|
||||
furi_string_free(app->down_button);
|
||||
|
||||
Reference in New Issue
Block a user