mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-27 06:50:21 +00:00
SubGHz: Fix keeloq, SL, counter going higher than 16bits
Proper reset to 0 after we get to 0xFFFF
This commit is contained in:
parent
6e7b7f1d89
commit
bf62f66dc8
2 changed files with 10 additions and 2 deletions
|
@ -137,7 +137,11 @@ void subghz_protocol_encoder_keeloq_free(void* context) {
|
|||
* @param btn Button number, 4 bit
|
||||
*/
|
||||
static bool subghz_protocol_keeloq_gen_data(SubGhzProtocolEncoderKeeloq* instance, uint8_t btn) {
|
||||
instance->generic.cnt++;
|
||||
if(instance->generic.cnt < 0xFFFF) {
|
||||
instance->generic.cnt++;
|
||||
} else if(instance->generic.cnt >= 0xFFFF) {
|
||||
instance->generic.cnt = 0;
|
||||
}
|
||||
uint32_t fix = btn << 28 | instance->generic.serial;
|
||||
uint32_t decrypt = btn << 28 |
|
||||
(instance->generic.serial & 0x3FF)
|
||||
|
|
|
@ -138,7 +138,11 @@ void subghz_protocol_encoder_star_line_free(void* context) {
|
|||
*/
|
||||
static bool
|
||||
subghz_protocol_star_line_gen_data(SubGhzProtocolEncoderStarLine* instance, uint8_t btn) {
|
||||
instance->generic.cnt++;
|
||||
if(instance->generic.cnt < 0xFFFF) {
|
||||
instance->generic.cnt++;
|
||||
} else if(instance->generic.cnt >= 0xFFFF) {
|
||||
instance->generic.cnt = 0;
|
||||
}
|
||||
uint32_t fix = btn << 24 | instance->generic.serial;
|
||||
uint32_t decrypt = btn << 24 | (instance->generic.serial & 0xFF) << 16 | instance->generic.cnt;
|
||||
uint32_t hop = 0;
|
||||
|
|
Loading…
Reference in a new issue