Minor fixes

This commit is contained in:
gid9798 2023-05-09 22:16:52 +03:00
parent 0019baaa00
commit a3cf592f29
3 changed files with 20 additions and 13 deletions

View File

@ -80,7 +80,7 @@ void subghz_txrx_set_preset(
const char* subghz_txrx_get_preset_name(SubGhzTxRx* instance, const char* preset) {
UNUSED(instance);
const char* preset_name = NULL;
const char* preset_name = "";
if(!strcmp(preset, "FuriHalSubGhzPresetOok270Async")) {
preset_name = "AM270";
} else if(!strcmp(preset, "FuriHalSubGhzPresetOok650Async")) {
@ -198,6 +198,7 @@ static bool subghz_txrx_tx(SubGhzTxRx* instance, uint32_t frequency) {
subghz_txrx_speaker_on(instance);
instance->txrx_state = SubGhzTxRxStateTx;
}
return ret;
}
@ -245,11 +246,13 @@ SubGhzTxRxStartTxState subghz_txrx_tx_start(SubGhzTxRx* instance, FlipperFormat*
} else {
ret = SubGhzTxRxStartTxStateErrorParserOthers;
}
} else {
FURI_LOG_E(
TAG, "Unknown name preset \" %s \"", furi_string_get_cstr(preset->name));
ret = SubGhzTxRxStartTxStateErrorParserOthers;
}
if(ret == SubGhzTxRxStartTxStateOk) {
//Start TX
furi_hal_subghz_start_async_tx(
@ -258,6 +261,8 @@ SubGhzTxRxStartTxState subghz_txrx_tx_start(SubGhzTxRx* instance, FlipperFormat*
} else {
ret = SubGhzTxRxStartTxStateErrorParserOthers;
}
} else {
ret = SubGhzTxRxStartTxStateErrorParserOthers;
}
if(ret != SubGhzTxRxStartTxStateOk) {
subghz_transmitter_free(instance->transmitter);

View File

@ -1,5 +1,7 @@
#pragma once
#include "subghz_types.h"
#include <lib/subghz/subghz_worker.h>
#include <lib/subghz/subghz_setting.h>
#include <lib/subghz/receiver.h>

View File

@ -130,7 +130,7 @@ bool subghz_key_load(SubGhz* subghz, const char* file_path, bool show_dialog) {
furi_string_set_str(
temp_str, subghz_txrx_get_preset_name(subghz->txrx, furi_string_get_cstr(temp_str)));
if(temp_str == NULL) {
if(!strcmp(furi_string_get_cstr(temp_str), "")) {
break;
}
@ -270,17 +270,6 @@ bool subghz_get_next_name_file(SubGhz* subghz, uint8_t max_len) {
return res;
}
void subghz_save_to_file(void* context) {
furi_assert(context);
SubGhz* subghz = context;
if(subghz_path_is_file(subghz->file_path)) {
subghz_save_protocol_to_file(
subghz,
subghz_txrx_get_fff_data(subghz->txrx),
furi_string_get_cstr(subghz->file_path));
}
}
bool subghz_save_protocol_to_file(
SubGhz* subghz,
FlipperFormat* flipper_format,
@ -321,6 +310,17 @@ bool subghz_save_protocol_to_file(
return saved;
}
void subghz_save_to_file(void* context) {
furi_assert(context);
SubGhz* subghz = context;
if(subghz_path_is_file(subghz->file_path)) {
subghz_save_protocol_to_file(
subghz,
subghz_txrx_get_fff_data(subghz->txrx),
furi_string_get_cstr(subghz->file_path));
}
}
bool subghz_load_protocol_from_file(SubGhz* subghz) {
furi_assert(subghz);