mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-06-07 19:01:54 -07:00
Remember if 5v was turned off, save its state
This commit is contained in:
+1
-1
@@ -1,7 +1,7 @@
|
||||
### New changes
|
||||
* SubGHz: New protocols support: CAME Space, Stilmatic / Schellenberg
|
||||
* SubGHz: Add Manually - new protocols -> Beninca, Sommer(FSK), IronLogic, DTM Neo, Gibidi, Elmes Electronic (Elmes Poland), CAME Space
|
||||
* SubGHz: Remember last external module setting, so if you turn off flipper it will remember last external module setting (only for subghz app)
|
||||
* SubGHz: Remember last external module setting and power setting, so if you turn off flipper it will remember last external module settings (only for subghz app)
|
||||
* SubGHz: Fix issues when external module is not found but plugins tries to use it, now they will fallback to internal in that case
|
||||
* SubGHz: Fixed external CC1101 module power issues, added more checks, fixed issues when launching subghz favourites
|
||||
* SubGHz: Removed 330MHz from default freq hopper to make it faster, to change freq hopper settings and remove/add your freqs see -> [Instruction](https://github.com/DarkFlippers/unleashed-firmware/blob/dev/documentation/SubGHzSettings.md)
|
||||
|
||||
@@ -88,6 +88,7 @@ static void subghz_scene_receiver_config_set_debug_counter(VariableItem* item) {
|
||||
}
|
||||
|
||||
static void subghz_scene_receiver_config_set_ext_mod_power(VariableItem* item) {
|
||||
SubGhz* subghz = variable_item_get_context(item);
|
||||
uint8_t index = variable_item_get_current_value_index(item);
|
||||
|
||||
variable_item_set_current_value_text(item, ext_mod_power_text[index]);
|
||||
@@ -98,6 +99,9 @@ static void subghz_scene_receiver_config_set_ext_mod_power(VariableItem* item) {
|
||||
} else {
|
||||
furi_hal_subghz_enable_ext_power();
|
||||
}
|
||||
|
||||
subghz->last_settings->external_module_power_5v_disable = index == 1;
|
||||
subghz_last_settings_save(subghz->last_settings);
|
||||
}
|
||||
|
||||
void subghz_scene_ext_module_settings_on_enter(void* context) {
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#define SUBGHZ_LAST_SETTING_FIELD_FREQUENCY_ANALYZER_FEEDBACK_LEVEL "FeedbackLevel"
|
||||
#define SUBGHZ_LAST_SETTING_FIELD_FREQUENCY_ANALYZER_TRIGGER "FATrigger"
|
||||
#define SUBGHZ_LAST_SETTING_FIELD_EXTERNAL_MODULE_ENABLED "External"
|
||||
#define SUBGHZ_LAST_SETTING_FIELD_EXTERNAL_MODULE_POWER "ExtPower"
|
||||
|
||||
SubGhzLastSettings* subghz_last_settings_alloc(void) {
|
||||
SubGhzLastSettings* instance = malloc(sizeof(SubGhzLastSettings));
|
||||
@@ -43,6 +44,7 @@ void subghz_last_settings_load(SubGhzLastSettings* instance, size_t preset_count
|
||||
uint32_t temp_frequency_analyzer_feedback_level = 0;
|
||||
float temp_frequency_analyzer_trigger = 0;
|
||||
bool temp_external_module_enabled = false;
|
||||
bool temp_external_module_power_5v_disable = false;
|
||||
//int32_t temp_preset = 0;
|
||||
bool frequency_analyzer_feedback_level_was_read = false;
|
||||
bool frequency_analyzer_trigger_was_read = false;
|
||||
@@ -69,6 +71,11 @@ void subghz_last_settings_load(SubGhzLastSettings* instance, size_t preset_count
|
||||
SUBGHZ_LAST_SETTING_FIELD_EXTERNAL_MODULE_ENABLED,
|
||||
(bool*)&temp_external_module_enabled,
|
||||
1);
|
||||
flipper_format_read_bool(
|
||||
fff_data_file,
|
||||
SUBGHZ_LAST_SETTING_FIELD_EXTERNAL_MODULE_POWER,
|
||||
(bool*)&temp_external_module_power_5v_disable,
|
||||
1);
|
||||
|
||||
} else {
|
||||
FURI_LOG_E(TAG, "Error open file %s", SUBGHZ_LAST_SETTINGS_PATH);
|
||||
@@ -100,6 +107,13 @@ void subghz_last_settings_load(SubGhzLastSettings* instance, size_t preset_count
|
||||
|
||||
instance->external_module_enabled = temp_external_module_enabled;
|
||||
|
||||
instance->external_module_power_5v_disable = temp_external_module_power_5v_disable;
|
||||
|
||||
if(instance->external_module_power_5v_disable) {
|
||||
furi_hal_subghz_set_external_power_disable(true);
|
||||
furi_hal_subghz_disable_ext_power();
|
||||
}
|
||||
|
||||
// Set selected radio module
|
||||
if(instance->external_module_enabled) {
|
||||
furi_hal_subghz_set_radio_type(SubGhzRadioExternal);
|
||||
@@ -168,6 +182,13 @@ bool subghz_last_settings_save(SubGhzLastSettings* instance) {
|
||||
1)) {
|
||||
break;
|
||||
}
|
||||
if(!flipper_format_insert_or_update_bool(
|
||||
file,
|
||||
SUBGHZ_LAST_SETTING_FIELD_EXTERNAL_MODULE_POWER,
|
||||
&instance->external_module_power_5v_disable,
|
||||
1)) {
|
||||
break;
|
||||
}
|
||||
saved = true;
|
||||
} while(0);
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ typedef struct {
|
||||
uint32_t frequency_analyzer_feedback_level;
|
||||
float frequency_analyzer_trigger;
|
||||
bool external_module_enabled;
|
||||
bool external_module_power_5v_disable;
|
||||
} SubGhzLastSettings;
|
||||
|
||||
SubGhzLastSettings* subghz_last_settings_alloc(void);
|
||||
|
||||
Reference in New Issue
Block a user