SubGHz: Manual region bypass (#47)

* Subghz: brought back manual region bypass

* MNTM: change frequency check
this allows to add "extended" frequencies to your custom added frequencies

* MNTM: reboot when changing extended frequencies

* Fix regio typo

* Show bypass before extend

* Consistency with OFW and UL api for region, version, otp

* Fix API symbols

* Restrict only on TX

* Oops

* Improve bypass/extend UI

---------

Co-authored-by: Willy-JL <49810075+Willy-JL@users.noreply.github.com>
This commit is contained in:
Sil
2024-03-20 02:00:46 +01:00
committed by GitHub
parent f5901cfa3c
commit 0111d85236
14 changed files with 187 additions and 36 deletions

View File

@@ -1,6 +1,6 @@
#include <furi_hal_subghz.h>
#include <lib/subghz/devices/cc1101_configs.h>
#include <furi_hal_region_i.h>
#include <furi_hal_version.h>
#include <furi_hal_rtc.h>
#include <furi_hal_spi.h>
@@ -54,6 +54,7 @@ typedef struct {
int8_t rolling_counter_mult;
bool ext_power_amp : 1;
bool extended_frequency_i : 1;
bool bypass_region : 1;
} FuriHalSubGhz;
volatile FuriHalSubGhz furi_hal_subghz = {
@@ -63,6 +64,7 @@ volatile FuriHalSubGhz furi_hal_subghz = {
.rolling_counter_mult = 1,
.ext_power_amp = false,
.extended_frequency_i = false,
.bypass_region = false,
};
int8_t furi_hal_subghz_get_rolling_counter_mult(void) {
@@ -77,6 +79,10 @@ void furi_hal_subghz_set_extended_frequency(bool state_i) {
furi_hal_subghz.extended_frequency_i = state_i;
}
void furi_hal_subghz_set_bypass_region(bool enabled) {
furi_hal_subghz.bypass_region = enabled;
}
void furi_hal_subghz_set_ext_power_amp(bool enabled) {
furi_hal_subghz.ext_power_amp = enabled;
}
@@ -381,6 +387,15 @@ uint32_t furi_hal_subghz_set_frequency_and_path(uint32_t value) {
}
bool furi_hal_subghz_is_tx_allowed(uint32_t value) {
if(!furi_hal_subghz.bypass_region) {
if(!_furi_hal_region_is_frequency_allowed(value)) {
FURI_LOG_I(TAG, "Frequency blocked - outside region range");
return false;
}
return true;
}
bool allow_extended_for_int = furi_hal_subghz.extended_frequency_i;
if(!(allow_extended_for_int) &&