-
-
Notifications
You must be signed in to change notification settings - Fork 248
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* initial working commit * update names + format * add skip functionality * misc tweaks * change back gpio label * remove gpio setting changes * misc fixes * bug fixes and polish * add subtitle button and reorganize order * update ir settings to version 2 * ir settings v1 migration support * fixes * format * misc fixes * Simplify and standardize settings handling * Auto-calculate easy_mode_button_count * Case insensitive match existing remote buttons * Display button name more prominently * Sort submenu indexes and handling * Fine to keep text highlighted * Some formatting for less conflicts * Not sure how these got lost kek * Update changelog --------- Co-authored-by: Willy-JL <49810075+Willy-JL@users.noreply.github.com>
- Loading branch information
1 parent
e6ccd22
commit 0a8b9a7
Showing
10 changed files
with
277 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule external
updated
3 files
+2 −7 | ir_intervalometer/intervalometer.c | |
+2 −7 | ir_remote/infrared_remote_app.c | |
+2 −7 | xremote/xremote.c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#pragma once | ||
|
||
#include <storage/storage.h> | ||
#include <furi_hal_infrared.h> | ||
#include <toolbox/saved_struct.h> | ||
|
||
#define INFRARED_SETTINGS_PATH INT_PATH(".infrared.settings") | ||
#define INFRARED_SETTINGS_VERSION (2) | ||
#define INFRARED_SETTINGS_MAGIC (0x1F) | ||
|
||
typedef struct { | ||
FuriHalInfraredTxPin tx_pin; | ||
bool otg_enabled; | ||
bool easy_mode; | ||
} InfraredSettings; | ||
|
||
typedef struct { | ||
FuriHalInfraredTxPin tx_pin; | ||
bool otg_enabled; | ||
} _InfraredSettingsV1; | ||
|
||
bool infrared_settings_load(InfraredSettings* settings) { | ||
// Default load | ||
if(saved_struct_load( | ||
INFRARED_SETTINGS_PATH, | ||
settings, | ||
sizeof(*settings), | ||
INFRARED_SETTINGS_MAGIC, | ||
INFRARED_SETTINGS_VERSION)) { | ||
return true; | ||
} | ||
|
||
// Set defaults | ||
settings->tx_pin = FuriHalInfraredTxPinInternal; | ||
settings->otg_enabled = false; | ||
settings->easy_mode = false; | ||
|
||
// Try to migrate | ||
uint8_t magic, version; | ||
if(saved_struct_get_metadata(INFRARED_SETTINGS_PATH, &magic, &version, NULL) && | ||
magic == INFRARED_SETTINGS_MAGIC) { | ||
_InfraredSettingsV1 v1; | ||
|
||
if(version == 1 && | ||
saved_struct_load(INFRARED_SETTINGS_PATH, &v1, sizeof(v1), magic, version)) { | ||
settings->tx_pin = v1.tx_pin; | ||
settings->otg_enabled = v1.otg_enabled; | ||
return true; | ||
} | ||
} | ||
|
||
return false; | ||
} | ||
|
||
bool infrared_settings_save(InfraredSettings* settings) { | ||
return saved_struct_save( | ||
INFRARED_SETTINGS_PATH, | ||
settings, | ||
sizeof(*settings), | ||
INFRARED_SETTINGS_MAGIC, | ||
INFRARED_SETTINGS_VERSION); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.