mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-22 05:14:46 -07:00
Merge pull request #956 from Dmitry422/dev
Add subghz signals button editor and refactor
This commit is contained in:
@@ -234,7 +234,6 @@ SubGhzTxRxStartTxState subghz_txrx_tx_start(SubGhzTxRx* instance, FlipperFormat*
|
||||
|
||||
SubGhzTxRxStartTxState ret = SubGhzTxRxStartTxStateErrorParserOthers;
|
||||
FuriString* temp_str = furi_string_alloc();
|
||||
uint32_t repeat = 200;
|
||||
do {
|
||||
if(!flipper_format_rewind(flipper_format)) {
|
||||
FURI_LOG_E(TAG, "Rewind error");
|
||||
@@ -244,10 +243,6 @@ SubGhzTxRxStartTxState subghz_txrx_tx_start(SubGhzTxRx* instance, FlipperFormat*
|
||||
FURI_LOG_E(TAG, "Missing Protocol");
|
||||
break;
|
||||
}
|
||||
if(!flipper_format_insert_or_update_uint32(flipper_format, "Repeat", &repeat, 1)) {
|
||||
FURI_LOG_E(TAG, "Unable Repeat");
|
||||
break;
|
||||
}
|
||||
ret = SubGhzTxRxStartTxStateOk;
|
||||
|
||||
SubGhzRadioPreset* preset = instance->preset;
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
#include <lib/subghz/blocks/custom_btn.h>
|
||||
|
||||
#include "applications/main/subghz/helpers/subghz_txrx_i.h"
|
||||
#include <lib/subghz/blocks/generic.h>
|
||||
|
||||
#define TAG "SubGhzSceneReceiverInfo"
|
||||
|
||||
void subghz_scene_receiver_info_callback(GuiButtonType result, InputType type, void* context) {
|
||||
@@ -133,25 +136,22 @@ bool subghz_scene_receiver_info_on_event(void* context, SceneManagerEvent event)
|
||||
subghz_txrx_hopper_unpause(subghz->txrx);
|
||||
subghz->state_notifications = SubGhzNotificationStateRx;
|
||||
} else {
|
||||
// key concept: we start endless TX until user release OK button, and after this we send last
|
||||
// protocols repeats - this guarantee that one press OK will
|
||||
// be guarantee send the required minimum protocol data packets
|
||||
// for all of this we use subghz_block_generic_global.endless_tx in protocols _yield function.
|
||||
subghz->state_notifications = SubGhzNotificationStateTx;
|
||||
subghz_block_generic_global.endless_tx = true;
|
||||
}
|
||||
return true;
|
||||
} else if(event.event == SubGhzCustomEventSceneReceiverInfoTxStop) {
|
||||
//CC1101 Stop Tx -> Start RX
|
||||
//CC1101 Stop Tx -> next tick event Start RX
|
||||
// user release OK
|
||||
// we switch off endless_tx - that mean protocols yield finish endless transmission,
|
||||
// send upload "repeat=xx" times, and after will be stoped by the tick event down in this code
|
||||
subghz->state_notifications = SubGhzNotificationStateIDLE;
|
||||
subghz_block_generic_global.endless_tx = false;
|
||||
|
||||
widget_reset(subghz->widget);
|
||||
subghz_scene_receiver_info_draw_widget(subghz);
|
||||
|
||||
subghz_txrx_stop(subghz->txrx);
|
||||
if(!scene_manager_has_previous_scene(subghz->scene_manager, SubGhzSceneDecodeRAW)) {
|
||||
subghz_txrx_rx_start(subghz->txrx);
|
||||
|
||||
subghz_txrx_hopper_unpause(subghz->txrx);
|
||||
if(!subghz_history_get_text_space_left(subghz->history, NULL)) {
|
||||
subghz->state_notifications = SubGhzNotificationStateRx;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else if(event.event == SubGhzCustomEventSceneReceiverInfoSave) {
|
||||
//CC1101 Stop RX -> Save
|
||||
@@ -188,6 +188,25 @@ bool subghz_scene_receiver_info_on_event(void* context, SceneManagerEvent event)
|
||||
notification_message(subghz->notifications, &sequence_blink_green_100);
|
||||
subghz->state_notifications = SubGhzNotificationStateRx;
|
||||
break;
|
||||
case SubGhzNotificationStateIDLE:
|
||||
// we wait until hardware TX finished and after stop TX and start RX, else just blink led
|
||||
if(!subghz_devices_is_async_complete_tx(subghz->txrx->radio_device)) {
|
||||
notification_message(subghz->notifications, &sequence_blink_magenta_10);
|
||||
} else {
|
||||
subghz_txrx_stop(subghz->txrx);
|
||||
// update screen
|
||||
widget_reset(subghz->widget);
|
||||
subghz_scene_receiver_info_draw_widget(subghz);
|
||||
|
||||
if(!scene_manager_has_previous_scene(subghz->scene_manager, SubGhzSceneDecodeRAW)) {
|
||||
subghz_txrx_rx_start(subghz->txrx);
|
||||
subghz_txrx_hopper_unpause(subghz->txrx);
|
||||
if(!subghz_history_get_text_space_left(subghz->history, NULL)) {
|
||||
subghz->state_notifications = SubGhzNotificationStateRx;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -11,10 +11,17 @@
|
||||
static uint32_t counter_mode = 0xff;
|
||||
static uint32_t counter32 = 0x0;
|
||||
static uint16_t counter16 = 0x0;
|
||||
static uint8_t byte_count = 0;
|
||||
static uint8_t* byte_ptr = NULL;
|
||||
static uint8_t cnt_byte_count = 0;
|
||||
static uint8_t* cnt_byte_ptr = NULL;
|
||||
|
||||
static FuriString* byte_input_text;
|
||||
|
||||
static uint8_t button = 0x0;
|
||||
static uint8_t btn_byte_count = 1;
|
||||
static uint8_t* btn_byte_ptr = NULL;
|
||||
|
||||
static uint8_t submenu_called = 0;
|
||||
|
||||
#define COUNTER_MODE_COUNT 7
|
||||
static const char* const counter_mode_text[COUNTER_MODE_COUNT] = {
|
||||
"System",
|
||||
@@ -68,6 +75,7 @@ void subghz_scene_signal_settings_variable_item_list_enter_callback(void* contex
|
||||
|
||||
// when we click OK on "Edit counter" item
|
||||
if(index == 1) {
|
||||
submenu_called = 1;
|
||||
furi_string_cat_printf(byte_input_text, "%i", subghz_block_generic_global.cnt_length_bit);
|
||||
furi_string_cat_str(byte_input_text, "-bits counter in HEX");
|
||||
|
||||
@@ -80,8 +88,27 @@ void subghz_scene_signal_settings_variable_item_list_enter_callback(void* contex
|
||||
subghz_scene_signal_settings_byte_input_callback,
|
||||
NULL,
|
||||
subghz,
|
||||
byte_ptr,
|
||||
byte_count);
|
||||
cnt_byte_ptr,
|
||||
cnt_byte_count);
|
||||
view_dispatcher_switch_to_view(subghz->view_dispatcher, SubGhzViewIdByteInput);
|
||||
}
|
||||
// when we click OK on "Edit button" item
|
||||
if(index == 2) {
|
||||
submenu_called = 2;
|
||||
furi_string_cat_printf(byte_input_text, "%i", subghz_block_generic_global.btn_length_bit);
|
||||
furi_string_cat_str(byte_input_text, "-bits button in HEX");
|
||||
|
||||
// Setup byte_input view
|
||||
ByteInput* byte_input = subghz->byte_input;
|
||||
byte_input_set_header_text(byte_input, furi_string_get_cstr(byte_input_text));
|
||||
|
||||
byte_input_set_result_callback(
|
||||
byte_input,
|
||||
subghz_scene_signal_settings_byte_input_callback,
|
||||
NULL,
|
||||
subghz,
|
||||
btn_byte_ptr,
|
||||
btn_byte_count);
|
||||
view_dispatcher_switch_to_view(subghz->view_dispatcher, SubGhzViewIdByteInput);
|
||||
}
|
||||
}
|
||||
@@ -131,44 +158,9 @@ void subghz_scene_signal_settings_on_enter(void* context) {
|
||||
flipper_format_free(fff_data_file);
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
// ### Counter edit section ###
|
||||
byte_input_text = furi_string_alloc_set_str("Enter ");
|
||||
bool counter_not_available = true;
|
||||
SubGhzProtocolDecoderBase* decoder = subghz_txrx_get_decoder(subghz->txrx);
|
||||
|
||||
// deserialaze and decode loaded sugbhz file and push data to subghz_block_generic_global variable
|
||||
if(subghz_protocol_decoder_base_deserialize(decoder, subghz_txrx_get_fff_data(subghz->txrx)) ==
|
||||
SubGhzProtocolStatusOk) {
|
||||
subghz_protocol_decoder_base_get_string(decoder, tmp_text);
|
||||
} else {
|
||||
FURI_LOG_E(TAG, "Cant deserialize this subghz file");
|
||||
}
|
||||
|
||||
if(!subghz_block_generic_global.cnt_is_available) {
|
||||
counter_mode = 0xff;
|
||||
FURI_LOG_D(TAG, "Counter mode and edit not available for this protocol");
|
||||
} else {
|
||||
counter_not_available = false;
|
||||
|
||||
// Check is there byte_count more than 2 hex bytes long or not
|
||||
// To show hex value we must correct revert bytes for ByteInput view with __bswapХХ
|
||||
if(subghz_block_generic_global.cnt_length_bit > 16) {
|
||||
counter32 = subghz_block_generic_global.current_cnt;
|
||||
furi_string_printf(tmp_text, "%lX", counter32);
|
||||
counter32 = __bswap32(counter32);
|
||||
byte_ptr = (uint8_t*)&counter32;
|
||||
byte_count = 4;
|
||||
} else {
|
||||
counter16 = subghz_block_generic_global.current_cnt;
|
||||
furi_string_printf(tmp_text, "%X", counter16);
|
||||
counter16 = __bswap16(counter16);
|
||||
byte_ptr = (uint8_t*)&counter16;
|
||||
byte_count = 2;
|
||||
}
|
||||
}
|
||||
|
||||
furi_assert(byte_ptr);
|
||||
furi_assert(byte_count > 0);
|
||||
bool button_not_available = true;
|
||||
|
||||
//Create and Enable/Disable variable_item_list depending on current values
|
||||
VariableItemList* variable_item_list = subghz->variable_item_list;
|
||||
@@ -187,15 +179,72 @@ void subghz_scene_signal_settings_on_enter(void* context) {
|
||||
subghz_scene_signal_settings_counter_mode_changed,
|
||||
subghz);
|
||||
value_index = value_index_int32(counter_mode, counter_mode_value, mode_count);
|
||||
|
||||
variable_item_set_current_value_index(item, value_index);
|
||||
variable_item_set_current_value_text(item, counter_mode_text[value_index]);
|
||||
variable_item_set_locked(item, (counter_mode == 0xff), "Not available\nfor this\nprotocol !");
|
||||
//
|
||||
|
||||
SubGhzProtocolDecoderBase* decoder = subghz_txrx_get_decoder(subghz->txrx);
|
||||
|
||||
// deserialaze and decode loaded sugbhz file and push data to subghz_block_generic_global variable
|
||||
if(subghz_protocol_decoder_base_deserialize(decoder, subghz_txrx_get_fff_data(subghz->txrx)) ==
|
||||
SubGhzProtocolStatusOk) {
|
||||
subghz_protocol_decoder_base_get_string(decoder, tmp_text);
|
||||
} else {
|
||||
FURI_LOG_E(TAG, "Cant deserialize this subghz file");
|
||||
}
|
||||
|
||||
// ### Counter edit section ###
|
||||
|
||||
if(!subghz_block_generic_global.cnt_is_available) {
|
||||
counter_mode = 0xff;
|
||||
FURI_LOG_D(TAG, "Counter mode and edit not available for this protocol");
|
||||
} else {
|
||||
counter_not_available = false;
|
||||
|
||||
// Check is there byte_count more than 2 hex bytes long or not
|
||||
// To show hex value we must correct revert bytes for ByteInput view with __bswapХХ
|
||||
if(subghz_block_generic_global.cnt_length_bit > 16) {
|
||||
counter32 = subghz_block_generic_global.current_cnt;
|
||||
furi_string_printf(tmp_text, "%lX", counter32);
|
||||
counter32 = __bswap32(counter32);
|
||||
cnt_byte_ptr = (uint8_t*)&counter32;
|
||||
cnt_byte_count = 4;
|
||||
} else {
|
||||
counter16 = subghz_block_generic_global.current_cnt;
|
||||
furi_string_printf(tmp_text, "%X", counter16);
|
||||
counter16 = __bswap16(counter16);
|
||||
cnt_byte_ptr = (uint8_t*)&counter16;
|
||||
cnt_byte_count = 2;
|
||||
}
|
||||
}
|
||||
|
||||
item = variable_item_list_add(variable_item_list, "Edit Counter", 1, NULL, subghz);
|
||||
variable_item_set_current_value_index(item, 0);
|
||||
variable_item_set_current_value_text(item, furi_string_get_cstr(tmp_text));
|
||||
variable_item_set_locked(item, (counter_not_available), "Not available\nfor this\nprotocol !");
|
||||
//
|
||||
|
||||
// ### Button edit section ###
|
||||
|
||||
if(!subghz_block_generic_global.btn_is_available) {
|
||||
FURI_LOG_D(TAG, "Button edit not available for this protocol");
|
||||
} else {
|
||||
button_not_available = false;
|
||||
button = subghz_block_generic_global.current_btn;
|
||||
furi_string_printf(tmp_text, "%X", button);
|
||||
btn_byte_ptr = (uint8_t*)&button;
|
||||
}
|
||||
|
||||
item = variable_item_list_add(variable_item_list, "Edit Button", 1, NULL, subghz);
|
||||
variable_item_set_current_value_index(item, 0);
|
||||
variable_item_set_current_value_text(item, furi_string_get_cstr(tmp_text));
|
||||
variable_item_set_locked(item, (button_not_available), "Not available\nfor this\nprotocol !");
|
||||
//
|
||||
|
||||
furi_assert(cnt_byte_ptr);
|
||||
furi_assert(cnt_byte_count > 0);
|
||||
furi_assert(btn_byte_ptr);
|
||||
|
||||
furi_string_free(tmp_text);
|
||||
|
||||
@@ -207,21 +256,40 @@ bool subghz_scene_signal_settings_on_event(void* context, SceneManagerEvent even
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
if(event.event == SubGhzCustomEventByteInputDone) {
|
||||
switch(byte_count) {
|
||||
switch(submenu_called) {
|
||||
// edit counter
|
||||
case 1:
|
||||
switch(cnt_byte_count) {
|
||||
case 2:
|
||||
// set new cnt value and override_flag to global variable and call transmit to generate and save subghz signal
|
||||
counter16 = __bswap16(counter16);
|
||||
subghz_block_generic_global_counter_override_set(counter16);
|
||||
subghz_tx_start(subghz, subghz_txrx_get_fff_data(subghz->txrx));
|
||||
subghz_txrx_stop(subghz->txrx);
|
||||
break;
|
||||
case 4:
|
||||
// the same for 32 bit Counter
|
||||
counter32 = __bswap32(counter32);
|
||||
subghz_block_generic_global_counter_override_set(counter32);
|
||||
subghz_tx_start(subghz, subghz_txrx_get_fff_data(subghz->txrx));
|
||||
subghz_txrx_stop(subghz->txrx);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
// edit button
|
||||
case 2:
|
||||
// set new cnt value and override_flag to global variable and call transmit to generate and save subghz signal
|
||||
counter16 = __bswap16(counter16);
|
||||
subghz_block_generic_global_counter_override_set(counter16);
|
||||
subghz_tx_start(subghz, subghz_txrx_get_fff_data(subghz->txrx));
|
||||
subghz_txrx_stop(subghz->txrx);
|
||||
break;
|
||||
case 4:
|
||||
// the same for 32 bit Counter
|
||||
counter32 = __bswap32(counter32);
|
||||
subghz_block_generic_global_counter_override_set(counter32);
|
||||
subghz_block_generic_global_button_override_set(button);
|
||||
// save counter mult to rewrite subghz singnal without changing counter
|
||||
int32_t tmp_counter = furi_hal_subghz_get_rolling_counter_mult();
|
||||
furi_hal_subghz_set_rolling_counter_mult(0);
|
||||
subghz_tx_start(subghz, subghz_txrx_get_fff_data(subghz->txrx));
|
||||
subghz_txrx_stop(subghz->txrx);
|
||||
// restore counter mult
|
||||
furi_hal_subghz_set_rolling_counter_mult(tmp_counter);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
|
||||
#include <lib/subghz/blocks/custom_btn.h>
|
||||
|
||||
#include <lib/subghz/devices/devices.c>
|
||||
#include "applications/main/subghz/helpers/subghz_txrx_i.h"
|
||||
#include "lib/subghz/blocks/generic.h"
|
||||
|
||||
#define TAG "SubGhzSceneTransmitter"
|
||||
|
||||
void subghz_scene_transmitter_callback(SubGhzCustomEvent event, void* context) {
|
||||
@@ -63,11 +67,16 @@ void subghz_scene_transmitter_on_enter(void* context) {
|
||||
}
|
||||
|
||||
bool subghz_scene_transmitter_on_event(void* context, SceneManagerEvent event) {
|
||||
// key concept: we start endless TX until user release OK button, and after this we send last
|
||||
// protocols repeats - this guarantee that one press OK will
|
||||
// be guarantee send the required minimum protocol data packets
|
||||
// for all of this we use subghz_block_generic_global.endless_tx in protocols _yield function.
|
||||
SubGhz* subghz = context;
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
if(event.event == SubGhzCustomEventViewTransmitterSendStart) {
|
||||
// user press OK - start endless TX
|
||||
subghz->state_notifications = SubGhzNotificationStateIDLE;
|
||||
|
||||
subghz_block_generic_global.endless_tx = true;
|
||||
if(subghz_tx_start(subghz, subghz_txrx_get_fff_data(subghz->txrx))) {
|
||||
subghz->state_notifications = SubGhzNotificationStateTx;
|
||||
subghz_scene_transmitter_update_data_show(subghz);
|
||||
@@ -75,24 +84,12 @@ bool subghz_scene_transmitter_on_event(void* context, SceneManagerEvent event) {
|
||||
}
|
||||
return true;
|
||||
} else if(event.event == SubGhzCustomEventViewTransmitterSendStop) {
|
||||
subghz->state_notifications = SubGhzNotificationStateIDLE;
|
||||
subghz_txrx_stop(subghz->txrx);
|
||||
if(subghz_custom_btn_get() != SUBGHZ_CUSTOM_BTN_OK) {
|
||||
subghz_custom_btn_set(SUBGHZ_CUSTOM_BTN_OK);
|
||||
int32_t tmp_counter = furi_hal_subghz_get_rolling_counter_mult();
|
||||
furi_hal_subghz_set_rolling_counter_mult(0);
|
||||
// Calling restore!
|
||||
subghz_tx_start(subghz, subghz_txrx_get_fff_data(subghz->txrx));
|
||||
subghz_txrx_stop(subghz->txrx);
|
||||
// Calling restore 2nd time special for FAAC SLH!
|
||||
// TODO: Find better way to restore after custom button is used!!!
|
||||
subghz_tx_start(subghz, subghz_txrx_get_fff_data(subghz->txrx));
|
||||
subghz_txrx_stop(subghz->txrx);
|
||||
furi_hal_subghz_set_rolling_counter_mult(tmp_counter);
|
||||
}
|
||||
// user release OK
|
||||
// we switch off endless_tx - that mean protocols yield finish endless transmission,
|
||||
// send upload "repeat=xx" times, and after will be stoped by tick event down this code.
|
||||
subghz_block_generic_global.endless_tx = false;
|
||||
return true;
|
||||
} else if(event.event == SubGhzCustomEventViewTransmitterBack) {
|
||||
subghz->state_notifications = SubGhzNotificationStateIDLE;
|
||||
scene_manager_search_and_switch_to_previous_scene(
|
||||
subghz->scene_manager, SubGhzSceneStart);
|
||||
return true;
|
||||
@@ -102,7 +99,28 @@ bool subghz_scene_transmitter_on_event(void* context, SceneManagerEvent event) {
|
||||
}
|
||||
} else if(event.type == SceneManagerEventTypeTick) {
|
||||
if(subghz->state_notifications == SubGhzNotificationStateTx) {
|
||||
notification_message(subghz->notifications, &sequence_blink_magenta_10);
|
||||
// if hardware TX still working at this time so we just blink led and return
|
||||
if(!subghz_devices_is_async_complete_tx(subghz->txrx->radio_device)) {
|
||||
notification_message(subghz->notifications, &sequence_blink_magenta_10);
|
||||
return true;
|
||||
// if hardware TX was stoped so we stop TX correctly
|
||||
} else {
|
||||
subghz->state_notifications = SubGhzNotificationStateIDLE;
|
||||
subghz_txrx_stop(subghz->txrx);
|
||||
if(subghz_custom_btn_get() != SUBGHZ_CUSTOM_BTN_OK) {
|
||||
subghz_custom_btn_set(SUBGHZ_CUSTOM_BTN_OK);
|
||||
int32_t tmp_counter = furi_hal_subghz_get_rolling_counter_mult();
|
||||
furi_hal_subghz_set_rolling_counter_mult(0);
|
||||
// Calling restore!
|
||||
subghz_tx_start(subghz, subghz_txrx_get_fff_data(subghz->txrx));
|
||||
subghz_txrx_stop(subghz->txrx);
|
||||
// Calling restore 2nd time special for FAAC SLH!
|
||||
// TODO: Find better way to restore after custom button is used!!!
|
||||
subghz_tx_start(subghz, subghz_txrx_get_fff_data(subghz->txrx));
|
||||
subghz_txrx_stop(subghz->txrx);
|
||||
furi_hal_subghz_set_rolling_counter_mult(tmp_counter);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -33,8 +33,12 @@ static uint8_t notification_settings_get_display_brightness(NotificationApp* app
|
||||
static uint8_t notification_settings_get_rgb_led_brightness(NotificationApp* app, uint8_t value);
|
||||
static uint32_t notification_settings_display_off_delay_ticks(NotificationApp* app);
|
||||
|
||||
// --- RGB BACKLIGHT ---
|
||||
// status of lcd backlight
|
||||
// used to ignore backlight_on event if backlight active now
|
||||
// prevent from extra ticking when key pressed with rgb_mod_installed
|
||||
static bool lcd_backligth_is_on = false;
|
||||
|
||||
// --- RGB BACKLIGHT ---
|
||||
// local variable for local use
|
||||
uint8_t rgb_backlight_installed_variable = 0;
|
||||
|
||||
@@ -330,6 +334,11 @@ static void notification_apply_notification_led_layer(
|
||||
layer->index = LayerNotification;
|
||||
// set layer
|
||||
layer->value[LayerNotification] = layer_value;
|
||||
|
||||
// if layer.light = LightBacklight and backlight active now then just exit.
|
||||
// prevent from extra ticking when key pressed with rgb_mod_installed
|
||||
if((layer->light == LightBacklight) & lcd_backligth_is_on) return;
|
||||
|
||||
// apply
|
||||
furi_hal_light_set(layer->light, layer->value[LayerNotification]);
|
||||
}
|
||||
@@ -371,11 +380,9 @@ static void notification_reset_notification_layer(
|
||||
}
|
||||
if(reset_mask & reset_display_mask) {
|
||||
if(!float_is_equal(display_brightness_set, app->settings.display_brightness)) {
|
||||
// --- NIGHT SHIFT ---
|
||||
furi_hal_light_set(
|
||||
LightBacklight,
|
||||
app->settings.display_brightness * 0xFF * app->current_night_shift * 1.0f);
|
||||
// --- NIGHT SHIFT END---
|
||||
}
|
||||
if(app->settings.display_off_delay_ms > 0) {
|
||||
furi_timer_start(
|
||||
@@ -460,26 +467,31 @@ static void notification_process_notification_message(
|
||||
while(notification_message != NULL) {
|
||||
switch(notification_message->type) {
|
||||
case NotificationMessageTypeLedDisplayBacklight:
|
||||
// if on - switch on and start timer
|
||||
// if off - switch off and stop timer
|
||||
// on timer - switch off
|
||||
// --- NIGHT SHIFT ---
|
||||
// if on (data.led.value =0xFF) - switch on and start timer
|
||||
// if off (data.led.value =0x0) - switch off and stop timer
|
||||
if(notification_message->data.led.value > 0x00) {
|
||||
// Backlight ON
|
||||
notification_apply_notification_led_layer(
|
||||
&app->display,
|
||||
notification_message->data.led.value * display_brightness_setting *
|
||||
app->current_night_shift * 1.0f);
|
||||
|
||||
reset_mask |= reset_display_mask;
|
||||
lcd_backligth_is_on = true;
|
||||
|
||||
//start rgb_mod_rainbow_timer when display backlight is ON and all corresponding settings is ON too
|
||||
rainbow_timer_starter(app);
|
||||
// --- NIGHT SHIFT END ---
|
||||
|
||||
} else {
|
||||
// Backlight OFF
|
||||
reset_mask &= ~reset_display_mask;
|
||||
notification_reset_notification_led_layer(&app->display);
|
||||
lcd_backligth_is_on = false;
|
||||
|
||||
if(furi_timer_is_running(app->display_timer)) {
|
||||
furi_timer_stop(app->display_timer);
|
||||
}
|
||||
|
||||
//stop rgb_mod_rainbow_timer when display backlight is OFF
|
||||
if(furi_timer_is_running(app->rainbow_timer)) {
|
||||
rainbow_timer_stop(app);
|
||||
@@ -487,13 +499,13 @@ static void notification_process_notification_message(
|
||||
}
|
||||
break;
|
||||
case NotificationMessageTypeLedDisplayBacklightEnforceOn:
|
||||
// --- NIGHT SHIFT ---
|
||||
if(!app->display_led_lock) {
|
||||
app->display_led_lock = true;
|
||||
notification_apply_internal_led_layer(
|
||||
&app->display,
|
||||
notification_message->data.led.value * display_brightness_setting *
|
||||
app->current_night_shift * 1.0f);
|
||||
lcd_backligth_is_on = true;
|
||||
}
|
||||
break;
|
||||
case NotificationMessageTypeLedDisplayBacklightEnforceAuto:
|
||||
@@ -505,7 +517,7 @@ static void notification_process_notification_message(
|
||||
app->current_night_shift * 1.0f);
|
||||
// --- NIGHT SHIFT END ---
|
||||
} else {
|
||||
FURI_LOG_E(TAG, "Incorrect BacklightEnforce use");
|
||||
FURI_LOG_E(TAG, "Incorrect BacklightEnforceAuto usage");
|
||||
}
|
||||
break;
|
||||
case NotificationMessageTypeLedRed:
|
||||
|
||||
@@ -17,7 +17,7 @@ void subghz_block_generic_global_counter_override_set(uint32_t counter) {
|
||||
|
||||
bool subghz_block_generic_global_counter_override_get(uint32_t* counter) {
|
||||
// if override flag was enabled then return succes TRUE and return overrided counter, else return success = FALSE
|
||||
// we cut counter bit length to available protocol bits length by the logical AND function
|
||||
// we cut counter bits length to available protocol bits length by the logical AND function
|
||||
if(subghz_block_generic_global.cnt_need_override) {
|
||||
*counter = subghz_block_generic_global.new_cnt &
|
||||
((0xFFFFFFFF >> (32 - subghz_block_generic_global.cnt_length_bit)));
|
||||
@@ -28,9 +28,30 @@ bool subghz_block_generic_global_counter_override_get(uint32_t* counter) {
|
||||
}
|
||||
}
|
||||
|
||||
void subghz_block_generic_global_button_override_set(uint8_t button) {
|
||||
subghz_block_generic_global.new_btn = button; // set global variable
|
||||
subghz_block_generic_global.btn_need_override = true; // set flag for protocols
|
||||
}
|
||||
|
||||
bool subghz_block_generic_global_button_override_get(uint8_t* button) {
|
||||
// if override flag was enabled then return succes TRUE and return overrided button, else return success = FALSE
|
||||
// we cut button bits length to available protocol bits length by the logical AND function
|
||||
if(subghz_block_generic_global.btn_need_override) {
|
||||
*button = subghz_block_generic_global.new_btn &
|
||||
((0xFF >> (8 - subghz_block_generic_global.btn_length_bit)));
|
||||
subghz_block_generic_global.btn_need_override = false;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void subghz_block_generic_global_reset(void* p) {
|
||||
UNUSED(p);
|
||||
// dont reset endless_tx, its used in protocols yield function to undless TX
|
||||
bool tmp = subghz_block_generic_global.endless_tx;
|
||||
memset(&subghz_block_generic_global, 0, sizeof(subghz_block_generic_global));
|
||||
subghz_block_generic_global.endless_tx = tmp;
|
||||
}
|
||||
|
||||
void subghz_block_generic_get_preset_name(const char* preset_name, FuriString* preset_str) {
|
||||
|
||||
@@ -30,28 +30,49 @@ struct SubGhzBlockGeneric {
|
||||
typedef struct SubGhzBlockGenericGlobal SubGhzBlockGenericGlobal;
|
||||
|
||||
struct SubGhzBlockGenericGlobal {
|
||||
uint32_t current_cnt; // global counter value;
|
||||
uint32_t new_cnt; // global counter value;
|
||||
uint32_t current_cnt; // current counter value;
|
||||
uint32_t new_cnt; // new counter value;
|
||||
bool cnt_need_override; // flag for protocols to override signals counter inside of protocols
|
||||
uint8_t cnt_length_bit; // counter length in bytes (used in counter editor giu)
|
||||
uint8_t cnt_length_bit; // counter length in bits (used in counter editor giu)
|
||||
bool cnt_is_available; // is there counter available for protocol (used in counter editor giu)
|
||||
|
||||
uint8_t current_btn; // current button value;
|
||||
uint8_t new_btn; // new button value;
|
||||
bool btn_need_override; // flag for protocols to override button inside of protocols
|
||||
uint8_t btn_length_bit; // button length in bits (used in counter editor giu)
|
||||
bool btn_is_available; // is there button available for protocol (used in button editor giu)
|
||||
|
||||
bool endless_tx; // used for endless/breakless transmission in subghz protols yield function (when user hold OK button)
|
||||
};
|
||||
|
||||
extern SubGhzBlockGenericGlobal subghz_block_generic_global; //global structure for subghz
|
||||
|
||||
/**
|
||||
* Setup SubGhzBlockGenericGlobal.cnt and cnt_need_override flag to be used in protocols;
|
||||
* Setup new_cnt and cnt_need_override flag to be used in protocols;
|
||||
* @param counter new counter value;
|
||||
*/
|
||||
void subghz_block_generic_global_counter_override_set(uint32_t counter);
|
||||
|
||||
/**
|
||||
* Return true if incomming variable was overrided by SubGhzBlockGenericGlobal.cnt
|
||||
* Return true if incomming variable was overrided by new_cnt
|
||||
* else return false and not change incomming variable
|
||||
* @param counter pointer to counter variable that must be changed
|
||||
*/
|
||||
bool subghz_block_generic_global_counter_override_get(uint32_t* counter);
|
||||
|
||||
/**
|
||||
* Setup new_btn and btn_need_override flag to be used in protocols;
|
||||
* @param button new button value;
|
||||
*/
|
||||
void subghz_block_generic_global_button_override_set(uint8_t button);
|
||||
|
||||
/**
|
||||
* Return true if incomming variable was overrided by new_btn
|
||||
* else return false and not change incomming variable
|
||||
* @param button pointer to counter variable that must be changed
|
||||
*/
|
||||
bool subghz_block_generic_global_button_override_get(uint8_t* button);
|
||||
|
||||
/**
|
||||
* Reset subghz_block_generic global structure;
|
||||
*/
|
||||
|
||||
@@ -94,7 +94,7 @@ void* subghz_protocol_encoder_alutech_at_4n_alloc(SubGhzEnvironment* environment
|
||||
instance->base.protocol = &subghz_protocol_alutech_at_4n;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 512;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -132,7 +132,7 @@ LevelDuration subghz_protocol_encoder_alutech_at_4n_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
@@ -400,6 +400,10 @@ static bool subghz_protocol_encoder_alutech_at_4n_get_upload(
|
||||
|
||||
btn = subghz_protocol_alutech_at_4n_get_btn_code();
|
||||
|
||||
// override button if we change it with signal settings button editor
|
||||
if(subghz_block_generic_global_button_override_get(&btn))
|
||||
FURI_LOG_D(TAG, "Button sucessfully changed to 0x%X", btn);
|
||||
|
||||
// Gen new key
|
||||
if(!subghz_protocol_alutech_at_4n_gen_data(instance, btn)) {
|
||||
return false;
|
||||
@@ -895,6 +899,10 @@ void subghz_protocol_decoder_alutech_at_4n_get_string(void* context, FuriString*
|
||||
subghz_block_generic_global.cnt_is_available = true;
|
||||
subghz_block_generic_global.cnt_length_bit = 16;
|
||||
subghz_block_generic_global.current_cnt = instance->generic.cnt;
|
||||
|
||||
subghz_block_generic_global.btn_is_available = true;
|
||||
subghz_block_generic_global.current_btn = instance->generic.btn;
|
||||
subghz_block_generic_global.btn_length_bit = 8;
|
||||
//
|
||||
|
||||
furi_string_cat_printf(
|
||||
|
||||
@@ -82,7 +82,7 @@ void* subghz_protocol_encoder_ansonic_alloc(SubGhzEnvironment* environment) {
|
||||
instance->base.protocol = &subghz_protocol_ansonic;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 52;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -180,7 +180,7 @@ LevelDuration subghz_protocol_encoder_ansonic_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
@@ -323,6 +323,13 @@ void subghz_protocol_decoder_ansonic_get_string(void* context, FuriString* outpu
|
||||
furi_assert(context);
|
||||
SubGhzProtocolDecoderAnsonic* instance = context;
|
||||
subghz_protocol_ansonic_check_remote_controller(&instance->generic);
|
||||
|
||||
// push protocol data to global variable
|
||||
subghz_block_generic_global.btn_is_available = false;
|
||||
subghz_block_generic_global.current_btn = instance->generic.btn;
|
||||
subghz_block_generic_global.btn_length_bit = 2;
|
||||
//
|
||||
|
||||
furi_string_cat_printf(
|
||||
output,
|
||||
"%s %dbit\r\n"
|
||||
|
||||
@@ -256,7 +256,7 @@ void* subghz_protocol_encoder_beninca_arc_alloc(SubGhzEnvironment* environment)
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
instance->keystore = subghz_environment_get_keystore(environment);
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 1;
|
||||
instance->encoder.size_upload = 800;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -350,6 +350,10 @@ static void subghz_protocol_beninca_arc_encoder_prepare_packets(
|
||||
// Generate new key using custom or default button
|
||||
instance->generic.btn = subghz_protocol_beninca_arc_get_btn_code();
|
||||
|
||||
// override button if we change it with signal settings button editor
|
||||
if(subghz_block_generic_global_button_override_get(&instance->generic.btn))
|
||||
FURI_LOG_D(TAG, "Button sucessfully changed to 0x%X", instance->generic.btn);
|
||||
|
||||
// Make 3 packets with different mini counter values - 2, 4, 6
|
||||
for(uint8_t i = 0; i < 3; i++) {
|
||||
subghz_protocol_beninca_arc_encrypt(
|
||||
@@ -477,7 +481,7 @@ LevelDuration subghz_protocol_encoder_beninca_arc_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
@@ -659,6 +663,11 @@ void subghz_protocol_decoder_beninca_arc_get_string(void* context, FuriString* o
|
||||
subghz_block_generic_global.cnt_length_bit = 32;
|
||||
subghz_block_generic_global.current_cnt = instance->generic.cnt;
|
||||
|
||||
subghz_block_generic_global.btn_is_available = true;
|
||||
subghz_block_generic_global.current_btn = instance->generic.btn;
|
||||
subghz_block_generic_global.btn_length_bit = 8;
|
||||
//
|
||||
|
||||
furi_string_printf(
|
||||
output,
|
||||
"%s %db\r\n"
|
||||
|
||||
@@ -91,7 +91,7 @@ void* subghz_protocol_encoder_bett_alloc(SubGhzEnvironment* environment) {
|
||||
instance->base.protocol = &subghz_protocol_bett;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 52;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -199,7 +199,7 @@ LevelDuration subghz_protocol_encoder_bett_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ void* subghz_protocol_encoder_bin_raw_alloc(SubGhzEnvironment* environment) {
|
||||
instance->base.protocol = &subghz_protocol_bin_raw;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = BIN_RAW_BUF_DATA_SIZE * 5;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->data = malloc(instance->encoder.size_upload * sizeof(uint8_t));
|
||||
@@ -342,7 +342,7 @@ LevelDuration subghz_protocol_encoder_bin_raw_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ void* subghz_protocol_encoder_came_alloc(SubGhzEnvironment* environment) {
|
||||
instance->base.protocol = &subghz_protocol_came;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 128;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -211,7 +211,7 @@ LevelDuration subghz_protocol_encoder_came_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ void* subghz_protocol_encoder_came_atomo_alloc(SubGhzEnvironment* environment) {
|
||||
instance->base.protocol = &subghz_protocol_came_atomo;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 1;
|
||||
instance->encoder.size_upload = 900; //actual size 766+
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -251,6 +251,10 @@ static void subghz_protocol_encoder_came_atomo_get_upload(
|
||||
btn = 0x6;
|
||||
}
|
||||
|
||||
// override button if we change it with signal settings button editor
|
||||
if(subghz_block_generic_global_button_override_get(&btn))
|
||||
FURI_LOG_D(TAG, "Button sucessfully changed to 0x%X", btn);
|
||||
|
||||
//Send header
|
||||
instance->encoder.upload[index++] =
|
||||
level_duration_make(true, (uint32_t)subghz_protocol_came_atomo_const.te_long * 15);
|
||||
@@ -430,7 +434,7 @@ LevelDuration subghz_protocol_encoder_came_atomo_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
@@ -829,6 +833,11 @@ void subghz_protocol_decoder_came_atomo_get_string(void* context, FuriString* ou
|
||||
subghz_block_generic_global.cnt_is_available = true;
|
||||
subghz_block_generic_global.cnt_length_bit = 16;
|
||||
subghz_block_generic_global.current_cnt = instance->generic.cnt;
|
||||
|
||||
subghz_block_generic_global.btn_is_available = true;
|
||||
subghz_block_generic_global.current_btn = instance->generic.btn;
|
||||
subghz_block_generic_global.btn_length_bit = 4;
|
||||
|
||||
//
|
||||
|
||||
furi_string_cat_printf(
|
||||
|
||||
@@ -109,7 +109,7 @@ void* subghz_protocol_encoder_came_twee_alloc(SubGhzEnvironment* environment) {
|
||||
instance->base.protocol = &subghz_protocol_came_twee;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 1536; //max upload 92*14 = 1288 !!!!
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -284,7 +284,7 @@ LevelDuration subghz_protocol_encoder_came_twee_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
@@ -444,6 +444,12 @@ void subghz_protocol_decoder_came_twee_get_string(void* context, FuriString* out
|
||||
uint32_t code_found_hi = instance->generic.data >> 32;
|
||||
uint32_t code_found_lo = instance->generic.data & 0x00000000ffffffff;
|
||||
|
||||
// push protocol data to global variable
|
||||
subghz_block_generic_global.btn_is_available = false;
|
||||
subghz_block_generic_global.current_btn = instance->generic.btn;
|
||||
subghz_block_generic_global.btn_length_bit = 4;
|
||||
//
|
||||
|
||||
furi_string_cat_printf(
|
||||
output,
|
||||
"%s %db\r\n"
|
||||
|
||||
@@ -105,7 +105,7 @@ void* subghz_protocol_encoder_chamb_code_alloc(SubGhzEnvironment* environment) {
|
||||
instance->base.protocol = &subghz_protocol_chamb_code;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 24;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -254,7 +254,7 @@ LevelDuration subghz_protocol_encoder_chamb_code_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ void* subghz_protocol_encoder_clemsa_alloc(SubGhzEnvironment* environment) {
|
||||
instance->base.protocol = &subghz_protocol_clemsa;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 52;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -199,7 +199,7 @@ LevelDuration subghz_protocol_encoder_clemsa_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
@@ -338,10 +338,17 @@ void subghz_protocol_decoder_clemsa_get_string(void* context, FuriString* output
|
||||
SubGhzProtocolDecoderClemsa* instance = context;
|
||||
subghz_protocol_clemsa_check_remote_controller(&instance->generic);
|
||||
//uint32_t data = (uint32_t)(instance->generic.data & 0xFFFFFF);
|
||||
|
||||
// push protocol data to global variable
|
||||
subghz_block_generic_global.btn_is_available = false;
|
||||
subghz_block_generic_global.current_btn = instance->generic.btn;
|
||||
subghz_block_generic_global.btn_length_bit = 2;
|
||||
//
|
||||
|
||||
furi_string_cat_printf(
|
||||
output,
|
||||
"%s %dbit\r\n"
|
||||
"Key:%05lX Btn %X\r\n"
|
||||
"Key:%05lX Btn:%X\r\n"
|
||||
" +: " DIP_PATTERN "\r\n"
|
||||
" o: " DIP_PATTERN "\r\n"
|
||||
" -: " DIP_PATTERN "\r\n",
|
||||
|
||||
@@ -132,7 +132,7 @@ void* subghz_protocol_encoder_dickert_mahs_alloc(SubGhzEnvironment* environment)
|
||||
instance->base.protocol = &subghz_protocol_dickert_mahs;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 128;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -237,7 +237,7 @@ LevelDuration subghz_protocol_encoder_dickert_mahs_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ void* subghz_protocol_encoder_doitrand_alloc(SubGhzEnvironment* environment) {
|
||||
instance->base.protocol = &subghz_protocol_doitrand;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 128;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -179,7 +179,7 @@ LevelDuration subghz_protocol_encoder_doitrand_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
@@ -333,6 +333,13 @@ void subghz_protocol_decoder_doitrand_get_string(void* context, FuriString* outp
|
||||
furi_assert(context);
|
||||
SubGhzProtocolDecoderDoitrand* instance = context;
|
||||
subghz_protocol_doitrand_check_remote_controller(&instance->generic);
|
||||
|
||||
// push protocol data to global variable
|
||||
subghz_block_generic_global.btn_is_available = false;
|
||||
subghz_block_generic_global.current_btn = instance->generic.btn;
|
||||
subghz_block_generic_global.btn_length_bit = 2;
|
||||
//
|
||||
|
||||
furi_string_cat_printf(
|
||||
output,
|
||||
"%s %dbit\r\n"
|
||||
|
||||
@@ -77,7 +77,7 @@ void* subghz_protocol_encoder_dooya_alloc(SubGhzEnvironment* environment) {
|
||||
instance->base.protocol = &subghz_protocol_dooya;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 128;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -189,7 +189,7 @@ LevelDuration subghz_protocol_encoder_dooya_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
@@ -418,16 +418,23 @@ void subghz_protocol_decoder_dooya_get_string(void* context, FuriString* output)
|
||||
|
||||
subghz_protocol_dooya_check_remote_controller(&instance->generic);
|
||||
|
||||
// push protocol data to global variable
|
||||
subghz_block_generic_global.btn_is_available = false;
|
||||
subghz_block_generic_global.current_btn = instance->generic.btn;
|
||||
subghz_block_generic_global.btn_length_bit = 8;
|
||||
//
|
||||
|
||||
furi_string_cat_printf(
|
||||
output,
|
||||
"%s %dbit\r\n"
|
||||
"Key:0x%010llX\r\n"
|
||||
"Sn:0x%08lX\r\n"
|
||||
"Btn:%s\r\n",
|
||||
"Btn:%X - %s\r\n",
|
||||
instance->generic.protocol_name,
|
||||
instance->generic.data_count_bit,
|
||||
instance->generic.data,
|
||||
instance->generic.serial,
|
||||
instance->generic.btn,
|
||||
subghz_protocol_dooya_get_name_button(instance->generic.btn));
|
||||
if(instance->generic.cnt == DOYA_SINGLE_CHANNEL) {
|
||||
furi_string_cat_printf(output, "Ch:Single\r\n");
|
||||
|
||||
@@ -73,7 +73,7 @@ void* subghz_protocol_encoder_elplast_alloc(SubGhzEnvironment* environment) {
|
||||
instance->base.protocol = &subghz_protocol_elplast;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 256;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -168,7 +168,7 @@ LevelDuration subghz_protocol_encoder_elplast_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ void* subghz_protocol_encoder_faac_slh_alloc(SubGhzEnvironment* environment) {
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
instance->keystore = subghz_environment_get_keystore(environment);
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 256;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -124,108 +124,115 @@ void subghz_protocol_encoder_faac_slh_free(void* context) {
|
||||
}
|
||||
|
||||
static bool subghz_protocol_faac_slh_gen_data(SubGhzProtocolEncoderFaacSLH* instance) {
|
||||
// TODO: Stupid bypass for custom button, remake later
|
||||
if(subghz_custom_btn_get_original() == 0) {
|
||||
subghz_custom_btn_set_original(0xF);
|
||||
}
|
||||
// override button if we change it with signal settings button editor
|
||||
// else work as standart
|
||||
if(subghz_block_generic_global_button_override_get(&instance->generic.btn)) {
|
||||
FURI_LOG_D(TAG, "Button sucessfully changed to 0x%X", instance->generic.btn);
|
||||
} else {
|
||||
// TODO: Stupid bypass for custom button, remake later
|
||||
if(subghz_custom_btn_get_original() == 0) {
|
||||
subghz_custom_btn_set_original(0xF);
|
||||
}
|
||||
|
||||
uint8_t custom_btn_id = subghz_custom_btn_get();
|
||||
uint8_t custom_btn_id = subghz_custom_btn_get();
|
||||
|
||||
// If we are using UP button - generate programming mode key and send it, otherwise - send regular key if possible
|
||||
if((custom_btn_id == SUBGHZ_CUSTOM_BTN_UP) &&
|
||||
!(!allow_zero_seed && (instance->generic.seed == 0x0))) {
|
||||
uint8_t data_tmp = 0;
|
||||
uint8_t data_prg[8];
|
||||
// If we are using UP button - generate programming mode key and send it, otherwise - send regular key if possible
|
||||
if((custom_btn_id == SUBGHZ_CUSTOM_BTN_UP) &&
|
||||
!(!allow_zero_seed && (instance->generic.seed == 0x0))) {
|
||||
uint8_t data_tmp = 0;
|
||||
uint8_t data_prg[8];
|
||||
|
||||
data_prg[0] = 0x00;
|
||||
data_prg[0] = 0x00;
|
||||
|
||||
if(allow_zero_seed || (instance->generic.seed != 0x0)) {
|
||||
// check OFEX mode
|
||||
if(furi_hal_subghz_get_rolling_counter_mult() != -0x7FFFFFFF) {
|
||||
// standart counter mode. PULL data from subghz_block_generic_global variables
|
||||
if(!subghz_block_generic_global_counter_override_get(&instance->generic.cnt)) {
|
||||
// if counter_override_get return FALSE then counter was not changed and we increase counter by standart mult value
|
||||
if((instance->generic.cnt + furi_hal_subghz_get_rolling_counter_mult()) >
|
||||
0xFFFFF) {
|
||||
instance->generic.cnt = 0;
|
||||
} else {
|
||||
instance->generic.cnt += furi_hal_subghz_get_rolling_counter_mult();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// TODO: OFEX mode
|
||||
instance->generic.cnt += 1;
|
||||
}
|
||||
|
||||
if(temp_counter_backup != 0x0) {
|
||||
if(allow_zero_seed || (instance->generic.seed != 0x0)) {
|
||||
// check OFEX mode
|
||||
if(furi_hal_subghz_get_rolling_counter_mult() != -0x7FFFFFFF) {
|
||||
// standart counter mode. PULL data from subghz_block_generic_global variables
|
||||
if(!subghz_block_generic_global_counter_override_get(&temp_counter_backup)) {
|
||||
if(!subghz_block_generic_global_counter_override_get(&instance->generic.cnt)) {
|
||||
// if counter_override_get return FALSE then counter was not changed and we increase counter by standart mult value
|
||||
if((temp_counter_backup + furi_hal_subghz_get_rolling_counter_mult()) >
|
||||
if((instance->generic.cnt + furi_hal_subghz_get_rolling_counter_mult()) >
|
||||
0xFFFFF) {
|
||||
temp_counter_backup = 0;
|
||||
instance->generic.cnt = 0;
|
||||
} else {
|
||||
temp_counter_backup += furi_hal_subghz_get_rolling_counter_mult();
|
||||
instance->generic.cnt += furi_hal_subghz_get_rolling_counter_mult();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// todo OFEX mode
|
||||
temp_counter_backup += 1;
|
||||
// TODO: OFEX mode
|
||||
instance->generic.cnt += 1;
|
||||
}
|
||||
|
||||
if(temp_counter_backup != 0x0) {
|
||||
// check OFEX mode
|
||||
if(furi_hal_subghz_get_rolling_counter_mult() != -0x7FFFFFFF) {
|
||||
// standart counter mode. PULL data from subghz_block_generic_global variables
|
||||
if(!subghz_block_generic_global_counter_override_get(
|
||||
&temp_counter_backup)) {
|
||||
// if counter_override_get return FALSE then counter was not changed and we increase counter by standart mult value
|
||||
if((temp_counter_backup + furi_hal_subghz_get_rolling_counter_mult()) >
|
||||
0xFFFFF) {
|
||||
temp_counter_backup = 0;
|
||||
} else {
|
||||
temp_counter_backup += furi_hal_subghz_get_rolling_counter_mult();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// todo OFEX mode
|
||||
temp_counter_backup += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data_prg[1] = instance->generic.cnt & 0xFF;
|
||||
data_prg[1] = instance->generic.cnt & 0xFF;
|
||||
|
||||
data_prg[2] = (uint8_t)(instance->generic.seed & 0xFF);
|
||||
data_prg[3] = (uint8_t)(instance->generic.seed >> 8 & 0xFF);
|
||||
data_prg[4] = (uint8_t)(instance->generic.seed >> 16 & 0xFF);
|
||||
data_prg[5] = (uint8_t)(instance->generic.seed >> 24);
|
||||
data_prg[2] = (uint8_t)(instance->generic.seed & 0xFF);
|
||||
data_prg[3] = (uint8_t)(instance->generic.seed >> 8 & 0xFF);
|
||||
data_prg[4] = (uint8_t)(instance->generic.seed >> 16 & 0xFF);
|
||||
data_prg[5] = (uint8_t)(instance->generic.seed >> 24);
|
||||
|
||||
data_prg[2] ^= data_prg[1];
|
||||
data_prg[3] ^= data_prg[1];
|
||||
data_prg[4] ^= data_prg[1];
|
||||
data_prg[5] ^= data_prg[1];
|
||||
data_prg[2] ^= data_prg[1];
|
||||
data_prg[3] ^= data_prg[1];
|
||||
data_prg[4] ^= data_prg[1];
|
||||
data_prg[5] ^= data_prg[1];
|
||||
|
||||
for(uint8_t i = data_prg[1] & 0x0F; i != 0; i--) {
|
||||
data_tmp = data_prg[5];
|
||||
for(uint8_t i = data_prg[1] & 0x0F; i != 0; i--) {
|
||||
data_tmp = data_prg[5];
|
||||
|
||||
data_prg[5] = ((data_prg[5] << 1) & 0xFF) | (data_prg[4] & 0x80) >> 7;
|
||||
data_prg[4] = ((data_prg[4] << 1) & 0xFF) | (data_prg[3] & 0x80) >> 7;
|
||||
data_prg[3] = ((data_prg[3] << 1) & 0xFF) | (data_prg[2] & 0x80) >> 7;
|
||||
data_prg[2] = ((data_prg[2] << 1) & 0xFF) | (data_tmp & 0x80) >> 7;
|
||||
}
|
||||
data_prg[6] = 0x0F;
|
||||
data_prg[7] = 0x52;
|
||||
data_prg[5] = ((data_prg[5] << 1) & 0xFF) | (data_prg[4] & 0x80) >> 7;
|
||||
data_prg[4] = ((data_prg[4] << 1) & 0xFF) | (data_prg[3] & 0x80) >> 7;
|
||||
data_prg[3] = ((data_prg[3] << 1) & 0xFF) | (data_prg[2] & 0x80) >> 7;
|
||||
data_prg[2] = ((data_prg[2] << 1) & 0xFF) | (data_tmp & 0x80) >> 7;
|
||||
}
|
||||
data_prg[6] = 0x0F;
|
||||
data_prg[7] = 0x52;
|
||||
|
||||
uint32_t enc_prg_1 = data_prg[7] << 24 | data_prg[6] << 16 | data_prg[5] << 8 |
|
||||
data_prg[4];
|
||||
uint32_t enc_prg_2 = data_prg[3] << 24 | data_prg[2] << 16 | data_prg[1] << 8 |
|
||||
data_prg[0];
|
||||
instance->generic.data = (uint64_t)enc_prg_1 << 32 | enc_prg_2;
|
||||
//FURI_LOG_D(TAG, "New Prog Mode Key Generated: %016llX\r", instance->generic.data);
|
||||
uint32_t enc_prg_1 = data_prg[7] << 24 | data_prg[6] << 16 | data_prg[5] << 8 |
|
||||
data_prg[4];
|
||||
uint32_t enc_prg_2 = data_prg[3] << 24 | data_prg[2] << 16 | data_prg[1] << 8 |
|
||||
data_prg[0];
|
||||
instance->generic.data = (uint64_t)enc_prg_1 << 32 | enc_prg_2;
|
||||
//FURI_LOG_D(TAG, "New Prog Mode Key Generated: %016llX\r", instance->generic.data);
|
||||
|
||||
return true;
|
||||
} else {
|
||||
if(!allow_zero_seed && (instance->generic.seed == 0x0)) {
|
||||
// Do not generate new data, send data from buffer
|
||||
return true;
|
||||
} else {
|
||||
if(!allow_zero_seed && (instance->generic.seed == 0x0)) {
|
||||
// Do not generate new data, send data from buffer
|
||||
return true;
|
||||
}
|
||||
// If we are in prog mode and regular Send button is used - Do not generate new data, send data from buffer
|
||||
if((faac_prog_mode == true) && (instance->generic.serial == 0x0) &&
|
||||
(instance->generic.btn == 0x0) && (temp_fix_backup == 0x0)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// If we are in prog mode and regular Send button is used - Do not generate new data, send data from buffer
|
||||
if((faac_prog_mode == true) && (instance->generic.serial == 0x0) &&
|
||||
(instance->generic.btn == 0x0) && (temp_fix_backup == 0x0)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// Restore main remote data when we exit programming mode
|
||||
if((instance->generic.serial == 0x0) && (instance->generic.btn == 0x0) &&
|
||||
(temp_fix_backup != 0x0) && !faac_prog_mode) {
|
||||
instance->generic.serial = temp_fix_backup >> 4;
|
||||
instance->generic.btn = temp_fix_backup & 0xF;
|
||||
if(temp_counter_backup != 0x0) {
|
||||
instance->generic.cnt = temp_counter_backup;
|
||||
// Restore main remote data when we exit programming mode
|
||||
if((instance->generic.serial == 0x0) && (instance->generic.btn == 0x0) &&
|
||||
(temp_fix_backup != 0x0) && !faac_prog_mode) {
|
||||
instance->generic.serial = temp_fix_backup >> 4;
|
||||
instance->generic.btn = temp_fix_backup & 0xF;
|
||||
if(temp_counter_backup != 0x0) {
|
||||
instance->generic.cnt = temp_counter_backup;
|
||||
}
|
||||
}
|
||||
}
|
||||
uint32_t fix = instance->generic.serial << 4 | instance->generic.btn;
|
||||
@@ -441,7 +448,7 @@ LevelDuration subghz_protocol_encoder_faac_slh_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
@@ -736,6 +743,11 @@ void subghz_protocol_decoder_faac_slh_get_string(void* context, FuriString* outp
|
||||
instance->generic.seed,
|
||||
(uint8_t)(instance->generic.cnt & 0xFF));
|
||||
} else if((allow_zero_seed == false) && (instance->generic.seed == 0x0)) {
|
||||
// push protocol data to global variable
|
||||
subghz_block_generic_global.btn_is_available = true;
|
||||
subghz_block_generic_global.current_btn = instance->generic.btn;
|
||||
subghz_block_generic_global.btn_length_bit = 4;
|
||||
//
|
||||
furi_string_cat_printf(
|
||||
output,
|
||||
"%s %dbit\r\n"
|
||||
@@ -756,6 +768,10 @@ void subghz_protocol_decoder_faac_slh_get_string(void* context, FuriString* outp
|
||||
subghz_block_generic_global.cnt_is_available = true;
|
||||
subghz_block_generic_global.cnt_length_bit = 20;
|
||||
subghz_block_generic_global.current_cnt = instance->generic.cnt;
|
||||
|
||||
subghz_block_generic_global.btn_is_available = true;
|
||||
subghz_block_generic_global.current_btn = instance->generic.btn;
|
||||
subghz_block_generic_global.btn_length_bit = 4;
|
||||
//
|
||||
|
||||
furi_string_cat_printf(
|
||||
|
||||
@@ -74,7 +74,7 @@ void* subghz_protocol_encoder_feron_alloc(SubGhzEnvironment* environment) {
|
||||
instance->base.protocol = &subghz_protocol_feron;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 256;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -188,7 +188,7 @@ LevelDuration subghz_protocol_encoder_feron_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ void* subghz_protocol_encoder_gangqi_alloc(SubGhzEnvironment* environment) {
|
||||
instance->base.protocol = &subghz_protocol_gangqi;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 256;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -169,6 +169,10 @@ static void subghz_protocol_encoder_gangqi_get_upload(SubGhzProtocolEncoderGangQ
|
||||
// Generate new key using custom or default button
|
||||
instance->generic.btn = subghz_protocol_gangqi_get_btn_code();
|
||||
|
||||
// override button if we change it with signal settings button editor
|
||||
if(subghz_block_generic_global_button_override_get(&instance->generic.btn))
|
||||
FURI_LOG_D(TAG, "Button sucessfully changed to 0x%X", instance->generic.btn);
|
||||
|
||||
uint16_t serial = (uint16_t)((instance->generic.data >> 18) & 0xFFFF);
|
||||
uint8_t const_and_button = (uint8_t)(0xD0 | instance->generic.btn);
|
||||
uint8_t serial_high = (uint8_t)(serial >> 8);
|
||||
@@ -295,7 +299,7 @@ LevelDuration subghz_protocol_encoder_gangqi_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
@@ -461,6 +465,12 @@ void subghz_protocol_decoder_gangqi_get_string(void* context, FuriString* output
|
||||
uint8_t sum_type1 = (uint8_t)(0xC8 - serial_high - serial_low - const_and_button);
|
||||
uint8_t sum_type2 = (uint8_t)(0x02 + serial_high + serial_low + const_and_button);
|
||||
|
||||
// push protocol data to global variable
|
||||
subghz_block_generic_global.btn_is_available = true;
|
||||
subghz_block_generic_global.current_btn = instance->generic.btn;
|
||||
subghz_block_generic_global.btn_length_bit = 4;
|
||||
//
|
||||
|
||||
furi_string_cat_printf(
|
||||
output,
|
||||
"%s %db\r\n"
|
||||
|
||||
@@ -75,7 +75,7 @@ void* subghz_protocol_encoder_gate_tx_alloc(SubGhzEnvironment* environment) {
|
||||
instance->base.protocol = &subghz_protocol_gate_tx;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 52; //max 24bit*2 + 2 (start, stop)
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -172,7 +172,7 @@ LevelDuration subghz_protocol_encoder_gate_tx_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
@@ -311,6 +311,13 @@ void subghz_protocol_decoder_gate_tx_get_string(void* context, FuriString* outpu
|
||||
furi_assert(context);
|
||||
SubGhzProtocolDecoderGateTx* instance = context;
|
||||
subghz_protocol_gate_tx_check_remote_controller(&instance->generic);
|
||||
|
||||
// push protocol data to global variable
|
||||
subghz_block_generic_global.btn_is_available = false;
|
||||
subghz_block_generic_global.current_btn = instance->generic.btn;
|
||||
subghz_block_generic_global.btn_length_bit = 4;
|
||||
//
|
||||
|
||||
furi_string_cat_printf(
|
||||
output,
|
||||
"%s %dbit\r\n"
|
||||
|
||||
@@ -75,7 +75,7 @@ void* subghz_protocol_encoder_hay21_alloc(SubGhzEnvironment* environment) {
|
||||
instance->base.protocol = &subghz_protocol_hay21;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 256;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -144,6 +144,10 @@ static void subghz_protocol_encoder_hay21_get_upload(SubGhzProtocolEncoderHay21*
|
||||
// Generate new key using custom or default button
|
||||
instance->generic.btn = subghz_protocol_hay21_get_btn_code();
|
||||
|
||||
// override button if we change it with signal settings button editor
|
||||
if(subghz_block_generic_global_button_override_get(&instance->generic.btn))
|
||||
FURI_LOG_D(TAG, "Button sucessfully changed to 0x%X", instance->generic.btn);
|
||||
|
||||
// Counter increment
|
||||
// Check for OFEX (overflow experimental) mode
|
||||
if(furi_hal_subghz_get_rolling_counter_mult() != -0x7FFFFFFF) {
|
||||
@@ -309,7 +313,7 @@ LevelDuration subghz_protocol_encoder_hay21_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
@@ -468,6 +472,11 @@ void subghz_protocol_decoder_hay21_get_string(void* context, FuriString* output)
|
||||
subghz_block_generic_global.cnt_length_bit = 8;
|
||||
subghz_block_generic_global.current_cnt = instance->generic.cnt;
|
||||
|
||||
subghz_block_generic_global.btn_is_available = true;
|
||||
subghz_block_generic_global.current_btn = instance->generic.btn;
|
||||
subghz_block_generic_global.btn_length_bit = 8;
|
||||
//
|
||||
|
||||
furi_string_cat_printf(
|
||||
output,
|
||||
"%s - %dbit\r\n"
|
||||
|
||||
@@ -76,7 +76,7 @@ void* subghz_protocol_encoder_hollarm_alloc(SubGhzEnvironment* environment) {
|
||||
instance->base.protocol = &subghz_protocol_hollarm;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 256;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -168,6 +168,10 @@ static void subghz_protocol_encoder_hollarm_get_upload(SubGhzProtocolEncoderHoll
|
||||
// Generate new key using custom or default button
|
||||
instance->generic.btn = subghz_protocol_hollarm_get_btn_code();
|
||||
|
||||
// override button if we change it with signal settings button editor
|
||||
if(subghz_block_generic_global_button_override_get(&instance->generic.btn))
|
||||
FURI_LOG_D(TAG, "Button sucessfully changed to 0x%X", instance->generic.btn);
|
||||
|
||||
uint64_t new_key = (instance->generic.data >> 12) << 12 | (instance->generic.btn << 8);
|
||||
|
||||
uint8_t bytesum = ((new_key >> 32) & 0xFF) + ((new_key >> 24) & 0xFF) +
|
||||
@@ -296,7 +300,7 @@ LevelDuration subghz_protocol_encoder_hollarm_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
@@ -468,6 +472,12 @@ void subghz_protocol_decoder_hollarm_get_string(void* context, FuriString* outpu
|
||||
((instance->generic.data >> 32) & 0xFF) + ((instance->generic.data >> 24) & 0xFF) +
|
||||
((instance->generic.data >> 16) & 0xFF) + ((instance->generic.data >> 8) & 0xFF);
|
||||
|
||||
// push protocol data to global variable
|
||||
subghz_block_generic_global.btn_is_available = true;
|
||||
subghz_block_generic_global.current_btn = instance->generic.btn;
|
||||
subghz_block_generic_global.btn_length_bit = 4;
|
||||
//
|
||||
|
||||
furi_string_cat_printf(
|
||||
output,
|
||||
"%s %db\r\n"
|
||||
|
||||
@@ -86,7 +86,7 @@ void* subghz_protocol_encoder_holtek_alloc(SubGhzEnvironment* environment) {
|
||||
instance->base.protocol = &subghz_protocol_holtek;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 128;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -185,7 +185,7 @@ LevelDuration subghz_protocol_encoder_holtek_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
@@ -344,6 +344,12 @@ void subghz_protocol_decoder_holtek_get_string(void* context, FuriString* output
|
||||
SubGhzProtocolDecoderHoltek* instance = context;
|
||||
subghz_protocol_holtek_check_remote_controller(&instance->generic);
|
||||
|
||||
// push protocol data to global variable
|
||||
subghz_block_generic_global.btn_is_available = false;
|
||||
subghz_block_generic_global.current_btn = instance->generic.btn;
|
||||
subghz_block_generic_global.btn_length_bit = 4;
|
||||
//
|
||||
|
||||
furi_string_cat_printf(
|
||||
output,
|
||||
"%s %dbit\r\n"
|
||||
|
||||
@@ -94,7 +94,7 @@ void* subghz_protocol_encoder_holtek_th12x_alloc(SubGhzEnvironment* environment)
|
||||
instance->base.protocol = &subghz_protocol_holtek_th12x;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 128;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -200,7 +200,7 @@ LevelDuration subghz_protocol_encoder_holtek_th12x_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
@@ -389,6 +389,12 @@ void subghz_protocol_decoder_holtek_th12x_get_string(void* context, FuriString*
|
||||
SubGhzProtocolDecoderHoltek_HT12X* instance = context;
|
||||
subghz_protocol_holtek_th12x_check_remote_controller(&instance->generic);
|
||||
|
||||
// push protocol data to global variable
|
||||
subghz_block_generic_global.btn_is_available = false;
|
||||
subghz_block_generic_global.current_btn = instance->generic.btn;
|
||||
subghz_block_generic_global.btn_length_bit = 4;
|
||||
//
|
||||
|
||||
furi_string_cat_printf(
|
||||
output,
|
||||
"%s %db\r\n"
|
||||
|
||||
@@ -244,7 +244,7 @@ LevelDuration subghz_protocol_encoder_honeywell_yield(void* context) {
|
||||
}
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
return ret;
|
||||
|
||||
@@ -88,7 +88,7 @@ void* subghz_protocol_encoder_honeywell_wdb_alloc(SubGhzEnvironment* environment
|
||||
instance->base.protocol = &subghz_protocol_honeywell_wdb;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 128;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -186,7 +186,7 @@ LevelDuration subghz_protocol_encoder_honeywell_wdb_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ void* subghz_protocol_encoder_hormann_alloc(SubGhzEnvironment* environment) {
|
||||
instance->base.protocol = &subghz_protocol_hormann;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 2048;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -110,7 +110,7 @@ static bool subghz_protocol_encoder_hormann_get_upload(SubGhzProtocolEncoderHorm
|
||||
} else {
|
||||
instance->encoder.size_upload = size_upload;
|
||||
}
|
||||
instance->encoder.repeat = 10; //original remote does 10 repeats
|
||||
instance->encoder.repeat = 3; //original remote does 10 repeats
|
||||
|
||||
for(size_t repeat = 0; repeat < 20; repeat++) {
|
||||
//Send start bit
|
||||
@@ -185,7 +185,7 @@ LevelDuration subghz_protocol_encoder_hormann_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
@@ -319,6 +319,12 @@ void subghz_protocol_decoder_hormann_get_string(void* context, FuriString* outpu
|
||||
SubGhzProtocolDecoderHormann* instance = context;
|
||||
subghz_protocol_hormann_check_remote_controller(&instance->generic);
|
||||
|
||||
// push protocol data to global variable
|
||||
subghz_block_generic_global.btn_is_available = false;
|
||||
subghz_block_generic_global.current_btn = instance->generic.btn;
|
||||
subghz_block_generic_global.btn_length_bit = 4;
|
||||
//
|
||||
|
||||
furi_string_cat_printf(
|
||||
output,
|
||||
"%s\r\n"
|
||||
|
||||
@@ -207,6 +207,12 @@ void subghz_protocol_decoder_ido_get_string(void* context, FuriString* output) {
|
||||
uint32_t code_fix = code_found_reverse & 0xFFFFFF;
|
||||
uint32_t code_hop = (code_found_reverse >> 24) & 0xFFFFFF;
|
||||
|
||||
// push protocol data to global variable
|
||||
subghz_block_generic_global.btn_is_available = false;
|
||||
subghz_block_generic_global.current_btn = instance->generic.btn;
|
||||
subghz_block_generic_global.btn_length_bit = 4;
|
||||
//
|
||||
|
||||
furi_string_cat_printf(
|
||||
output,
|
||||
"%s %dbit\r\n"
|
||||
|
||||
@@ -86,7 +86,7 @@ void* subghz_protocol_encoder_intertechno_v3_alloc(SubGhzEnvironment* environmen
|
||||
instance->base.protocol = &subghz_protocol_intertechno_v3;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 256;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -207,7 +207,7 @@ LevelDuration subghz_protocol_encoder_intertechno_v3_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
@@ -444,6 +444,10 @@ void subghz_protocol_decoder_intertechno_v3_get_string(void* context, FuriString
|
||||
|
||||
subghz_protocol_intertechno_v3_check_remote_controller(&instance->generic);
|
||||
|
||||
// push protocol data to global variable
|
||||
subghz_block_generic_global.current_btn = instance->generic.btn;
|
||||
//
|
||||
|
||||
furi_string_cat_printf(
|
||||
output,
|
||||
"%.11s %db\r\n"
|
||||
@@ -459,12 +463,16 @@ void subghz_protocol_decoder_intertechno_v3_get_string(void* context, FuriString
|
||||
if(instance->generic.cnt >> 5) {
|
||||
furi_string_cat_printf(
|
||||
output, "Ch: All Btn:%s\r\n", (instance->generic.btn ? "On" : "Off"));
|
||||
subghz_block_generic_global.btn_is_available = false;
|
||||
subghz_block_generic_global.btn_length_bit = 1;
|
||||
} else {
|
||||
furi_string_cat_printf(
|
||||
output,
|
||||
"Ch:" CH_PATTERN " Btn:%s\r\n",
|
||||
CNT_TO_CH(instance->generic.cnt),
|
||||
(instance->generic.btn ? "On" : "Off"));
|
||||
subghz_block_generic_global.btn_is_available = false;
|
||||
subghz_block_generic_global.btn_length_bit = 1;
|
||||
}
|
||||
} else if(instance->generic.data_count_bit == INTERTECHNO_V3_DIMMING_COUNT_BIT) {
|
||||
furi_string_cat_printf(
|
||||
@@ -472,5 +480,7 @@ void subghz_protocol_decoder_intertechno_v3_get_string(void* context, FuriString
|
||||
"Ch:" CH_PATTERN " Dimm:%d%%\r\n",
|
||||
CNT_TO_CH(instance->generic.cnt),
|
||||
(int)(6.67f * (float)instance->generic.btn));
|
||||
subghz_block_generic_global.btn_is_available = false;
|
||||
subghz_block_generic_global.btn_length_bit = 4;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ void* subghz_protocol_encoder_jarolift_alloc(SubGhzEnvironment* environment) {
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
instance->keystore = subghz_environment_get_keystore(environment);
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 256;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -131,7 +131,7 @@ LevelDuration subghz_protocol_encoder_jarolift_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
@@ -152,6 +152,10 @@ static bool
|
||||
|
||||
btn = subghz_protocol_jarolift_get_btn_code();
|
||||
|
||||
// override button if we change it with signal settings button editor
|
||||
if(subghz_block_generic_global_button_override_get(&btn))
|
||||
FURI_LOG_D(TAG, "Button sucessfully changed to 0x%X", btn);
|
||||
|
||||
// Check for OFEX (overflow experimental) mode
|
||||
if(furi_hal_subghz_get_rolling_counter_mult() != -0x7FFFFFFF) {
|
||||
// standart counter mode. PULL data from subghz_block_generic_global variables
|
||||
@@ -760,6 +764,11 @@ void subghz_protocol_decoder_jarolift_get_string(void* context, FuriString* outp
|
||||
subghz_block_generic_global.cnt_length_bit = 16;
|
||||
subghz_block_generic_global.current_cnt = instance->generic.cnt;
|
||||
|
||||
subghz_block_generic_global.btn_is_available = true;
|
||||
subghz_block_generic_global.current_btn = instance->generic.btn;
|
||||
subghz_block_generic_global.btn_length_bit = 4;
|
||||
//
|
||||
|
||||
furi_string_cat_printf(
|
||||
output,
|
||||
"%s %dbit\r\n"
|
||||
|
||||
@@ -135,6 +135,10 @@ static bool subghz_protocol_keeloq_gen_data(
|
||||
SubGhzProtocolEncoderKeeloq* instance,
|
||||
uint8_t btn,
|
||||
bool counter_up) {
|
||||
// override button if we change it with signal settings button editor
|
||||
if(subghz_block_generic_global_button_override_get(&btn))
|
||||
FURI_LOG_D(TAG, "Button sucessfully changed to 0x%X", btn);
|
||||
|
||||
uint32_t fix = (uint32_t)btn << 28 | instance->generic.serial;
|
||||
uint32_t hop = 0;
|
||||
uint64_t man = 0;
|
||||
@@ -1512,9 +1516,16 @@ void subghz_protocol_decoder_keeloq_get_string(void* context, FuriString* output
|
||||
uint32_t code_found_reverse_lo = code_found_reverse & 0x00000000ffffffff;
|
||||
|
||||
if(strcmp(instance->manufacture_name, "BFT") == 0) {
|
||||
// push protocol data to global variable
|
||||
subghz_block_generic_global.cnt_is_available = true;
|
||||
subghz_block_generic_global.cnt_length_bit = 16;
|
||||
subghz_block_generic_global.current_cnt = instance->generic.cnt;
|
||||
|
||||
subghz_block_generic_global.btn_is_available = true;
|
||||
subghz_block_generic_global.current_btn = instance->generic.btn;
|
||||
subghz_block_generic_global.btn_length_bit = 4;
|
||||
//
|
||||
|
||||
ProgMode prog_mode = subghz_custom_btn_get_prog_mode();
|
||||
if(prog_mode == PROG_MODE_KEELOQ_BFT) {
|
||||
furi_string_cat_printf(
|
||||
@@ -1554,6 +1565,9 @@ void subghz_protocol_decoder_keeloq_get_string(void* context, FuriString* output
|
||||
instance->generic.seed);
|
||||
}
|
||||
} else if(strcmp(instance->manufacture_name, "Unknown") == 0) {
|
||||
subghz_block_generic_global.btn_is_available = true;
|
||||
subghz_block_generic_global.current_btn = instance->generic.btn;
|
||||
subghz_block_generic_global.btn_length_bit = 4;
|
||||
instance->generic.cnt = 0x0;
|
||||
furi_string_cat_printf(
|
||||
output,
|
||||
@@ -1574,6 +1588,9 @@ void subghz_protocol_decoder_keeloq_get_string(void* context, FuriString* output
|
||||
subghz_block_generic_global.cnt_is_available = true;
|
||||
subghz_block_generic_global.cnt_length_bit = 16;
|
||||
subghz_block_generic_global.current_cnt = instance->generic.cnt;
|
||||
subghz_block_generic_global.btn_is_available = true;
|
||||
subghz_block_generic_global.current_btn = instance->generic.btn;
|
||||
subghz_block_generic_global.btn_length_bit = 4;
|
||||
furi_string_cat_printf(
|
||||
output,
|
||||
"%s %dbit\r\n"
|
||||
|
||||
@@ -101,7 +101,7 @@ void* subghz_protocol_encoder_kinggates_stylo_4k_alloc(SubGhzEnvironment* enviro
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
instance->keystore = subghz_environment_get_keystore(environment);
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 512;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -132,7 +132,7 @@ LevelDuration subghz_protocol_encoder_kinggates_stylo_4k_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
@@ -154,6 +154,10 @@ static bool subghz_protocol_kinggates_stylo_4k_gen_data(
|
||||
|
||||
btn = subghz_protocol_kinggates_stylo_4k_get_btn_code();
|
||||
|
||||
// override button if we change it with signal settings button editor
|
||||
if(subghz_block_generic_global_button_override_get(&btn))
|
||||
FURI_LOG_D(TAG, "Button sucessfully changed to 0x%X", btn);
|
||||
|
||||
// Check for OFEX (overflow experimental) mode
|
||||
if(furi_hal_subghz_get_rolling_counter_mult() != -0x7FFFFFFF) {
|
||||
// standart counter mode. PULL data from subghz_block_generic_global variables
|
||||
@@ -727,6 +731,11 @@ void subghz_protocol_decoder_kinggates_stylo_4k_get_string(void* context, FuriSt
|
||||
subghz_block_generic_global.cnt_length_bit = 16;
|
||||
subghz_block_generic_global.current_cnt = instance->generic.cnt;
|
||||
|
||||
subghz_block_generic_global.btn_is_available = true;
|
||||
subghz_block_generic_global.current_btn = instance->generic.btn;
|
||||
subghz_block_generic_global.btn_length_bit = 4;
|
||||
//
|
||||
|
||||
furi_string_cat_printf(
|
||||
output,
|
||||
"%s\r\n"
|
||||
|
||||
@@ -81,7 +81,7 @@ void* subghz_protocol_encoder_legrand_alloc(SubGhzEnvironment* environment) {
|
||||
instance->base.protocol = &subghz_protocol_legrand;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = subghz_protocol_legrand_const.min_count_bit_for_found * 2 + 1;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -185,7 +185,7 @@ LevelDuration subghz_protocol_encoder_legrand_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ void* subghz_protocol_encoder_linear_alloc(SubGhzEnvironment* environment) {
|
||||
instance->base.protocol = &subghz_protocol_linear;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 28; //max 10bit*2 + 2 (start, stop)
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -190,7 +190,7 @@ LevelDuration subghz_protocol_encoder_linear_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ void* subghz_protocol_encoder_linear_delta3_alloc(SubGhzEnvironment* environment
|
||||
instance->base.protocol = &subghz_protocol_linear_delta3;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 16;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -194,7 +194,7 @@ LevelDuration subghz_protocol_encoder_linear_delta3_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ void* subghz_protocol_encoder_magellan_alloc(SubGhzEnvironment* environment) {
|
||||
instance->base.protocol = &subghz_protocol_magellan;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 256;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -196,7 +196,7 @@ LevelDuration subghz_protocol_encoder_magellan_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
@@ -499,6 +499,13 @@ void subghz_protocol_decoder_magellan_get_string(void* context, FuriString* outp
|
||||
furi_assert(context);
|
||||
SubGhzProtocolDecoderMagellan* instance = context;
|
||||
subghz_protocol_magellan_check_remote_controller(&instance->generic);
|
||||
|
||||
// push protocol data to global variable
|
||||
subghz_block_generic_global.btn_is_available = false;
|
||||
subghz_block_generic_global.current_btn = instance->generic.btn;
|
||||
subghz_block_generic_global.btn_length_bit = 8;
|
||||
//
|
||||
|
||||
furi_string_cat_printf(
|
||||
output,
|
||||
"%s %dbit\r\n"
|
||||
|
||||
@@ -77,7 +77,7 @@ void* subghz_protocol_encoder_marantec_alloc(SubGhzEnvironment* environment) {
|
||||
instance->base.protocol = &subghz_protocol_marantec;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 256;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -243,7 +243,7 @@ LevelDuration subghz_protocol_encoder_marantec_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
@@ -393,6 +393,12 @@ void subghz_protocol_decoder_marantec_get_string(void* context, FuriString* outp
|
||||
uint8_t crc = subghz_protocol_marantec_crc8(tdata, sizeof(tdata));
|
||||
bool crc_ok = (crc == (instance->generic.data & 0xFF));
|
||||
|
||||
// push protocol data to global variable
|
||||
subghz_block_generic_global.btn_is_available = false;
|
||||
subghz_block_generic_global.current_btn = instance->generic.btn;
|
||||
subghz_block_generic_global.btn_length_bit = 4;
|
||||
//
|
||||
|
||||
furi_string_cat_printf(
|
||||
output,
|
||||
"%s %db\r\n"
|
||||
|
||||
@@ -73,7 +73,7 @@ void* subghz_protocol_encoder_marantec24_alloc(SubGhzEnvironment* environment) {
|
||||
instance->base.protocol = &subghz_protocol_marantec24;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 256;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -183,7 +183,7 @@ LevelDuration subghz_protocol_encoder_marantec24_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
@@ -332,6 +332,12 @@ void subghz_protocol_decoder_marantec24_get_string(void* context, FuriString* ou
|
||||
|
||||
subghz_protocol_marantec24_check_remote_controller(&instance->generic);
|
||||
|
||||
// push protocol data to global variable
|
||||
subghz_block_generic_global.btn_is_available = false;
|
||||
subghz_block_generic_global.current_btn = instance->generic.btn;
|
||||
subghz_block_generic_global.btn_length_bit = 4;
|
||||
//
|
||||
|
||||
furi_string_cat_printf(
|
||||
output,
|
||||
"%s %db\r\n"
|
||||
|
||||
@@ -89,7 +89,7 @@ void* subghz_protocol_encoder_mastercode_alloc(SubGhzEnvironment* environment) {
|
||||
instance->base.protocol = &subghz_protocol_mastercode;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 72;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -199,7 +199,7 @@ LevelDuration subghz_protocol_encoder_mastercode_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
@@ -343,10 +343,17 @@ void subghz_protocol_decoder_mastercode_get_string(void* context, FuriString* ou
|
||||
furi_assert(context);
|
||||
SubGhzProtocolDecoderMastercode* instance = context;
|
||||
subghz_protocol_mastercode_check_remote_controller(&instance->generic);
|
||||
|
||||
// push protocol data to global variable
|
||||
subghz_block_generic_global.btn_is_available = false;
|
||||
subghz_block_generic_global.current_btn = instance->generic.btn;
|
||||
subghz_block_generic_global.btn_length_bit = 2;
|
||||
//
|
||||
|
||||
furi_string_cat_printf(
|
||||
output,
|
||||
"%s %dbit\r\n"
|
||||
"Key:%llX Btn %X\r\n"
|
||||
"Key:%llX Btn:%X\r\n"
|
||||
" +: " DIP_PATTERN "\r\n"
|
||||
" o: " DIP_PATTERN "\r\n"
|
||||
" -: " DIP_PATTERN "\r\n",
|
||||
|
||||
@@ -87,7 +87,7 @@ void* subghz_protocol_encoder_megacode_alloc(SubGhzEnvironment* environment) {
|
||||
instance->base.protocol = &subghz_protocol_megacode;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 52;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -218,7 +218,7 @@ LevelDuration subghz_protocol_encoder_megacode_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
@@ -405,6 +405,12 @@ void subghz_protocol_decoder_megacode_get_string(void* context, FuriString* outp
|
||||
SubGhzProtocolDecoderMegaCode* instance = context;
|
||||
subghz_protocol_megacode_check_remote_controller(&instance->generic);
|
||||
|
||||
// push protocol data to global variable
|
||||
subghz_block_generic_global.btn_is_available = false;
|
||||
subghz_block_generic_global.current_btn = instance->generic.btn;
|
||||
subghz_block_generic_global.btn_length_bit = 3;
|
||||
//
|
||||
|
||||
furi_string_cat_printf(
|
||||
output,
|
||||
"%s %dbit\r\n"
|
||||
|
||||
@@ -77,7 +77,7 @@ void* subghz_protocol_encoder_nero_radio_alloc(SubGhzEnvironment* environment) {
|
||||
instance->base.protocol = &subghz_protocol_nero_radio;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 256;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -210,7 +210,7 @@ LevelDuration subghz_protocol_encoder_nero_radio_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
@@ -430,6 +430,12 @@ void subghz_protocol_decoder_nero_radio_get_string(void* context, FuriString* ou
|
||||
|
||||
subghz_protocol_nero_radio_parse_data(&instance->generic);
|
||||
|
||||
// push protocol data to global variable
|
||||
subghz_block_generic_global.btn_is_available = false;
|
||||
subghz_block_generic_global.current_btn = instance->generic.btn;
|
||||
subghz_block_generic_global.btn_length_bit = 4;
|
||||
//
|
||||
|
||||
furi_string_cat_printf(
|
||||
output,
|
||||
"%s %dbit\r\n"
|
||||
|
||||
@@ -76,7 +76,7 @@ void* subghz_protocol_encoder_nero_sketch_alloc(SubGhzEnvironment* environment)
|
||||
instance->base.protocol = &subghz_protocol_nero_sketch;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 256;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -191,7 +191,7 @@ LevelDuration subghz_protocol_encoder_nero_sketch_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ void* subghz_protocol_encoder_nice_flo_alloc(SubGhzEnvironment* environment) {
|
||||
instance->base.protocol = &subghz_protocol_nice_flo;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 52; //max 24bit*2 + 2 (start, stop)
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -177,7 +177,7 @@ LevelDuration subghz_protocol_encoder_nice_flo_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ void* subghz_protocol_encoder_nice_flor_s_alloc(SubGhzEnvironment* environment)
|
||||
FURI_LOG_D(
|
||||
TAG, "Loading rainbow table from %s", instance->nice_flor_s_rainbow_table_file_name);
|
||||
}
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 1;
|
||||
instance->encoder.size_upload = 2400; //wrong!! upload 186*16 = 2976 - actual size about 1728
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -147,6 +147,10 @@ static void subghz_protocol_encoder_nice_flor_s_get_upload(
|
||||
|
||||
btn = subghz_protocol_nice_flor_s_get_btn_code();
|
||||
|
||||
// override button if we change it with signal settings button editor
|
||||
if(subghz_block_generic_global_button_override_get(&btn))
|
||||
FURI_LOG_D(TAG, "Button sucessfully changed to 0x%X", btn);
|
||||
|
||||
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.");
|
||||
@@ -349,7 +353,7 @@ LevelDuration subghz_protocol_encoder_nice_flor_s_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
@@ -937,6 +941,11 @@ void subghz_protocol_decoder_nice_flor_s_get_string(void* context, FuriString* o
|
||||
subghz_block_generic_global.cnt_length_bit = 16;
|
||||
subghz_block_generic_global.current_cnt = instance->generic.cnt;
|
||||
|
||||
subghz_block_generic_global.btn_is_available = true;
|
||||
subghz_block_generic_global.current_btn = instance->generic.btn;
|
||||
subghz_block_generic_global.btn_length_bit = 4;
|
||||
//
|
||||
|
||||
if(instance->generic.data_count_bit == NICE_ONE_COUNT_BIT) {
|
||||
furi_string_cat_printf(
|
||||
output,
|
||||
|
||||
@@ -77,7 +77,7 @@ void* subghz_protocol_encoder_phoenix_v2_alloc(SubGhzEnvironment* environment) {
|
||||
instance->base.protocol = &subghz_protocol_phoenix_v2;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 128;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -118,9 +118,11 @@ bool subghz_protocol_phoenix_v2_create_data(
|
||||
local_data_rev, instance->generic.cnt);
|
||||
|
||||
instance->generic.data = subghz_protocol_blocks_reverse_key(
|
||||
(uint64_t)(((uint64_t)encrypted_counter << 40) | ((uint64_t)instance->generic.btn << 32) |
|
||||
(uint64_t)instance->generic.serial),
|
||||
instance->generic.data_count_bit + 4);
|
||||
(uint64_t)(((uint64_t)encrypted_counter << 40) |
|
||||
((uint64_t)instance->generic.btn << 32) |
|
||||
(uint64_t)instance->generic.serial),
|
||||
instance->generic.data_count_bit + 4) &
|
||||
0xFFFFFFFFFFFFF;
|
||||
|
||||
return SubGhzProtocolStatusOk ==
|
||||
subghz_block_generic_serialize(&instance->generic, flipper_format, preset);
|
||||
@@ -253,6 +255,10 @@ static bool
|
||||
// This will override the btn variable if a custom button is set
|
||||
btn = subghz_protocol_phoenix_v2_get_btn_code();
|
||||
|
||||
// override button if we change it with signal settings button editor
|
||||
if(subghz_block_generic_global_button_override_get(&btn))
|
||||
FURI_LOG_D(TAG, "Button sucessfully changed to 0x%X", btn);
|
||||
|
||||
// Reconstruction of the data
|
||||
if(v2_phoenix_counter_mode == 0) {
|
||||
// Check for OFEX (overflow experimental) mode
|
||||
@@ -403,7 +409,7 @@ LevelDuration subghz_protocol_encoder_phoenix_v2_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
@@ -652,6 +658,11 @@ void subghz_protocol_decoder_phoenix_v2_get_string(void* context, FuriString* ou
|
||||
subghz_block_generic_global.cnt_length_bit = 16;
|
||||
subghz_block_generic_global.current_cnt = instance->generic.cnt;
|
||||
|
||||
subghz_block_generic_global.btn_is_available = true;
|
||||
subghz_block_generic_global.current_btn = instance->generic.btn;
|
||||
subghz_block_generic_global.btn_length_bit = 4;
|
||||
//
|
||||
|
||||
furi_string_cat_printf(
|
||||
output,
|
||||
"V2 Phoenix %dbit\r\n"
|
||||
|
||||
@@ -85,7 +85,7 @@ void* subghz_protocol_encoder_power_smart_alloc(SubGhzEnvironment* environment)
|
||||
instance->base.protocol = &subghz_protocol_power_smart;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 1024;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -236,7 +236,7 @@ LevelDuration subghz_protocol_encoder_power_smart_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
@@ -369,6 +369,12 @@ void subghz_protocol_decoder_power_smart_get_string(void* context, FuriString* o
|
||||
SubGhzProtocolDecoderPowerSmart* instance = context;
|
||||
subghz_protocol_power_smart_remote_controller(&instance->generic);
|
||||
|
||||
// push protocol data to global variable
|
||||
subghz_block_generic_global.btn_is_available = false;
|
||||
subghz_block_generic_global.current_btn = instance->generic.btn;
|
||||
subghz_block_generic_global.btn_length_bit = 2;
|
||||
//
|
||||
|
||||
furi_string_cat_printf(
|
||||
output,
|
||||
"%s %db\r\n"
|
||||
|
||||
@@ -93,7 +93,7 @@ void* subghz_protocol_encoder_princeton_alloc(SubGhzEnvironment* environment) {
|
||||
instance->base.protocol = &subghz_protocol_princeton;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 52; //max 24bit*2 + 2 (start, stop)
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -257,6 +257,10 @@ static bool
|
||||
// Generate new key using custom or default button
|
||||
instance->generic.btn = subghz_protocol_princeton_get_btn_code();
|
||||
|
||||
// override button if we change it with signal settings button editor
|
||||
if(subghz_block_generic_global_button_override_get(&instance->generic.btn))
|
||||
FURI_LOG_D(TAG, "Button sucessfully changed to 0x%X", instance->generic.btn);
|
||||
|
||||
// Reconstruction of the data
|
||||
// If we have 8bit button code move serial to left by 8 bits (and 4 if 4 bits)
|
||||
if(instance->generic.btn == 0x30 || instance->generic.btn == 0xC0) {
|
||||
@@ -410,7 +414,7 @@ LevelDuration subghz_protocol_encoder_princeton_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
@@ -590,8 +594,14 @@ void subghz_protocol_decoder_princeton_get_string(void* context, FuriString* out
|
||||
uint32_t data_rev = subghz_protocol_blocks_reverse_key(
|
||||
instance->generic.data, instance->generic.data_count_bit);
|
||||
|
||||
// push protocol data to global variable
|
||||
subghz_block_generic_global.btn_is_available = true;
|
||||
subghz_block_generic_global.current_btn = instance->generic.btn;
|
||||
//
|
||||
|
||||
if(instance->generic.btn == 0x30 || instance->generic.btn == 0xC0 ||
|
||||
instance->generic.btn == 0xF3 || instance->generic.btn == 0xFC) {
|
||||
subghz_block_generic_global.btn_length_bit = 8;
|
||||
furi_string_cat_printf(
|
||||
output,
|
||||
"%s %dbit\r\n"
|
||||
@@ -610,6 +620,7 @@ void subghz_protocol_decoder_princeton_get_string(void* context, FuriString* out
|
||||
instance->te,
|
||||
instance->guard_time);
|
||||
} else {
|
||||
subghz_block_generic_global.btn_length_bit = 4;
|
||||
furi_string_cat_printf(
|
||||
output,
|
||||
"%s %dbit\r\n"
|
||||
|
||||
@@ -78,7 +78,7 @@ void* subghz_protocol_encoder_revers_rb2_alloc(SubGhzEnvironment* environment) {
|
||||
instance->base.protocol = &subghz_protocol_revers_rb2;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 256;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -204,7 +204,7 @@ LevelDuration subghz_protocol_encoder_revers_rb2_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ void* subghz_protocol_encoder_roger_alloc(SubGhzEnvironment* environment) {
|
||||
instance->base.protocol = &subghz_protocol_roger;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 256;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -178,6 +178,10 @@ static void subghz_protocol_encoder_roger_get_upload(SubGhzProtocolEncoderRoger*
|
||||
// This will override the btn variable if a custom button is set
|
||||
btn = subghz_protocol_roger_get_btn_code();
|
||||
|
||||
// override button if we change it with signal settings button editor
|
||||
if(subghz_block_generic_global_button_override_get(&btn))
|
||||
FURI_LOG_D(TAG, "Button sucessfully changed to 0x%X", btn);
|
||||
|
||||
// If End is not == button - transmit as is, no custom button allowed
|
||||
// For "End" values 23 and 20 - transmit correct ending used for their buttons
|
||||
if((instance->generic.data & 0xFF) == instance->generic.btn) {
|
||||
@@ -303,7 +307,7 @@ LevelDuration subghz_protocol_encoder_roger_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
@@ -433,6 +437,12 @@ void subghz_protocol_decoder_roger_get_string(void* context, FuriString* output)
|
||||
|
||||
subghz_protocol_roger_check_remote_controller(&instance->generic);
|
||||
|
||||
// push protocol data to global variable
|
||||
subghz_block_generic_global.btn_is_available = true;
|
||||
subghz_block_generic_global.current_btn = instance->generic.btn;
|
||||
subghz_block_generic_global.btn_length_bit = 4;
|
||||
//
|
||||
|
||||
furi_string_cat_printf(
|
||||
output,
|
||||
"%s %db\r\n"
|
||||
|
||||
@@ -98,7 +98,7 @@ void* subghz_protocol_encoder_secplus_v1_alloc(SubGhzEnvironment* environment) {
|
||||
instance->base.protocol = &subghz_protocol_secplus_v1;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 128;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -344,7 +344,7 @@ LevelDuration subghz_protocol_encoder_secplus_v1_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
@@ -586,6 +586,11 @@ void subghz_protocol_decoder_secplus_v1_get_string(void* context, FuriString* ou
|
||||
subghz_block_generic_global.cnt_length_bit = 32;
|
||||
subghz_block_generic_global.current_cnt = instance->generic.cnt;
|
||||
|
||||
subghz_block_generic_global.btn_is_available = false;
|
||||
subghz_block_generic_global.current_btn = instance->generic.btn;
|
||||
subghz_block_generic_global.btn_length_bit = 2;
|
||||
//
|
||||
|
||||
furi_string_cat_printf(
|
||||
output,
|
||||
"%s %db\r\n"
|
||||
|
||||
@@ -92,7 +92,7 @@ void* subghz_protocol_encoder_secplus_v2_alloc(SubGhzEnvironment* environment) {
|
||||
instance->base.protocol = &subghz_protocol_secplus_v2;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 256;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -395,6 +395,10 @@ static void subghz_protocol_secplus_v2_encode(SubGhzProtocolEncoderSecPlus_v2* i
|
||||
|
||||
instance->generic.btn = subghz_protocol_secplus_v2_get_btn_code();
|
||||
|
||||
// override button if we change it with signal settings button editor
|
||||
if(subghz_block_generic_global_button_override_get(&instance->generic.btn))
|
||||
FURI_LOG_D(TAG, "Button sucessfully changed to 0x%X", instance->generic.btn);
|
||||
|
||||
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};
|
||||
@@ -623,7 +627,7 @@ LevelDuration subghz_protocol_encoder_secplus_v2_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
@@ -966,6 +970,11 @@ void subghz_protocol_decoder_secplus_v2_get_string(void* context, FuriString* ou
|
||||
subghz_block_generic_global.cnt_length_bit = 28;
|
||||
subghz_block_generic_global.current_cnt = instance->generic.cnt;
|
||||
|
||||
subghz_block_generic_global.btn_is_available = true;
|
||||
subghz_block_generic_global.current_btn = instance->generic.btn;
|
||||
subghz_block_generic_global.btn_length_bit = 8;
|
||||
//
|
||||
|
||||
furi_string_cat_printf(
|
||||
output,
|
||||
"%s %db\r\n"
|
||||
|
||||
@@ -101,7 +101,7 @@ void* subghz_protocol_encoder_smc5326_alloc(SubGhzEnvironment* environment) {
|
||||
instance->base.protocol = &subghz_protocol_smc5326;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 128;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -208,7 +208,7 @@ LevelDuration subghz_protocol_encoder_smc5326_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ void* subghz_protocol_encoder_somfy_keytis_alloc(SubGhzEnvironment* environment)
|
||||
instance->base.protocol = &subghz_protocol_somfy_keytis;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 512;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -130,6 +130,10 @@ static bool
|
||||
instance->generic.cnt = (data >> 24) & 0xFFFF;
|
||||
instance->generic.serial = data & 0xFFFFFF;
|
||||
|
||||
// override button if we change it with signal settings button editor
|
||||
if(subghz_block_generic_global_button_override_get(&instance->generic.btn))
|
||||
FURI_LOG_D(TAG, "Button sucessfully changed to 0x%X", instance->generic.btn);
|
||||
|
||||
// Check for OFEX (overflow experimental) mode
|
||||
if(furi_hal_subghz_get_rolling_counter_mult() != -0x7FFFFFFF) {
|
||||
// standart counter mode. PULL data from subghz_block_generic_global variables
|
||||
@@ -455,7 +459,7 @@ LevelDuration subghz_protocol_encoder_somfy_keytis_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
@@ -801,13 +805,18 @@ void subghz_protocol_decoder_somfy_keytis_get_string(void* context, FuriString*
|
||||
subghz_block_generic_global.cnt_length_bit = 16;
|
||||
subghz_block_generic_global.current_cnt = instance->generic.cnt;
|
||||
|
||||
subghz_block_generic_global.btn_is_available = true;
|
||||
subghz_block_generic_global.current_btn = instance->generic.btn;
|
||||
subghz_block_generic_global.btn_length_bit = 4;
|
||||
//
|
||||
|
||||
furi_string_cat_printf(
|
||||
output,
|
||||
"%s %db\r\n"
|
||||
"%lX%08lX%06lX\r\n"
|
||||
"Sn:0x%06lX \r\n"
|
||||
"Cnt:%04lX\r\n"
|
||||
"Btn:%s\r\n",
|
||||
"Btn:%X - %s\r\n",
|
||||
|
||||
instance->generic.protocol_name,
|
||||
instance->generic.data_count_bit,
|
||||
@@ -816,5 +825,6 @@ void subghz_protocol_decoder_somfy_keytis_get_string(void* context, FuriString*
|
||||
instance->press_duration_counter,
|
||||
instance->generic.serial,
|
||||
instance->generic.cnt,
|
||||
instance->generic.btn,
|
||||
subghz_protocol_somfy_keytis_get_name_button(instance->generic.btn));
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ void* subghz_protocol_encoder_somfy_telis_alloc(SubGhzEnvironment* environment)
|
||||
instance->base.protocol = &subghz_protocol_somfy_telis;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 512;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -124,6 +124,10 @@ static bool subghz_protocol_somfy_telis_gen_data(
|
||||
|
||||
btn = subghz_protocol_somfy_telis_get_btn_code();
|
||||
|
||||
// override button if we change it with signal settings button editor
|
||||
if(subghz_block_generic_global_button_override_get(&btn))
|
||||
FURI_LOG_D(TAG, "Button sucessfully changed to 0x%X", btn);
|
||||
|
||||
// Check for OFEX (overflow experimental) mode
|
||||
if(furi_hal_subghz_get_rolling_counter_mult() != -0x7FFFFFFF) {
|
||||
// standart counter mode. PULL data from subghz_block_generic_global variables
|
||||
@@ -384,7 +388,7 @@ LevelDuration subghz_protocol_encoder_somfy_telis_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
@@ -758,13 +762,18 @@ void subghz_protocol_decoder_somfy_telis_get_string(void* context, FuriString* o
|
||||
subghz_block_generic_global.cnt_length_bit = 16;
|
||||
subghz_block_generic_global.current_cnt = instance->generic.cnt;
|
||||
|
||||
subghz_block_generic_global.btn_is_available = true;
|
||||
subghz_block_generic_global.current_btn = instance->generic.btn;
|
||||
subghz_block_generic_global.btn_length_bit = 4;
|
||||
//
|
||||
|
||||
furi_string_cat_printf(
|
||||
output,
|
||||
"%s %db\r\n"
|
||||
"Key:0x%lX%08lX\r\n"
|
||||
"Sn:0x%06lX \r\n"
|
||||
"Cnt:%04lX\r\n"
|
||||
"Btn:%s\r\n",
|
||||
"Btn:%X - %s\r\n",
|
||||
|
||||
instance->generic.protocol_name,
|
||||
instance->generic.data_count_bit,
|
||||
@@ -772,5 +781,6 @@ void subghz_protocol_decoder_somfy_telis_get_string(void* context, FuriString* o
|
||||
(uint32_t)instance->generic.data,
|
||||
instance->generic.serial,
|
||||
instance->generic.cnt,
|
||||
instance->generic.btn,
|
||||
subghz_protocol_somfy_telis_get_name_button(instance->generic.btn));
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ void* subghz_protocol_encoder_treadmill37_alloc(SubGhzEnvironment* environment)
|
||||
instance->base.protocol = &subghz_protocol_treadmill37;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.repeat = 3;
|
||||
instance->encoder.size_upload = 256;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
@@ -179,7 +179,7 @@ LevelDuration subghz_protocol_encoder_treadmill37_yield(void* context) {
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
@@ -333,6 +333,13 @@ void subghz_protocol_decoder_treadmill37_get_string(void* context, FuriString* o
|
||||
uint64_t code_found_reverse = subghz_protocol_blocks_reverse_key(
|
||||
instance->generic.data, instance->generic.data_count_bit);
|
||||
|
||||
// for future use
|
||||
// // push protocol data to global variable
|
||||
// subghz_block_generic_global.btn_is_available = false;
|
||||
// subghz_block_generic_global.current_btn = instance->generic.btn;
|
||||
// subghz_block_generic_global.btn_length_bit = 4;
|
||||
// //
|
||||
|
||||
furi_string_cat_printf(
|
||||
output,
|
||||
"%s %db\r\n"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
entry,status,name,type,params
|
||||
Version,+,87.4,,
|
||||
Version,+,87.5,,
|
||||
Header,+,applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.h,,
|
||||
Header,+,applications/services/applications.h,,
|
||||
Header,+,applications/services/bt/bt_service/bt.h,,
|
||||
@@ -3613,6 +3613,8 @@ Function,-,strxfrm_l,size_t,"char*, const char*, size_t, locale_t"
|
||||
Function,+,subghz_block_generic_deserialize,SubGhzProtocolStatus,"SubGhzBlockGeneric*, FlipperFormat*"
|
||||
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_global_button_override_get,_Bool,uint8_t*
|
||||
Function,+,subghz_block_generic_global_button_override_set,void,uint8_t
|
||||
Function,+,subghz_block_generic_global_counter_override_get,_Bool,uint32_t*
|
||||
Function,+,subghz_block_generic_global_counter_override_set,void,uint32_t
|
||||
Function,+,subghz_block_generic_global_reset,void,void*
|
||||
|
||||
|
@@ -677,10 +677,12 @@ static inline uint32_t furi_hal_subghz_async_tx_middleware_get_duration(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// here we fill DMA buffer by signal durations until we recieve duration=0 (that mean protocol give as full data = signal_size*repeats)
|
||||
// or until we reach the end of required samples count
|
||||
static void furi_hal_subghz_async_tx_refill(uint32_t* buffer, size_t samples) {
|
||||
furi_check(furi_hal_subghz.state == SubGhzStateAsyncTx);
|
||||
|
||||
// furi_hal_subghz_async_tx.callback - linked to protocols "_yield" function
|
||||
// and return one current LevelDuration from protocol upload buffer.
|
||||
while(samples > 0) {
|
||||
volatile uint32_t duration = furi_hal_subghz_async_tx_middleware_get_duration(
|
||||
&furi_hal_subghz_async_tx.middleware, furi_hal_subghz_async_tx.callback);
|
||||
|
||||
Reference in New Issue
Block a user