Security+ 2.0 custom buttons

This commit is contained in:
MX 2023-03-16 18:14:39 +03:00
parent cda605f578
commit 2cefc9aab0
No known key found for this signature in database
GPG Key ID: 7CCC66B7DBDD1C83
10 changed files with 117 additions and 1 deletions

View File

@ -1,6 +1,7 @@
### New changes
* SubGHz: New protocols support: CAME Space, Stilmatic / Schellenberg
* SubGHz: Add Manually - new protocols -> Beninca, Sommer(FSK), IronLogic, DTM Neo, Gibidi, Elmes Electronic (Elmes Poland), CAME Space
* SubGHz: Security+ 2.0 -> Ability to send custom buttons codes (0x80, 0x81, 0xE2)
* SubGHz: Remember last external module setting and power setting, so if you turn off flipper it will remember last external module settings (only for subghz app)
* SubGHz: Fix issues when external module is not found but plugins tries to use it, now they will fallback to internal in that case
* SubGHz: Fixed external CC1101 module power issues, added more checks, fixed issues when launching subghz favourites

View File

@ -56,7 +56,7 @@ Our Discord Community:
* Sub-GHz -> Long press OK button in Sub-GHz Frequency analyzer to switch to Read menu
* Sub-GHz -> External CC1101 module support
* SubGHz -> **Hold right in received signal list to delete selected signal**
* SubGHz -> **Custom buttons for Keeloq / Alutech AT4N / Nice Flor S / Somfy Telis** - now you can use arrow buttons to send signal with different button code
* SubGHz -> **Custom buttons for Keeloq / Alutech AT4N / Nice Flor S / Somfy Telis / Security+ 2.0** - now you can use arrow buttons to send signal with different button code
* SubGHz -> BFT Mitto / Somfy Telis / Nice Flor S manual creation with programming new remote into receiver (use button 0xF for BFT Mitto, 0x8 (Prog) on Somfy Telis)
* SubGHz -> Debug mode counter increase settings (+1 -> +5, +10, default: +1)
* SubGHz -> Debug PIN output settings for protocol development

View File

@ -5,6 +5,7 @@
#include <lib/subghz/protocols/alutech_at_4n.h>
#include <lib/subghz/protocols/nice_flor_s.h>
#include <lib/subghz/protocols/somfy_telis.h>
#include <lib/subghz/protocols/secplus_v2.h>
void subghz_scene_receiver_info_callback(GuiButtonType result, InputType type, void* context) {
furi_assert(context);
@ -240,6 +241,7 @@ void subghz_scene_receiver_info_on_exit(void* context) {
alutech_reset_original_btn();
nice_flors_reset_original_btn();
somfy_telis_reset_original_btn();
secplus2_reset_original_btn();
star_line_reset_mfname();
star_line_reset_kl_type();
}

View File

@ -4,6 +4,7 @@
#include <lib/subghz/protocols/alutech_at_4n.h>
#include <lib/subghz/protocols/nice_flor_s.h>
#include <lib/subghz/protocols/somfy_telis.h>
#include <lib/subghz/protocols/secplus_v2.h>
typedef enum {
SubGhzRpcStateIdle,
@ -117,6 +118,7 @@ void subghz_scene_rpc_on_exit(void* context) {
alutech_reset_original_btn();
nice_flors_reset_original_btn();
somfy_telis_reset_original_btn();
secplus2_reset_original_btn();
star_line_reset_mfname();
star_line_reset_kl_type();
}

View File

@ -6,6 +6,7 @@
#include <lib/subghz/protocols/star_line.h>
#include <lib/subghz/protocols/nice_flor_s.h>
#include <lib/subghz/protocols/somfy_telis.h>
#include <lib/subghz/protocols/secplus_v2.h>
void subghz_scene_transmitter_callback(SubGhzCustomEvent event, void* context) {
furi_assert(context);
@ -95,6 +96,7 @@ bool subghz_scene_transmitter_on_event(void* context, SceneManagerEvent event) {
alutech_set_btn(0);
nice_flors_set_btn(0);
somfy_telis_set_btn(0);
secplus2_set_btn(0);
uint8_t tmp_counter = furi_hal_subghz_get_rolling_counter_mult();
furi_hal_subghz_set_rolling_counter_mult(0);
// Calling restore!
@ -139,6 +141,7 @@ void subghz_scene_transmitter_on_exit(void* context) {
alutech_reset_original_btn();
nice_flors_reset_original_btn();
somfy_telis_reset_original_btn();
secplus2_reset_original_btn();
star_line_reset_mfname();
star_line_reset_kl_type();
}

View File

@ -8,6 +8,7 @@
#include <lib/subghz/protocols/alutech_at_4n.h>
#include <lib/subghz/protocols/nice_flor_s.h>
#include <lib/subghz/protocols/somfy_telis.h>
#include <lib/subghz/protocols/secplus_v2.h>
struct SubGhzViewTransmitter {
View* view;
@ -163,6 +164,7 @@ bool subghz_view_transmitter_input(InputEvent* event, void* context) {
alutech_set_btn(1);
nice_flors_set_btn(1);
somfy_telis_set_btn(1);
secplus2_set_btn(1);
with_view_model(
subghz_transmitter->view,
SubGhzViewTransmitterModel * model,
@ -199,6 +201,7 @@ bool subghz_view_transmitter_input(InputEvent* event, void* context) {
alutech_set_btn(2);
nice_flors_set_btn(2);
somfy_telis_set_btn(2);
secplus2_set_btn(2);
with_view_model(
subghz_transmitter->view,
SubGhzViewTransmitterModel * model,
@ -235,6 +238,7 @@ bool subghz_view_transmitter_input(InputEvent* event, void* context) {
alutech_set_btn(3);
nice_flors_set_btn(3);
somfy_telis_set_btn(3);
secplus2_set_btn(3);
with_view_model(
subghz_transmitter->view,
SubGhzViewTransmitterModel * model,

View File

@ -22,6 +22,7 @@
#include <lib/subghz/protocols/alutech_at_4n.h>
#include <lib/subghz/protocols/nice_flor_s.h>
#include <lib/subghz/protocols/somfy_telis.h>
#include <lib/subghz/protocols/secplus_v2.h>
#define SUBREMOTEMAP_FOLDER "/ext/subghz_remote"
#define SUBREMOTEMAP_EXTENSION ".txt"
@ -491,6 +492,7 @@ void subghz_remote_tx_stop(SubGHzRemote* app) {
alutech_reset_original_btn();
nice_flors_reset_original_btn();
somfy_telis_reset_original_btn();
secplus2_reset_original_btn();
star_line_reset_mfname();
star_line_reset_kl_type();
}

View File

@ -2462,6 +2462,10 @@ Function,+,scene_manager_search_and_switch_to_previous_scene_one_of,_Bool,"Scene
Function,+,scene_manager_set_scene_state,void,"SceneManager*, uint32_t, uint32_t"
Function,+,scene_manager_stop,void,SceneManager*
Function,+,sd_api_get_fs_type_text,const char*,SDFsType
Function,-,secplus2_get_custom_btn,uint8_t,
Function,-,secplus2_get_original_btn,uint8_t,
Function,-,secplus2_reset_original_btn,void,
Function,-,secplus2_set_btn,void,uint8_t
Function,-,secure_getenv,char*,const char*
Function,-,seed48,unsigned short*,unsigned short[3]
Function,-,select,int,"int, fd_set*, fd_set*, fd_set*, timeval*"

1 entry status name type params
2462 Function + scene_manager_set_scene_state void SceneManager*, uint32_t, uint32_t
2463 Function + scene_manager_stop void SceneManager*
2464 Function + sd_api_get_fs_type_text const char* SDFsType
2465 Function - secplus2_get_custom_btn uint8_t
2466 Function - secplus2_get_original_btn uint8_t
2467 Function - secplus2_reset_original_btn void
2468 Function - secplus2_set_btn void uint8_t
2469 Function - secure_getenv char* const char*
2470 Function - seed48 unsigned short* unsigned short[3]
2471 Function - select int int, fd_set*, fd_set*, fd_set*, timeval*

View File

@ -83,6 +83,25 @@ const SubGhzProtocol subghz_protocol_secplus_v2 = {
.encoder = &subghz_protocol_secplus_v2_encoder,
};
static uint8_t sc_btn_temp_id;
static uint8_t sc_btn_temp_id_original;
void secplus2_set_btn(uint8_t b) {
sc_btn_temp_id = b;
}
uint8_t secplus2_get_original_btn() {
return sc_btn_temp_id_original;
}
uint8_t secplus2_get_custom_btn() {
return sc_btn_temp_id;
}
void secplus2_reset_original_btn() {
sc_btn_temp_id_original = 0;
}
void* subghz_protocol_encoder_secplus_v2_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolEncoderSecPlus_v2* instance = malloc(sizeof(SubGhzProtocolEncoderSecPlus_v2));
@ -338,6 +357,11 @@ static void
instance->btn = 0;
instance->serial = 0;
}
// Save original button for later use
if(sc_btn_temp_id_original == 0) {
sc_btn_temp_id_original = instance->btn;
}
}
/**
@ -373,6 +397,72 @@ static uint64_t subghz_protocol_secplus_v2_encode_half(uint8_t roll_array[], uin
*/
static void subghz_protocol_secplus_v2_encode(SubGhzProtocolEncoderSecPlus_v2* instance) {
// Save original button for later use
if(sc_btn_temp_id_original == 0) {
sc_btn_temp_id_original = instance->generic.btn;
}
// Set custom button
if(sc_btn_temp_id == 1) {
switch(sc_btn_temp_id_original) {
case 0x68:
instance->generic.btn = 0x80;
break;
case 0x80:
instance->generic.btn = 0x68;
break;
case 0x81:
instance->generic.btn = 0x80;
break;
case 0xE2:
instance->generic.btn = 0x80;
break;
default:
break;
}
}
if(sc_btn_temp_id == 2) {
switch(sc_btn_temp_id_original) {
case 0x68:
instance->generic.btn = 0x81;
break;
case 0x80:
instance->generic.btn = 0x81;
break;
case 0x81:
instance->generic.btn = 0x68;
break;
case 0xE2:
instance->generic.btn = 0x81;
break;
default:
break;
}
}
if(sc_btn_temp_id == 3) {
switch(sc_btn_temp_id_original) {
case 0x68:
instance->generic.btn = 0xE2;
break;
case 0x80:
instance->generic.btn = 0xE2;
break;
case 0x81:
instance->generic.btn = 0xE2;
break;
case 0xE2:
instance->generic.btn = 0x68;
break;
default:
break;
}
}
if((sc_btn_temp_id == 0) && (sc_btn_temp_id_original != 0)) {
instance->generic.btn = sc_btn_temp_id_original;
}
uint32_t fixed_1[1] = {instance->generic.btn << 12 | instance->generic.serial >> 20};
uint32_t fixed_2[1] = {instance->generic.serial & 0xFFFFF};
uint8_t rolling_digits[18] = {0};

View File

@ -10,6 +10,14 @@ extern const SubGhzProtocolDecoder subghz_protocol_secplus_v2_decoder;
extern const SubGhzProtocolEncoder subghz_protocol_secplus_v2_encoder;
extern const SubGhzProtocol subghz_protocol_secplus_v2;
// Custom buttons
void secplus2_set_btn(uint8_t b);
uint8_t secplus2_get_original_btn();
uint8_t secplus2_get_custom_btn();
void secplus2_reset_original_btn();
/**
* Allocate SubGhzProtocolEncoderSecPlus_v2.
* @param environment Pointer to a SubGhzEnvironment instance