mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-11 06:09:08 -07:00
Merge remote-tracking branch 'ul/dev' into mntm-dev
This commit is contained in:
@@ -125,6 +125,9 @@ typedef enum {
|
||||
SetTypePricenton315,
|
||||
SetTypePricenton433,
|
||||
SetTypeBETT_433,
|
||||
SetTypeGangQi_433,
|
||||
SetTypeHollarm_433,
|
||||
SetTypeMarantec24_868,
|
||||
SetTypeLinear_300_00,
|
||||
// SetTypeNeroSketch, //Deleted in OFW
|
||||
// SetTypeNeroRadio, //Deleted in OFW
|
||||
|
||||
@@ -382,3 +382,26 @@ bool subghz_txrx_gen_secplus_v1_protocol(
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void subghz_txrx_gen_serial_gangqi(uint64_t* result_key) {
|
||||
uint64_t randkey;
|
||||
uint64_t only_required_bytes;
|
||||
uint16_t sum_of_3bytes;
|
||||
|
||||
do {
|
||||
randkey = (uint64_t)rand();
|
||||
only_required_bytes = (randkey & 0xFFFFF0000);
|
||||
sum_of_3bytes = ((only_required_bytes >> 32) & 0xFF) +
|
||||
((only_required_bytes >> 24) & 0xFF) +
|
||||
((only_required_bytes >> 16) & 0xFF);
|
||||
} while(!((!(sum_of_3bytes & 0x3)) && ((0xb2 < sum_of_3bytes) && (sum_of_3bytes < 0x1ae))));
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
@@ -146,3 +146,10 @@ bool subghz_txrx_gen_secplus_v1_protocol(
|
||||
SubGhzTxRx* instance,
|
||||
const char* name_preset,
|
||||
uint32_t frequency);
|
||||
|
||||
/**
|
||||
* Generate valid serial number for GangQi protocol
|
||||
*
|
||||
* @return uint64_t if success
|
||||
*/
|
||||
void subghz_txrx_gen_serial_gangqi(uint64_t* result_key);
|
||||
|
||||
@@ -63,6 +63,9 @@ static const char* submenu_names[SetTypeMAX] = {
|
||||
[SetTypeCAMESpace] = "KL: CAME Space 433MHz",
|
||||
[SetTypePricenton315] = "Princeton 315MHz",
|
||||
[SetTypePricenton433] = "Princeton 433MHz",
|
||||
[SetTypeGangQi_433] = "GangQi 433MHz",
|
||||
[SetTypeHollarm_433] = "Hollarm 433MHz",
|
||||
[SetTypeMarantec24_868] = "Marantec24 868MHz",
|
||||
[SetTypeBETT_433] = "BETT 433MHz",
|
||||
[SetTypeLinear_300_00] = "Linear 300MHz",
|
||||
// [SetTypeNeroSketch] = "Nero Sketch", // Deleted in OFW
|
||||
@@ -111,7 +114,7 @@ typedef struct {
|
||||
union {
|
||||
struct {
|
||||
const char* name;
|
||||
uint32_t key;
|
||||
uint64_t key;
|
||||
uint8_t bits;
|
||||
uint16_t te;
|
||||
} data;
|
||||
@@ -179,7 +182,11 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t key = (uint32_t)rand();
|
||||
uint64_t key = (uint64_t)rand();
|
||||
|
||||
uint64_t gangqi_key;
|
||||
subghz_txrx_gen_serial_gangqi(&gangqi_key);
|
||||
|
||||
GenInfo gen_info = {0};
|
||||
switch(event.event) {
|
||||
case SetTypePricenton433:
|
||||
@@ -302,6 +309,42 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
|
||||
.data.bits = 24,
|
||||
.data.te = 0};
|
||||
break;
|
||||
case SetTypeGangQi_433:
|
||||
gen_info = (GenInfo){
|
||||
.type = GenData,
|
||||
.mod = "AM650",
|
||||
.freq = 433920000,
|
||||
.data.name =
|
||||
SUBGHZ_PROTOCOL_GANGQI_NAME, // Add button 0xD arm and crc sum to the end
|
||||
.data.key = gangqi_key,
|
||||
.data.bits = 34,
|
||||
.data.te = 0};
|
||||
break;
|
||||
case SetTypeHollarm_433:
|
||||
gen_info = (GenInfo){
|
||||
.type = GenData,
|
||||
.mod = "AM650",
|
||||
.freq = 433920000,
|
||||
.data.name = SUBGHZ_PROTOCOL_HOLLARM_NAME, // Add button 0x2 and crc sum to the end
|
||||
.data.key = (key & 0x000FFF0000) | 0xF0B0002200 |
|
||||
((((((key & 0x000FFF0000) | 0xF0B0002200) >> 32) & 0xFF) +
|
||||
((((key & 0x000FFF0000) | 0xF0B0002200) >> 24) & 0xFF) +
|
||||
((((key & 0x000FFF0000) | 0xF0B0002200) >> 16) & 0xFF) +
|
||||
((((key & 0x000FFF0000) | 0xF0B0002200) >> 8) & 0xFF)) &
|
||||
0xFF),
|
||||
.data.bits = 42,
|
||||
.data.te = 0};
|
||||
break;
|
||||
case SetTypeMarantec24_868:
|
||||
gen_info = (GenInfo){
|
||||
.type = GenData,
|
||||
.mod = "AM650",
|
||||
.freq = 868350000,
|
||||
.data.name = SUBGHZ_PROTOCOL_MARANTEC24_NAME, // Add button code 0x8 to the end
|
||||
.data.key = (key & 0xFFFFF0) | 0x000008,
|
||||
.data.bits = 24,
|
||||
.data.te = 0};
|
||||
break;
|
||||
case SetTypeFaacSLH_433:
|
||||
gen_info = (GenInfo){
|
||||
.type = GenFaacSLH,
|
||||
@@ -321,7 +364,7 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
|
||||
.faac_slh.serial = ((key & 0x00FFFFF0) | 0xA0000006) >> 4,
|
||||
.faac_slh.btn = 0x06,
|
||||
.faac_slh.cnt = 0x02,
|
||||
.faac_slh.seed = key,
|
||||
.faac_slh.seed = (key & 0x0FFFFFFF),
|
||||
.faac_slh.manuf = "FAAC_SLH"};
|
||||
break;
|
||||
case SetTypeBeninca433:
|
||||
|
||||
Reference in New Issue
Block a user