mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-14 08:08:36 -07:00
IR: Remember OTG state
This commit is contained in:
@@ -12,11 +12,12 @@
|
|||||||
#define INFRARED_TX_MIN_INTERVAL_MS (50U)
|
#define INFRARED_TX_MIN_INTERVAL_MS (50U)
|
||||||
#define INFRARED_TASK_STACK_SIZE (2048UL)
|
#define INFRARED_TASK_STACK_SIZE (2048UL)
|
||||||
|
|
||||||
#define INFRARED_SETTINGS_VERSION (0)
|
#define INFRARED_SETTINGS_VERSION (1)
|
||||||
#define INFRARED_SETTINGS_MAGIC (0x1F)
|
#define INFRARED_SETTINGS_MAGIC (0x1F)
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t tx_pin;
|
FuriHalInfraredTxPin tx_pin;
|
||||||
|
bool otg_enabled;
|
||||||
} InfraredSettings;
|
} InfraredSettings;
|
||||||
|
|
||||||
static const NotificationSequence*
|
static const NotificationSequence*
|
||||||
@@ -486,11 +487,15 @@ static void infrared_load_settings(InfraredApp* infrared) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
infrared_set_tx_pin(infrared, settings.tx_pin);
|
infrared_set_tx_pin(infrared, settings.tx_pin);
|
||||||
|
if(settings.tx_pin < FuriHalInfraredTxPinMax) {
|
||||||
|
infrared_enable_otg(infrared, settings.otg_enabled);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void infrared_save_settings(InfraredApp* infrared) {
|
void infrared_save_settings(InfraredApp* infrared) {
|
||||||
InfraredSettings settings = {
|
InfraredSettings settings = {
|
||||||
.tx_pin = infrared->app_state.tx_pin,
|
.tx_pin = infrared->app_state.tx_pin,
|
||||||
|
.otg_enabled = infrared->app_state.is_otg_enabled,
|
||||||
};
|
};
|
||||||
|
|
||||||
if(!saved_struct_save(
|
if(!saved_struct_save(
|
||||||
|
|||||||
Reference in New Issue
Block a user