mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-12 20:38:36 -07:00
Merge branch 'dev' of https://github.com/DarkFlippers/unleashed-firmware into xfw-dev
This commit is contained in:
@@ -1455,7 +1455,6 @@ Function,+,furi_hal_subghz_enable_ext_power,_Bool,
|
||||
Function,+,furi_hal_subghz_flush_rx,void,
|
||||
Function,+,furi_hal_subghz_flush_tx,void,
|
||||
Function,+,furi_hal_subghz_get_external_power_disable,_Bool,
|
||||
Function,+,furi_hal_subghz_get_is_extended,_Bool,
|
||||
Function,+,furi_hal_subghz_get_lqi,uint8_t,
|
||||
Function,+,furi_hal_subghz_get_radio_type,SubGhzRadioType,
|
||||
Function,+,furi_hal_subghz_get_rolling_counter_mult,uint8_t,
|
||||
@@ -1482,7 +1481,6 @@ Function,+,furi_hal_subghz_set_async_mirror_pin,void,const GpioPin*
|
||||
Function,+,furi_hal_subghz_set_external_power_disable,void,_Bool
|
||||
Function,+,furi_hal_subghz_set_frequency,uint32_t,uint32_t
|
||||
Function,+,furi_hal_subghz_set_frequency_and_path,uint32_t,uint32_t
|
||||
Function,+,furi_hal_subghz_set_is_extended,void,_Bool
|
||||
Function,+,furi_hal_subghz_set_path,void,FuriHalSubGhzPath
|
||||
Function,+,furi_hal_subghz_set_rolling_counter_mult,void,uint8_t
|
||||
Function,+,furi_hal_subghz_set_timestamp_file_names,void,_Bool
|
||||
@@ -2822,6 +2820,7 @@ Function,+,subghz_protocol_blocks_parity_bytes,uint8_t,"const uint8_t[], size_t"
|
||||
Function,+,subghz_protocol_blocks_reverse_key,uint64_t,"uint64_t, uint8_t"
|
||||
Function,+,subghz_protocol_blocks_set_bit_array,void,"_Bool, uint8_t[], size_t, size_t"
|
||||
Function,+,subghz_protocol_blocks_xor_bytes,uint8_t,"const uint8_t[], size_t"
|
||||
Function,-,subghz_protocol_came_atomo_create_data,_Bool,"void*, FlipperFormat*, uint32_t, uint16_t, SubGhzRadioPreset*"
|
||||
Function,-,subghz_protocol_decoder_alutech_at_4n_alloc,void*,SubGhzEnvironment*
|
||||
Function,-,subghz_protocol_decoder_alutech_at_4n_deserialize,SubGhzProtocolStatus,"void*, FlipperFormat*"
|
||||
Function,-,subghz_protocol_decoder_alutech_at_4n_feed,void,"void*, _Bool, uint32_t"
|
||||
|
||||
|
@@ -41,6 +41,7 @@ volatile FuriHalSubGhz furi_hal_subghz = {
|
||||
.rolling_counter_mult = 1,
|
||||
.ext_module_power_disabled = false,
|
||||
.timestamp_file_names = false,
|
||||
.extended_frequency_i = false,
|
||||
};
|
||||
|
||||
void furi_hal_subghz_select_radio_type(SubGhzRadioType state) {
|
||||
@@ -96,6 +97,10 @@ bool furi_hal_subghz_get_timestamp_file_names(void) {
|
||||
return furi_hal_subghz.timestamp_file_names;
|
||||
}
|
||||
|
||||
void furi_hal_subghz_set_extended_frequency(bool state_i) {
|
||||
furi_hal_subghz.extended_frequency_i = state_i;
|
||||
}
|
||||
|
||||
void furi_hal_subghz_set_async_mirror_pin(const GpioPin* pin) {
|
||||
furi_hal_subghz.async_mirror_pin = pin;
|
||||
}
|
||||
@@ -448,49 +453,20 @@ uint32_t furi_hal_subghz_set_frequency_and_path(uint32_t value) {
|
||||
return value;
|
||||
}
|
||||
|
||||
bool furi_hal_subghz_get_is_extended() {
|
||||
bool is_extended = false;
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
FlipperFormat* file = flipper_format_file_alloc(storage);
|
||||
|
||||
if(flipper_format_file_open_existing(file, "/ext/subghz/assets/extend_range.txt")) {
|
||||
flipper_format_read_bool(file, "use_ext_range_at_own_risk", &is_extended, 1);
|
||||
}
|
||||
|
||||
flipper_format_free(file);
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
return is_extended;
|
||||
}
|
||||
|
||||
void furi_hal_subghz_set_is_extended(bool is_extended) {
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
FlipperFormat* file = flipper_format_file_alloc(storage);
|
||||
|
||||
do {
|
||||
if(!flipper_format_file_open_always(file, "/ext/subghz/assets/extend_range.txt")) break;
|
||||
if(!flipper_format_write_header_cstr(file, "Flipper SubGhz Setting File", 1)) break;
|
||||
if(!flipper_format_write_comment_cstr(
|
||||
file, "Whether to allow extended ranges that can break your flipper"))
|
||||
break;
|
||||
if(!flipper_format_write_bool(file, "use_ext_range_at_own_risk", &is_extended, 1)) break;
|
||||
} while(0);
|
||||
|
||||
flipper_format_free(file);
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
}
|
||||
|
||||
bool furi_hal_subghz_is_tx_allowed(uint32_t value) {
|
||||
bool is_extended = furi_hal_subghz_get_is_extended();
|
||||
bool allow_extended_for_int = furi_hal_subghz.extended_frequency_i;
|
||||
|
||||
if(!(value >= 299999755 && value <= 350000335) && // was increased from 348 to 350
|
||||
if(!(allow_extended_for_int) &&
|
||||
!(value >= 299999755 && value <= 350000335) && // was increased from 348 to 350
|
||||
!(value >= 386999938 && value <= 467750000) && // was increased from 464 to 467.75
|
||||
!(value >= 778999847 && value <= 928000000) && !(is_extended)) {
|
||||
!(value >= 778999847 && value <= 928000000)) {
|
||||
FURI_LOG_I(TAG, "Frequency blocked - outside default range");
|
||||
return false;
|
||||
} else if(
|
||||
(allow_extended_for_int) && //
|
||||
!(value >= 281000000 && value <= 361000000) &&
|
||||
!(value >= 378000000 && value <= 481000000) &&
|
||||
!(value >= 749000000 && value <= 962000000) && is_extended) {
|
||||
!(value >= 749000000 && value <= 962000000)) {
|
||||
FURI_LOG_I(TAG, "Frequency blocked - outside extended range");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -78,8 +78,9 @@ typedef struct {
|
||||
FuriHalSpiBusHandle* spi_bus_handle;
|
||||
const GpioPin* cc1101_g0_pin;
|
||||
uint8_t rolling_counter_mult;
|
||||
bool ext_module_power_disabled;
|
||||
bool timestamp_file_names;
|
||||
bool ext_module_power_disabled : 1;
|
||||
bool timestamp_file_names : 1;
|
||||
bool extended_frequency_i : 1;
|
||||
} FuriHalSubGhz;
|
||||
|
||||
extern volatile FuriHalSubGhz furi_hal_subghz;
|
||||
@@ -225,18 +226,6 @@ bool furi_hal_subghz_is_frequency_valid(uint32_t value);
|
||||
*/
|
||||
uint32_t furi_hal_subghz_set_frequency_and_path(uint32_t value);
|
||||
|
||||
/** Read extend and bypass settings values into out params
|
||||
*
|
||||
* @return is_extended bool
|
||||
*/
|
||||
bool furi_hal_subghz_get_is_extended();
|
||||
|
||||
/** Set extend and bypass settings values to file
|
||||
*
|
||||
* @param is_extended bool for extend
|
||||
*/
|
||||
void furi_hal_subghz_set_is_extended(bool is_extended);
|
||||
|
||||
/** Сheck if transmission is allowed on this frequency with your current config
|
||||
*
|
||||
* @param value frequency in Hz
|
||||
|
||||
3
firmware/targets/f7/furi_hal/furi_hal_subghz_i.h
Normal file
3
firmware/targets/f7/furi_hal/furi_hal_subghz_i.h
Normal file
@@ -0,0 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
void furi_hal_subghz_set_extended_frequency(bool state_i);
|
||||
Reference in New Issue
Block a user