mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-10 06:54:19 +00:00
Nice flor s - custom buttons
This commit is contained in:
parent
5b0c5a82c0
commit
182296d8af
10 changed files with 140 additions and 9 deletions
18
CHANGELOG.md
18
CHANGELOG.md
|
@ -1,12 +1,14 @@
|
|||
### New changes
|
||||
* SubGHz: **Keeloq: Beninca - protocol support**
|
||||
* SubGHz: **Hold right in received signal list to delete selected signal**
|
||||
* SubGHz: **Custom buttons for Keeloq and Alutech AT4N** - now you can use arrow buttons to send signal with different button code
|
||||
* SubGHz: Debug mode counter increase settings (+5, +10, default: +1)
|
||||
* Infrared: Debug TX PIN output settings (ability to move tx signal out to GPIO) (implemented #364)
|
||||
* Plugins: Updated -> [BH1750] Lightmeter [(by oleksiikutuzov)](https://github.com/oleksiikutuzov/flipperzero-lightmeter)
|
||||
* OFW: BadUSB -> STRINGDELAY(STRING_DELAY) feature, worker signal handling refactoring -> (Fixed #365 (BadUSB won't detect connection and/or hangs))
|
||||
* OFW: Grammar fixes
|
||||
* SubGHz: **Custom buttons for Nice Flor S** - now you can use arrow buttons to send signal with different button code
|
||||
* OFW: Drivers: remove excessive check in bq25896 and make PVS happy
|
||||
* OFW: FuriHal, Power, UnitTests: fix, rename battery charging voltage limit API -> **Breaking API change, api was changed from 14.x to 15.x**
|
||||
**(this will make your manually copied plugins not work, update them in same way you installed them, or delete `apps` folder and then install firmware, if you using extra pack builds (with `e` in version) all apps in _Extra will be updated automatically)**
|
||||
|
||||
* OFW: Fix incorrect type choise condition in image compressor
|
||||
* OFW: Updater: handle storage errors when removing files, fix folder remove routine, prevent unused services from starting
|
||||
* OFW: Unify power info, power debug, and device_info into one info command
|
||||
* OFW: SD Cache: moved to diskio layer, invalidation in case of error
|
||||
* OFW: Picopass: factory key support, minor code cleanup
|
||||
|
||||
#### [🎲 Download latest extra apps pack](https://download-directory.github.io/?url=https://github.com/xMasterX/unleashed-extra-pack/tree/main/apps)
|
||||
|
||||
|
|
|
@ -166,7 +166,7 @@ Games:
|
|||
- Sub-GHz -> Long press OK button in Sub-GHz Frequency analyzer to switch to Read menu [(by derskythe)](https://github.com/DarkFlippers/unleashed-firmware/pull/79)
|
||||
- Lock device with pin(or regular lock if pin not set) by holding UP button on main screen [(by an4tur0r)](https://github.com/DarkFlippers/unleashed-firmware/pull/107)
|
||||
* SubGHz -> **Hold right in received signal list to delete selected signal**
|
||||
* SubGHz -> **Custom buttons for Keeloq and Alutech AT4N** - now you can use arrow buttons to send signal with different button code
|
||||
* SubGHz -> **Custom buttons for Keeloq / Alutech AT4N / Nice Flor S** - now you can use arrow buttons to send signal with different button code
|
||||
* SubGHz -> Debug mode counter increase settings (+5, +10, default: +1)
|
||||
* SubGHz -> Debug PIN output settings for protocol development
|
||||
* Infrared -> Debug TX PIN output settings
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <lib/subghz/protocols/keeloq.h>
|
||||
#include <lib/subghz/protocols/star_line.h>
|
||||
#include <lib/subghz/protocols/alutech_at_4n.h>
|
||||
#include <lib/subghz/protocols/nice_flor_s.h>
|
||||
|
||||
void subghz_scene_receiver_info_callback(GuiButtonType result, InputType type, void* context) {
|
||||
furi_assert(context);
|
||||
|
@ -236,6 +237,7 @@ void subghz_scene_receiver_info_on_exit(void* context) {
|
|||
keeloq_reset_kl_type();
|
||||
keeloq_reset_original_btn();
|
||||
alutech_reset_original_btn();
|
||||
nice_flors_reset_original_btn();
|
||||
star_line_reset_mfname();
|
||||
star_line_reset_kl_type();
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include <lib/subghz/protocols/keeloq.h>
|
||||
#include <lib/subghz/protocols/star_line.h>
|
||||
#include <lib/subghz/protocols/alutech_at_4n.h>
|
||||
#include <lib/subghz/protocols/nice_flor_s.h>
|
||||
|
||||
typedef enum {
|
||||
SubGhzRpcStateIdle,
|
||||
|
@ -113,6 +114,7 @@ void subghz_scene_rpc_on_exit(void* context) {
|
|||
keeloq_reset_kl_type();
|
||||
keeloq_reset_original_btn();
|
||||
alutech_reset_original_btn();
|
||||
nice_flors_reset_original_btn();
|
||||
star_line_reset_mfname();
|
||||
star_line_reset_kl_type();
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#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/nice_flor_s.h>
|
||||
|
||||
void subghz_scene_transmitter_callback(SubGhzCustomEvent event, void* context) {
|
||||
furi_assert(context);
|
||||
|
@ -93,6 +94,7 @@ bool subghz_scene_transmitter_on_event(void* context, SceneManagerEvent event) {
|
|||
if(keeloq_get_custom_btn() != 0) {
|
||||
keeloq_set_btn(0);
|
||||
alutech_set_btn(0);
|
||||
nice_flors_set_btn(0);
|
||||
uint8_t tmp_counter = furi_hal_subghz_get_rolling_counter_mult();
|
||||
furi_hal_subghz_set_rolling_counter_mult(0);
|
||||
// Calling restore!
|
||||
|
@ -135,6 +137,7 @@ void subghz_scene_transmitter_on_exit(void* context) {
|
|||
keeloq_reset_kl_type();
|
||||
keeloq_reset_original_btn();
|
||||
alutech_reset_original_btn();
|
||||
nice_flors_reset_original_btn();
|
||||
star_line_reset_mfname();
|
||||
star_line_reset_kl_type();
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <lib/subghz/protocols/keeloq.h>
|
||||
#include <lib/subghz/protocols/alutech_at_4n.h>
|
||||
#include <lib/subghz/protocols/nice_flor_s.h>
|
||||
|
||||
struct SubGhzViewTransmitter {
|
||||
View* view;
|
||||
|
@ -159,6 +160,7 @@ bool subghz_view_transmitter_input(InputEvent* event, void* context) {
|
|||
if(can_be_sent && event->key == InputKeyUp && event->type == InputTypePress) {
|
||||
keeloq_set_btn(1);
|
||||
alutech_set_btn(1);
|
||||
nice_flors_set_btn(1);
|
||||
with_view_model(
|
||||
subghz_transmitter->view,
|
||||
SubGhzViewTransmitterModel * model,
|
||||
|
@ -170,6 +172,10 @@ bool subghz_view_transmitter_input(InputEvent* event, void* context) {
|
|||
} 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(
|
||||
model->temp_button_id, "%01X", nice_flors_get_original_btn());
|
||||
model->draw_temp_button = true;
|
||||
}
|
||||
},
|
||||
true);
|
||||
|
@ -185,6 +191,7 @@ bool subghz_view_transmitter_input(InputEvent* event, void* context) {
|
|||
if(can_be_sent && event->key == InputKeyDown && event->type == InputTypePress) {
|
||||
keeloq_set_btn(2);
|
||||
alutech_set_btn(2);
|
||||
nice_flors_set_btn(2);
|
||||
with_view_model(
|
||||
subghz_transmitter->view,
|
||||
SubGhzViewTransmitterModel * model,
|
||||
|
@ -196,6 +203,10 @@ bool subghz_view_transmitter_input(InputEvent* event, void* context) {
|
|||
} 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(
|
||||
model->temp_button_id, "%01X", nice_flors_get_original_btn());
|
||||
model->draw_temp_button = true;
|
||||
}
|
||||
},
|
||||
true);
|
||||
|
@ -211,6 +222,7 @@ bool subghz_view_transmitter_input(InputEvent* event, void* context) {
|
|||
if(can_be_sent && event->key == InputKeyLeft && event->type == InputTypePress) {
|
||||
keeloq_set_btn(3);
|
||||
alutech_set_btn(3);
|
||||
nice_flors_set_btn(3);
|
||||
with_view_model(
|
||||
subghz_transmitter->view,
|
||||
SubGhzViewTransmitterModel * model,
|
||||
|
@ -222,6 +234,10 @@ bool subghz_view_transmitter_input(InputEvent* event, void* context) {
|
|||
} 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(
|
||||
model->temp_button_id, "%01X", nice_flors_get_original_btn());
|
||||
model->draw_temp_button = true;
|
||||
}
|
||||
},
|
||||
true);
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <lib/subghz/protocols/keeloq.h>
|
||||
#include <lib/subghz/protocols/star_line.h>
|
||||
#include <lib/subghz/protocols/alutech_at_4n.h>
|
||||
#include <lib/subghz/protocols/nice_flor_s.h>
|
||||
|
||||
#define UNIRFMAP_FOLDER "/ext/unirf"
|
||||
#define UNIRFMAP_EXTENSION ".txt"
|
||||
|
@ -484,6 +485,7 @@ void unirfremix_tx_stop(UniRFRemix* app) {
|
|||
keeloq_reset_kl_type();
|
||||
keeloq_reset_original_btn();
|
||||
alutech_reset_original_btn();
|
||||
nice_flors_reset_original_btn();
|
||||
star_line_reset_mfname();
|
||||
star_line_reset_kl_type();
|
||||
}
|
||||
|
|
|
@ -2063,6 +2063,10 @@ Function,-,nfca_get_crc16,uint16_t,"uint8_t*, uint16_t"
|
|||
Function,-,nfca_signal_alloc,NfcaSignal*,
|
||||
Function,-,nfca_signal_encode,void,"NfcaSignal*, uint8_t*, uint16_t, uint8_t*"
|
||||
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_block,void,"NotificationApp*, const NotificationSequence*"
|
||||
Function,+,notification_message,void,"NotificationApp*, const NotificationSequence*"
|
||||
|
|
|
|
@ -84,6 +84,25 @@ const SubGhzProtocol subghz_protocol_nice_flor_s = {
|
|||
.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(
|
||||
SubGhzBlockGeneric* instance,
|
||||
const char* file_name);
|
||||
|
@ -128,6 +147,74 @@ static void subghz_protocol_encoder_nice_flor_s_get_upload(
|
|||
size_t index = 0;
|
||||
btn = instance->generic.btn;
|
||||
|
||||
// Save original button for later use
|
||||
if(n_btn_temp_id_original == 0) {
|
||||
n_btn_temp_id_original = btn;
|
||||
}
|
||||
|
||||
// Set custom button
|
||||
if(n_btn_temp_id == 1) {
|
||||
switch(n_btn_temp_id_original) {
|
||||
case 0x1:
|
||||
btn = 0x2;
|
||||
break;
|
||||
case 0x2:
|
||||
btn = 0x1;
|
||||
break;
|
||||
case 0x4:
|
||||
btn = 0x1;
|
||||
break;
|
||||
case 0x8:
|
||||
btn = 0x1;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(n_btn_temp_id == 2) {
|
||||
switch(n_btn_temp_id_original) {
|
||||
case 0x1:
|
||||
btn = 0x4;
|
||||
break;
|
||||
case 0x2:
|
||||
btn = 0x4;
|
||||
break;
|
||||
case 0x4:
|
||||
btn = 0x2;
|
||||
break;
|
||||
case 0x8:
|
||||
btn = 0x4;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(n_btn_temp_id == 3) {
|
||||
switch(n_btn_temp_id_original) {
|
||||
case 0x1:
|
||||
btn = 0x8;
|
||||
break;
|
||||
case 0x2:
|
||||
btn = 0x8;
|
||||
break;
|
||||
case 0x4:
|
||||
btn = 0x8;
|
||||
break;
|
||||
case 0x8:
|
||||
btn = 0x2;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if((n_btn_temp_id == 0) && (n_btn_temp_id_original != 0)) {
|
||||
btn = n_btn_temp_id_original;
|
||||
}
|
||||
|
||||
size_t size_upload = ((instance->generic.data_count_bit * 2) + ((37 + 2 + 2) * 2) * 16);
|
||||
if(size_upload > instance->encoder.size_upload) {
|
||||
FURI_LOG_E(TAG, "Size upload exceeds allocated encoder buffer.");
|
||||
|
@ -646,6 +733,11 @@ static void subghz_protocol_nice_flor_s_remote_controller(
|
|||
instance->serial = (decrypt >> 16) & 0xFFFFFFF;
|
||||
instance->btn = (decrypt >> 48) & 0xF;
|
||||
}
|
||||
|
||||
// Save original button for later use
|
||||
if(n_btn_temp_id_original == 0) {
|
||||
n_btn_temp_id_original = instance->btn;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t subghz_protocol_decoder_nice_flor_s_get_hash_data(void* context) {
|
||||
|
|
|
@ -11,6 +11,14 @@ extern const SubGhzProtocolDecoder subghz_protocol_nice_flor_s_decoder;
|
|||
extern const SubGhzProtocolEncoder subghz_protocol_nice_flor_s_encoder;
|
||||
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.
|
||||
* @param environment Pointer to a SubGhzEnvironment instance
|
||||
|
|
Loading…
Reference in a new issue