mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-11-27 13:58:47 +03:00
SubGhz: refactoring move txrx
This commit is contained in:
parent
9b3654c1f0
commit
d7f3b8a425
@ -1,4 +1,4 @@
|
||||
#include "subghz_radio.h"
|
||||
#include "subghz_txrx.h"
|
||||
#include <lib/subghz/protocols/protocol_items.h>
|
||||
|
||||
#define TAG "SubGhz"
|
||||
@ -21,7 +21,6 @@ struct SubGhzTxRx {
|
||||
SubGhzHopperState hopper_state;
|
||||
|
||||
SubGhzTxRxState txrx_state;
|
||||
|
||||
SubGhzSpeakerState speaker_state;
|
||||
|
||||
SubGhzTxRxNeedSaveCallback need_save_callback;
|
||||
@ -31,79 +30,81 @@ struct SubGhzTxRx {
|
||||
};
|
||||
|
||||
SubGhzTxRx* subghz_txrx_alloc() {
|
||||
SubGhzTxRx* txrx = malloc(sizeof(SubGhzTxRx));
|
||||
txrx->setting = subghz_setting_alloc();
|
||||
subghz_setting_load(txrx->setting, EXT_PATH("subghz/assets/setting_user"));
|
||||
SubGhzTxRx* instance = malloc(sizeof(SubGhzTxRx));
|
||||
instance->setting = subghz_setting_alloc();
|
||||
subghz_setting_load(instance->setting, EXT_PATH("subghz/assets/setting_user"));
|
||||
|
||||
txrx->preset = malloc(sizeof(SubGhzRadioPreset));
|
||||
txrx->preset->name = furi_string_alloc();
|
||||
subghz_set_preset(txrx, "AM650", subghz_setting_get_default_frequency(txrx->setting), NULL, 0);
|
||||
instance->preset = malloc(sizeof(SubGhzRadioPreset));
|
||||
instance->preset->name = furi_string_alloc();
|
||||
subghz_txrx_set_preset(
|
||||
instance, "AM650", subghz_setting_get_default_frequency(instance->setting), NULL, 0);
|
||||
|
||||
txrx->txrx_state = SubGhzTxRxStateSleep;
|
||||
instance->txrx_state = SubGhzTxRxStateSleep;
|
||||
|
||||
subghz_hopper_set_state(txrx, SubGhzHopperStateOFF);
|
||||
subghz_speaker_set_state(txrx, SubGhzSpeakerStateDisable);
|
||||
subghz_txrx_set_debug_pin_state(txrx, false);
|
||||
subghz_txrx_hopper_set_state(instance, SubGhzHopperStateOFF);
|
||||
subghz_txrx_speaker_set_state(instance, SubGhzSpeakerStateDisable);
|
||||
subghz_txrx_set_debug_pin_state(instance, false);
|
||||
|
||||
txrx->worker = subghz_worker_alloc();
|
||||
txrx->fff_data = flipper_format_string_alloc();
|
||||
instance->worker = subghz_worker_alloc();
|
||||
instance->fff_data = flipper_format_string_alloc();
|
||||
|
||||
txrx->environment = subghz_environment_alloc();
|
||||
txrx->load_database = subghz_environment_load_keystore(
|
||||
txrx->environment, EXT_PATH("subghz/assets/keeloq_mfcodes"));
|
||||
instance->environment = subghz_environment_alloc();
|
||||
instance->load_database = subghz_environment_load_keystore(
|
||||
instance->environment, EXT_PATH("subghz/assets/keeloq_mfcodes"));
|
||||
subghz_environment_load_keystore(
|
||||
txrx->environment, EXT_PATH("subghz/assets/keeloq_mfcodes_user"));
|
||||
instance->environment, EXT_PATH("subghz/assets/keeloq_mfcodes_user"));
|
||||
subghz_environment_set_came_atomo_rainbow_table_file_name(
|
||||
txrx->environment, EXT_PATH("subghz/assets/came_atomo"));
|
||||
instance->environment, EXT_PATH("subghz/assets/came_atomo"));
|
||||
subghz_environment_set_alutech_at_4n_rainbow_table_file_name(
|
||||
txrx->environment, EXT_PATH("subghz/assets/alutech_at_4n"));
|
||||
instance->environment, EXT_PATH("subghz/assets/alutech_at_4n"));
|
||||
subghz_environment_set_nice_flor_s_rainbow_table_file_name(
|
||||
txrx->environment, EXT_PATH("subghz/assets/nice_flor_s"));
|
||||
subghz_environment_set_protocol_registry(txrx->environment, (void*)&subghz_protocol_registry);
|
||||
txrx->receiver = subghz_receiver_alloc_init(txrx->environment);
|
||||
instance->environment, EXT_PATH("subghz/assets/nice_flor_s"));
|
||||
subghz_environment_set_protocol_registry(
|
||||
instance->environment, (void*)&subghz_protocol_registry);
|
||||
instance->receiver = subghz_receiver_alloc_init(instance->environment);
|
||||
|
||||
subghz_worker_set_overrun_callback(
|
||||
txrx->worker, (SubGhzWorkerOverrunCallback)subghz_receiver_reset);
|
||||
instance->worker, (SubGhzWorkerOverrunCallback)subghz_receiver_reset);
|
||||
subghz_worker_set_pair_callback(
|
||||
txrx->worker, (SubGhzWorkerPairCallback)subghz_receiver_decode);
|
||||
subghz_worker_set_context(txrx->worker, txrx->receiver);
|
||||
instance->worker, (SubGhzWorkerPairCallback)subghz_receiver_decode);
|
||||
subghz_worker_set_context(instance->worker, instance->receiver);
|
||||
|
||||
return txrx;
|
||||
return instance;
|
||||
}
|
||||
|
||||
void subghz_txrx_free(SubGhzTxRx* txrx) {
|
||||
furi_assert(txrx);
|
||||
void subghz_txrx_free(SubGhzTxRx* instance) {
|
||||
furi_assert(instance);
|
||||
|
||||
subghz_worker_free(txrx->worker);
|
||||
subghz_receiver_free(txrx->receiver);
|
||||
subghz_environment_free(txrx->environment);
|
||||
flipper_format_free(txrx->fff_data);
|
||||
furi_string_free(txrx->preset->name);
|
||||
subghz_setting_free(txrx->setting);
|
||||
free(txrx->preset);
|
||||
free(txrx);
|
||||
subghz_worker_free(instance->worker);
|
||||
subghz_receiver_free(instance->receiver);
|
||||
subghz_environment_free(instance->environment);
|
||||
flipper_format_free(instance->fff_data);
|
||||
furi_string_free(instance->preset->name);
|
||||
subghz_setting_free(instance->setting);
|
||||
free(instance->preset);
|
||||
free(instance);
|
||||
}
|
||||
|
||||
bool subghz_txrx_is_load_database(SubGhzTxRx* txrx) {
|
||||
furi_assert(txrx);
|
||||
return txrx->load_database;
|
||||
bool subghz_txrx_is_load_database(SubGhzTxRx* instance) {
|
||||
furi_assert(instance);
|
||||
return instance->load_database;
|
||||
}
|
||||
|
||||
void subghz_set_preset(
|
||||
SubGhzTxRx* txrx,
|
||||
void subghz_txrx_set_preset(
|
||||
SubGhzTxRx* instance,
|
||||
const char* preset_name,
|
||||
uint32_t frequency,
|
||||
uint8_t* preset_data,
|
||||
size_t preset_data_size) {
|
||||
furi_assert(txrx);
|
||||
furi_string_set(txrx->preset->name, preset_name);
|
||||
txrx->preset->frequency = frequency;
|
||||
txrx->preset->data = preset_data;
|
||||
txrx->preset->data_size = preset_data_size;
|
||||
furi_assert(instance);
|
||||
furi_string_set(instance->preset->name, preset_name);
|
||||
instance->preset->frequency = frequency;
|
||||
instance->preset->data = preset_data;
|
||||
instance->preset->data_size = preset_data_size;
|
||||
}
|
||||
|
||||
const char* subghz_get_name_preset(SubGhzTxRx* txrx, const char* preset) {
|
||||
UNUSED(txrx);
|
||||
const char* subghz_txrx_get_name_preset(SubGhzTxRx* instance, const char* preset) {
|
||||
UNUSED(instance);
|
||||
const char* preset_name = NULL;
|
||||
if(!strcmp(preset, "FuriHalSubGhzPresetOok270Async")) {
|
||||
preset_name = "AM270";
|
||||
@ -121,95 +122,96 @@ const char* subghz_get_name_preset(SubGhzTxRx* txrx, const char* preset) {
|
||||
return preset_name;
|
||||
}
|
||||
|
||||
SubGhzRadioPreset subghz_get_preset(SubGhzTxRx* txrx) {
|
||||
furi_assert(txrx);
|
||||
return *txrx->preset;
|
||||
SubGhzRadioPreset subghz_txrx_get_preset(SubGhzTxRx* instance) {
|
||||
furi_assert(instance);
|
||||
return *instance->preset;
|
||||
}
|
||||
|
||||
void subghz_get_frequency_modulation(
|
||||
SubGhzTxRx* txrx,
|
||||
void subghz_txrx_get_frequency_modulation(
|
||||
SubGhzTxRx* instance,
|
||||
FuriString* frequency,
|
||||
FuriString* modulation,
|
||||
bool long_name) {
|
||||
furi_assert(txrx);
|
||||
furi_assert(instance);
|
||||
if(frequency != NULL) {
|
||||
furi_string_printf(
|
||||
frequency,
|
||||
"%03ld.%02ld",
|
||||
txrx->preset->frequency / 1000000 % 1000,
|
||||
txrx->preset->frequency / 10000 % 100);
|
||||
instance->preset->frequency / 1000000 % 1000,
|
||||
instance->preset->frequency / 10000 % 100);
|
||||
}
|
||||
if(modulation != NULL) {
|
||||
if(long_name) {
|
||||
furi_string_printf(modulation, "%s", furi_string_get_cstr(txrx->preset->name));
|
||||
furi_string_printf(modulation, "%s", furi_string_get_cstr(instance->preset->name));
|
||||
} else {
|
||||
furi_string_printf(modulation, "%.2s", furi_string_get_cstr(txrx->preset->name));
|
||||
furi_string_printf(modulation, "%.2s", furi_string_get_cstr(instance->preset->name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void subghz_begin(SubGhzTxRx* txrx, uint8_t* preset_data) {
|
||||
furi_assert(txrx);
|
||||
static void subghz_txrx_begin(SubGhzTxRx* instance, uint8_t* preset_data) {
|
||||
furi_assert(instance);
|
||||
furi_hal_subghz_reset();
|
||||
furi_hal_subghz_idle();
|
||||
furi_hal_subghz_load_custom_preset(preset_data);
|
||||
furi_hal_gpio_init(furi_hal_subghz.cc1101_g0_pin, GpioModeInput, GpioPullNo, GpioSpeedLow);
|
||||
txrx->txrx_state = SubGhzTxRxStateIDLE;
|
||||
instance->txrx_state = SubGhzTxRxStateIDLE;
|
||||
}
|
||||
|
||||
static uint32_t subghz_rx(SubGhzTxRx* txrx, uint32_t frequency) {
|
||||
furi_assert(txrx);
|
||||
static uint32_t subghz_txrx_rx(SubGhzTxRx* instance, uint32_t frequency) {
|
||||
furi_assert(instance);
|
||||
if(!furi_hal_subghz_is_frequency_valid(frequency)) {
|
||||
furi_crash("SubGhz: Incorrect RX frequency.");
|
||||
}
|
||||
furi_assert(txrx->txrx_state != SubGhzTxRxStateRx && txrx->txrx_state != SubGhzTxRxStateSleep);
|
||||
furi_assert(
|
||||
instance->txrx_state != SubGhzTxRxStateRx && instance->txrx_state != SubGhzTxRxStateSleep);
|
||||
|
||||
furi_hal_subghz_idle();
|
||||
uint32_t value = furi_hal_subghz_set_frequency_and_path(frequency);
|
||||
furi_hal_gpio_init(furi_hal_subghz.cc1101_g0_pin, GpioModeInput, GpioPullNo, GpioSpeedLow);
|
||||
furi_hal_subghz_flush_rx();
|
||||
subghz_speaker_on(txrx);
|
||||
subghz_txrx_speaker_on(instance);
|
||||
furi_hal_subghz_rx();
|
||||
|
||||
furi_hal_subghz_start_async_rx(subghz_worker_rx_callback, txrx->worker);
|
||||
subghz_worker_start(txrx->worker);
|
||||
txrx->txrx_state = SubGhzTxRxStateRx;
|
||||
furi_hal_subghz_start_async_rx(subghz_worker_rx_callback, instance->worker);
|
||||
subghz_worker_start(instance->worker);
|
||||
instance->txrx_state = SubGhzTxRxStateRx;
|
||||
return value;
|
||||
}
|
||||
|
||||
static void subghz_idle(SubGhzTxRx* txrx) {
|
||||
furi_assert(txrx);
|
||||
furi_assert(txrx->txrx_state != SubGhzTxRxStateSleep);
|
||||
static void subghz_txrx_idle(SubGhzTxRx* instance) {
|
||||
furi_assert(instance);
|
||||
furi_assert(instance->txrx_state != SubGhzTxRxStateSleep);
|
||||
furi_hal_subghz_idle();
|
||||
subghz_speaker_off(txrx);
|
||||
txrx->txrx_state = SubGhzTxRxStateIDLE;
|
||||
subghz_txrx_speaker_off(instance);
|
||||
instance->txrx_state = SubGhzTxRxStateIDLE;
|
||||
}
|
||||
|
||||
static void subghz_rx_end(SubGhzTxRx* txrx) {
|
||||
furi_assert(txrx);
|
||||
furi_assert(txrx->txrx_state == SubGhzTxRxStateRx);
|
||||
static void subghz_txrx_rx_end(SubGhzTxRx* instance) {
|
||||
furi_assert(instance);
|
||||
furi_assert(instance->txrx_state == SubGhzTxRxStateRx);
|
||||
|
||||
if(subghz_worker_is_running(txrx->worker)) {
|
||||
subghz_worker_stop(txrx->worker);
|
||||
if(subghz_worker_is_running(instance->worker)) {
|
||||
subghz_worker_stop(instance->worker);
|
||||
furi_hal_subghz_stop_async_rx();
|
||||
}
|
||||
furi_hal_subghz_idle();
|
||||
subghz_speaker_off(txrx);
|
||||
txrx->txrx_state = SubGhzTxRxStateIDLE;
|
||||
subghz_txrx_speaker_off(instance);
|
||||
instance->txrx_state = SubGhzTxRxStateIDLE;
|
||||
}
|
||||
|
||||
void subghz_sleep(SubGhzTxRx* txrx) {
|
||||
furi_assert(txrx);
|
||||
void subghz_txrx_sleep(SubGhzTxRx* instance) {
|
||||
furi_assert(instance);
|
||||
furi_hal_subghz_sleep();
|
||||
txrx->txrx_state = SubGhzTxRxStateSleep;
|
||||
instance->txrx_state = SubGhzTxRxStateSleep;
|
||||
}
|
||||
|
||||
static bool subghz_tx(SubGhzTxRx* txrx, uint32_t frequency) {
|
||||
furi_assert(txrx);
|
||||
static bool subghz_txrx_tx(SubGhzTxRx* instance, uint32_t frequency) {
|
||||
furi_assert(instance);
|
||||
if(!furi_hal_subghz_is_frequency_valid(frequency)) {
|
||||
furi_crash("SubGhz: Incorrect TX frequency.");
|
||||
}
|
||||
furi_assert(txrx->txrx_state != SubGhzTxRxStateSleep);
|
||||
furi_assert(instance->txrx_state != SubGhzTxRxStateSleep);
|
||||
furi_hal_subghz_idle();
|
||||
furi_hal_subghz_set_frequency_and_path(frequency);
|
||||
furi_hal_gpio_write(furi_hal_subghz.cc1101_g0_pin, false);
|
||||
@ -217,17 +219,17 @@ static bool subghz_tx(SubGhzTxRx* txrx, uint32_t frequency) {
|
||||
furi_hal_subghz.cc1101_g0_pin, GpioModeOutputPushPull, GpioPullNo, GpioSpeedLow);
|
||||
bool ret = furi_hal_subghz_tx();
|
||||
if(ret) {
|
||||
subghz_speaker_on(txrx);
|
||||
txrx->txrx_state = SubGhzTxRxStateTx;
|
||||
subghz_txrx_speaker_on(instance);
|
||||
instance->txrx_state = SubGhzTxRxStateTx;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool subghz_tx_start(SubGhzTxRx* txrx, FlipperFormat* flipper_format) {
|
||||
furi_assert(txrx);
|
||||
bool subghz_txrx_tx_start(SubGhzTxRx* instance, FlipperFormat* flipper_format) {
|
||||
furi_assert(instance);
|
||||
furi_assert(flipper_format);
|
||||
|
||||
subghz_txrx_stop(txrx);
|
||||
subghz_txrx_stop(instance);
|
||||
|
||||
bool ret = false;
|
||||
FuriString* temp_str = furi_string_alloc();
|
||||
@ -246,33 +248,35 @@ bool subghz_tx_start(SubGhzTxRx* txrx, FlipperFormat* flipper_format) {
|
||||
break;
|
||||
}
|
||||
|
||||
txrx->transmitter =
|
||||
subghz_transmitter_alloc_init(txrx->environment, furi_string_get_cstr(temp_str));
|
||||
instance->transmitter =
|
||||
subghz_transmitter_alloc_init(instance->environment, furi_string_get_cstr(temp_str));
|
||||
|
||||
if(txrx->transmitter) {
|
||||
if(subghz_transmitter_deserialize(txrx->transmitter, flipper_format) ==
|
||||
if(instance->transmitter) {
|
||||
if(subghz_transmitter_deserialize(instance->transmitter, flipper_format) ==
|
||||
SubGhzProtocolStatusOk) {
|
||||
if(strcmp(furi_string_get_cstr(txrx->preset->name), "") != 0) {
|
||||
subghz_begin(
|
||||
txrx,
|
||||
if(strcmp(furi_string_get_cstr(instance->preset->name), "") != 0) {
|
||||
subghz_txrx_begin(
|
||||
instance,
|
||||
subghz_setting_get_preset_data_by_name(
|
||||
txrx->setting, furi_string_get_cstr(txrx->preset->name)));
|
||||
instance->setting, furi_string_get_cstr(instance->preset->name)));
|
||||
} else {
|
||||
FURI_LOG_E(
|
||||
TAG,
|
||||
"Unknown name preset \" %s \"",
|
||||
furi_string_get_cstr(txrx->preset->name));
|
||||
subghz_begin(
|
||||
txrx, subghz_setting_get_preset_data_by_name(txrx->setting, "AM650"));
|
||||
furi_string_get_cstr(instance->preset->name));
|
||||
subghz_txrx_begin(
|
||||
instance,
|
||||
subghz_setting_get_preset_data_by_name(instance->setting, "AM650"));
|
||||
}
|
||||
if(txrx->preset->frequency) {
|
||||
ret = subghz_tx(txrx, txrx->preset->frequency);
|
||||
if(instance->preset->frequency) {
|
||||
ret = subghz_txrx_tx(instance, instance->preset->frequency);
|
||||
} else {
|
||||
ret = subghz_tx(txrx, 433920000);
|
||||
ret = subghz_txrx_tx(instance, 433920000);
|
||||
}
|
||||
if(ret) {
|
||||
//Start TX
|
||||
furi_hal_subghz_start_async_tx(subghz_transmitter_yield, txrx->transmitter);
|
||||
furi_hal_subghz_start_async_tx(
|
||||
subghz_transmitter_yield, instance->transmitter);
|
||||
} else {
|
||||
//Todo: Show error
|
||||
//subghz_dialog_message_show_only_rx(subghz);
|
||||
@ -284,9 +288,9 @@ bool subghz_tx_start(SubGhzTxRx* txrx, FlipperFormat* flipper_format) {
|
||||
}
|
||||
}
|
||||
if(!ret) {
|
||||
subghz_transmitter_free(txrx->transmitter);
|
||||
if(txrx->txrx_state != SubGhzTxRxStateSleep) {
|
||||
subghz_idle(txrx);
|
||||
subghz_transmitter_free(instance->transmitter);
|
||||
if(instance->txrx_state != SubGhzTxRxStateIDLE) {
|
||||
subghz_txrx_idle(instance);
|
||||
}
|
||||
}
|
||||
|
||||
@ -295,68 +299,68 @@ bool subghz_tx_start(SubGhzTxRx* txrx, FlipperFormat* flipper_format) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
void subghz_rx_start(SubGhzTxRx* txrx) {
|
||||
furi_assert(txrx);
|
||||
subghz_txrx_stop(txrx);
|
||||
subghz_begin(
|
||||
txrx,
|
||||
void subghz_txrx_rx_start(SubGhzTxRx* instance) {
|
||||
furi_assert(instance);
|
||||
subghz_txrx_stop(instance);
|
||||
subghz_txrx_begin(
|
||||
instance,
|
||||
subghz_setting_get_preset_data_by_name(
|
||||
subghz_txrx_get_setting(txrx), furi_string_get_cstr(txrx->preset->name)));
|
||||
subghz_rx(txrx, txrx->preset->frequency);
|
||||
subghz_txrx_get_setting(instance), furi_string_get_cstr(instance->preset->name)));
|
||||
subghz_txrx_rx(instance, instance->preset->frequency);
|
||||
}
|
||||
|
||||
void subghz_txrx_need_save_callback_set(
|
||||
SubGhzTxRx* txrx,
|
||||
SubGhzTxRx* instance,
|
||||
SubGhzTxRxNeedSaveCallback callback,
|
||||
void* context) {
|
||||
furi_assert(txrx);
|
||||
txrx->need_save_callback = callback;
|
||||
txrx->need_save_context = context;
|
||||
furi_assert(instance);
|
||||
instance->need_save_callback = callback;
|
||||
instance->need_save_context = context;
|
||||
}
|
||||
|
||||
static void subghz_tx_stop(SubGhzTxRx* txrx) {
|
||||
furi_assert(txrx);
|
||||
furi_assert(txrx->txrx_state == SubGhzTxRxStateTx);
|
||||
static void subghz_txrx_tx_stop(SubGhzTxRx* instance) {
|
||||
furi_assert(instance);
|
||||
furi_assert(instance->txrx_state == SubGhzTxRxStateTx);
|
||||
//Stop TX
|
||||
furi_hal_subghz_stop_async_tx();
|
||||
subghz_transmitter_stop(txrx->transmitter);
|
||||
subghz_transmitter_free(txrx->transmitter);
|
||||
subghz_transmitter_stop(instance->transmitter);
|
||||
subghz_transmitter_free(instance->transmitter);
|
||||
|
||||
//if protocol dynamic then we save the last upload
|
||||
if(txrx->decoder_result->protocol->type == SubGhzProtocolTypeDynamic) {
|
||||
if(txrx->need_save_callback) {
|
||||
txrx->need_save_callback(txrx->need_save_context);
|
||||
if(instance->decoder_result->protocol->type == SubGhzProtocolTypeDynamic) {
|
||||
if(instance->need_save_callback) {
|
||||
instance->need_save_callback(instance->need_save_context);
|
||||
}
|
||||
}
|
||||
subghz_idle(txrx);
|
||||
subghz_speaker_off(txrx);
|
||||
subghz_txrx_idle(instance);
|
||||
subghz_txrx_speaker_off(instance);
|
||||
//Todo: Show message
|
||||
// notification_message(notifications, &sequence_reset_red);
|
||||
}
|
||||
|
||||
FlipperFormat* subghz_txtx_get_fff_data(SubGhzTxRx* txrx) {
|
||||
furi_assert(txrx);
|
||||
return txrx->fff_data;
|
||||
FlipperFormat* subghz_txtx_get_fff_data(SubGhzTxRx* instance) {
|
||||
furi_assert(instance);
|
||||
return instance->fff_data;
|
||||
}
|
||||
|
||||
SubGhzSetting* subghz_txrx_get_setting(SubGhzTxRx* txrx) {
|
||||
furi_assert(txrx);
|
||||
return txrx->setting;
|
||||
SubGhzSetting* subghz_txrx_get_setting(SubGhzTxRx* instance) {
|
||||
furi_assert(instance);
|
||||
return instance->setting;
|
||||
}
|
||||
|
||||
void subghz_txrx_stop(SubGhzTxRx* txrx) {
|
||||
furi_assert(txrx);
|
||||
void subghz_txrx_stop(SubGhzTxRx* instance) {
|
||||
furi_assert(instance);
|
||||
|
||||
switch(txrx->txrx_state) {
|
||||
switch(instance->txrx_state) {
|
||||
case SubGhzTxRxStateTx:
|
||||
subghz_tx_stop(txrx);
|
||||
subghz_speaker_unmute(txrx);
|
||||
//subghz_sleep(txrx);
|
||||
subghz_txrx_tx_stop(instance);
|
||||
subghz_txrx_speaker_unmute(instance);
|
||||
//subghz_txrx_sleep(txrx);
|
||||
break;
|
||||
case SubGhzTxRxStateRx:
|
||||
subghz_rx_end(txrx);
|
||||
subghz_speaker_mute(txrx);
|
||||
//subghz_sleep(txrx);
|
||||
subghz_txrx_rx_end(instance);
|
||||
subghz_txrx_speaker_mute(instance);
|
||||
//subghz_txrx_sleep(txrx);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -364,21 +368,21 @@ void subghz_txrx_stop(SubGhzTxRx* txrx) {
|
||||
}
|
||||
}
|
||||
|
||||
SubGhzTxRxState subghz_txrx_get_state(SubGhzTxRx* txrx) {
|
||||
furi_assert(txrx);
|
||||
return txrx->txrx_state;
|
||||
SubGhzTxRxState subghz_txrx_get_state(SubGhzTxRx* instance) {
|
||||
furi_assert(instance);
|
||||
return instance->txrx_state;
|
||||
}
|
||||
|
||||
void subghz_hopper_update(SubGhzTxRx* txrx) {
|
||||
furi_assert(txrx);
|
||||
void subghz_txrx_hopper_update(SubGhzTxRx* instance) {
|
||||
furi_assert(instance);
|
||||
|
||||
switch(txrx->hopper_state) {
|
||||
switch(instance->hopper_state) {
|
||||
case SubGhzHopperStateOFF:
|
||||
case SubGhzHopperStatePause:
|
||||
return;
|
||||
case SubGhzHopperStateRSSITimeOut:
|
||||
if(txrx->hopper_timeout != 0) {
|
||||
txrx->hopper_timeout--;
|
||||
if(instance->hopper_timeout != 0) {
|
||||
instance->hopper_timeout--;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
@ -386,205 +390,209 @@ void subghz_hopper_update(SubGhzTxRx* txrx) {
|
||||
break;
|
||||
}
|
||||
float rssi = -127.0f;
|
||||
if(txrx->hopper_state != SubGhzHopperStateRSSITimeOut) {
|
||||
if(instance->hopper_state != SubGhzHopperStateRSSITimeOut) {
|
||||
// See RSSI Calculation timings in CC1101 17.3 RSSI
|
||||
rssi = furi_hal_subghz_get_rssi();
|
||||
|
||||
// Stay if RSSI is high enough
|
||||
if(rssi > -90.0f) {
|
||||
txrx->hopper_timeout = 10;
|
||||
txrx->hopper_state = SubGhzHopperStateRSSITimeOut;
|
||||
instance->hopper_timeout = 10;
|
||||
instance->hopper_state = SubGhzHopperStateRSSITimeOut;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
txrx->hopper_state = SubGhzHopperStateRunning;
|
||||
instance->hopper_state = SubGhzHopperStateRunning;
|
||||
}
|
||||
// Select next frequency
|
||||
if(txrx->hopper_idx_frequency < subghz_setting_get_hopper_frequency_count(txrx->setting) - 1) {
|
||||
txrx->hopper_idx_frequency++;
|
||||
if(instance->hopper_idx_frequency <
|
||||
subghz_setting_get_hopper_frequency_count(instance->setting) - 1) {
|
||||
instance->hopper_idx_frequency++;
|
||||
} else {
|
||||
txrx->hopper_idx_frequency = 0;
|
||||
instance->hopper_idx_frequency = 0;
|
||||
}
|
||||
|
||||
if(txrx->txrx_state == SubGhzTxRxStateRx) {
|
||||
subghz_rx_end(txrx);
|
||||
if(instance->txrx_state == SubGhzTxRxStateRx) {
|
||||
subghz_txrx_rx_end(instance);
|
||||
};
|
||||
if(txrx->txrx_state == SubGhzTxRxStateIDLE) {
|
||||
subghz_receiver_reset(txrx->receiver);
|
||||
txrx->preset->frequency =
|
||||
subghz_setting_get_hopper_frequency(txrx->setting, txrx->hopper_idx_frequency);
|
||||
subghz_rx(txrx, txrx->preset->frequency);
|
||||
if(instance->txrx_state == SubGhzTxRxStateIDLE) {
|
||||
subghz_receiver_reset(instance->receiver);
|
||||
instance->preset->frequency =
|
||||
subghz_setting_get_hopper_frequency(instance->setting, instance->hopper_idx_frequency);
|
||||
subghz_txrx_rx(instance, instance->preset->frequency);
|
||||
}
|
||||
}
|
||||
|
||||
SubGhzHopperState subghz_hopper_get_state(SubGhzTxRx* txrx) {
|
||||
furi_assert(txrx);
|
||||
return txrx->hopper_state;
|
||||
SubGhzHopperState subghz_txrx_hopper_get_state(SubGhzTxRx* instance) {
|
||||
furi_assert(instance);
|
||||
return instance->hopper_state;
|
||||
}
|
||||
|
||||
void subghz_hopper_set_state(SubGhzTxRx* txrx, SubGhzHopperState state) {
|
||||
furi_assert(txrx);
|
||||
txrx->hopper_state = state;
|
||||
void subghz_txrx_hopper_set_state(SubGhzTxRx* instance, SubGhzHopperState state) {
|
||||
furi_assert(instance);
|
||||
instance->hopper_state = state;
|
||||
}
|
||||
|
||||
void subghz_hopper_remove_pause(SubGhzTxRx* txrx) {
|
||||
furi_assert(txrx);
|
||||
if(txrx->hopper_state == SubGhzHopperStatePause) {
|
||||
txrx->hopper_state = SubGhzHopperStateRunning;
|
||||
void subghz_txrx_hopper_remove_pause(SubGhzTxRx* instance) {
|
||||
furi_assert(instance);
|
||||
if(instance->hopper_state == SubGhzHopperStatePause) {
|
||||
instance->hopper_state = SubGhzHopperStateRunning;
|
||||
}
|
||||
}
|
||||
|
||||
void subghz_subghz_hopper_set_pause(SubGhzTxRx* txrx) {
|
||||
furi_assert(txrx);
|
||||
if(txrx->hopper_state == SubGhzHopperStateRunning) {
|
||||
txrx->hopper_state = SubGhzHopperStatePause;
|
||||
void subghz_txrx_hopper_set_pause(SubGhzTxRx* instance) {
|
||||
furi_assert(instance);
|
||||
if(instance->hopper_state == SubGhzHopperStateRunning) {
|
||||
instance->hopper_state = SubGhzHopperStatePause;
|
||||
}
|
||||
}
|
||||
|
||||
void subghz_speaker_on(SubGhzTxRx* txrx) {
|
||||
furi_assert(txrx);
|
||||
if(txrx->debug_pin_state) {
|
||||
void subghz_txrx_speaker_on(SubGhzTxRx* instance) {
|
||||
furi_assert(instance);
|
||||
if(instance->debug_pin_state) {
|
||||
furi_hal_subghz_set_async_mirror_pin(&gpio_ibutton);
|
||||
}
|
||||
|
||||
if(txrx->speaker_state == SubGhzSpeakerStateEnable) {
|
||||
if(instance->speaker_state == SubGhzSpeakerStateEnable) {
|
||||
if(furi_hal_speaker_acquire(30)) {
|
||||
if(!txrx->debug_pin_state) {
|
||||
if(!instance->debug_pin_state) {
|
||||
furi_hal_subghz_set_async_mirror_pin(&gpio_speaker);
|
||||
}
|
||||
} else {
|
||||
txrx->speaker_state = SubGhzSpeakerStateDisable;
|
||||
instance->speaker_state = SubGhzSpeakerStateDisable;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void subghz_speaker_off(SubGhzTxRx* txrx) {
|
||||
furi_assert(txrx);
|
||||
if(txrx->debug_pin_state) {
|
||||
void subghz_txrx_speaker_off(SubGhzTxRx* instance) {
|
||||
furi_assert(instance);
|
||||
if(instance->debug_pin_state) {
|
||||
furi_hal_subghz_set_async_mirror_pin(NULL);
|
||||
}
|
||||
if(txrx->speaker_state != SubGhzSpeakerStateDisable) {
|
||||
if(instance->speaker_state != SubGhzSpeakerStateDisable) {
|
||||
if(furi_hal_speaker_is_mine()) {
|
||||
if(!txrx->debug_pin_state) {
|
||||
if(!instance->debug_pin_state) {
|
||||
furi_hal_subghz_set_async_mirror_pin(NULL);
|
||||
}
|
||||
furi_hal_speaker_release();
|
||||
if(txrx->speaker_state == SubGhzSpeakerStateShutdown)
|
||||
txrx->speaker_state = SubGhzSpeakerStateDisable;
|
||||
if(instance->speaker_state == SubGhzSpeakerStateShutdown)
|
||||
instance->speaker_state = SubGhzSpeakerStateDisable;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void subghz_speaker_mute(SubGhzTxRx* txrx) {
|
||||
furi_assert(txrx);
|
||||
if(txrx->debug_pin_state) {
|
||||
void subghz_txrx_speaker_mute(SubGhzTxRx* instance) {
|
||||
furi_assert(instance);
|
||||
if(instance->debug_pin_state) {
|
||||
furi_hal_subghz_set_async_mirror_pin(NULL);
|
||||
}
|
||||
if(txrx->speaker_state == SubGhzSpeakerStateEnable) {
|
||||
if(instance->speaker_state == SubGhzSpeakerStateEnable) {
|
||||
if(furi_hal_speaker_is_mine()) {
|
||||
if(!txrx->debug_pin_state) {
|
||||
if(!instance->debug_pin_state) {
|
||||
furi_hal_subghz_set_async_mirror_pin(NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void subghz_speaker_unmute(SubGhzTxRx* txrx) {
|
||||
furi_assert(txrx);
|
||||
if(txrx->debug_pin_state) {
|
||||
void subghz_txrx_speaker_unmute(SubGhzTxRx* instance) {
|
||||
furi_assert(instance);
|
||||
if(instance->debug_pin_state) {
|
||||
furi_hal_subghz_set_async_mirror_pin(&gpio_ibutton);
|
||||
}
|
||||
if(txrx->speaker_state == SubGhzSpeakerStateEnable) {
|
||||
if(instance->speaker_state == SubGhzSpeakerStateEnable) {
|
||||
if(furi_hal_speaker_is_mine()) {
|
||||
if(!txrx->debug_pin_state) {
|
||||
if(!instance->debug_pin_state) {
|
||||
furi_hal_subghz_set_async_mirror_pin(&gpio_speaker);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void subghz_speaker_set_state(SubGhzTxRx* txrx, SubGhzSpeakerState state) {
|
||||
furi_assert(txrx);
|
||||
txrx->speaker_state = state;
|
||||
void subghz_txrx_speaker_set_state(SubGhzTxRx* instance, SubGhzSpeakerState state) {
|
||||
furi_assert(instance);
|
||||
instance->speaker_state = state;
|
||||
}
|
||||
|
||||
SubGhzSpeakerState subghz_speaker_get_state(SubGhzTxRx* txrx) {
|
||||
furi_assert(txrx);
|
||||
return txrx->speaker_state;
|
||||
SubGhzSpeakerState subghz_txrx_speaker_get_state(SubGhzTxRx* instance) {
|
||||
furi_assert(instance);
|
||||
return instance->speaker_state;
|
||||
}
|
||||
|
||||
bool subghz_txrx_load_decoder_by_name_protocol(SubGhzTxRx* txrx, const char* name_protocol) {
|
||||
furi_assert(txrx);
|
||||
bool subghz_txrx_load_decoder_by_name_protocol(SubGhzTxRx* instance, const char* name_protocol) {
|
||||
furi_assert(instance);
|
||||
furi_assert(name_protocol);
|
||||
bool res = false;
|
||||
txrx->decoder_result = NULL;
|
||||
txrx->decoder_result =
|
||||
subghz_receiver_search_decoder_base_by_name(txrx->receiver, name_protocol);
|
||||
if(txrx->decoder_result) {
|
||||
instance->decoder_result = NULL;
|
||||
instance->decoder_result =
|
||||
subghz_receiver_search_decoder_base_by_name(instance->receiver, name_protocol);
|
||||
if(instance->decoder_result) {
|
||||
res = true;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
SubGhzProtocolDecoderBase* subghz_txrx_get_decoder(SubGhzTxRx* txrx) {
|
||||
furi_assert(txrx);
|
||||
return txrx->decoder_result;
|
||||
SubGhzProtocolDecoderBase* subghz_txrx_get_decoder(SubGhzTxRx* instance) {
|
||||
furi_assert(instance);
|
||||
return instance->decoder_result;
|
||||
}
|
||||
|
||||
bool subghz_txrx_protocol_is_preserved(SubGhzTxRx* txrx) {
|
||||
furi_assert(txrx);
|
||||
bool subghz_txrx_protocol_is_preserved(SubGhzTxRx* instance) {
|
||||
furi_assert(instance);
|
||||
return (
|
||||
(txrx->decoder_result->protocol->flag & SubGhzProtocolFlag_Save) ==
|
||||
(instance->decoder_result->protocol->flag & SubGhzProtocolFlag_Save) ==
|
||||
SubGhzProtocolFlag_Save);
|
||||
}
|
||||
|
||||
bool subghz_txrx_protocol_is_send(SubGhzTxRx* txrx, bool check_type) {
|
||||
furi_assert(txrx);
|
||||
bool subghz_txrx_protocol_is_send(SubGhzTxRx* instance, bool check_type) {
|
||||
furi_assert(instance);
|
||||
if(check_type) {
|
||||
return (
|
||||
((txrx->decoder_result->protocol->flag & SubGhzProtocolFlag_Send) ==
|
||||
((instance->decoder_result->protocol->flag & SubGhzProtocolFlag_Send) ==
|
||||
SubGhzProtocolFlag_Send) &&
|
||||
txrx->decoder_result->protocol->encoder->deserialize &&
|
||||
txrx->decoder_result->protocol->type == SubGhzProtocolTypeStatic);
|
||||
instance->decoder_result->protocol->encoder->deserialize &&
|
||||
instance->decoder_result->protocol->type == SubGhzProtocolTypeStatic);
|
||||
}
|
||||
return (
|
||||
((txrx->decoder_result->protocol->flag & SubGhzProtocolFlag_Send) ==
|
||||
((instance->decoder_result->protocol->flag & SubGhzProtocolFlag_Send) ==
|
||||
SubGhzProtocolFlag_Send) &&
|
||||
txrx->decoder_result->protocol->encoder->deserialize);
|
||||
instance->decoder_result->protocol->encoder->deserialize);
|
||||
}
|
||||
|
||||
void subghz_txrx_receiver_set_filter(SubGhzTxRx* txrx, SubGhzProtocolFlag filter) {
|
||||
furi_assert(txrx);
|
||||
subghz_receiver_set_filter(txrx->receiver, filter);
|
||||
void subghz_txrx_receiver_set_filter(SubGhzTxRx* instance, SubGhzProtocolFlag filter) {
|
||||
furi_assert(instance);
|
||||
subghz_receiver_set_filter(instance->receiver, filter);
|
||||
}
|
||||
|
||||
void subghz_txrx_set_rx_calback(SubGhzTxRx* txrx, SubGhzReceiverCallback callback, void* context) {
|
||||
subghz_receiver_set_rx_callback(txrx->receiver, callback, context);
|
||||
void subghz_txrx_set_rx_calback(
|
||||
SubGhzTxRx* instance,
|
||||
SubGhzReceiverCallback callback,
|
||||
void* context) {
|
||||
subghz_receiver_set_rx_callback(instance->receiver, callback, context);
|
||||
}
|
||||
|
||||
void subghz_txrx_set_raw_file_encoder_worker_set_callback_end(
|
||||
SubGhzTxRx* txrx,
|
||||
SubGhzTxRx* instance,
|
||||
SubGhzProtocolEncoderRAWCallbackEnd callback,
|
||||
void* context) {
|
||||
subghz_protocol_raw_file_encoder_worker_set_callback_end(
|
||||
(SubGhzProtocolEncoderRAW*)subghz_transmitter_get_protocol_instance(txrx->transmitter),
|
||||
(SubGhzProtocolEncoderRAW*)subghz_transmitter_get_protocol_instance(instance->transmitter),
|
||||
callback,
|
||||
context);
|
||||
}
|
||||
|
||||
void subghz_txrx_set_debug_pin_state(SubGhzTxRx* txrx, bool state) {
|
||||
furi_assert(txrx);
|
||||
txrx->debug_pin_state = state;
|
||||
void subghz_txrx_set_debug_pin_state(SubGhzTxRx* instance, bool state) {
|
||||
furi_assert(instance);
|
||||
instance->debug_pin_state = state;
|
||||
}
|
||||
|
||||
bool subghz_txrx_get_debug_pin_state(SubGhzTxRx* txrx) {
|
||||
furi_assert(txrx);
|
||||
return txrx->debug_pin_state;
|
||||
bool subghz_txrx_get_debug_pin_state(SubGhzTxRx* instance) {
|
||||
furi_assert(instance);
|
||||
return instance->debug_pin_state;
|
||||
}
|
||||
|
||||
SubGhzReceiver* subghz_txrx_get_receiver(SubGhzTxRx* txrx) {
|
||||
furi_assert(txrx);
|
||||
return txrx->receiver;
|
||||
SubGhzReceiver* subghz_txrx_get_receiver(SubGhzTxRx* instance) {
|
||||
furi_assert(instance);
|
||||
return instance->receiver;
|
||||
}
|
||||
|
||||
//#############Create new Key##############
|
||||
@ -598,7 +606,7 @@ SubGhzReceiver* subghz_txrx_get_receiver(SubGhzTxRx* txrx) {
|
||||
#include <lib/toolbox/stream/stream.h>
|
||||
#include <lib/subghz/protocols/raw.h>
|
||||
|
||||
bool subghz_gen_data_protocol(
|
||||
bool subghz_txrx_gen_data_protocol(
|
||||
void* context,
|
||||
const char* preset_name,
|
||||
uint32_t frequency,
|
||||
@ -606,15 +614,15 @@ bool subghz_gen_data_protocol(
|
||||
uint64_t key,
|
||||
uint32_t bit) {
|
||||
furi_assert(context);
|
||||
SubGhzTxRx* txrx = context;
|
||||
SubGhzTxRx* instance = context;
|
||||
|
||||
bool res = false;
|
||||
|
||||
subghz_set_preset(txrx, preset_name, frequency, NULL, 0);
|
||||
txrx->decoder_result =
|
||||
subghz_receiver_search_decoder_base_by_name(txrx->receiver, protocol_name);
|
||||
subghz_txrx_set_preset(instance, preset_name, frequency, NULL, 0);
|
||||
instance->decoder_result =
|
||||
subghz_receiver_search_decoder_base_by_name(instance->receiver, protocol_name);
|
||||
|
||||
if(txrx->decoder_result == NULL) {
|
||||
if(instance->decoder_result == NULL) {
|
||||
//TODO: Error
|
||||
// furi_string_set(error_str, "Protocol not\nfound!");
|
||||
// scene_manager_next_scene(scene_manager, SubGhzSceneShowErrorSub);
|
||||
@ -622,14 +630,15 @@ bool subghz_gen_data_protocol(
|
||||
}
|
||||
|
||||
do {
|
||||
Stream* fff_data_stream = flipper_format_get_raw_stream(txrx->fff_data);
|
||||
Stream* fff_data_stream = flipper_format_get_raw_stream(instance->fff_data);
|
||||
stream_clean(fff_data_stream);
|
||||
if(subghz_protocol_decoder_base_serialize(
|
||||
txrx->decoder_result, txrx->fff_data, txrx->preset) != SubGhzProtocolStatusOk) {
|
||||
instance->decoder_result, instance->fff_data, instance->preset) !=
|
||||
SubGhzProtocolStatusOk) {
|
||||
FURI_LOG_E(TAG, "Unable to serialize");
|
||||
break;
|
||||
}
|
||||
if(!flipper_format_update_uint32(txrx->fff_data, "Bit", &bit, 1)) {
|
||||
if(!flipper_format_update_uint32(instance->fff_data, "Bit", &bit, 1)) {
|
||||
FURI_LOG_E(TAG, "Unable to update Bit");
|
||||
break;
|
||||
}
|
||||
@ -638,7 +647,7 @@ bool subghz_gen_data_protocol(
|
||||
for(size_t i = 0; i < sizeof(uint64_t); i++) {
|
||||
key_data[sizeof(uint64_t) - i - 1] = (key >> (i * 8)) & 0xFF;
|
||||
}
|
||||
if(!flipper_format_update_hex(txrx->fff_data, "Key", key_data, sizeof(uint64_t))) {
|
||||
if(!flipper_format_update_hex(instance->fff_data, "Key", key_data, sizeof(uint64_t))) {
|
||||
FURI_LOG_E(TAG, "Unable to update Key");
|
||||
break;
|
||||
}
|
||||
@ -647,18 +656,18 @@ bool subghz_gen_data_protocol(
|
||||
return res;
|
||||
}
|
||||
|
||||
bool subghz_gen_data_protocol_and_te(
|
||||
SubGhzTxRx* txrx,
|
||||
bool subghz_txrx_gen_data_protocol_and_te(
|
||||
SubGhzTxRx* instance,
|
||||
const char* preset_name,
|
||||
uint32_t frequency,
|
||||
const char* protocol_name,
|
||||
uint64_t key,
|
||||
uint32_t bit,
|
||||
uint32_t te) {
|
||||
furi_assert(txrx);
|
||||
furi_assert(instance);
|
||||
bool ret = false;
|
||||
if(subghz_gen_data_protocol(txrx, preset_name, frequency, protocol_name, key, bit)) {
|
||||
if(!flipper_format_update_uint32(txrx->fff_data, "TE", (uint32_t*)&te, 1)) {
|
||||
if(subghz_txrx_gen_data_protocol(instance, preset_name, frequency, protocol_name, key, bit)) {
|
||||
if(!flipper_format_update_uint32(instance->fff_data, "TE", (uint32_t*)&te, 1)) {
|
||||
FURI_LOG_E(TAG, "Unable to update Te");
|
||||
} else {
|
||||
ret = true;
|
||||
@ -681,7 +690,7 @@ bool subghz_scene_set_type_submenu_gen_data_keeloq( //TODO rename
|
||||
|
||||
txrx->transmitter =
|
||||
subghz_transmitter_alloc_init(txrx->environment, SUBGHZ_PROTOCOL_KEELOQ_NAME);
|
||||
subghz_set_preset(txrx, preset_name, frequency, NULL, 0);
|
||||
subghz_txrx_set_preset(txrx, preset_name, frequency, NULL, 0);
|
||||
|
||||
if(txrx->transmitter && subghz_protocol_keeloq_create_data(
|
||||
subghz_transmitter_get_protocol_instance(txrx->transmitter),
|
||||
@ -713,7 +722,7 @@ bool subghz_scene_set_type_submenu_gen_data_keeloq_bft( //TODO rename
|
||||
|
||||
txrx->transmitter =
|
||||
subghz_transmitter_alloc_init(txrx->environment, SUBGHZ_PROTOCOL_KEELOQ_NAME);
|
||||
subghz_set_preset(txrx, preset_name, frequency, NULL, 0);
|
||||
subghz_txrx_set_preset(txrx, preset_name, frequency, NULL, 0);
|
||||
|
||||
if(txrx->transmitter && subghz_protocol_keeloq_bft_create_data(
|
||||
subghz_transmitter_get_protocol_instance(txrx->transmitter),
|
||||
@ -757,7 +766,7 @@ bool subghz_scene_set_type_submenu_gen_data_nice_flor( //TODO rename
|
||||
|
||||
txrx->transmitter =
|
||||
subghz_transmitter_alloc_init(txrx->environment, SUBGHZ_PROTOCOL_NICE_FLOR_S_NAME);
|
||||
subghz_set_preset(txrx, preset_name, frequency, NULL, 0);
|
||||
subghz_txrx_set_preset(txrx, preset_name, frequency, NULL, 0);
|
||||
|
||||
if(txrx->transmitter && subghz_protocol_nice_flor_s_create_data(
|
||||
subghz_transmitter_get_protocol_instance(txrx->transmitter),
|
||||
@ -790,7 +799,7 @@ bool subghz_scene_set_type_submenu_gen_data_faac_slh( //TODO rename
|
||||
|
||||
txrx->transmitter =
|
||||
subghz_transmitter_alloc_init(txrx->environment, SUBGHZ_PROTOCOL_FAAC_SLH_NAME);
|
||||
subghz_set_preset(txrx, preset_name, frequency, NULL, 0);
|
||||
subghz_txrx_set_preset(txrx, preset_name, frequency, NULL, 0);
|
||||
|
||||
if(txrx->transmitter && subghz_protocol_faac_slh_create_data(
|
||||
subghz_transmitter_get_protocol_instance(txrx->transmitter),
|
||||
@ -831,7 +840,7 @@ bool subghz_scene_set_type_submenu_gen_data_alutech_at_4n( //TODO rename
|
||||
|
||||
txrx->transmitter =
|
||||
subghz_transmitter_alloc_init(txrx->environment, SUBGHZ_PROTOCOL_ALUTECH_AT_4N_NAME);
|
||||
subghz_set_preset(txrx, preset_name, frequency, NULL, 0);
|
||||
subghz_txrx_set_preset(txrx, preset_name, frequency, NULL, 0);
|
||||
|
||||
if(txrx->transmitter && subghz_protocol_alutech_at_4n_create_data(
|
||||
subghz_transmitter_get_protocol_instance(txrx->transmitter),
|
||||
@ -861,7 +870,7 @@ bool subghz_scene_set_type_submenu_gen_data_somfy_telis( //TODO rename
|
||||
|
||||
txrx->transmitter =
|
||||
subghz_transmitter_alloc_init(txrx->environment, SUBGHZ_PROTOCOL_SOMFY_TELIS_NAME);
|
||||
subghz_set_preset(txrx, preset_name, frequency, NULL, 0);
|
||||
subghz_txrx_set_preset(txrx, preset_name, frequency, NULL, 0);
|
||||
|
||||
if(txrx->transmitter && subghz_protocol_somfy_telis_create_data(
|
||||
subghz_transmitter_get_protocol_instance(txrx->transmitter),
|
||||
@ -878,7 +887,7 @@ bool subghz_scene_set_type_submenu_gen_data_somfy_telis( //TODO rename
|
||||
return res;
|
||||
}
|
||||
|
||||
bool subghz_gen_secplus_v2_protocol(
|
||||
bool subghz_txrx_gen_secplus_v2_protocol(
|
||||
SubGhzTxRx* txrx,
|
||||
const char* name_preset,
|
||||
uint32_t frequency,
|
||||
@ -890,7 +899,7 @@ bool subghz_gen_secplus_v2_protocol(
|
||||
bool ret = false;
|
||||
txrx->transmitter =
|
||||
subghz_transmitter_alloc_init(txrx->environment, SUBGHZ_PROTOCOL_SECPLUS_V2_NAME);
|
||||
subghz_set_preset(txrx, name_preset, frequency, NULL, 0);
|
||||
subghz_txrx_set_preset(txrx, name_preset, frequency, NULL, 0);
|
||||
if(txrx->transmitter) {
|
||||
subghz_protocol_secplus_v2_create_data(
|
||||
subghz_transmitter_get_protocol_instance(txrx->transmitter),
|
||||
@ -904,7 +913,10 @@ bool subghz_gen_secplus_v2_protocol(
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool subghz_gen_secplus_v1_protocol(SubGhzTxRx* txrx, const char* name_preset, uint32_t frequency) {
|
||||
bool subghz_txrx_gen_secplus_v1_protocol(
|
||||
SubGhzTxRx* txrx,
|
||||
const char* name_preset,
|
||||
uint32_t frequency) {
|
||||
furi_assert(txrx);
|
||||
|
||||
bool ret = false;
|
||||
@ -912,7 +924,7 @@ bool subghz_gen_secplus_v1_protocol(SubGhzTxRx* txrx, const char* name_preset, u
|
||||
while(!subghz_protocol_secplus_v1_check_fixed(serial)) {
|
||||
serial = (uint32_t)rand();
|
||||
}
|
||||
if(subghz_gen_data_protocol(
|
||||
if(subghz_txrx_gen_data_protocol(
|
||||
txrx,
|
||||
name_preset,
|
||||
frequency,
|
@ -1,84 +1,84 @@
|
||||
#pragma once
|
||||
//#include "subghz_i.h"
|
||||
#include "helpers/subghz_types.h"
|
||||
#include "subghz_types.h"
|
||||
#include <lib/subghz/subghz_worker.h>
|
||||
#include <lib/subghz/subghz_setting.h>
|
||||
#include <lib/subghz/receiver.h>
|
||||
#include <lib/subghz/transmitter.h>
|
||||
#include <lib/subghz/protocols/raw.h>
|
||||
|
||||
#include "subghz_history.h"
|
||||
|
||||
typedef void (*SubGhzTxRxNeedSaveCallback)(void* context);
|
||||
|
||||
typedef struct SubGhzTxRx SubGhzTxRx;
|
||||
|
||||
SubGhzTxRx* subghz_txrx_alloc();
|
||||
void subghz_txrx_free(SubGhzTxRx* txrx);
|
||||
bool subghz_txrx_is_load_database(SubGhzTxRx* txrx);
|
||||
void subghz_txrx_free(SubGhzTxRx* instance);
|
||||
bool subghz_txrx_is_load_database(SubGhzTxRx* instance);
|
||||
|
||||
void subghz_set_preset(
|
||||
SubGhzTxRx* txrx,
|
||||
void subghz_txrx_set_preset(
|
||||
SubGhzTxRx* instance,
|
||||
const char* preset_name,
|
||||
uint32_t frequency,
|
||||
uint8_t* preset_data,
|
||||
size_t preset_data_size);
|
||||
|
||||
const char* subghz_get_name_preset(SubGhzTxRx* txrx, const char* preset);
|
||||
SubGhzRadioPreset subghz_get_preset(SubGhzTxRx* txrx);
|
||||
const char* subghz_txrx_get_name_preset(SubGhzTxRx* instance, const char* preset);
|
||||
SubGhzRadioPreset subghz_txrx_get_preset(SubGhzTxRx* instance);
|
||||
|
||||
void subghz_get_frequency_modulation(
|
||||
SubGhzTxRx* txrx,
|
||||
void subghz_txrx_get_frequency_modulation(
|
||||
SubGhzTxRx* instance,
|
||||
FuriString* frequency,
|
||||
FuriString* modulation,
|
||||
bool long_name);
|
||||
bool subghz_tx_start(SubGhzTxRx* txrx, FlipperFormat* flipper_format);
|
||||
void subghz_rx_start(SubGhzTxRx* txrx);
|
||||
void subghz_txrx_stop(SubGhzTxRx* txrx);
|
||||
void subghz_sleep(SubGhzTxRx* txrx);
|
||||
bool subghz_txrx_tx_start(SubGhzTxRx* instance, FlipperFormat* flipper_format);
|
||||
void subghz_txrx_rx_start(SubGhzTxRx* instance);
|
||||
void subghz_txrx_stop(SubGhzTxRx* instance);
|
||||
void subghz_txrx_sleep(SubGhzTxRx* instance);
|
||||
|
||||
SubGhzTxRxState subghz_txrx_get_state(SubGhzTxRx* txrx);
|
||||
SubGhzTxRxState subghz_txrx_get_state(SubGhzTxRx* instance);
|
||||
|
||||
void subghz_hopper_update(SubGhzTxRx* txrx);
|
||||
SubGhzHopperState subghz_hopper_get_state(SubGhzTxRx* txrx);
|
||||
void subghz_hopper_set_state(SubGhzTxRx* txrx, SubGhzHopperState state);
|
||||
void subghz_hopper_remove_pause(SubGhzTxRx* txrx);
|
||||
void subghz_subghz_hopper_set_pause(SubGhzTxRx* txrx);
|
||||
void subghz_txrx_hopper_update(SubGhzTxRx* instance);
|
||||
SubGhzHopperState subghz_txrx_hopper_get_state(SubGhzTxRx* instance);
|
||||
void subghz_txrx_hopper_set_state(SubGhzTxRx* instance, SubGhzHopperState state);
|
||||
void subghz_txrx_hopper_remove_pause(SubGhzTxRx* instance);
|
||||
void subghz_txrx_hopper_set_pause(SubGhzTxRx* instance);
|
||||
|
||||
void subghz_speaker_on(SubGhzTxRx* txrx);
|
||||
void subghz_speaker_off(SubGhzTxRx* txrx);
|
||||
void subghz_speaker_mute(SubGhzTxRx* txrx);
|
||||
void subghz_speaker_unmute(SubGhzTxRx* txrx);
|
||||
void subghz_speaker_set_state(SubGhzTxRx* txrx, SubGhzSpeakerState state);
|
||||
SubGhzSpeakerState subghz_speaker_get_state(SubGhzTxRx* txrx);
|
||||
bool subghz_txrx_load_decoder_by_name_protocol(SubGhzTxRx* txrx, const char* name_protocol);
|
||||
SubGhzProtocolDecoderBase* subghz_txrx_get_decoder(SubGhzTxRx* txrx);
|
||||
void subghz_txrx_speaker_on(SubGhzTxRx* instance);
|
||||
void subghz_txrx_speaker_off(SubGhzTxRx* instance);
|
||||
void subghz_txrx_speaker_mute(SubGhzTxRx* instance);
|
||||
void subghz_txrx_speaker_unmute(SubGhzTxRx* instance);
|
||||
void subghz_txrx_speaker_set_state(SubGhzTxRx* instance, SubGhzSpeakerState state);
|
||||
SubGhzSpeakerState subghz_txrx_speaker_get_state(SubGhzTxRx* instance);
|
||||
bool subghz_txrx_load_decoder_by_name_protocol(SubGhzTxRx* instance, const char* name_protocol);
|
||||
SubGhzProtocolDecoderBase* subghz_txrx_get_decoder(SubGhzTxRx* instance);
|
||||
|
||||
void subghz_txrx_need_save_callback_set(
|
||||
SubGhzTxRx* txrx,
|
||||
SubGhzTxRx* instance,
|
||||
SubGhzTxRxNeedSaveCallback callback,
|
||||
void* context);
|
||||
FlipperFormat* subghz_txtx_get_fff_data(SubGhzTxRx* txrx);
|
||||
SubGhzSetting* subghz_txrx_get_setting(SubGhzTxRx* txrx);
|
||||
FlipperFormat* subghz_txtx_get_fff_data(SubGhzTxRx* instance);
|
||||
SubGhzSetting* subghz_txrx_get_setting(SubGhzTxRx* instance);
|
||||
|
||||
bool subghz_txrx_protocol_is_preserved(SubGhzTxRx* txrx);
|
||||
bool subghz_txrx_protocol_is_send(SubGhzTxRx* txrx, bool check_type);
|
||||
bool subghz_txrx_protocol_is_preserved(SubGhzTxRx* instance);
|
||||
bool subghz_txrx_protocol_is_send(SubGhzTxRx* instance, bool check_type);
|
||||
|
||||
void subghz_txrx_receiver_set_filter(SubGhzTxRx* txrx, SubGhzProtocolFlag filter);
|
||||
void subghz_txrx_receiver_set_filter(SubGhzTxRx* instance, SubGhzProtocolFlag filter);
|
||||
|
||||
void subghz_txrx_set_rx_calback(SubGhzTxRx* txrx, SubGhzReceiverCallback callback, void* context);
|
||||
void subghz_txrx_set_rx_calback(
|
||||
SubGhzTxRx* instance,
|
||||
SubGhzReceiverCallback callback,
|
||||
void* context);
|
||||
void subghz_txrx_set_raw_file_encoder_worker_set_callback_end(
|
||||
SubGhzTxRx* txrx,
|
||||
SubGhzTxRx* instance,
|
||||
SubGhzProtocolEncoderRAWCallbackEnd callback,
|
||||
void* context);
|
||||
|
||||
void subghz_txrx_set_debug_pin_state(SubGhzTxRx* txrx, bool state);
|
||||
bool subghz_txrx_get_debug_pin_state(SubGhzTxRx* txrx);
|
||||
void subghz_txrx_set_debug_pin_state(SubGhzTxRx* instance, bool state);
|
||||
bool subghz_txrx_get_debug_pin_state(SubGhzTxRx* instance);
|
||||
|
||||
SubGhzReceiver* subghz_txrx_get_receiver(SubGhzTxRx* txrx); // TODO use only in DecodeRaw
|
||||
SubGhzReceiver* subghz_txrx_get_receiver(SubGhzTxRx* instance); // TODO use only in DecodeRaw
|
||||
|
||||
//#############Create new Key##############
|
||||
bool subghz_gen_data_protocol(
|
||||
bool subghz_txrx_gen_data_protocol(
|
||||
void* context,
|
||||
const char* preset_name,
|
||||
uint32_t frequency,
|
||||
@ -86,8 +86,8 @@ bool subghz_gen_data_protocol(
|
||||
uint64_t key,
|
||||
uint32_t bit);
|
||||
|
||||
bool subghz_gen_data_protocol_and_te(
|
||||
SubGhzTxRx* txrx,
|
||||
bool subghz_txrx_gen_data_protocol_and_te(
|
||||
SubGhzTxRx* instance,
|
||||
const char* preset_name,
|
||||
uint32_t frequency,
|
||||
const char* protocol_name,
|
||||
@ -149,7 +149,7 @@ bool subghz_scene_set_type_submenu_gen_data_somfy_telis( //TODO rename
|
||||
uint8_t btn,
|
||||
uint16_t cnt);
|
||||
|
||||
bool subghz_gen_secplus_v2_protocol(
|
||||
bool subghz_txrx_gen_secplus_v2_protocol(
|
||||
SubGhzTxRx* txrx,
|
||||
const char* name_preset,
|
||||
uint32_t frequency,
|
||||
@ -157,4 +157,7 @@ bool subghz_gen_secplus_v2_protocol(
|
||||
uint8_t btn,
|
||||
uint32_t cnt);
|
||||
|
||||
bool subghz_gen_secplus_v1_protocol(SubGhzTxRx* txrx, const char* name_preset, uint32_t frequency);
|
||||
bool subghz_txrx_gen_secplus_v1_protocol(
|
||||
SubGhzTxRx* txrx,
|
||||
const char* name_preset,
|
||||
uint32_t frequency);
|
@ -29,7 +29,7 @@ static void subghz_scene_receiver_update_statusbar(void* context) {
|
||||
FuriString* frequency_str = furi_string_alloc();
|
||||
FuriString* modulation_str = furi_string_alloc();
|
||||
|
||||
subghz_get_frequency_modulation(subghz->txrx, frequency_str, modulation_str, false);
|
||||
subghz_txrx_get_frequency_modulation(subghz->txrx, frequency_str, modulation_str, false);
|
||||
|
||||
subghz_view_receiver_add_data_statusbar(
|
||||
subghz->subghz_receiver,
|
||||
@ -61,7 +61,7 @@ static void subghz_scene_add_to_history_callback(
|
||||
FuriString* item_name = furi_string_alloc();
|
||||
FuriString* item_time = furi_string_alloc();
|
||||
uint16_t idx = subghz_history_get_item(subghz->history);
|
||||
SubGhzRadioPreset preset = subghz_get_preset(subghz->txrx);
|
||||
SubGhzRadioPreset preset = subghz_txrx_get_preset(subghz->txrx);
|
||||
|
||||
if(subghz_history_add_to_history(subghz->history, decoder_base, &preset)) {
|
||||
furi_string_reset(item_name);
|
||||
|
@ -15,7 +15,7 @@ void subghz_scene_delete_on_enter(void* context) {
|
||||
FuriString* modulation_str = furi_string_alloc();
|
||||
FuriString* text = furi_string_alloc();
|
||||
|
||||
subghz_get_frequency_modulation(subghz->txrx, frequency_str, modulation_str, false);
|
||||
subghz_txrx_get_frequency_modulation(subghz->txrx, frequency_str, modulation_str, false);
|
||||
widget_add_string_element(
|
||||
subghz->widget,
|
||||
78,
|
||||
|
@ -30,7 +30,7 @@ void subghz_scene_delete_raw_on_enter(void* context) {
|
||||
|
||||
widget_add_string_element(
|
||||
subghz->widget, 38, 25, AlignLeft, AlignTop, FontSecondary, "RAW signal");
|
||||
subghz_get_frequency_modulation(subghz->txrx, frequency_str, modulation_str, false);
|
||||
subghz_txrx_get_frequency_modulation(subghz->txrx, frequency_str, modulation_str, false);
|
||||
widget_add_string_element(
|
||||
subghz->widget,
|
||||
35,
|
||||
|
@ -48,7 +48,7 @@ bool subghz_scene_need_saving_on_event(void* context, SceneManagerEvent event) {
|
||||
} else if(event.event == SubGhzCustomEventSceneExit) {
|
||||
if(subghz_rx_key_state_get(subghz) == SubGhzRxKeyStateExit) {
|
||||
subghz_rx_key_state_set(subghz, SubGhzRxKeyStateIDLE);
|
||||
subghz_set_preset(
|
||||
subghz_txrx_set_preset(
|
||||
subghz->txrx, "AM650", subghz->last_settings->frequency, NULL, 0);
|
||||
scene_manager_search_and_switch_to_previous_scene(
|
||||
subghz->scene_manager, SubGhzSceneStart);
|
||||
|
@ -41,8 +41,8 @@ static void subghz_scene_read_raw_update_statusbar(void* context) {
|
||||
FuriString* modulation_str = furi_string_alloc();
|
||||
|
||||
#ifdef SUBGHZ_EXT_PRESET_NAME
|
||||
subghz_get_frequency_modulation(subghz->txrx, frequency_str, modulation_str, true);
|
||||
//TODO if need subghz_get_preset
|
||||
subghz_txrx_get_frequency_modulation(subghz->txrx, frequency_str, modulation_str, true);
|
||||
//TODO if need subghz_txrx_get_preset
|
||||
//furi_string_printf(modulation_str, "%s", furi_string_get_cstr(subghz->txrx->preset->name));
|
||||
#else
|
||||
subghz_get_frequency_modulation(subghz->txrx, frequency_str, modulation_str, false);
|
||||
@ -140,7 +140,7 @@ bool subghz_scene_read_raw_on_event(void* context, SceneManagerEvent event) {
|
||||
} else {
|
||||
//Restore default setting
|
||||
if(subghz->raw_send_only) {
|
||||
subghz_set_preset(
|
||||
subghz_txrx_set_preset(
|
||||
subghz->txrx,
|
||||
"AM650",
|
||||
subghz_setting_get_default_frequency(
|
||||
@ -148,7 +148,7 @@ bool subghz_scene_read_raw_on_event(void* context, SceneManagerEvent event) {
|
||||
NULL,
|
||||
0);
|
||||
} else {
|
||||
subghz_set_preset(
|
||||
subghz_txrx_set_preset(
|
||||
subghz->txrx, "AM650", subghz->last_settings->frequency, NULL, 0);
|
||||
}
|
||||
if(!scene_manager_search_and_switch_to_previous_scene(
|
||||
@ -215,7 +215,7 @@ bool subghz_scene_read_raw_on_event(void* context, SceneManagerEvent event) {
|
||||
subghz->state_notifications = SubGhzNotificationStateIDLE;
|
||||
|
||||
subghz_txrx_stop(subghz->txrx);
|
||||
if(!subghz_tx_start(subghz->txrx, subghz_txtx_get_fff_data(subghz->txrx))) {
|
||||
if(!subghz_txrx_tx_start(subghz->txrx, subghz_txtx_get_fff_data(subghz->txrx))) {
|
||||
subghz_rx_key_state_set(subghz, SubGhzRxKeyStateBack);
|
||||
subghz_read_raw_set_status(
|
||||
subghz->subghz_read_raw,
|
||||
@ -280,13 +280,13 @@ bool subghz_scene_read_raw_on_event(void* context, SceneManagerEvent event) {
|
||||
if(subghz_rx_key_state_get(subghz) != SubGhzRxKeyStateIDLE) {
|
||||
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneNeedSaving);
|
||||
} else {
|
||||
SubGhzRadioPreset preset = subghz_get_preset(subghz->txrx);
|
||||
SubGhzRadioPreset preset = subghz_txrx_get_preset(subghz->txrx);
|
||||
if(subghz_protocol_raw_save_to_file_init(
|
||||
(SubGhzProtocolDecoderRAW*)subghz_txrx_get_decoder(subghz->txrx),
|
||||
RAW_FILE_NAME,
|
||||
&preset)) {
|
||||
DOLPHIN_DEED(DolphinDeedSubGhzRawRec);
|
||||
subghz_rx_start(subghz->txrx);
|
||||
subghz_txrx_rx_start(subghz->txrx);
|
||||
|
||||
subghz->state_notifications = SubGhzNotificationStateRx;
|
||||
subghz_rx_key_state_set(subghz, SubGhzRxKeyStateAddKey);
|
||||
|
@ -46,11 +46,12 @@ static void subghz_scene_receiver_update_statusbar(void* context) {
|
||||
|
||||
#ifdef SUBGHZ_EXT_PRESET_NAME
|
||||
if(subghz_history_get_last_index(subghz->history) > 0) {
|
||||
subghz_get_frequency_modulation(subghz->txrx, frequency_str, modulation_str, false);
|
||||
subghz_txrx_get_frequency_modulation(
|
||||
subghz->txrx, frequency_str, modulation_str, false);
|
||||
} else {
|
||||
FuriString* temp_str = furi_string_alloc();
|
||||
|
||||
subghz_get_frequency_modulation(subghz->txrx, frequency_str, temp_str, true);
|
||||
subghz_txrx_get_frequency_modulation(subghz->txrx, frequency_str, temp_str, true);
|
||||
furi_string_printf(
|
||||
modulation_str,
|
||||
"%s Mod: %s",
|
||||
@ -59,7 +60,7 @@ static void subghz_scene_receiver_update_statusbar(void* context) {
|
||||
furi_string_free(temp_str);
|
||||
}
|
||||
#else
|
||||
subghz_get_frequency_modulation(subghz->txrx, frequency_str, modulation_str, false);
|
||||
subghz_txrx_get_frequency_modulation(subghz->txrx, frequency_str, modulation_str, false);
|
||||
#endif
|
||||
|
||||
subghz_view_receiver_add_data_statusbar(
|
||||
@ -96,7 +97,7 @@ static void subghz_scene_add_to_history_callback(
|
||||
FuriString* item_time = furi_string_alloc();
|
||||
uint16_t idx = subghz_history_get_item(subghz->history);
|
||||
|
||||
SubGhzRadioPreset preset = subghz_get_preset(subghz->txrx);
|
||||
SubGhzRadioPreset preset = subghz_txrx_get_preset(subghz->txrx);
|
||||
if(subghz_history_add_to_history(subghz->history, decoder_base, &preset)) {
|
||||
furi_string_reset(item_name);
|
||||
furi_string_reset(item_time);
|
||||
@ -126,7 +127,7 @@ void subghz_scene_receiver_on_enter(void* context) {
|
||||
FuriString* item_time = furi_string_alloc();
|
||||
|
||||
if(subghz_rx_key_state_get(subghz) == SubGhzRxKeyStateIDLE) {
|
||||
subghz_set_preset(subghz->txrx, "AM650", subghz->last_settings->frequency, NULL, 0);
|
||||
subghz_txrx_set_preset(subghz->txrx, "AM650", subghz->last_settings->frequency, NULL, 0);
|
||||
subghz_history_reset(subghz->history);
|
||||
subghz_rx_key_state_set(subghz, SubGhzRxKeyStateStart);
|
||||
}
|
||||
@ -183,7 +184,7 @@ void subghz_scene_receiver_on_enter(void* context) {
|
||||
|
||||
subghz->state_notifications = SubGhzNotificationStateRx;
|
||||
subghz_txrx_stop(subghz->txrx);
|
||||
subghz_rx_start(subghz->txrx);
|
||||
subghz_txrx_rx_start(subghz->txrx);
|
||||
subghz_view_receiver_set_idx_menu(subghz->subghz_receiver, subghz->idx_menu_chosen);
|
||||
|
||||
//to use a universal decoder, we are looking for a link to it
|
||||
@ -202,7 +203,7 @@ bool subghz_scene_receiver_on_event(void* context, SceneManagerEvent event) {
|
||||
// Stop CC1101 Rx
|
||||
subghz->state_notifications = SubGhzNotificationStateIDLE;
|
||||
subghz_txrx_stop(subghz->txrx);
|
||||
subghz_hopper_set_state(subghz->txrx, SubGhzHopperStateOFF);
|
||||
subghz_txrx_hopper_set_state(subghz->txrx, SubGhzHopperStateOFF);
|
||||
subghz->idx_menu_chosen = 0;
|
||||
subghz_txrx_set_rx_calback(subghz->txrx, NULL, subghz);
|
||||
|
||||
@ -211,7 +212,7 @@ bool subghz_scene_receiver_on_event(void* context, SceneManagerEvent event) {
|
||||
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneNeedSaving);
|
||||
} else {
|
||||
subghz_rx_key_state_set(subghz, SubGhzRxKeyStateIDLE);
|
||||
subghz_set_preset(
|
||||
subghz_txrx_set_preset(
|
||||
subghz->txrx, "AM650", subghz->last_settings->frequency, NULL, 0);
|
||||
scene_manager_search_and_switch_to_previous_scene(
|
||||
subghz->scene_manager, SubGhzSceneStart);
|
||||
@ -254,8 +255,8 @@ bool subghz_scene_receiver_on_event(void* context, SceneManagerEvent event) {
|
||||
break;
|
||||
}
|
||||
} else if(event.type == SceneManagerEventTypeTick) {
|
||||
if(subghz_hopper_get_state(subghz->txrx) != SubGhzHopperStateOFF) {
|
||||
subghz_hopper_update(subghz->txrx);
|
||||
if(subghz_txrx_hopper_get_state(subghz->txrx) != SubGhzHopperStateOFF) {
|
||||
subghz_txrx_hopper_update(subghz->txrx);
|
||||
subghz_scene_receiver_update_statusbar(subghz);
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ static void subghz_scene_receiver_config_set_frequency(VariableItem* item) {
|
||||
SubGhz* subghz = variable_item_get_context(item);
|
||||
uint8_t index = variable_item_get_current_value_index(item);
|
||||
|
||||
if(subghz_hopper_get_state(subghz->txrx) == SubGhzHopperStateOFF) {
|
||||
if(subghz_txrx_hopper_get_state(subghz->txrx) == SubGhzHopperStateOFF) {
|
||||
char text_buf[10] = {0};
|
||||
snprintf(
|
||||
text_buf,
|
||||
@ -161,16 +161,16 @@ static void subghz_scene_receiver_config_set_frequency(VariableItem* item) {
|
||||
10000);
|
||||
variable_item_set_current_value_text(item, text_buf);
|
||||
|
||||
SubGhzRadioPreset preset = subghz_get_preset(subghz->txrx);
|
||||
SubGhzRadioPreset preset = subghz_txrx_get_preset(subghz->txrx);
|
||||
|
||||
subghz_set_preset(
|
||||
subghz_txrx_set_preset(
|
||||
subghz->txrx,
|
||||
furi_string_get_cstr(preset.name),
|
||||
subghz_setting_get_frequency(subghz_txrx_get_setting(subghz->txrx), index),
|
||||
preset.data,
|
||||
preset.data_size);
|
||||
|
||||
preset = subghz_get_preset(subghz->txrx);
|
||||
preset = subghz_txrx_get_preset(subghz->txrx);
|
||||
|
||||
subghz->last_settings->frequency = preset.frequency;
|
||||
subghz_setting_set_default_frequency(
|
||||
@ -189,9 +189,9 @@ static void subghz_scene_receiver_config_set_preset(VariableItem* item) {
|
||||
subghz_setting_get_preset_name(subghz_txrx_get_setting(subghz->txrx), index);
|
||||
variable_item_set_current_value_text(item, preset_name);
|
||||
//subghz->last_settings->preset = index;
|
||||
SubGhzRadioPreset preset = subghz_get_preset(subghz->txrx);
|
||||
SubGhzRadioPreset preset = subghz_txrx_get_preset(subghz->txrx);
|
||||
|
||||
subghz_set_preset(
|
||||
subghz_txrx_set_preset(
|
||||
subghz->txrx,
|
||||
preset_name,
|
||||
preset.frequency,
|
||||
@ -218,8 +218,8 @@ static void subghz_scene_receiver_config_set_hopping_running(VariableItem* item)
|
||||
(VariableItem*)scene_manager_get_scene_state(
|
||||
subghz->scene_manager, SubGhzSceneReceiverConfig),
|
||||
text_buf);
|
||||
SubGhzRadioPreset preset = subghz_get_preset(subghz->txrx);
|
||||
subghz_set_preset(
|
||||
SubGhzRadioPreset preset = subghz_txrx_get_preset(subghz->txrx);
|
||||
subghz_txrx_set_preset(
|
||||
subghz->txrx,
|
||||
furi_string_get_cstr(preset.name),
|
||||
subghz_setting_get_default_frequency(subghz_txrx_get_setting(subghz->txrx)),
|
||||
@ -240,7 +240,7 @@ static void subghz_scene_receiver_config_set_hopping_running(VariableItem* item)
|
||||
subghz_setting_get_frequency_default_index(subghz_txrx_get_setting(subghz->txrx)));
|
||||
}
|
||||
|
||||
subghz_hopper_set_state(subghz->txrx, hopping_value[index]);
|
||||
subghz_txrx_hopper_set_state(subghz->txrx, hopping_value[index]);
|
||||
}
|
||||
|
||||
static void subghz_scene_receiver_config_set_speaker(VariableItem* item) {
|
||||
@ -248,7 +248,7 @@ static void subghz_scene_receiver_config_set_speaker(VariableItem* item) {
|
||||
uint8_t index = variable_item_get_current_value_index(item);
|
||||
|
||||
variable_item_set_current_value_text(item, speaker_text[index]);
|
||||
subghz_speaker_set_state(subghz->txrx, speaker_value[index]);
|
||||
subghz_txrx_speaker_set_state(subghz->txrx, speaker_value[index]);
|
||||
}
|
||||
|
||||
static void subghz_scene_receiver_config_set_bin_raw(VariableItem* item) {
|
||||
@ -305,7 +305,7 @@ void subghz_scene_receiver_config_on_enter(void* context) {
|
||||
SubGhz* subghz = context;
|
||||
VariableItem* item;
|
||||
uint8_t value_index;
|
||||
SubGhzRadioPreset preset = subghz_get_preset(subghz->txrx);
|
||||
SubGhzRadioPreset preset = subghz_txrx_get_preset(subghz->txrx);
|
||||
|
||||
item = variable_item_list_add(
|
||||
subghz->variable_item_list,
|
||||
@ -350,7 +350,7 @@ void subghz_scene_receiver_config_on_enter(void* context) {
|
||||
subghz_scene_receiver_config_set_hopping_running,
|
||||
subghz);
|
||||
value_index = subghz_scene_receiver_config_hopper_value_index(
|
||||
subghz_hopper_get_state(subghz->txrx), hopping_value, HOPPING_COUNT, subghz);
|
||||
subghz_txrx_hopper_get_state(subghz->txrx), hopping_value, HOPPING_COUNT, subghz);
|
||||
variable_item_set_current_value_index(item, value_index);
|
||||
variable_item_set_current_value_text(item, hopping_text[value_index]);
|
||||
}
|
||||
@ -412,7 +412,7 @@ void subghz_scene_receiver_config_on_enter(void* context) {
|
||||
subghz_scene_receiver_config_set_speaker,
|
||||
subghz);
|
||||
value_index =
|
||||
value_index_uint32(subghz_speaker_get_state(subghz->txrx), speaker_value, SPEAKER_COUNT);
|
||||
value_index_uint32(subghz_txrx_speaker_get_state(subghz->txrx), speaker_value, SPEAKER_COUNT);
|
||||
variable_item_set_current_value_index(item, value_index);
|
||||
variable_item_set_current_value_text(item, speaker_text[value_index]);
|
||||
|
||||
|
@ -34,7 +34,7 @@ static bool subghz_scene_receiver_info_update_parser(void* context) {
|
||||
|
||||
SubGhzRadioPreset* preset =
|
||||
subghz_history_get_radio_preset(subghz->history, subghz->idx_menu_chosen);
|
||||
subghz_set_preset(
|
||||
subghz_txrx_set_preset(
|
||||
subghz->txrx,
|
||||
furi_string_get_cstr(preset->name),
|
||||
preset->frequency,
|
||||
@ -52,7 +52,7 @@ void subghz_scene_receiver_info_draw_widget(SubGhz* subghz) {
|
||||
FuriString* modulation_str = furi_string_alloc();
|
||||
FuriString* text = furi_string_alloc();
|
||||
|
||||
subghz_get_frequency_modulation(subghz->txrx, frequency_str, modulation_str, false);
|
||||
subghz_txrx_get_frequency_modulation(subghz->txrx, frequency_str, modulation_str, false);
|
||||
widget_add_string_element(
|
||||
subghz->widget,
|
||||
78,
|
||||
@ -118,17 +118,17 @@ bool subghz_scene_receiver_info_on_event(void* context, SceneManagerEvent event)
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
if(event.event == SubGhzCustomEventSceneReceiverInfoTxStart) {
|
||||
//CC1101 Stop RX -> Start TX
|
||||
subghz_subghz_hopper_set_pause(subghz->txrx);
|
||||
subghz_txrx_hopper_set_pause(subghz->txrx);
|
||||
|
||||
if(!subghz_scene_receiver_info_update_parser(subghz)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!subghz_tx_start(
|
||||
if(!subghz_txrx_tx_start(
|
||||
subghz->txrx,
|
||||
subghz_history_get_raw_data(subghz->history, subghz->idx_menu_chosen))) {
|
||||
subghz_rx_start(subghz->txrx);
|
||||
subghz_hopper_remove_pause(subghz->txrx);
|
||||
subghz_txrx_rx_start(subghz->txrx);
|
||||
subghz_txrx_hopper_remove_pause(subghz->txrx);
|
||||
subghz->state_notifications = SubGhzNotificationStateRx;
|
||||
} else {
|
||||
subghz->state_notifications = SubGhzNotificationStateTx;
|
||||
@ -143,16 +143,16 @@ bool subghz_scene_receiver_info_on_event(void* context, SceneManagerEvent event)
|
||||
|
||||
subghz_txrx_stop(subghz->txrx);
|
||||
if(!subghz->in_decoder_scene) {
|
||||
subghz_rx_start(subghz->txrx);
|
||||
subghz_txrx_rx_start(subghz->txrx);
|
||||
|
||||
subghz_hopper_remove_pause(subghz->txrx);
|
||||
subghz_txrx_hopper_remove_pause(subghz->txrx);
|
||||
subghz->state_notifications = SubGhzNotificationStateRx;
|
||||
}
|
||||
return true;
|
||||
} else if(event.event == SubGhzCustomEventSceneReceiverInfoSave) {
|
||||
//CC1101 Stop RX -> Save
|
||||
subghz->state_notifications = SubGhzNotificationStateIDLE;
|
||||
subghz_hopper_set_state(subghz->txrx, SubGhzHopperStateOFF);
|
||||
subghz_txrx_hopper_set_state(subghz->txrx, SubGhzHopperStateOFF);
|
||||
|
||||
subghz_txrx_stop(subghz->txrx);
|
||||
if(!subghz_scene_receiver_info_update_parser(subghz)) {
|
||||
@ -170,8 +170,8 @@ bool subghz_scene_receiver_info_on_event(void* context, SceneManagerEvent event)
|
||||
return true;
|
||||
}
|
||||
} else if(event.type == SceneManagerEventTypeTick) {
|
||||
if(subghz_hopper_get_state(subghz->txrx) != SubGhzHopperStateOFF) {
|
||||
subghz_hopper_update(subghz->txrx);
|
||||
if(subghz_txrx_hopper_get_state(subghz->txrx) != SubGhzHopperStateOFF) {
|
||||
subghz_txrx_hopper_update(subghz->txrx);
|
||||
}
|
||||
switch(subghz->state_notifications) {
|
||||
case SubGhzNotificationStateTx:
|
||||
|
@ -44,7 +44,7 @@ bool subghz_scene_rpc_on_event(void* context, SceneManagerEvent event) {
|
||||
bool result = false;
|
||||
if((subghz_txrx_get_state(subghz->txrx) == SubGhzTxRxStateSleep) &&
|
||||
(state == SubGhzRpcStateLoaded)) {
|
||||
result = subghz_tx_start(subghz->txrx, subghz_txtx_get_fff_data(subghz->txrx));
|
||||
result = subghz_txrx_tx_start(subghz->txrx, subghz_txtx_get_fff_data(subghz->txrx));
|
||||
if(result) subghz_blink_start(subghz);
|
||||
}
|
||||
if(!result) {
|
||||
|
@ -305,64 +305,64 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
|
||||
break;
|
||||
case SubmenuIndexPricenton433:
|
||||
key = (key & 0x00FFFFF0) | 0x4; //btn 0x1, 0x2, 0x4, 0x8
|
||||
generated_protocol = subghz_gen_data_protocol_and_te(
|
||||
generated_protocol = subghz_txrx_gen_data_protocol_and_te(
|
||||
subghz->txrx, "AM650", 433920000, SUBGHZ_PROTOCOL_PRINCETON_NAME, key, 24, 400);
|
||||
break;
|
||||
case SubmenuIndexPricenton315:
|
||||
key = (key & 0x00FFFFF0) | 0x4; //btn 0x1, 0x2, 0x4, 0x8
|
||||
generated_protocol = subghz_gen_data_protocol_and_te(
|
||||
generated_protocol = subghz_txrx_gen_data_protocol_and_te(
|
||||
subghz->txrx, "AM650", 315000000, SUBGHZ_PROTOCOL_PRINCETON_NAME, key, 24, 400);
|
||||
break;
|
||||
case SubmenuIndexNiceFlo12bit:
|
||||
key = (key & 0x0000FFF0) | 0x1; //btn 0x1, 0x2, 0x4
|
||||
generated_protocol = subghz_gen_data_protocol(
|
||||
generated_protocol = subghz_txrx_gen_data_protocol(
|
||||
subghz->txrx, "AM650", 433920000, SUBGHZ_PROTOCOL_NICE_FLO_NAME, key, 12);
|
||||
break;
|
||||
case SubmenuIndexNiceFlo24bit:
|
||||
key = (key & 0x00FFFFF0) | 0x4; //btn 0x1, 0x2, 0x4, 0x8
|
||||
generated_protocol = subghz_gen_data_protocol(
|
||||
generated_protocol = subghz_txrx_gen_data_protocol(
|
||||
subghz->txrx, "AM650", 433920000, SUBGHZ_PROTOCOL_NICE_FLO_NAME, key, 24);
|
||||
break;
|
||||
case SubmenuIndexCAME12bit:
|
||||
key = (key & 0x0000FFF0) | 0x1; //btn 0x1, 0x2, 0x4
|
||||
generated_protocol = subghz_gen_data_protocol(
|
||||
generated_protocol = subghz_txrx_gen_data_protocol(
|
||||
subghz->txrx, "AM650", 433920000, SUBGHZ_PROTOCOL_CAME_NAME, key, 12);
|
||||
break;
|
||||
case SubmenuIndexCAME24bit:
|
||||
key = (key & 0x00FFFFF0) | 0x4; //btn 0x1, 0x2, 0x4, 0x8
|
||||
generated_protocol = subghz_gen_data_protocol(
|
||||
generated_protocol = subghz_txrx_gen_data_protocol(
|
||||
subghz->txrx, "AM650", 433920000, SUBGHZ_PROTOCOL_CAME_NAME, key, 24);
|
||||
break;
|
||||
case SubmenuIndexCAME12bit868:
|
||||
key = (key & 0x0000FFF0) | 0x1; //btn 0x1, 0x2, 0x4
|
||||
generated_protocol = subghz_gen_data_protocol(
|
||||
generated_protocol = subghz_txrx_gen_data_protocol(
|
||||
subghz->txrx, "AM650", 868350000, SUBGHZ_PROTOCOL_CAME_NAME, key, 12);
|
||||
break;
|
||||
case SubmenuIndexCAME24bit868:
|
||||
key = (key & 0x00FFFFF0) | 0x4; //btn 0x1, 0x2, 0x4, 0x8
|
||||
generated_protocol = subghz_gen_data_protocol(
|
||||
generated_protocol = subghz_txrx_gen_data_protocol(
|
||||
subghz->txrx, "AM650", 868350000, SUBGHZ_PROTOCOL_CAME_NAME, key, 24);
|
||||
break;
|
||||
case SubmenuIndexLinear_300_00:
|
||||
key = (key & 0x3FF);
|
||||
generated_protocol = subghz_gen_data_protocol(
|
||||
generated_protocol = subghz_txrx_gen_data_protocol(
|
||||
subghz->txrx, "AM650", 300000000, SUBGHZ_PROTOCOL_LINEAR_NAME, key, 10);
|
||||
break;
|
||||
case SubmenuIndexBETT_433:
|
||||
key = (key & 0x0000FFF0);
|
||||
generated_protocol = subghz_gen_data_protocol(
|
||||
generated_protocol = subghz_txrx_gen_data_protocol(
|
||||
subghz->txrx, "AM650", 433920000, SUBGHZ_PROTOCOL_BETT_NAME, key, 18);
|
||||
break;
|
||||
case SubmenuIndexCAMETwee:
|
||||
key = (key & 0x0FFFFFF0);
|
||||
key = 0x003FFF7200000000 | (key ^ 0xE0E0E0EE);
|
||||
generated_protocol = subghz_gen_data_protocol(
|
||||
generated_protocol = subghz_txrx_gen_data_protocol(
|
||||
subghz->txrx, "AM650", 433920000, SUBGHZ_PROTOCOL_CAME_TWEE_NAME, key, 54);
|
||||
break;
|
||||
case SubmenuIndexGateTX:
|
||||
key = (key & 0x00F0FF00) | 0xF << 16 | 0x40; //btn 0xF, 0xC, 0xA, 0x6 (?)
|
||||
uint64_t rev_key = subghz_protocol_blocks_reverse_key(key, 24);
|
||||
generated_protocol = subghz_gen_data_protocol(
|
||||
generated_protocol = subghz_txrx_gen_data_protocol(
|
||||
subghz->txrx, "AM650", 433920000, SUBGHZ_PROTOCOL_GATE_TX_NAME, rev_key, 24);
|
||||
break;
|
||||
case SubmenuIndexBeninca433:
|
||||
@ -613,28 +613,28 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
|
||||
}
|
||||
break;
|
||||
case SubmenuIndexLiftMaster_315_00:
|
||||
generated_protocol = subghz_gen_secplus_v1_protocol(subghz->txrx, "AM650", 315000000);
|
||||
generated_protocol = subghz_txrx_gen_secplus_v1_protocol(subghz->txrx, "AM650", 315000000);
|
||||
break;
|
||||
case SubmenuIndexLiftMaster_390_00:
|
||||
generated_protocol = subghz_gen_secplus_v1_protocol(subghz->txrx, "AM650", 390000000);
|
||||
generated_protocol = subghz_txrx_gen_secplus_v1_protocol(subghz->txrx, "AM650", 390000000);
|
||||
break;
|
||||
case SubmenuIndexLiftMaster_433_00:
|
||||
generated_protocol = subghz_gen_secplus_v1_protocol(subghz->txrx, "AM650", 433920000);
|
||||
generated_protocol = subghz_txrx_gen_secplus_v1_protocol(subghz->txrx, "AM650", 433920000);
|
||||
break;
|
||||
case SubmenuIndexSecPlus_v2_310_00:
|
||||
generated_protocol = subghz_gen_secplus_v2_protocol(
|
||||
generated_protocol = subghz_txrx_gen_secplus_v2_protocol(
|
||||
subghz->txrx, "AM650", 310000000, key, 0x68, 0xE500000);
|
||||
break;
|
||||
case SubmenuIndexSecPlus_v2_315_00:
|
||||
generated_protocol = subghz_gen_secplus_v2_protocol(
|
||||
generated_protocol = subghz_txrx_gen_secplus_v2_protocol(
|
||||
subghz->txrx, "AM650", 315000000, key, 0x68, 0xE500000);
|
||||
break;
|
||||
case SubmenuIndexSecPlus_v2_390_00:
|
||||
generated_protocol = subghz_gen_secplus_v2_protocol(
|
||||
generated_protocol = subghz_txrx_gen_secplus_v2_protocol(
|
||||
subghz->txrx, "AM650", 390000000, key, 0x68, 0xE500000);
|
||||
break;
|
||||
case SubmenuIndexSecPlus_v2_433_00:
|
||||
generated_protocol = subghz_gen_secplus_v2_protocol(
|
||||
generated_protocol = subghz_txrx_gen_secplus_v2_protocol(
|
||||
subghz->txrx, "AM650", 433920000, key, 0x68, 0xE500000);
|
||||
break;
|
||||
default:
|
||||
|
@ -26,7 +26,7 @@ bool subghz_scene_transmitter_update_data_show(void* context) {
|
||||
subghz_protocol_decoder_base_get_string(
|
||||
subghz_txrx_get_decoder(subghz->txrx), key_str);
|
||||
|
||||
subghz_get_frequency_modulation(subghz->txrx, frequency_str, modulation_str, false);
|
||||
subghz_txrx_get_frequency_modulation(subghz->txrx, frequency_str, modulation_str, false);
|
||||
subghz_view_transmitter_add_data_to_show(
|
||||
subghz->subghz_transmitter,
|
||||
furi_string_get_cstr(key_str),
|
||||
@ -66,7 +66,7 @@ bool subghz_scene_transmitter_on_event(void* context, SceneManagerEvent event) {
|
||||
if(event.event == SubGhzCustomEventViewTransmitterSendStart) {
|
||||
subghz->state_notifications = SubGhzNotificationStateIDLE;
|
||||
|
||||
if(subghz_tx_start(subghz->txrx, subghz_txtx_get_fff_data(subghz->txrx))) {
|
||||
if(subghz_txrx_tx_start(subghz->txrx, subghz_txtx_get_fff_data(subghz->txrx))) {
|
||||
subghz->state_notifications = SubGhzNotificationStateTx;
|
||||
subghz_scene_transmitter_update_data_show(subghz);
|
||||
DOLPHIN_DEED(DolphinDeedSubGhzSend);
|
||||
@ -82,7 +82,7 @@ bool subghz_scene_transmitter_on_event(void* context, SceneManagerEvent event) {
|
||||
// Calling restore!
|
||||
subghz_txrx_stop(subghz->txrx);
|
||||
|
||||
if(!subghz_tx_start(subghz->txrx, subghz_txtx_get_fff_data(subghz->txrx))) {
|
||||
if(!subghz_txrx_tx_start(subghz->txrx, subghz_txtx_get_fff_data(subghz->txrx))) {
|
||||
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneShowOnlyRx);
|
||||
}
|
||||
|
||||
|
@ -51,14 +51,14 @@ static void subghz_rpc_command_callback(RpcAppSystemEvent event, void* context)
|
||||
}
|
||||
}
|
||||
|
||||
void subghz_blink_start(SubGhz* instance) {
|
||||
furi_assert(instance);
|
||||
notification_message(instance->notifications, &sequence_blink_start_magenta);
|
||||
void subghz_blink_start(SubGhz* subghz) {
|
||||
furi_assert(subghz);
|
||||
notification_message(subghz->notifications, &sequence_blink_start_magenta);
|
||||
}
|
||||
|
||||
void subghz_blink_stop(SubGhz* instance) {
|
||||
furi_assert(instance);
|
||||
notification_message(instance->notifications, &sequence_blink_stop);
|
||||
void subghz_blink_stop(SubGhz* subghz) {
|
||||
furi_assert(subghz);
|
||||
notification_message(subghz->notifications, &sequence_blink_stop);
|
||||
}
|
||||
|
||||
SubGhz* subghz_alloc(bool alloc_for_tx_only) {
|
||||
@ -262,7 +262,7 @@ SubGhz* subghz_alloc(bool alloc_for_tx_only) {
|
||||
}
|
||||
|
||||
if(!alloc_for_tx_only) {
|
||||
subghz_set_preset(subghz->txrx, "AM650", subghz->last_settings->frequency, NULL, 0);
|
||||
subghz_txrx_set_preset(subghz->txrx, "AM650", subghz->last_settings->frequency, NULL, 0);
|
||||
}
|
||||
|
||||
subghz_rx_key_state_set(subghz, SubGhzRxKeyStateIDLE);
|
||||
@ -295,9 +295,9 @@ void subghz_free(SubGhz* subghz, bool alloc_for_tx_only) {
|
||||
subghz->rpc_ctx = NULL;
|
||||
}
|
||||
|
||||
subghz_speaker_off(subghz->txrx);
|
||||
subghz_txrx_speaker_off(subghz->txrx);
|
||||
subghz_txrx_stop(subghz->txrx);
|
||||
subghz_sleep(subghz->txrx);
|
||||
subghz_txrx_sleep(subghz->txrx);
|
||||
|
||||
#if FURI_DEBUG
|
||||
// Packet Test
|
||||
|
@ -91,7 +91,7 @@ bool subghz_key_load(SubGhz* subghz, const char* file_path, bool show_dialog) {
|
||||
}
|
||||
|
||||
furi_string_set_str(
|
||||
temp_str, subghz_get_name_preset(subghz->txrx, furi_string_get_cstr(temp_str)));
|
||||
temp_str, subghz_txrx_get_name_preset(subghz->txrx, furi_string_get_cstr(temp_str)));
|
||||
if(temp_str == NULL) {
|
||||
break;
|
||||
}
|
||||
@ -112,7 +112,7 @@ bool subghz_key_load(SubGhz* subghz, const char* file_path, bool show_dialog) {
|
||||
}
|
||||
size_t preset_index = subghz_setting_get_inx_preset_by_name(
|
||||
subghz_txrx_get_setting(subghz->txrx), furi_string_get_cstr(temp_str));
|
||||
subghz_set_preset(
|
||||
subghz_txrx_set_preset(
|
||||
subghz->txrx,
|
||||
furi_string_get_cstr(temp_str),
|
||||
temp_data32,
|
||||
|
@ -43,7 +43,7 @@
|
||||
|
||||
#include "helpers/subghz_threshold_rssi.h"
|
||||
|
||||
#include "subghz_radio.h"
|
||||
#include "helpers/subghz_txrx.h"
|
||||
|
||||
#define SUBGHZ_MAX_LEN_NAME 64
|
||||
#define SUBGHZ_EXT_PRESET_NAME true
|
||||
@ -120,8 +120,8 @@ struct SubGhz {
|
||||
void* rpc_ctx;
|
||||
};
|
||||
|
||||
void subghz_blink_start(SubGhz* instance);
|
||||
void subghz_blink_stop(SubGhz* instance);
|
||||
void subghz_blink_start(SubGhz* subghz);
|
||||
void subghz_blink_stop(SubGhz* subghz);
|
||||
|
||||
void subghz_dialog_message_show_only_rx(SubGhz* subghz);
|
||||
bool subghz_key_load(SubGhz* subghz, const char* file_path, bool show_dialog);
|
||||
|
Loading…
Reference in New Issue
Block a user