|
|
@@ -1,5 +1,7 @@
|
|
|
#include "xremote.h"
|
|
|
|
|
|
+#include <infrared/infrared_settings.h>
|
|
|
+
|
|
|
bool xremote_custom_event_callback(void* context, uint32_t event) {
|
|
|
furi_assert(context);
|
|
|
XRemote* app = context;
|
|
|
@@ -203,8 +205,37 @@ int32_t xremote_app(void* p) {
|
|
|
|
|
|
furi_hal_power_suppress_charge_enter();
|
|
|
|
|
|
+ bool otg_was_enabled = furi_hal_power_is_otg_enabled();
|
|
|
+ InfraredSettings settings = {0};
|
|
|
+ infrared_settings_load(&settings);
|
|
|
+ if(settings.tx_pin < FuriHalInfraredTxPinMax) {
|
|
|
+ furi_hal_infrared_set_tx_output(settings.tx_pin);
|
|
|
+ if(settings.otg_enabled != otg_was_enabled) {
|
|
|
+ if(settings.otg_enabled) {
|
|
|
+ furi_hal_power_enable_otg();
|
|
|
+ } else {
|
|
|
+ furi_hal_power_disable_otg();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ FuriHalInfraredTxPin tx_pin_detected = furi_hal_infrared_detect_tx_output();
|
|
|
+ furi_hal_infrared_set_tx_output(tx_pin_detected);
|
|
|
+ if(tx_pin_detected != FuriHalInfraredTxPinInternal) {
|
|
|
+ furi_hal_power_enable_otg();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
view_dispatcher_run(app->view_dispatcher);
|
|
|
|
|
|
+ furi_hal_infrared_set_tx_output(FuriHalInfraredTxPinInternal);
|
|
|
+ if(furi_hal_power_is_otg_enabled() != otg_was_enabled) {
|
|
|
+ if(otg_was_enabled) {
|
|
|
+ furi_hal_power_enable_otg();
|
|
|
+ } else {
|
|
|
+ furi_hal_power_disable_otg();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
xremote_save_settings(app);
|
|
|
|
|
|
furi_hal_power_suppress_charge_exit();
|