diff --git a/CHANGELOG.md b/CHANGELOG.md index b7bd0d9d9..abb675d3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -67,10 +67,12 @@ - OFW: Make file extensions case-insensitive (by @gsurkov) - File Browser: Fix race condition for switch folder and refresh (by @Willy-JL) - MNTM Settings: Fix UI desync after reset mainmenu (by @Willy-JL) +- Sub-GHz: + - Make sure previous frequency is in list, fix UI desync (by @Willy-JL) + - OFW: Fix RPC status for ButtonRelease event (by @Skorpionm) - NFC: - OFW: Fix plantain balance string (by @Astrrra) - OFW: Now fifo size in ST25 chip is calculated properly (by @RebornedBrain) -- OFW: Sub-GHz: Fix RPC status for ButtonRelease event (by @Skorpionm) - OFW: Infrared: Fix cumulative error in infrared signals (by @gsurkov) - OFW: Desktop: Separate callbacks for dolphin and storage subscriptions (by @skotopes) - OFW: FBT: Improved size validator for updater image (by @hedger) diff --git a/applications/main/subghz/subghz.c b/applications/main/subghz/subghz.c index 1d86d596d..19ea02a95 100644 --- a/applications/main/subghz/subghz.c +++ b/applications/main/subghz/subghz.c @@ -203,6 +203,28 @@ SubGhz* subghz_alloc(bool alloc_for_tx_only) { size_t preset_count = subghz_setting_get_preset_count(setting); subghz_last_settings_load(subghz->last_settings, preset_count); if(!alloc_for_tx_only) { + // Make sure we select a frequency available in loaded setting configuration + uint32_t last_frequency = subghz->last_settings->frequency; + size_t count = subghz_setting_get_frequency_count(setting); + bool found_last = false; + bool found_default = false; + for(size_t i = 0; i < count; i++) { + uint32_t frequency = subghz_setting_get_frequency(setting, i); + if(frequency == last_frequency) { + found_last = true; + break; + } + if(frequency == SUBGHZ_LAST_SETTING_DEFAULT_FREQUENCY) found_default = true; + } + if(!found_last) { + if(found_default) { + last_frequency = SUBGHZ_LAST_SETTING_DEFAULT_FREQUENCY; + } else if(count > 0) { + last_frequency = subghz_setting_get_frequency(setting, 0); + } + subghz->last_settings->frequency = last_frequency; + } + subghz_txrx_set_preset_internal( subghz->txrx, subghz->last_settings->frequency, subghz->last_settings->preset_index); subghz->history = subghz_history_alloc();