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

This commit is contained in:
Willy-JL
2025-02-28 02:29:29 +00:00
105 changed files with 1676 additions and 687 deletions

View File

@@ -130,6 +130,7 @@ typedef enum {
SetTypeBETT_433,
SetTypeGangQi_433,
SetTypeHollarm_433,
SetTypeReversRB2_433,
SetTypeMarantec24_868,
SetTypeLinear_300_00,
// SetTypeNeroSketch, //Deleted in OFW

View File

@@ -384,33 +384,14 @@ bool subghz_txrx_gen_secplus_v1_protocol(
}
void subghz_txrx_gen_serial_gangqi(uint64_t* result_key) {
uint64_t randkey;
uint64_t only_required_bytes;
uint16_t sum_of_3bytes;
uint8_t xorbytes;
uint64_t randkey = (uint64_t)rand();
uint16_t serial = (uint16_t)((randkey) & 0xFFFF);
uint8_t const_and_button = (uint8_t)(0xD0 | 0xD);
uint8_t serial_high = (uint8_t)(serial >> 8);
uint8_t serial_low = (uint8_t)(serial & 0xFF);
uint8_t bytesum = (uint8_t)(0xC8 - serial_high - serial_low - const_and_button);
do {
randkey = (uint64_t)rand();
only_required_bytes = (randkey & 0x0FFFF0000) | 0x200000000;
sum_of_3bytes = ((only_required_bytes >> 32) & 0xFF) +
((only_required_bytes >> 24) & 0xFF) +
((only_required_bytes >> 16) & 0xFF);
xorbytes = ((only_required_bytes >> 32) & 0xFF) ^ ((only_required_bytes >> 24) & 0xFF) ^
((only_required_bytes >> 16) & 0xFF);
} while(
!((((!(sum_of_3bytes & 0x3)) && ((0xB < sum_of_3bytes) && (sum_of_3bytes < 0x141))) &&
((((only_required_bytes >> 32) & 0xFF) == 0x2) ||
(((only_required_bytes >> 32) & 0xFF) == 0x3))) &&
((((xorbytes == 0xBA) || (xorbytes == 0xE2)) ||
((xorbytes == 0x3A) || (xorbytes == 0xF2))) ||
(xorbytes == 0xB2))));
// Serial 01 button 01
uint64_t new_key = only_required_bytes | (0b01 << 14) | (0xD << 10) | (0b01 << 8);
uint8_t crc = -0xD7 - ((new_key >> 32) & 0xFF) - ((new_key >> 24) & 0xFF) -
((new_key >> 16) & 0xFF) - ((new_key >> 8) & 0xFF);
// Add crc sum to the end
*result_key = (new_key | crc);
// Add bytesum to the end
// serial | const_and_button
*result_key = (serial << 18) | (const_and_button << 10) | (bytesum << 2);
}