Skip to content

Commit

Permalink
came atomo button hold simulation half cycle
Browse files Browse the repository at this point in the history
  • Loading branch information
xMasterX committed Feb 20, 2025
1 parent f37044d commit 536ebe3
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 5 deletions.
42 changes: 38 additions & 4 deletions lib/subghz/protocols/came_atomo.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,10 @@ static void subghz_protocol_encoder_came_atomo_get_upload(
instance->encoder.upload[index++] =
level_duration_make(false, (uint32_t)subghz_protocol_came_atomo_const.te_long * 60);

// Btn counter 0x0 - 0x7F
pack[0] = 0;
for(uint8_t i = 0; i < 8; i++) {
pack[0] = (instance->generic.data_2 >> 56);
//pack[0] = (instance->generic.data_2 >> 56);
pack[1] = (instance->generic.cnt >> 8);
pack[2] = (instance->generic.cnt & 0xFF);
pack[3] = ((instance->generic.data_2 >> 32) & 0xFF);
Expand All @@ -228,11 +230,42 @@ static void subghz_protocol_encoder_came_atomo_get_upload(
pack[6] = ((instance->generic.data_2 >> 8) & 0xFF);
pack[7] = (btn << 4);

if(pack[0] == 0x7F) {
/* if(pack[0] == 0x7F) {
pack[0] = 0;
} else {
pack[0] += (i + 1);
}
*/
switch(i) {
case 0:
pack[0] = 10; // 0A
break;
case 1:
pack[0] = 30;
break;
case 2:
pack[0] = 125; // 7D
break;
case 3:
pack[0] = 126; // 7E
break;
case 4:
pack[0] = 127; // 7F
break;
case 5:
pack[0] = 0; // 00
break;
case 6:
pack[0] = 1; // 01
break;
case 7:
pack[0] = 3;
break;

default:
break;
}
// 10 50 125 126 127 0 1 2

atomo_encrypt(pack);
uint32_t hi = pack[0] << 24 | pack[1] << 16 | pack[2] << 8 | pack[3];
Expand Down Expand Up @@ -521,7 +554,8 @@ static void subghz_protocol_came_atomo_remote_controller(SubGhzBlockGeneric* ins
* 0x931dfb16c0b1 ^ 0xXXXXXXXXXXXXXXXX = 0xEF3ED0F7D9EF
* 0xEF3 ED0F7D9E F => 0xEF3 - CNT, 0xED0F7D9E - SN, 0xF - key
*
* ***Eng1n33r ver. (actual)***
* ***Actual***
* Button hold-cycle counter (8-bit, from 0 to 0x7F) should DO full cycle or half cycle keeping values like zero
* 0x1FF08D9924984115 - received data
* 0x00F7266DB67BEEA0 - inverted data
* 0x0501FD0000A08300 - decrypted data,
Expand Down Expand Up @@ -720,7 +754,7 @@ void subghz_protocol_decoder_came_atomo_get_string(void* context, FuriString* ou
"%s %db\r\n"
"Key:%08lX%08lX\r\n"
"Sn:0x%08lX Btn:%01X\r\n"
"Pcl_Cnt:0x%04lX\r\n"
"Cnt:0x%04lX\r\n"
"Btn_Cnt:0x%02X",

instance->generic.protocol_name,
Expand Down
2 changes: 1 addition & 1 deletion lib/subghz/protocols/gangqi.c
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ void subghz_protocol_decoder_gangqi_get_string(void* context, FuriString* output
"%s %db\r\n"
"Key: 0x%X%08lX\r\n"
"Serial: 0x%05lX\r\n"
"Sum: 0x%02X Sum2: 0x%02X\r\n"
"Sum: 0x%02X Sum2: 0x%02X\r\n"
"Btn: 0x%01X - %s\r\n",
instance->generic.protocol_name,
instance->generic.data_count_bit,
Expand Down

0 comments on commit 536ebe3

Please sign in to comment.