mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-18 19:01:47 +03:00
Transferring and combining the functionality of "custom buttons" into a separate file.
This commit is contained in:
parent
f0d94e2757
commit
5603ed7ebb
@ -2,10 +2,8 @@
|
|||||||
#include "../helpers/subghz_custom_event.h"
|
#include "../helpers/subghz_custom_event.h"
|
||||||
#include <lib/subghz/protocols/keeloq.h>
|
#include <lib/subghz/protocols/keeloq.h>
|
||||||
#include <lib/subghz/protocols/star_line.h>
|
#include <lib/subghz/protocols/star_line.h>
|
||||||
#include <lib/subghz/protocols/alutech_at_4n.h>
|
|
||||||
#include <lib/subghz/protocols/nice_flor_s.h>
|
#include <lib/subghz/blocks/custom_btn.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) {
|
void subghz_scene_receiver_info_callback(GuiButtonType result, InputType type, void* context) {
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
@ -238,10 +236,7 @@ void subghz_scene_receiver_info_on_exit(void* context) {
|
|||||||
keeloq_reset_mfname();
|
keeloq_reset_mfname();
|
||||||
keeloq_reset_kl_type();
|
keeloq_reset_kl_type();
|
||||||
keeloq_reset_original_btn();
|
keeloq_reset_original_btn();
|
||||||
alutech_reset_original_btn();
|
subghz_custom_btns_reset();
|
||||||
nice_flors_reset_original_btn();
|
|
||||||
somfy_telis_reset_original_btn();
|
|
||||||
secplus2_reset_original_btn();
|
|
||||||
star_line_reset_mfname();
|
star_line_reset_mfname();
|
||||||
star_line_reset_kl_type();
|
star_line_reset_kl_type();
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
#include "../subghz_i.h"
|
#include "../subghz_i.h"
|
||||||
#include <lib/subghz/protocols/keeloq.h>
|
#include <lib/subghz/protocols/keeloq.h>
|
||||||
#include <lib/subghz/protocols/star_line.h>
|
#include <lib/subghz/protocols/star_line.h>
|
||||||
#include <lib/subghz/protocols/alutech_at_4n.h>
|
|
||||||
#include <lib/subghz/protocols/nice_flor_s.h>
|
#include <lib/subghz/blocks/custom_btn.h>
|
||||||
#include <lib/subghz/protocols/somfy_telis.h>
|
|
||||||
#include <lib/subghz/protocols/secplus_v2.h>
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
SubGhzRpcStateIdle,
|
SubGhzRpcStateIdle,
|
||||||
@ -115,10 +113,7 @@ void subghz_scene_rpc_on_exit(void* context) {
|
|||||||
keeloq_reset_mfname();
|
keeloq_reset_mfname();
|
||||||
keeloq_reset_kl_type();
|
keeloq_reset_kl_type();
|
||||||
keeloq_reset_original_btn();
|
keeloq_reset_original_btn();
|
||||||
alutech_reset_original_btn();
|
subghz_custom_btns_reset();
|
||||||
nice_flors_reset_original_btn();
|
|
||||||
somfy_telis_reset_original_btn();
|
|
||||||
secplus2_reset_original_btn();
|
|
||||||
star_line_reset_mfname();
|
star_line_reset_mfname();
|
||||||
star_line_reset_kl_type();
|
star_line_reset_kl_type();
|
||||||
}
|
}
|
||||||
|
@ -2,11 +2,9 @@
|
|||||||
#include "../views/transmitter.h"
|
#include "../views/transmitter.h"
|
||||||
#include <dolphin/dolphin.h>
|
#include <dolphin/dolphin.h>
|
||||||
#include <lib/subghz/protocols/keeloq.h>
|
#include <lib/subghz/protocols/keeloq.h>
|
||||||
#include <lib/subghz/protocols/alutech_at_4n.h>
|
|
||||||
#include <lib/subghz/protocols/star_line.h>
|
#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/blocks/custom_btn.h>
|
||||||
#include <lib/subghz/protocols/secplus_v2.h>
|
|
||||||
|
|
||||||
void subghz_scene_transmitter_callback(SubGhzCustomEvent event, void* context) {
|
void subghz_scene_transmitter_callback(SubGhzCustomEvent event, void* context) {
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
@ -91,12 +89,8 @@ bool subghz_scene_transmitter_on_event(void* context, SceneManagerEvent event) {
|
|||||||
subghz_tx_stop(subghz);
|
subghz_tx_stop(subghz);
|
||||||
subghz_sleep(subghz);
|
subghz_sleep(subghz);
|
||||||
}
|
}
|
||||||
if(keeloq_get_custom_btn() != 0) {
|
if(subghz_custom_btn_get() != 0) {
|
||||||
keeloq_set_btn(0);
|
subghz_custom_btn_set(0);
|
||||||
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();
|
uint8_t tmp_counter = furi_hal_subghz_get_rolling_counter_mult();
|
||||||
furi_hal_subghz_set_rolling_counter_mult(0);
|
furi_hal_subghz_set_rolling_counter_mult(0);
|
||||||
// Calling restore!
|
// Calling restore!
|
||||||
@ -138,10 +132,7 @@ void subghz_scene_transmitter_on_exit(void* context) {
|
|||||||
keeloq_reset_mfname();
|
keeloq_reset_mfname();
|
||||||
keeloq_reset_kl_type();
|
keeloq_reset_kl_type();
|
||||||
keeloq_reset_original_btn();
|
keeloq_reset_original_btn();
|
||||||
alutech_reset_original_btn();
|
subghz_custom_btns_reset();
|
||||||
nice_flors_reset_original_btn();
|
|
||||||
somfy_telis_reset_original_btn();
|
|
||||||
secplus2_reset_original_btn();
|
|
||||||
star_line_reset_mfname();
|
star_line_reset_mfname();
|
||||||
star_line_reset_kl_type();
|
star_line_reset_kl_type();
|
||||||
}
|
}
|
||||||
|
@ -4,11 +4,7 @@
|
|||||||
#include <input/input.h>
|
#include <input/input.h>
|
||||||
#include <gui/elements.h>
|
#include <gui/elements.h>
|
||||||
|
|
||||||
#include <lib/subghz/protocols/keeloq.h>
|
#include <lib/subghz/blocks/custom_btn.h>
|
||||||
#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 {
|
struct SubGhzViewTransmitter {
|
||||||
View* view;
|
View* view;
|
||||||
@ -160,31 +156,19 @@ bool subghz_view_transmitter_input(InputEvent* event, void* context) {
|
|||||||
|
|
||||||
// Temp Buttons (UP)
|
// Temp Buttons (UP)
|
||||||
if(can_be_sent && event->key == InputKeyUp && event->type == InputTypePress) {
|
if(can_be_sent && event->key == InputKeyUp && event->type == InputTypePress) {
|
||||||
keeloq_set_btn(1);
|
subghz_custom_btn_set(1);
|
||||||
alutech_set_btn(1);
|
|
||||||
nice_flors_set_btn(1);
|
|
||||||
somfy_telis_set_btn(1);
|
|
||||||
secplus2_set_btn(1);
|
|
||||||
with_view_model(
|
with_view_model(
|
||||||
subghz_transmitter->view,
|
subghz_transmitter->view,
|
||||||
SubGhzViewTransmitterModel * model,
|
SubGhzViewTransmitterModel * model,
|
||||||
{
|
{
|
||||||
furi_string_reset(model->temp_button_id);
|
furi_string_reset(model->temp_button_id);
|
||||||
if(keeloq_get_original_btn() != 0) {
|
if(subghz_custom_btn_get_original() != 0) {
|
||||||
furi_string_printf(model->temp_button_id, "%01X", keeloq_get_original_btn());
|
if(subghz_custom_btn_get() == 1) {
|
||||||
model->draw_temp_button = true;
|
|
||||||
} else if(alutech_get_original_btn() != 0) {
|
|
||||||
furi_string_printf(model->temp_button_id, "%01X", alutech_get_original_btn());
|
|
||||||
model->draw_temp_button = true;
|
|
||||||
} else if(nice_flors_get_original_btn() != 0) {
|
|
||||||
furi_string_printf(
|
furi_string_printf(
|
||||||
model->temp_button_id, "%01X", nice_flors_get_original_btn());
|
model->temp_button_id, "%01X", subghz_custom_btn_get_original());
|
||||||
model->draw_temp_button = true;
|
|
||||||
} else if(somfy_telis_get_original_btn() != 0) {
|
|
||||||
furi_string_printf(
|
|
||||||
model->temp_button_id, "%01X", somfy_telis_get_original_btn());
|
|
||||||
model->draw_temp_button = true;
|
model->draw_temp_button = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
true);
|
true);
|
||||||
subghz_transmitter->callback(
|
subghz_transmitter->callback(
|
||||||
@ -197,31 +181,19 @@ bool subghz_view_transmitter_input(InputEvent* event, void* context) {
|
|||||||
}
|
}
|
||||||
// Down
|
// Down
|
||||||
if(can_be_sent && event->key == InputKeyDown && event->type == InputTypePress) {
|
if(can_be_sent && event->key == InputKeyDown && event->type == InputTypePress) {
|
||||||
keeloq_set_btn(2);
|
subghz_custom_btn_set(2);
|
||||||
alutech_set_btn(2);
|
|
||||||
nice_flors_set_btn(2);
|
|
||||||
somfy_telis_set_btn(2);
|
|
||||||
secplus2_set_btn(2);
|
|
||||||
with_view_model(
|
with_view_model(
|
||||||
subghz_transmitter->view,
|
subghz_transmitter->view,
|
||||||
SubGhzViewTransmitterModel * model,
|
SubGhzViewTransmitterModel * model,
|
||||||
{
|
{
|
||||||
furi_string_reset(model->temp_button_id);
|
furi_string_reset(model->temp_button_id);
|
||||||
if(keeloq_get_original_btn() != 0) {
|
if(subghz_custom_btn_get_original() != 0) {
|
||||||
furi_string_printf(model->temp_button_id, "%01X", keeloq_get_original_btn());
|
if(subghz_custom_btn_get() == 2) {
|
||||||
model->draw_temp_button = true;
|
|
||||||
} else if(alutech_get_original_btn() != 0) {
|
|
||||||
furi_string_printf(model->temp_button_id, "%01X", alutech_get_original_btn());
|
|
||||||
model->draw_temp_button = true;
|
|
||||||
} else if(nice_flors_get_original_btn() != 0) {
|
|
||||||
furi_string_printf(
|
furi_string_printf(
|
||||||
model->temp_button_id, "%01X", nice_flors_get_original_btn());
|
model->temp_button_id, "%01X", subghz_custom_btn_get_original());
|
||||||
model->draw_temp_button = true;
|
|
||||||
} else if(somfy_telis_get_original_btn() != 0) {
|
|
||||||
furi_string_printf(
|
|
||||||
model->temp_button_id, "%01X", somfy_telis_get_original_btn());
|
|
||||||
model->draw_temp_button = true;
|
model->draw_temp_button = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
true);
|
true);
|
||||||
subghz_transmitter->callback(
|
subghz_transmitter->callback(
|
||||||
@ -234,31 +206,19 @@ bool subghz_view_transmitter_input(InputEvent* event, void* context) {
|
|||||||
}
|
}
|
||||||
// Left
|
// Left
|
||||||
if(can_be_sent && event->key == InputKeyLeft && event->type == InputTypePress) {
|
if(can_be_sent && event->key == InputKeyLeft && event->type == InputTypePress) {
|
||||||
keeloq_set_btn(3);
|
subghz_custom_btn_set(3);
|
||||||
alutech_set_btn(3);
|
|
||||||
nice_flors_set_btn(3);
|
|
||||||
somfy_telis_set_btn(3);
|
|
||||||
secplus2_set_btn(3);
|
|
||||||
with_view_model(
|
with_view_model(
|
||||||
subghz_transmitter->view,
|
subghz_transmitter->view,
|
||||||
SubGhzViewTransmitterModel * model,
|
SubGhzViewTransmitterModel * model,
|
||||||
{
|
{
|
||||||
furi_string_reset(model->temp_button_id);
|
furi_string_reset(model->temp_button_id);
|
||||||
if(keeloq_get_original_btn() != 0) {
|
if(subghz_custom_btn_get_original() != 0) {
|
||||||
furi_string_printf(model->temp_button_id, "%01X", keeloq_get_original_btn());
|
if(subghz_custom_btn_get() == 3) {
|
||||||
model->draw_temp_button = true;
|
|
||||||
} else if(alutech_get_original_btn() != 0) {
|
|
||||||
furi_string_printf(model->temp_button_id, "%01X", alutech_get_original_btn());
|
|
||||||
model->draw_temp_button = true;
|
|
||||||
} else if(nice_flors_get_original_btn() != 0) {
|
|
||||||
furi_string_printf(
|
furi_string_printf(
|
||||||
model->temp_button_id, "%01X", nice_flors_get_original_btn());
|
model->temp_button_id, "%01X", subghz_custom_btn_get_original());
|
||||||
model->draw_temp_button = true;
|
|
||||||
} else if(somfy_telis_get_original_btn() != 0) {
|
|
||||||
furi_string_printf(
|
|
||||||
model->temp_button_id, "%01X", somfy_telis_get_original_btn());
|
|
||||||
model->draw_temp_button = true;
|
model->draw_temp_button = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
true);
|
true);
|
||||||
subghz_transmitter->callback(
|
subghz_transmitter->callback(
|
||||||
@ -271,20 +231,19 @@ bool subghz_view_transmitter_input(InputEvent* event, void* context) {
|
|||||||
}
|
}
|
||||||
// Right
|
// Right
|
||||||
if(can_be_sent && event->key == InputKeyRight && event->type == InputTypePress) {
|
if(can_be_sent && event->key == InputKeyRight && event->type == InputTypePress) {
|
||||||
keeloq_set_btn(4);
|
subghz_custom_btn_set(4);
|
||||||
alutech_set_btn(4);
|
|
||||||
with_view_model(
|
with_view_model(
|
||||||
subghz_transmitter->view,
|
subghz_transmitter->view,
|
||||||
SubGhzViewTransmitterModel * model,
|
SubGhzViewTransmitterModel * model,
|
||||||
{
|
{
|
||||||
furi_string_reset(model->temp_button_id);
|
furi_string_reset(model->temp_button_id);
|
||||||
if(keeloq_get_original_btn() != 0) {
|
if(subghz_custom_btn_get_original() != 0) {
|
||||||
furi_string_printf(model->temp_button_id, "%01X", keeloq_get_original_btn());
|
if(subghz_custom_btn_get() == 4) {
|
||||||
model->draw_temp_button = true;
|
furi_string_printf(
|
||||||
} else if(alutech_get_original_btn() != 0) {
|
model->temp_button_id, "%01X", subghz_custom_btn_get_original());
|
||||||
furi_string_printf(model->temp_button_id, "%01X", alutech_get_original_btn());
|
|
||||||
model->draw_temp_button = true;
|
model->draw_temp_button = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
true);
|
true);
|
||||||
subghz_transmitter->callback(
|
subghz_transmitter->callback(
|
||||||
|
@ -19,10 +19,8 @@
|
|||||||
#include <lib/subghz/types.h>
|
#include <lib/subghz/types.h>
|
||||||
#include <lib/subghz/protocols/keeloq.h>
|
#include <lib/subghz/protocols/keeloq.h>
|
||||||
#include <lib/subghz/protocols/star_line.h>
|
#include <lib/subghz/protocols/star_line.h>
|
||||||
#include <lib/subghz/protocols/alutech_at_4n.h>
|
|
||||||
#include <lib/subghz/protocols/nice_flor_s.h>
|
#include <lib/subghz/blocks/custom_btn.h>
|
||||||
#include <lib/subghz/protocols/somfy_telis.h>
|
|
||||||
#include <lib/subghz/protocols/secplus_v2.h>
|
|
||||||
|
|
||||||
#define SUBREMOTEMAP_FOLDER "/ext/subghz_remote"
|
#define SUBREMOTEMAP_FOLDER "/ext/subghz_remote"
|
||||||
#define SUBREMOTEMAP_EXTENSION ".txt"
|
#define SUBREMOTEMAP_EXTENSION ".txt"
|
||||||
@ -489,10 +487,7 @@ void subghz_remote_tx_stop(SubGHzRemote* app) {
|
|||||||
keeloq_reset_mfname();
|
keeloq_reset_mfname();
|
||||||
keeloq_reset_kl_type();
|
keeloq_reset_kl_type();
|
||||||
keeloq_reset_original_btn();
|
keeloq_reset_original_btn();
|
||||||
alutech_reset_original_btn();
|
subghz_custom_btns_reset();
|
||||||
nice_flors_reset_original_btn();
|
|
||||||
somfy_telis_reset_original_btn();
|
|
||||||
secplus2_reset_original_btn();
|
|
||||||
star_line_reset_mfname();
|
star_line_reset_mfname();
|
||||||
star_line_reset_kl_type();
|
star_line_reset_kl_type();
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
entry,status,name,type,params
|
entry,status,name,type,params
|
||||||
Version,+,20.0,,
|
Version,+,20.1,,
|
||||||
Header,+,applications/services/bt/bt_service/bt.h,,
|
Header,+,applications/services/bt/bt_service/bt.h,,
|
||||||
Header,+,applications/services/cli/cli.h,,
|
Header,+,applications/services/cli/cli.h,,
|
||||||
Header,+,applications/services/cli/cli_vcp.h,,
|
Header,+,applications/services/cli/cli_vcp.h,,
|
||||||
@ -502,10 +502,6 @@ Function,-,acosl,long double,long double
|
|||||||
Function,-,aligned_alloc,void*,"size_t, size_t"
|
Function,-,aligned_alloc,void*,"size_t, size_t"
|
||||||
Function,+,aligned_free,void,void*
|
Function,+,aligned_free,void,void*
|
||||||
Function,+,aligned_malloc,void*,"size_t, size_t"
|
Function,+,aligned_malloc,void*,"size_t, size_t"
|
||||||
Function,-,alutech_get_custom_btn,uint8_t,
|
|
||||||
Function,-,alutech_get_original_btn,uint8_t,
|
|
||||||
Function,-,alutech_reset_original_btn,void,
|
|
||||||
Function,-,alutech_set_btn,void,uint8_t
|
|
||||||
Function,-,arc4random,__uint32_t,
|
Function,-,arc4random,__uint32_t,
|
||||||
Function,-,arc4random_buf,void,"void*, size_t"
|
Function,-,arc4random_buf,void,"void*, size_t"
|
||||||
Function,-,arc4random_uniform,__uint32_t,__uint32_t
|
Function,-,arc4random_uniform,__uint32_t,__uint32_t
|
||||||
@ -1775,12 +1771,9 @@ Function,-,j1f,float,float
|
|||||||
Function,-,jn,double,"int, double"
|
Function,-,jn,double,"int, double"
|
||||||
Function,-,jnf,float,"int, float"
|
Function,-,jnf,float,"int, float"
|
||||||
Function,-,jrand48,long,unsigned short[3]
|
Function,-,jrand48,long,unsigned short[3]
|
||||||
Function,-,keeloq_get_custom_btn,uint8_t,
|
|
||||||
Function,-,keeloq_get_original_btn,uint8_t,
|
|
||||||
Function,-,keeloq_reset_kl_type,void,
|
Function,-,keeloq_reset_kl_type,void,
|
||||||
Function,-,keeloq_reset_mfname,void,
|
Function,-,keeloq_reset_mfname,void,
|
||||||
Function,-,keeloq_reset_original_btn,void,
|
Function,-,keeloq_reset_original_btn,void,
|
||||||
Function,-,keeloq_set_btn,void,uint8_t
|
|
||||||
Function,-,l64a,char*,long
|
Function,-,l64a,char*,long
|
||||||
Function,-,labs,long,long
|
Function,-,labs,long,long
|
||||||
Function,-,lcong48,void,unsigned short[7]
|
Function,-,lcong48,void,unsigned short[7]
|
||||||
@ -2088,10 +2081,6 @@ Function,-,nfca_get_crc16,uint16_t,"uint8_t*, uint16_t"
|
|||||||
Function,-,nfca_signal_alloc,NfcaSignal*,
|
Function,-,nfca_signal_alloc,NfcaSignal*,
|
||||||
Function,-,nfca_signal_encode,void,"NfcaSignal*, uint8_t*, uint16_t, uint8_t*"
|
Function,-,nfca_signal_encode,void,"NfcaSignal*, uint8_t*, uint16_t, uint8_t*"
|
||||||
Function,-,nfca_signal_free,void,NfcaSignal*
|
Function,-,nfca_signal_free,void,NfcaSignal*
|
||||||
Function,-,nice_flors_get_custom_btn,uint8_t,
|
|
||||||
Function,-,nice_flors_get_original_btn,uint8_t,
|
|
||||||
Function,-,nice_flors_reset_original_btn,void,
|
|
||||||
Function,-,nice_flors_set_btn,void,uint8_t
|
|
||||||
Function,+,notification_internal_message,void,"NotificationApp*, const NotificationSequence*"
|
Function,+,notification_internal_message,void,"NotificationApp*, const NotificationSequence*"
|
||||||
Function,+,notification_internal_message_block,void,"NotificationApp*, const NotificationSequence*"
|
Function,+,notification_internal_message_block,void,"NotificationApp*, const NotificationSequence*"
|
||||||
Function,+,notification_message,void,"NotificationApp*, const NotificationSequence*"
|
Function,+,notification_message,void,"NotificationApp*, const NotificationSequence*"
|
||||||
@ -2459,10 +2448,6 @@ 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_set_scene_state,void,"SceneManager*, uint32_t, uint32_t"
|
||||||
Function,+,scene_manager_stop,void,SceneManager*
|
Function,+,scene_manager_stop,void,SceneManager*
|
||||||
Function,+,sd_api_get_fs_type_text,const char*,SDFsType
|
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,-,secure_getenv,char*,const char*
|
||||||
Function,-,seed48,unsigned short*,unsigned short[3]
|
Function,-,seed48,unsigned short*,unsigned short[3]
|
||||||
Function,-,select,int,"int, fd_set*, fd_set*, fd_set*, timeval*"
|
Function,-,select,int,"int, fd_set*, fd_set*, fd_set*, timeval*"
|
||||||
@ -2498,10 +2483,6 @@ Function,-,siprintf,int,"char*, const char*, ..."
|
|||||||
Function,-,siscanf,int,"const char*, const char*, ..."
|
Function,-,siscanf,int,"const char*, const char*, ..."
|
||||||
Function,-,sniprintf,int,"char*, size_t, const char*, ..."
|
Function,-,sniprintf,int,"char*, size_t, const char*, ..."
|
||||||
Function,+,snprintf,int,"char*, size_t, const char*, ..."
|
Function,+,snprintf,int,"char*, size_t, const char*, ..."
|
||||||
Function,-,somfy_telis_get_custom_btn,uint8_t,
|
|
||||||
Function,-,somfy_telis_get_original_btn,uint8_t,
|
|
||||||
Function,-,somfy_telis_reset_original_btn,void,
|
|
||||||
Function,-,somfy_telis_set_btn,void,uint8_t
|
|
||||||
Function,-,sprintf,int,"char*, const char*, ..."
|
Function,-,sprintf,int,"char*, const char*, ..."
|
||||||
Function,-,sqrt,double,double
|
Function,-,sqrt,double,double
|
||||||
Function,-,sqrtf,float,float
|
Function,-,sqrtf,float,float
|
||||||
@ -2658,6 +2639,12 @@ Function,+,subghz_block_generic_deserialize,SubGhzProtocolStatus,"SubGhzBlockGen
|
|||||||
Function,+,subghz_block_generic_deserialize_check_count_bit,SubGhzProtocolStatus,"SubGhzBlockGeneric*, FlipperFormat*, uint16_t"
|
Function,+,subghz_block_generic_deserialize_check_count_bit,SubGhzProtocolStatus,"SubGhzBlockGeneric*, FlipperFormat*, uint16_t"
|
||||||
Function,+,subghz_block_generic_get_preset_name,void,"const char*, FuriString*"
|
Function,+,subghz_block_generic_get_preset_name,void,"const char*, FuriString*"
|
||||||
Function,+,subghz_block_generic_serialize,SubGhzProtocolStatus,"SubGhzBlockGeneric*, FlipperFormat*, SubGhzRadioPreset*"
|
Function,+,subghz_block_generic_serialize,SubGhzProtocolStatus,"SubGhzBlockGeneric*, FlipperFormat*, SubGhzRadioPreset*"
|
||||||
|
Function,-,subghz_custom_btn_get,uint8_t,
|
||||||
|
Function,-,subghz_custom_btn_get_original,uint8_t,
|
||||||
|
Function,-,subghz_custom_btn_set,void,uint8_t
|
||||||
|
Function,-,subghz_custom_btn_set_max,void,uint8_t
|
||||||
|
Function,-,subghz_custom_btn_set_original,void,uint8_t
|
||||||
|
Function,-,subghz_custom_btns_reset,void,
|
||||||
Function,+,subghz_environment_alloc,SubGhzEnvironment*,
|
Function,+,subghz_environment_alloc,SubGhzEnvironment*,
|
||||||
Function,+,subghz_environment_free,void,SubGhzEnvironment*
|
Function,+,subghz_environment_free,void,SubGhzEnvironment*
|
||||||
Function,+,subghz_environment_get_alutech_at_4n_rainbow_table_file_name,const char*,SubGhzEnvironment*
|
Function,+,subghz_environment_get_alutech_at_4n_rainbow_table_file_name,const char*,SubGhzEnvironment*
|
||||||
|
|
34
lib/subghz/blocks/custom_btn.c
Normal file
34
lib/subghz/blocks/custom_btn.c
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#include "custom_btn.h"
|
||||||
|
|
||||||
|
static uint8_t custom_btn_id;
|
||||||
|
static uint8_t custom_btn_original;
|
||||||
|
static uint8_t custom_btn_max_btns = 0;
|
||||||
|
|
||||||
|
void subghz_custom_btn_set(uint8_t b) {
|
||||||
|
if(b > custom_btn_max_btns) {
|
||||||
|
custom_btn_id = 0;
|
||||||
|
} else {
|
||||||
|
custom_btn_id = b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t subghz_custom_btn_get() {
|
||||||
|
return custom_btn_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
void subghz_custom_btn_set_original(uint8_t b) {
|
||||||
|
custom_btn_original = b;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t subghz_custom_btn_get_original() {
|
||||||
|
return custom_btn_original;
|
||||||
|
}
|
||||||
|
|
||||||
|
void subghz_custom_btn_set_max(uint8_t b) {
|
||||||
|
custom_btn_max_btns = b;
|
||||||
|
}
|
||||||
|
|
||||||
|
void subghz_custom_btns_reset() {
|
||||||
|
custom_btn_original = 0;
|
||||||
|
custom_btn_max_btns = 0;
|
||||||
|
}
|
17
lib/subghz/blocks/custom_btn.h
Normal file
17
lib/subghz/blocks/custom_btn.h
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
void subghz_custom_btn_set(uint8_t b);
|
||||||
|
|
||||||
|
uint8_t subghz_custom_btn_get();
|
||||||
|
|
||||||
|
void subghz_custom_btn_set_original(uint8_t b);
|
||||||
|
|
||||||
|
uint8_t subghz_custom_btn_get_original();
|
||||||
|
|
||||||
|
void subghz_custom_btn_set_max(uint8_t b);
|
||||||
|
|
||||||
|
void subghz_custom_btns_reset();
|
@ -5,6 +5,8 @@
|
|||||||
#include "../blocks/generic.h"
|
#include "../blocks/generic.h"
|
||||||
#include "../blocks/math.h"
|
#include "../blocks/math.h"
|
||||||
|
|
||||||
|
#include "../blocks/custom_btn.h"
|
||||||
|
|
||||||
#define TAG "SubGhzProtocoAlutech_at_4n"
|
#define TAG "SubGhzProtocoAlutech_at_4n"
|
||||||
|
|
||||||
#define SUBGHZ_NO_ALUTECH_AT_4N_RAINBOW_TABLE 0xFFFFFFFF
|
#define SUBGHZ_NO_ALUTECH_AT_4N_RAINBOW_TABLE 0xFFFFFFFF
|
||||||
@ -77,25 +79,6 @@ const SubGhzProtocol subghz_protocol_alutech_at_4n = {
|
|||||||
.encoder = &subghz_protocol_alutech_at_4n_encoder,
|
.encoder = &subghz_protocol_alutech_at_4n_encoder,
|
||||||
};
|
};
|
||||||
|
|
||||||
static uint8_t al_btn_temp_id;
|
|
||||||
static uint8_t al_btn_temp_id_original;
|
|
||||||
|
|
||||||
void alutech_set_btn(uint8_t b) {
|
|
||||||
al_btn_temp_id = b;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t alutech_get_original_btn() {
|
|
||||||
return al_btn_temp_id_original;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t alutech_get_custom_btn() {
|
|
||||||
return al_btn_temp_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
void alutech_reset_original_btn() {
|
|
||||||
al_btn_temp_id_original = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void* subghz_protocol_encoder_alutech_at_4n_alloc(SubGhzEnvironment* environment) {
|
void* subghz_protocol_encoder_alutech_at_4n_alloc(SubGhzEnvironment* environment) {
|
||||||
UNUSED(environment);
|
UNUSED(environment);
|
||||||
SubGhzProtocolEncoderAlutech_at_4n* instance =
|
SubGhzProtocolEncoderAlutech_at_4n* instance =
|
||||||
@ -341,13 +324,16 @@ static bool subghz_protocol_encoder_alutech_at_4n_get_upload(
|
|||||||
furi_assert(instance);
|
furi_assert(instance);
|
||||||
|
|
||||||
// Save original button for later use
|
// Save original button for later use
|
||||||
if(al_btn_temp_id_original == 0) {
|
if(subghz_custom_btn_get_original() == 0) {
|
||||||
al_btn_temp_id_original = btn;
|
subghz_custom_btn_set_original(btn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t custom_btn_id = subghz_custom_btn_get();
|
||||||
|
uint8_t original_btn_num = subghz_custom_btn_get_original();
|
||||||
|
|
||||||
// Set custom button
|
// Set custom button
|
||||||
if(al_btn_temp_id == 1) {
|
if(custom_btn_id == 1) {
|
||||||
switch(al_btn_temp_id_original) {
|
switch(original_btn_num) {
|
||||||
case 0x11:
|
case 0x11:
|
||||||
btn = 0x22;
|
btn = 0x22;
|
||||||
break;
|
break;
|
||||||
@ -368,8 +354,8 @@ static bool subghz_protocol_encoder_alutech_at_4n_get_upload(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(al_btn_temp_id == 2) {
|
if(custom_btn_id == 2) {
|
||||||
switch(al_btn_temp_id_original) {
|
switch(original_btn_num) {
|
||||||
case 0x11:
|
case 0x11:
|
||||||
btn = 0x44;
|
btn = 0x44;
|
||||||
break;
|
break;
|
||||||
@ -390,8 +376,8 @@ static bool subghz_protocol_encoder_alutech_at_4n_get_upload(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(al_btn_temp_id == 3) {
|
if(custom_btn_id == 3) {
|
||||||
switch(al_btn_temp_id_original) {
|
switch(original_btn_num) {
|
||||||
case 0x11:
|
case 0x11:
|
||||||
btn = 0x33;
|
btn = 0x33;
|
||||||
break;
|
break;
|
||||||
@ -412,8 +398,8 @@ static bool subghz_protocol_encoder_alutech_at_4n_get_upload(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(al_btn_temp_id == 4) {
|
if(custom_btn_id == 4) {
|
||||||
switch(al_btn_temp_id_original) {
|
switch(original_btn_num) {
|
||||||
case 0x11:
|
case 0x11:
|
||||||
btn = 0xFF;
|
btn = 0xFF;
|
||||||
break;
|
break;
|
||||||
@ -435,8 +421,8 @@ static bool subghz_protocol_encoder_alutech_at_4n_get_upload(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if((al_btn_temp_id == 0) && (al_btn_temp_id_original != 0)) {
|
if((custom_btn_id == 0) && (original_btn_num != 0)) {
|
||||||
btn = al_btn_temp_id_original;
|
btn = original_btn_num;
|
||||||
}
|
}
|
||||||
//gen new key
|
//gen new key
|
||||||
if(subghz_protocol_alutech_at_4n_gen_data(instance, btn)) {
|
if(subghz_protocol_alutech_at_4n_gen_data(instance, btn)) {
|
||||||
@ -735,9 +721,10 @@ static void subghz_protocol_alutech_at_4n_remote_controller(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Save original button for later use
|
// Save original button for later use
|
||||||
if(al_btn_temp_id_original == 0) {
|
if(subghz_custom_btn_get_original() == 0) {
|
||||||
al_btn_temp_id_original = instance->btn;
|
subghz_custom_btn_set_original(instance->btn);
|
||||||
}
|
}
|
||||||
|
subghz_custom_btn_set_max(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t subghz_protocol_decoder_alutech_at_4n_get_hash_data(void* context) {
|
uint8_t subghz_protocol_decoder_alutech_at_4n_get_hash_data(void* context) {
|
||||||
|
@ -10,14 +10,6 @@ extern const SubGhzProtocolDecoder subghz_protocol_alutech_at_4n_decoder;
|
|||||||
extern const SubGhzProtocolEncoder subghz_protocol_alutech_at_4n_encoder;
|
extern const SubGhzProtocolEncoder subghz_protocol_alutech_at_4n_encoder;
|
||||||
extern const SubGhzProtocol subghz_protocol_alutech_at_4n;
|
extern const SubGhzProtocol subghz_protocol_alutech_at_4n;
|
||||||
|
|
||||||
// Custom buttons
|
|
||||||
void alutech_set_btn(uint8_t b);
|
|
||||||
|
|
||||||
uint8_t alutech_get_original_btn();
|
|
||||||
uint8_t alutech_get_custom_btn();
|
|
||||||
|
|
||||||
void alutech_reset_original_btn();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocate SubGhzProtocolEncoderAlutech_at_4n.
|
* Allocate SubGhzProtocolEncoderAlutech_at_4n.
|
||||||
* @param environment Pointer to a SubGhzEnvironment instance
|
* @param environment Pointer to a SubGhzEnvironment instance
|
||||||
|
@ -10,6 +10,8 @@
|
|||||||
#include "../blocks/generic.h"
|
#include "../blocks/generic.h"
|
||||||
#include "../blocks/math.h"
|
#include "../blocks/math.h"
|
||||||
|
|
||||||
|
#include "../blocks/custom_btn.h"
|
||||||
|
|
||||||
#define TAG "SubGhzProtocolKeeloq"
|
#define TAG "SubGhzProtocolKeeloq"
|
||||||
|
|
||||||
static const SubGhzBlockConst subghz_protocol_keeloq_const = {
|
static const SubGhzBlockConst subghz_protocol_keeloq_const = {
|
||||||
@ -86,25 +88,12 @@ const SubGhzProtocol subghz_protocol_keeloq = {
|
|||||||
|
|
||||||
static const char* mfname;
|
static const char* mfname;
|
||||||
static uint8_t kl_type;
|
static uint8_t kl_type;
|
||||||
static uint8_t btn_temp_id;
|
|
||||||
static uint8_t btn_temp_id_original;
|
|
||||||
static uint8_t klq_prog_mode;
|
static uint8_t klq_prog_mode;
|
||||||
static uint16_t temp_counter;
|
static uint16_t temp_counter;
|
||||||
|
|
||||||
void keeloq_set_btn(uint8_t b) {
|
|
||||||
btn_temp_id = b;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t keeloq_get_original_btn() {
|
|
||||||
return btn_temp_id_original;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t keeloq_get_custom_btn() {
|
|
||||||
return btn_temp_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
void keeloq_reset_original_btn() {
|
void keeloq_reset_original_btn() {
|
||||||
btn_temp_id_original = 0;
|
subghz_custom_btn_set_original(0);
|
||||||
|
subghz_custom_btn_set_max(0);
|
||||||
temp_counter = 0;
|
temp_counter = 0;
|
||||||
klq_prog_mode = 0;
|
klq_prog_mode = 0;
|
||||||
}
|
}
|
||||||
@ -384,8 +373,8 @@ static bool
|
|||||||
furi_assert(instance);
|
furi_assert(instance);
|
||||||
|
|
||||||
// Save original button
|
// Save original button
|
||||||
if(btn_temp_id_original == 0) {
|
if(subghz_custom_btn_get_original() == 0) {
|
||||||
btn_temp_id_original = btn;
|
subghz_custom_btn_set_original(btn);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(instance->manufacture_name == 0x0) {
|
if(instance->manufacture_name == 0x0) {
|
||||||
@ -402,9 +391,12 @@ static bool
|
|||||||
klq_last_custom_btn = 0xF;
|
klq_last_custom_btn = 0xF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t custom_btn_id = subghz_custom_btn_get();
|
||||||
|
uint8_t original_btn_num = subghz_custom_btn_get_original();
|
||||||
|
|
||||||
// Set custom button
|
// Set custom button
|
||||||
if(btn_temp_id == 1) {
|
if(custom_btn_id == 1) {
|
||||||
switch(btn_temp_id_original) {
|
switch(original_btn_num) {
|
||||||
case 0x1:
|
case 0x1:
|
||||||
btn = 0x2;
|
btn = 0x2;
|
||||||
break;
|
break;
|
||||||
@ -429,8 +421,8 @@ static bool
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(btn_temp_id == 2) {
|
if(custom_btn_id == 2) {
|
||||||
switch(btn_temp_id_original) {
|
switch(original_btn_num) {
|
||||||
case 0x1:
|
case 0x1:
|
||||||
btn = 0x4;
|
btn = 0x4;
|
||||||
break;
|
break;
|
||||||
@ -455,8 +447,8 @@ static bool
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(btn_temp_id == 3) {
|
if(custom_btn_id == 3) {
|
||||||
switch(btn_temp_id_original) {
|
switch(original_btn_num) {
|
||||||
case 0x1:
|
case 0x1:
|
||||||
btn = 0x8;
|
btn = 0x8;
|
||||||
break;
|
break;
|
||||||
@ -481,8 +473,8 @@ static bool
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(btn_temp_id == 4) {
|
if(custom_btn_id == 4) {
|
||||||
switch(btn_temp_id_original) {
|
switch(original_btn_num) {
|
||||||
case 0x1:
|
case 0x1:
|
||||||
btn = klq_last_custom_btn;
|
btn = klq_last_custom_btn;
|
||||||
break;
|
break;
|
||||||
@ -508,8 +500,8 @@ static bool
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if((btn_temp_id == 0) && (btn_temp_id_original != 0)) {
|
if((custom_btn_id == 0) && (original_btn_num != 0)) {
|
||||||
btn = btn_temp_id_original;
|
btn = original_btn_num;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate new key
|
// Generate new key
|
||||||
@ -1213,9 +1205,10 @@ static void subghz_protocol_keeloq_check_remote_controller(
|
|||||||
instance->btn = key_fix >> 28;
|
instance->btn = key_fix >> 28;
|
||||||
|
|
||||||
// Save original button for later use
|
// Save original button for later use
|
||||||
if(btn_temp_id_original == 0) {
|
if(subghz_custom_btn_get_original() == 0) {
|
||||||
btn_temp_id_original = instance->btn;
|
subghz_custom_btn_set_original(instance->btn);
|
||||||
}
|
}
|
||||||
|
subghz_custom_btn_set_max(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t subghz_protocol_decoder_keeloq_get_hash_data(void* context) {
|
uint8_t subghz_protocol_decoder_keeloq_get_hash_data(void* context) {
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
#include "base.h"
|
#include "base.h"
|
||||||
|
|
||||||
|
#include "../blocks/custom_btn.h"
|
||||||
|
|
||||||
#define SUBGHZ_PROTOCOL_KEELOQ_NAME "KeeLoq"
|
#define SUBGHZ_PROTOCOL_KEELOQ_NAME "KeeLoq"
|
||||||
|
|
||||||
typedef struct SubGhzProtocolDecoderKeeloq SubGhzProtocolDecoderKeeloq;
|
typedef struct SubGhzProtocolDecoderKeeloq SubGhzProtocolDecoderKeeloq;
|
||||||
@ -15,11 +17,6 @@ void keeloq_reset_mfname();
|
|||||||
|
|
||||||
void keeloq_reset_kl_type();
|
void keeloq_reset_kl_type();
|
||||||
|
|
||||||
void keeloq_set_btn(uint8_t b);
|
|
||||||
|
|
||||||
uint8_t keeloq_get_original_btn();
|
|
||||||
uint8_t keeloq_get_custom_btn();
|
|
||||||
|
|
||||||
void keeloq_reset_original_btn();
|
void keeloq_reset_original_btn();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
#include "../blocks/generic.h"
|
#include "../blocks/generic.h"
|
||||||
#include "../blocks/math.h"
|
#include "../blocks/math.h"
|
||||||
|
|
||||||
|
#include "../blocks/custom_btn.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* https://phreakerclub.com/1615
|
* https://phreakerclub.com/1615
|
||||||
* https://phreakerclub.com/forum/showthread.php?t=2360
|
* https://phreakerclub.com/forum/showthread.php?t=2360
|
||||||
@ -84,25 +86,6 @@ const SubGhzProtocol subghz_protocol_nice_flor_s = {
|
|||||||
.encoder = &subghz_protocol_nice_flor_s_encoder,
|
.encoder = &subghz_protocol_nice_flor_s_encoder,
|
||||||
};
|
};
|
||||||
|
|
||||||
static uint8_t n_btn_temp_id;
|
|
||||||
static uint8_t n_btn_temp_id_original;
|
|
||||||
|
|
||||||
void nice_flors_set_btn(uint8_t b) {
|
|
||||||
n_btn_temp_id = b;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t nice_flors_get_original_btn() {
|
|
||||||
return n_btn_temp_id_original;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t nice_flors_get_custom_btn() {
|
|
||||||
return n_btn_temp_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
void nice_flors_reset_original_btn() {
|
|
||||||
n_btn_temp_id_original = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void subghz_protocol_nice_flor_s_remote_controller(
|
static void subghz_protocol_nice_flor_s_remote_controller(
|
||||||
SubGhzBlockGeneric* instance,
|
SubGhzBlockGeneric* instance,
|
||||||
const char* file_name);
|
const char* file_name);
|
||||||
@ -148,13 +131,16 @@ static void subghz_protocol_encoder_nice_flor_s_get_upload(
|
|||||||
btn = instance->generic.btn;
|
btn = instance->generic.btn;
|
||||||
|
|
||||||
// Save original button for later use
|
// Save original button for later use
|
||||||
if(n_btn_temp_id_original == 0) {
|
if(subghz_custom_btn_get_original() == 0) {
|
||||||
n_btn_temp_id_original = btn;
|
subghz_custom_btn_set_original(btn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t custom_btn_id = subghz_custom_btn_get();
|
||||||
|
uint8_t original_btn_num = subghz_custom_btn_get_original();
|
||||||
|
|
||||||
// Set custom button
|
// Set custom button
|
||||||
if(n_btn_temp_id == 1) {
|
if(custom_btn_id == 1) {
|
||||||
switch(n_btn_temp_id_original) {
|
switch(original_btn_num) {
|
||||||
case 0x1:
|
case 0x1:
|
||||||
btn = 0x2;
|
btn = 0x2;
|
||||||
break;
|
break;
|
||||||
@ -172,8 +158,8 @@ static void subghz_protocol_encoder_nice_flor_s_get_upload(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(n_btn_temp_id == 2) {
|
if(custom_btn_id == 2) {
|
||||||
switch(n_btn_temp_id_original) {
|
switch(original_btn_num) {
|
||||||
case 0x1:
|
case 0x1:
|
||||||
btn = 0x4;
|
btn = 0x4;
|
||||||
break;
|
break;
|
||||||
@ -191,8 +177,8 @@ static void subghz_protocol_encoder_nice_flor_s_get_upload(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(n_btn_temp_id == 3) {
|
if(custom_btn_id == 3) {
|
||||||
switch(n_btn_temp_id_original) {
|
switch(original_btn_num) {
|
||||||
case 0x1:
|
case 0x1:
|
||||||
btn = 0x8;
|
btn = 0x8;
|
||||||
break;
|
break;
|
||||||
@ -211,8 +197,8 @@ static void subghz_protocol_encoder_nice_flor_s_get_upload(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if((n_btn_temp_id == 0) && (n_btn_temp_id_original != 0)) {
|
if((custom_btn_id == 0) && (original_btn_num != 0)) {
|
||||||
btn = n_btn_temp_id_original;
|
btn = original_btn_num;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t size_upload = ((instance->generic.data_count_bit * 2) + ((37 + 2 + 2) * 2) * 16);
|
size_t size_upload = ((instance->generic.data_count_bit * 2) + ((37 + 2 + 2) * 2) * 16);
|
||||||
@ -756,9 +742,10 @@ static void subghz_protocol_nice_flor_s_remote_controller(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Save original button for later use
|
// Save original button for later use
|
||||||
if(n_btn_temp_id_original == 0) {
|
if(subghz_custom_btn_get_original() == 0) {
|
||||||
n_btn_temp_id_original = instance->btn;
|
subghz_custom_btn_set_original(instance->btn);
|
||||||
}
|
}
|
||||||
|
subghz_custom_btn_set_max(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t subghz_protocol_decoder_nice_flor_s_get_hash_data(void* context) {
|
uint8_t subghz_protocol_decoder_nice_flor_s_get_hash_data(void* context) {
|
||||||
|
@ -11,14 +11,6 @@ extern const SubGhzProtocolDecoder subghz_protocol_nice_flor_s_decoder;
|
|||||||
extern const SubGhzProtocolEncoder subghz_protocol_nice_flor_s_encoder;
|
extern const SubGhzProtocolEncoder subghz_protocol_nice_flor_s_encoder;
|
||||||
extern const SubGhzProtocol subghz_protocol_nice_flor_s;
|
extern const SubGhzProtocol subghz_protocol_nice_flor_s;
|
||||||
|
|
||||||
// Custom buttons
|
|
||||||
void nice_flors_set_btn(uint8_t b);
|
|
||||||
|
|
||||||
uint8_t nice_flors_get_original_btn();
|
|
||||||
uint8_t nice_flors_get_custom_btn();
|
|
||||||
|
|
||||||
void nice_flors_reset_original_btn();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocate SubGhzProtocolEncoderNiceFlorS.
|
* Allocate SubGhzProtocolEncoderNiceFlorS.
|
||||||
* @param environment Pointer to a SubGhzEnvironment instance
|
* @param environment Pointer to a SubGhzEnvironment instance
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
#include "../blocks/generic.h"
|
#include "../blocks/generic.h"
|
||||||
#include "../blocks/math.h"
|
#include "../blocks/math.h"
|
||||||
|
|
||||||
|
#include "../blocks/custom_btn.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Help
|
* Help
|
||||||
* https://github.com/argilo/secplus
|
* https://github.com/argilo/secplus
|
||||||
@ -83,25 +85,6 @@ const SubGhzProtocol subghz_protocol_secplus_v2 = {
|
|||||||
.encoder = &subghz_protocol_secplus_v2_encoder,
|
.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) {
|
void* subghz_protocol_encoder_secplus_v2_alloc(SubGhzEnvironment* environment) {
|
||||||
UNUSED(environment);
|
UNUSED(environment);
|
||||||
SubGhzProtocolEncoderSecPlus_v2* instance = malloc(sizeof(SubGhzProtocolEncoderSecPlus_v2));
|
SubGhzProtocolEncoderSecPlus_v2* instance = malloc(sizeof(SubGhzProtocolEncoderSecPlus_v2));
|
||||||
@ -359,9 +342,10 @@ static void
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Save original button for later use
|
// Save original button for later use
|
||||||
if(sc_btn_temp_id_original == 0) {
|
if(subghz_custom_btn_get_original() == 0) {
|
||||||
sc_btn_temp_id_original = instance->btn;
|
subghz_custom_btn_set_original(instance->btn);
|
||||||
}
|
}
|
||||||
|
subghz_custom_btn_set_max(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -398,13 +382,16 @@ static uint64_t subghz_protocol_secplus_v2_encode_half(uint8_t roll_array[], uin
|
|||||||
|
|
||||||
static void subghz_protocol_secplus_v2_encode(SubGhzProtocolEncoderSecPlus_v2* instance) {
|
static void subghz_protocol_secplus_v2_encode(SubGhzProtocolEncoderSecPlus_v2* instance) {
|
||||||
// Save original button for later use
|
// Save original button for later use
|
||||||
if(sc_btn_temp_id_original == 0) {
|
if(subghz_custom_btn_get_original() == 0) {
|
||||||
sc_btn_temp_id_original = instance->generic.btn;
|
subghz_custom_btn_set_original(instance->generic.btn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t custom_btn_id = subghz_custom_btn_get();
|
||||||
|
uint8_t original_btn_num = subghz_custom_btn_get_original();
|
||||||
|
|
||||||
// Set custom button
|
// Set custom button
|
||||||
if(sc_btn_temp_id == 1) {
|
if(custom_btn_id == 1) {
|
||||||
switch(sc_btn_temp_id_original) {
|
switch(original_btn_num) {
|
||||||
case 0x68:
|
case 0x68:
|
||||||
instance->generic.btn = 0x80;
|
instance->generic.btn = 0x80;
|
||||||
break;
|
break;
|
||||||
@ -422,8 +409,8 @@ static void subghz_protocol_secplus_v2_encode(SubGhzProtocolEncoderSecPlus_v2* i
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(sc_btn_temp_id == 2) {
|
if(custom_btn_id == 2) {
|
||||||
switch(sc_btn_temp_id_original) {
|
switch(original_btn_num) {
|
||||||
case 0x68:
|
case 0x68:
|
||||||
instance->generic.btn = 0x81;
|
instance->generic.btn = 0x81;
|
||||||
break;
|
break;
|
||||||
@ -441,8 +428,8 @@ static void subghz_protocol_secplus_v2_encode(SubGhzProtocolEncoderSecPlus_v2* i
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(sc_btn_temp_id == 3) {
|
if(custom_btn_id == 3) {
|
||||||
switch(sc_btn_temp_id_original) {
|
switch(original_btn_num) {
|
||||||
case 0x68:
|
case 0x68:
|
||||||
instance->generic.btn = 0xE2;
|
instance->generic.btn = 0xE2;
|
||||||
break;
|
break;
|
||||||
@ -460,8 +447,8 @@ static void subghz_protocol_secplus_v2_encode(SubGhzProtocolEncoderSecPlus_v2* i
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if((sc_btn_temp_id == 0) && (sc_btn_temp_id_original != 0)) {
|
if((custom_btn_id == 0) && (original_btn_num != 0)) {
|
||||||
instance->generic.btn = sc_btn_temp_id_original;
|
instance->generic.btn = original_btn_num;
|
||||||
}
|
}
|
||||||
uint32_t fixed_1[1] = {instance->generic.btn << 12 | instance->generic.serial >> 20};
|
uint32_t fixed_1[1] = {instance->generic.btn << 12 | instance->generic.serial >> 20};
|
||||||
uint32_t fixed_2[1] = {instance->generic.serial & 0xFFFFF};
|
uint32_t fixed_2[1] = {instance->generic.serial & 0xFFFFF};
|
||||||
|
@ -10,14 +10,6 @@ extern const SubGhzProtocolDecoder subghz_protocol_secplus_v2_decoder;
|
|||||||
extern const SubGhzProtocolEncoder subghz_protocol_secplus_v2_encoder;
|
extern const SubGhzProtocolEncoder subghz_protocol_secplus_v2_encoder;
|
||||||
extern const SubGhzProtocol subghz_protocol_secplus_v2;
|
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.
|
* Allocate SubGhzProtocolEncoderSecPlus_v2.
|
||||||
* @param environment Pointer to a SubGhzEnvironment instance
|
* @param environment Pointer to a SubGhzEnvironment instance
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
#include "../blocks/generic.h"
|
#include "../blocks/generic.h"
|
||||||
#include "../blocks/math.h"
|
#include "../blocks/math.h"
|
||||||
|
|
||||||
|
#include "../blocks/custom_btn.h"
|
||||||
|
|
||||||
#define TAG "SubGhzProtocolSomfyTelis"
|
#define TAG "SubGhzProtocolSomfyTelis"
|
||||||
|
|
||||||
static const SubGhzBlockConst subghz_protocol_somfy_telis_const = {
|
static const SubGhzBlockConst subghz_protocol_somfy_telis_const = {
|
||||||
@ -73,25 +75,6 @@ const SubGhzProtocol subghz_protocol_somfy_telis = {
|
|||||||
.encoder = &subghz_protocol_somfy_telis_encoder,
|
.encoder = &subghz_protocol_somfy_telis_encoder,
|
||||||
};
|
};
|
||||||
|
|
||||||
static uint8_t st_btn_temp_id;
|
|
||||||
static uint8_t st_btn_temp_id_original;
|
|
||||||
|
|
||||||
void somfy_telis_set_btn(uint8_t b) {
|
|
||||||
st_btn_temp_id = b;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t somfy_telis_get_original_btn() {
|
|
||||||
return st_btn_temp_id_original;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t somfy_telis_get_custom_btn() {
|
|
||||||
return st_btn_temp_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
void somfy_telis_reset_original_btn() {
|
|
||||||
st_btn_temp_id_original = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void* subghz_protocol_encoder_somfy_telis_alloc(SubGhzEnvironment* environment) {
|
void* subghz_protocol_encoder_somfy_telis_alloc(SubGhzEnvironment* environment) {
|
||||||
UNUSED(environment);
|
UNUSED(environment);
|
||||||
SubGhzProtocolEncoderSomfyTelis* instance = malloc(sizeof(SubGhzProtocolEncoderSomfyTelis));
|
SubGhzProtocolEncoderSomfyTelis* instance = malloc(sizeof(SubGhzProtocolEncoderSomfyTelis));
|
||||||
@ -128,13 +111,16 @@ static bool subghz_protocol_somfy_telis_gen_data(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Save original button for later use
|
// Save original button for later use
|
||||||
if(st_btn_temp_id_original == 0) {
|
if(subghz_custom_btn_get_original() == 0) {
|
||||||
st_btn_temp_id_original = btn;
|
subghz_custom_btn_set_original(btn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t custom_btn_id = subghz_custom_btn_get();
|
||||||
|
uint8_t original_btn_num = subghz_custom_btn_get_original();
|
||||||
|
|
||||||
// Set custom button
|
// Set custom button
|
||||||
if(st_btn_temp_id == 1) {
|
if(custom_btn_id == 1) {
|
||||||
switch(st_btn_temp_id_original) {
|
switch(original_btn_num) {
|
||||||
case 0x1:
|
case 0x1:
|
||||||
btn = 0x2;
|
btn = 0x2;
|
||||||
break;
|
break;
|
||||||
@ -152,8 +138,8 @@ static bool subghz_protocol_somfy_telis_gen_data(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(st_btn_temp_id == 2) {
|
if(custom_btn_id == 2) {
|
||||||
switch(st_btn_temp_id_original) {
|
switch(original_btn_num) {
|
||||||
case 0x1:
|
case 0x1:
|
||||||
btn = 0x4;
|
btn = 0x4;
|
||||||
break;
|
break;
|
||||||
@ -171,8 +157,8 @@ static bool subghz_protocol_somfy_telis_gen_data(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(st_btn_temp_id == 3) {
|
if(custom_btn_id == 3) {
|
||||||
switch(st_btn_temp_id_original) {
|
switch(original_btn_num) {
|
||||||
case 0x1:
|
case 0x1:
|
||||||
btn = 0x8;
|
btn = 0x8;
|
||||||
break;
|
break;
|
||||||
@ -191,8 +177,8 @@ static bool subghz_protocol_somfy_telis_gen_data(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if((st_btn_temp_id == 0) && (st_btn_temp_id_original != 0)) {
|
if((custom_btn_id == 0) && (original_btn_num != 0)) {
|
||||||
btn = st_btn_temp_id_original;
|
btn = original_btn_num;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(instance->generic.cnt < 0xFFFF) {
|
if(instance->generic.cnt < 0xFFFF) {
|
||||||
@ -684,9 +670,10 @@ static void subghz_protocol_somfy_telis_check_remote_controller(SubGhzBlockGener
|
|||||||
instance->serial = data & 0xFFFFFF; // address
|
instance->serial = data & 0xFFFFFF; // address
|
||||||
|
|
||||||
// Save original button for later use
|
// Save original button for later use
|
||||||
if(st_btn_temp_id_original == 0) {
|
if(subghz_custom_btn_get_original() == 0) {
|
||||||
st_btn_temp_id_original = instance->btn;
|
subghz_custom_btn_set_original(instance->btn);
|
||||||
}
|
}
|
||||||
|
subghz_custom_btn_set_max(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,14 +11,6 @@ extern const SubGhzProtocolDecoder subghz_protocol_somfy_telis_decoder;
|
|||||||
extern const SubGhzProtocolEncoder subghz_protocol_somfy_telis_encoder;
|
extern const SubGhzProtocolEncoder subghz_protocol_somfy_telis_encoder;
|
||||||
extern const SubGhzProtocol subghz_protocol_somfy_telis;
|
extern const SubGhzProtocol subghz_protocol_somfy_telis;
|
||||||
|
|
||||||
// Custom buttons
|
|
||||||
void somfy_telis_set_btn(uint8_t b);
|
|
||||||
|
|
||||||
uint8_t somfy_telis_get_original_btn();
|
|
||||||
uint8_t somfy_telis_get_custom_btn();
|
|
||||||
|
|
||||||
void somfy_telis_reset_original_btn();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocate SubGhzProtocolEncoderSomfyTelis.
|
* Allocate SubGhzProtocolEncoderSomfyTelis.
|
||||||
* @param environment Pointer to a SubGhzEnvironment instance
|
* @param environment Pointer to a SubGhzEnvironment instance
|
||||||
|
Loading…
Reference in New Issue
Block a user