Merge remote-tracking branch 'ul/dev' into mntm-dev --nobuild

This commit is contained in:
WillyJL
2026-01-21 21:42:50 +01:00
105 changed files with 2816 additions and 2413 deletions

View File

@@ -404,40 +404,19 @@ static void subghz_protocol_secplus_v2_encode(SubGhzProtocolEncoderSecPlus_v2* i
uint8_t roll_2[9] = {0};
// Experemental case - we dont know counter size exactly, so just will be think that it is in range of 0xE500000 - 0xFFFFFFF
// one case when we have mult = 0xFFFFFFFF - its when we reset counter before applying new cnt value
// so at first step we reset cnt to 0 and now we sure here will be second step (set new cnt value);
// at second step check what user set for new Cnt (and correct it if cnt less than 0xE500000 or more than 0xFFFFFFF)
int32_t multicntr = (furi_hal_subghz_get_rolling_counter_mult() & 0xFFFFFFF);
// Adjust for negative multiplier
if(furi_hal_subghz_get_rolling_counter_mult() < 0) {
multicntr = furi_hal_subghz_get_rolling_counter_mult();
}
// Check for OFEX (overflow experimental) mode
if(furi_hal_subghz_get_rolling_counter_mult() != -0x7FFFFFFF) {
if((furi_hal_subghz_get_rolling_counter_mult() == (int32_t)0xFFFFFFF) &
(instance->generic.cnt != 0)) {
instance->generic.cnt = 0;
} else {
// if cnt was reset to 0 on previous step and user want new Cnt then set it to 0xE500000 or 0xFFFFFFF or new user value
if(instance->generic.cnt == 0) {
if(furi_hal_subghz_get_rolling_counter_mult() < (int32_t)0xE500000) {
instance->generic.cnt = 0xE500000;
} else {
if(furi_hal_subghz_get_rolling_counter_mult() >= (int32_t)0xFFFFFFF) {
instance->generic.cnt = 0xFFFFFFF;
} else {
instance->generic.cnt += multicntr;
}
}
// standart counter mode. PULL data from subghz_block_generic_global variables
if(!subghz_block_generic_global_counter_override_get(&instance->generic.cnt)) {
// if counter_override_get return FALSE then counter was not changed and we increase counter by standart mult value
if((instance->generic.cnt + furi_hal_subghz_get_rolling_counter_mult()) > 0xFFFFFFF) {
instance->generic.cnt = 0xE500000;
} else {
// if we have not special cases - so work as standart mode
if((instance->generic.cnt + multicntr) > 0xFFFFFFF) {
instance->generic.cnt = 0xE500000;
} else {
instance->generic.cnt += multicntr;
}
instance->generic.cnt += furi_hal_subghz_get_rolling_counter_mult();
}
}
if(instance->generic.cnt < 0xE500000) instance->generic.cnt = 0xE500000;
} else {
// OFEX (overflow experimental) mode
if((instance->generic.cnt + 0x1) > 0xFFFFFFF) {
@@ -597,7 +576,7 @@ SubGhzProtocolStatus
subghz_protocol_secplus_v2_remote_controller(
&instance->generic, instance->secplus_packet_1);
subghz_protocol_secplus_v2_encode(instance);
//optional parameter parameter
// Optional value
flipper_format_read_uint32(
flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1);
subghz_protocol_encoder_secplus_v2_get_upload(instance);
@@ -984,6 +963,11 @@ void subghz_protocol_decoder_secplus_v2_get_string(void* context, FuriString* ou
subghz_protocol_secplus_v2_remote_controller(&instance->generic, instance->secplus_packet_1);
// need to research or practice check how much bits in counter
// push protocol data to global variable
subghz_block_generic_global.cnt_is_available = true;
subghz_block_generic_global.cnt_length_bit = 28;
subghz_block_generic_global.current_cnt = instance->generic.cnt;
furi_string_cat_printf(
output,
"%s %db\r\n"