This commit is contained in:
Willy-JL
2023-05-20 01:20:34 +01:00
parent ff76fe32c1
commit 9ddff2a259
51 changed files with 2272 additions and 1420 deletions

View File

@@ -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"
1 entry status name type params
1455 Function + furi_hal_subghz_flush_rx void
1456 Function + furi_hal_subghz_flush_tx void
1457 Function + furi_hal_subghz_get_external_power_disable _Bool
Function + furi_hal_subghz_get_is_extended _Bool
1458 Function + furi_hal_subghz_get_lqi uint8_t
1459 Function + furi_hal_subghz_get_radio_type SubGhzRadioType
1460 Function + furi_hal_subghz_get_rolling_counter_mult uint8_t
1481 Function + furi_hal_subghz_set_external_power_disable void _Bool
1482 Function + furi_hal_subghz_set_frequency uint32_t uint32_t
1483 Function + furi_hal_subghz_set_frequency_and_path uint32_t uint32_t
Function + furi_hal_subghz_set_is_extended void _Bool
1484 Function + furi_hal_subghz_set_path void FuriHalSubGhzPath
1485 Function + furi_hal_subghz_set_rolling_counter_mult void uint8_t
1486 Function + furi_hal_subghz_set_timestamp_file_names void _Bool
2820 Function + subghz_protocol_blocks_reverse_key uint64_t uint64_t, uint8_t
2821 Function + subghz_protocol_blocks_set_bit_array void _Bool, uint8_t[], size_t, size_t
2822 Function + subghz_protocol_blocks_xor_bytes uint8_t const uint8_t[], size_t
2823 Function - subghz_protocol_came_atomo_create_data _Bool void*, FlipperFormat*, uint32_t, uint16_t, SubGhzRadioPreset*
2824 Function - subghz_protocol_decoder_alutech_at_4n_alloc void* SubGhzEnvironment*
2825 Function - subghz_protocol_decoder_alutech_at_4n_deserialize SubGhzProtocolStatus void*, FlipperFormat*
2826 Function - subghz_protocol_decoder_alutech_at_4n_feed void void*, _Bool, uint32_t

View File

@@ -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;
}

View File

@@ -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

View File

@@ -0,0 +1,3 @@
#pragma once
void furi_hal_subghz_set_extended_frequency(bool state_i);