Skip to content

Commit

Permalink
Latest RM0907-1313-0.104.1-e659585 on PATREON - ADD SUBGHZ PROTOCOL
Browse files Browse the repository at this point in the history
  • Loading branch information
RogueMaster committed Sep 9, 2024
1 parent ea2610f commit bc19dbf
Show file tree
Hide file tree
Showing 14 changed files with 1,443 additions and 16 deletions.
1 change: 1 addition & 0 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ This software is for experimental purposes only and is not meant for any illegal
- OFW: [Infrared: add TCL 75S451 to TV universal remote #3880 (By christhetech131)](https://github.com/flipperdevices/flipperzero-firmware/pull/3880)
- OFW: [feat: add linux/gnome badusb demo resource files #3846 (By thomasnemer)](https://github.com/flipperdevices/flipperzero-firmware/pull/3846)
- Added: [Voyah Password v0.2 (By bolknote)](https://github.com/bolknote/Flipper-Zero-Voyah-Password)
- UL: SubGHz: [Add new protocols: Hay21 and Hollarm (By xMasterX)](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/commit/)
- Coming Soon: OFW: [Storage: remove LFS #3577](https://github.com/flipperdevices/flipperzero-firmware/pull/3577) [FuriEventLoop Pt.2 #3703](https://github.com/flipperdevices/flipperzero-firmware/pull/3703) [#3824](https://github.com/flipperdevices/flipperzero-firmware/pull/3824) [#3836](https://github.com/flipperdevices/flipperzero-firmware/pull/3836) [#3834](https://github.com/flipperdevices/flipperzero-firmware/pull/3834) [#3830](https://github.com/flipperdevices/flipperzero-firmware/pull/3834) [#3837](https://github.com/flipperdevices/flipperzero-firmware/pull/3837) [#3839](https://github.com/flipperdevices/flipperzero-firmware/pull/3839) [#3849](https://github.com/flipperdevices/flipperzero-firmware/pull/3849) [#3852](https://github.com/flipperdevices/flipperzero-firmware/pull/3852) [#3879](https://github.com/flipperdevices/flipperzero-firmware/pull/3879) [#3875](https://github.com/flipperdevices/flipperzero-firmware/pull/3875) [#3859](https://github.com/flipperdevices/flipperzero-firmware/pull/3859) [#3863](https://github.com/flipperdevices/flipperzero-firmware/pull/3863) [#3866](https://github.com/flipperdevices/flipperzero-firmware/pull/3866) [#3865](https://github.com/flipperdevices/flipperzero-firmware/pull/3865) [#3887](https://github.com/flipperdevices/flipperzero-firmware/pull/3887)

<a name="release">
Expand Down
3 changes: 3 additions & 0 deletions applications/main/subghz/helpers/subghz_custom_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
32 changes: 32 additions & 0 deletions applications/main/subghz/helpers/subghz_txrx_create_protocol_key.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,3 +382,35 @@ 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;
uint8_t xorbytes;

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);
}
49 changes: 46 additions & 3 deletions applications/main/subghz/scenes/subghz_scene_set_type.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -111,7 +114,7 @@ typedef struct {
union {
struct {
const char* name;
uint32_t key;
uint64_t key;
uint8_t bits;
uint16_t te;
} data;
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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,
Expand All @@ -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:
Expand Down
Loading

0 comments on commit bc19dbf

Please sign in to comment.