1
mirror of https://github.com/DarkFlippers/unleashed-firmware.git synced 2025-12-12 04:34:43 +04:00

grand finale?

This commit is contained in:
MX
2025-12-10 03:05:16 +03:00
parent 32a182c439
commit d10a601109
2 changed files with 35 additions and 19 deletions

View File

@@ -334,11 +334,9 @@ bool subghz_scene_signal_settings_on_event(void* context, SceneManagerEvent even
// convert back after byte_input and do one send with our new mult (counter16) - at end we must have signal Cnt = counter16
counter16 = __bswap16(counter16);
if(counter16 > 0) {
furi_hal_subghz_set_rolling_counter_mult(counter16);
subghz_tx_start(subghz, subghz_txrx_get_fff_data(subghz->txrx));
subghz_txrx_stop(subghz->txrx);
}
// restore user definded counter increase value (mult)
furi_hal_subghz_set_rolling_counter_mult(tmp_counter);
@@ -360,11 +358,9 @@ bool subghz_scene_signal_settings_on_event(void* context, SceneManagerEvent even
counter32 = __bswap32(counter32);
if(counter32 > 0) {
furi_hal_subghz_set_rolling_counter_mult(counter32);
subghz_tx_start(subghz, subghz_txrx_get_fff_data(subghz->txrx));
subghz_txrx_stop(subghz->txrx);
}
furi_hal_subghz_set_rolling_counter_mult(tmp_counter);
break;

View File

@@ -401,17 +401,37 @@ static void subghz_protocol_secplus_v2_encode(SubGhzProtocolEncoderSecPlus_v2* i
uint8_t roll_1[9] = {0};
uint8_t roll_2[9] = {0};
// ---Experemental case - we dont know counter size exactly, so just will be think that is "FF FF FF F"
// 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 aplaying 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)
if(((int32_t)furi_hal_subghz_get_rolling_counter_mult() == (int32_t)0xFFFFFFFF) &
(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((uint32_t)furi_hal_subghz_get_rolling_counter_mult() < (uint32_t)0xE500000) {
instance->generic.cnt = 0xE500000;
} else {
if((uint32_t)furi_hal_subghz_get_rolling_counter_mult() > (uint32_t)0xFFFFFFF) {
instance->generic.cnt = 0xFFFFFFF;
} else {
instance->generic.cnt +=
((furi_hal_subghz_get_rolling_counter_mult() & 0xFFFFFFF));
}
}
} else {
// if we have not special cases - so work as standart mode
if((instance->generic.cnt + (furi_hal_subghz_get_rolling_counter_mult() & 0xFFFFFFF)) >
0xFFFFFFF) {
instance->generic.cnt = 0xE500000;
} else {
instance->generic.cnt += (furi_hal_subghz_get_rolling_counter_mult() & 0xFFFFFFF);
instance->generic.cnt +=
((furi_hal_subghz_get_rolling_counter_mult() & 0xFFFFFFF));
}
}
}
// --- instead of :
//instance->generic.cnt += furi_hal_subghz_get_rolling_counter_mult();
//ToDo it is not known what value the counter starts
//if(instance->generic.cnt > 0xFFFFFFF) instance->generic.cnt = 0xE500000;
uint32_t rolling = subghz_protocol_blocks_reverse_key(instance->generic.cnt, 28);