SubGhz: frequency hopping mode (#671)

* SubGhz: fix assert on worker double stop.
* SubGhz: add hopping mode (315.00, 433.92, 868.00)
* SubGhz: add support for new alarms on the keelog protocol
* SubGhz: update te in princeton protocol
* SubGhz: move static to tests, rename sniffer to hopper/auto, remove delay from timer thread, optimize locking strategy.

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
Skorpionm
2021-08-29 17:05:15 +04:00
committed by GitHub
parent 0a8a944e10
commit 663dbbfe9f
13 changed files with 185 additions and 93 deletions

View File

@@ -65,7 +65,8 @@ uint8_t subghz_protocol_keeloq_check_remote_controller_selector(
//Simple Learning
decrypt = subghz_protocol_keeloq_common_decrypt(hop, manufacture_code->key);
if((decrypt >> 28 == btn) &&
((((uint16_t)(decrypt >> 16)) & 0x3FF) == end_serial)) {
(((((uint16_t)(decrypt >> 16)) & 0x3FF) == end_serial) ||
((((uint16_t)(decrypt >> 16)) & 0x3FF) == 0))) {
instance->manufacture_name = string_get_cstr(manufacture_code->name);
instance->common.cnt = decrypt & 0x0000FFFF;
return 1;
@@ -78,7 +79,8 @@ uint8_t subghz_protocol_keeloq_check_remote_controller_selector(
subghz_protocol_keeloq_common_normal_learning(fix, manufacture_code->key);
decrypt = subghz_protocol_keeloq_common_decrypt(hop, man_normal_learning);
if((decrypt >> 28 == btn) &&
((((uint16_t)(decrypt >> 16)) & 0x3FF) == end_serial)) {
(((((uint16_t)(decrypt >> 16)) & 0x3FF) == end_serial) ||
((((uint16_t)(decrypt >> 16)) & 0x3FF) == 0))) {
instance->manufacture_name = string_get_cstr(manufacture_code->name);
instance->common.cnt = decrypt & 0x0000FFFF;
return 1;
@@ -88,7 +90,8 @@ uint8_t subghz_protocol_keeloq_check_remote_controller_selector(
// Simple Learning
decrypt = subghz_protocol_keeloq_common_decrypt(hop, manufacture_code->key);
if((decrypt >> 28 == btn) &&
((((uint16_t)(decrypt >> 16)) & 0x3FF) == end_serial)) {
(((((uint16_t)(decrypt >> 16)) & 0x3FF) == end_serial) ||
((((uint16_t)(decrypt >> 16)) & 0x3FF) == 0))) {
instance->manufacture_name = string_get_cstr(manufacture_code->name);
instance->common.cnt = decrypt & 0x0000FFFF;
return 1;
@@ -102,7 +105,8 @@ uint8_t subghz_protocol_keeloq_check_remote_controller_selector(
}
decrypt = subghz_protocol_keeloq_common_decrypt(hop, man_rev);
if((decrypt >> 28 == btn) &&
((((uint16_t)(decrypt >> 16)) & 0x3FF) == end_serial)) {
(((((uint16_t)(decrypt >> 16)) & 0x3FF) == end_serial) ||
((((uint16_t)(decrypt >> 16)) & 0x3FF) == 0))) {
instance->manufacture_name = string_get_cstr(manufacture_code->name);
instance->common.cnt = decrypt & 0x0000FFFF;
return 1;
@@ -114,7 +118,8 @@ uint8_t subghz_protocol_keeloq_check_remote_controller_selector(
subghz_protocol_keeloq_common_normal_learning(fix, manufacture_code->key);
decrypt = subghz_protocol_keeloq_common_decrypt(hop, man_normal_learning);
if((decrypt >> 28 == btn) &&
((((uint16_t)(decrypt >> 16)) & 0x3FF) == end_serial)) {
(((((uint16_t)(decrypt >> 16)) & 0x3FF) == end_serial) ||
((((uint16_t)(decrypt >> 16)) & 0x3FF) == 0))) {
instance->manufacture_name = string_get_cstr(manufacture_code->name);
instance->common.cnt = decrypt & 0x0000FFFF;
return 1;
@@ -129,7 +134,8 @@ uint8_t subghz_protocol_keeloq_check_remote_controller_selector(
man_normal_learning = subghz_protocol_keeloq_common_normal_learning(fix, man_rev);
decrypt = subghz_protocol_keeloq_common_decrypt(hop, man_normal_learning);
if((decrypt >> 28 == btn) &&
((((uint16_t)(decrypt >> 16)) & 0x3FF) == end_serial)) {
(((((uint16_t)(decrypt >> 16)) & 0x3FF) == end_serial) ||
((((uint16_t)(decrypt >> 16)) & 0x3FF) == 0))) {
instance->manufacture_name = string_get_cstr(manufacture_code->name);
instance->common.cnt = decrypt & 0x0000FFFF;
return 1;
@@ -453,4 +459,4 @@ void subghz_decoder_keeloq_to_load_protocol(
instance->common.code_last_found = data->code_found;
instance->common.code_last_count_bit = data->code_count_bit;
subghz_protocol_keeloq_check_remote_controller(instance);
}
}

View File

@@ -5,7 +5,7 @@
*
*/
#define SUBGHZ_PT_SHORT 450
#define SUBGHZ_PT_SHORT 400
#define SUBGHZ_PT_LONG (SUBGHZ_PT_SHORT * 3)
#define SUBGHZ_PT_GUARD (SUBGHZ_PT_SHORT * 30)
@@ -86,7 +86,7 @@ SubGhzDecoderPrinceton* subghz_decoder_princeton_alloc(void) {
instance->common.code_min_count_bit_for_found = 24;
instance->common.te_short = SUBGHZ_PT_SHORT; //150;
instance->common.te_long = SUBGHZ_PT_LONG; //450;
instance->common.te_delta = 200; //50;
instance->common.te_delta = 250; //50;
instance->common.type_protocol = TYPE_PROTOCOL_STATIC;
instance->common.to_string = (SubGhzProtocolCommonToStr)subghz_decoder_princeton_to_str;
instance->common.to_save_string =