mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
Merge remote-tracking branch 'ul/dev' into mntm-dev
This commit is contained in:
@@ -130,6 +130,7 @@ typedef enum {
|
||||
SetTypeBETT_433,
|
||||
SetTypeGangQi_433,
|
||||
SetTypeHollarm_433,
|
||||
SetTypeReversRB2_433,
|
||||
SetTypeMarantec24_868,
|
||||
SetTypeLinear_300_00,
|
||||
// SetTypeNeroSketch, //Deleted in OFW
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -67,6 +67,7 @@ static const char* submenu_names[SetTypeMAX] = {
|
||||
[SetTypePricenton433] = "Princeton 433MHz",
|
||||
[SetTypeGangQi_433] = "GangQi 433MHz",
|
||||
[SetTypeHollarm_433] = "Hollarm 433MHz",
|
||||
[SetTypeReversRB2_433] = "Revers RB2 433MHz",
|
||||
[SetTypeMarantec24_868] = "Marantec24 868MHz",
|
||||
[SetTypeBETT_433] = "BETT 433MHz",
|
||||
[SetTypeLinear_300_00] = "Linear 300MHz",
|
||||
@@ -337,6 +338,16 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
|
||||
.data.bits = 42,
|
||||
.data.te = 0};
|
||||
break;
|
||||
case SetTypeReversRB2_433:
|
||||
gen_info = (GenInfo){
|
||||
.type = GenData,
|
||||
.mod = "AM650",
|
||||
.freq = 433920000,
|
||||
.data.name = SUBGHZ_PROTOCOL_REVERSRB2_NAME, // 64bits no buttons
|
||||
.data.key = (key & 0x00000FFFFFFFF000) | 0xFFFFF00000000000 | 0x0000000000000A00,
|
||||
.data.bits = 64,
|
||||
.data.te = 0};
|
||||
break;
|
||||
case SetTypeMarantec24_868:
|
||||
gen_info = (GenInfo){
|
||||
.type = GenData,
|
||||
|
||||
Reference in New Issue
Block a user