mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-26 22:40:25 +00:00
Fixes and de-kostilying
This commit is contained in:
parent
17269a5386
commit
3898e6e71d
4 changed files with 15 additions and 36 deletions
|
@ -228,9 +228,9 @@ bool subghz_txrx_gen_faac_slh_protocol(
|
|||
seed_data[sizeof(uint32_t) - i - 1] = (seed >> i * 8) & 0xFF;
|
||||
}
|
||||
|
||||
bool allow_zero_seed = true;
|
||||
flipper_format_write_hex(txrx->fff_data, "Seed", seed_data, sizeof(uint32_t));
|
||||
flipper_format_write_string_cstr(txrx->fff_data, "Valid", "1\r\n");
|
||||
FURI_LOG_I(TAG, "Flag write to SD is OK");
|
||||
flipper_format_write_bool(txrx->fff_data, "AllowZeroSeed", &allow_zero_seed, 1);
|
||||
}
|
||||
|
||||
subghz_transmitter_free(txrx->transmitter);
|
||||
|
|
|
@ -32,7 +32,7 @@ const char* const debug_pin_text[DEBUG_P_COUNT] = {
|
|||
"17(1W)",
|
||||
};
|
||||
|
||||
#define DEBUG_COUNTER_COUNT 15
|
||||
#define DEBUG_COUNTER_COUNT 13
|
||||
const char* const debug_counter_text[DEBUG_COUNTER_COUNT] = {
|
||||
"+1",
|
||||
"+2",
|
||||
|
@ -40,7 +40,6 @@ const char* const debug_counter_text[DEBUG_COUNTER_COUNT] = {
|
|||
"+4",
|
||||
"+5",
|
||||
"+10",
|
||||
"+100",
|
||||
"0",
|
||||
"-1",
|
||||
"-2",
|
||||
|
@ -48,7 +47,6 @@ const char* const debug_counter_text[DEBUG_COUNTER_COUNT] = {
|
|||
"-4",
|
||||
"-5",
|
||||
"-10",
|
||||
"-100",
|
||||
};
|
||||
const uint32_t debug_counter_val[DEBUG_COUNTER_COUNT] = {
|
||||
1,
|
||||
|
@ -57,7 +55,6 @@ const uint32_t debug_counter_val[DEBUG_COUNTER_COUNT] = {
|
|||
4,
|
||||
5,
|
||||
10,
|
||||
100,
|
||||
0,
|
||||
-1,
|
||||
-2,
|
||||
|
@ -65,7 +62,6 @@ const uint32_t debug_counter_val[DEBUG_COUNTER_COUNT] = {
|
|||
-4,
|
||||
-5,
|
||||
-10,
|
||||
-100,
|
||||
};
|
||||
|
||||
static void subghz_scene_radio_settings_set_device(VariableItem* item) {
|
||||
|
|
|
@ -25,6 +25,7 @@ struct SubGhzBlockGeneric {
|
|||
uint32_t cnt;
|
||||
uint8_t cnt_2;
|
||||
uint32_t seed;
|
||||
bool allow_zero_seed;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
|
||||
#define TAG "SubGhzProtocolFaacSLH"
|
||||
|
||||
bool bvalid;
|
||||
|
||||
static const SubGhzBlockConst subghz_protocol_faac_slh_const = {
|
||||
.te_short = 255,
|
||||
.te_long = 595,
|
||||
|
@ -112,21 +110,10 @@ void subghz_protocol_encoder_faac_slh_free(void* context) {
|
|||
}
|
||||
|
||||
static bool subghz_protocol_faac_slh_gen_data(SubGhzProtocolEncoderFaacSLH* instance) {
|
||||
//FuriString* valid = furi_string_alloc();
|
||||
//if(flipper_format_read_string(flipper_format, "Valid", valid)) {
|
||||
//bvalid = true;
|
||||
//FURI_LOG_I(TAG, "[gen_data] is valid ? : %i", bvalid);
|
||||
//} else {
|
||||
//bvalid = false;
|
||||
//FURI_LOG_I(TAG, "[gen_data] is valid ? : %i", bvalid);
|
||||
//}
|
||||
//furi_string_free(valid);
|
||||
if(bvalid) {
|
||||
if(instance->generic.allow_zero_seed) {
|
||||
instance->generic.cnt += furi_hal_subghz_get_rolling_counter_mult();
|
||||
FURI_LOG_I(TAG, "[gen_data] TRUE : %i", bvalid);
|
||||
} else {
|
||||
// Do not generate new data, send data from buffer
|
||||
FURI_LOG_I(TAG, "[gen_data] FALSE : %i", bvalid);
|
||||
return true;
|
||||
}
|
||||
uint32_t fix = instance->generic.serial << 4 | instance->generic.btn;
|
||||
|
@ -255,15 +242,13 @@ SubGhzProtocolStatus
|
|||
FURI_LOG_E(TAG, "Missing Seed");
|
||||
break;
|
||||
}
|
||||
FuriString* valid = furi_string_alloc();
|
||||
if(flipper_format_read_string(flipper_format, "Valid", valid)) {
|
||||
bvalid = true;
|
||||
FURI_LOG_I(TAG, "[encoder_des] True : %i", bvalid);
|
||||
bool allow_zero_seed;
|
||||
if(flipper_format_read_bool(flipper_format, "AllowZeroSeed", &allow_zero_seed, 1)) {
|
||||
instance->generic.allow_zero_seed = true;
|
||||
} else {
|
||||
bvalid = false;
|
||||
FURI_LOG_I(TAG, "[encoder_des] False : %i", bvalid);
|
||||
instance->generic.allow_zero_seed = false;
|
||||
}
|
||||
furi_string_free(valid);
|
||||
|
||||
instance->generic.seed = seed_data[0] << 24 | seed_data[1] << 16 | seed_data[2] << 8 |
|
||||
seed_data[3];
|
||||
|
||||
|
@ -508,15 +493,12 @@ SubGhzProtocolStatus
|
|||
FURI_LOG_E(TAG, "Missing Seed");
|
||||
break;
|
||||
}
|
||||
FuriString* valid = furi_string_alloc();
|
||||
if(flipper_format_read_string(flipper_format, "Valid", valid)) {
|
||||
bvalid = true;
|
||||
FURI_LOG_I(TAG, "[decoder_des] TRUE : %i", bvalid);
|
||||
bool allow_zero_seed;
|
||||
if(flipper_format_read_bool(flipper_format, "AllowZeroSeed", &allow_zero_seed, 1)) {
|
||||
instance->generic.allow_zero_seed = true;
|
||||
} else {
|
||||
bvalid = false;
|
||||
FURI_LOG_I(TAG, "[decoder_des] FALSE : %i", bvalid);
|
||||
instance->generic.allow_zero_seed = false;
|
||||
}
|
||||
furi_string_free(valid);
|
||||
instance->generic.seed = seed_data[0] << 24 | seed_data[1] << 16 | seed_data[2] << 8 |
|
||||
seed_data[3];
|
||||
|
||||
|
@ -538,7 +520,7 @@ void subghz_protocol_decoder_faac_slh_get_string(void* context, FuriString* outp
|
|||
uint32_t code_fix = instance->generic.data >> 32;
|
||||
uint32_t code_hop = instance->generic.data & 0xFFFFFFFF;
|
||||
|
||||
if(bvalid == false) {
|
||||
if(instance->generic.allow_zero_seed == false) {
|
||||
furi_string_cat_printf(
|
||||
output,
|
||||
"%s %dbit\r\n"
|
||||
|
|
Loading…
Reference in a new issue