Skip to content

Commit

Permalink
Fixed repeat in subghz tx_from_file command (#4099)
Browse files Browse the repository at this point in the history
* Fixed repeat in subghz tx_from_file command
* Fix PVS warnings

Co-authored-by: あく <alleteam@gmail.com>
  • Loading branch information
Jnesselr and skotopes authored Feb 20, 2025
1 parent 04fa7a9 commit 3698fc8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 24 deletions.
2 changes: 1 addition & 1 deletion applications/main/subghz/subghz_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ void subghz_cli_command_tx_from_file(Cli* cli, FuriString* args, void* context)
if(furi_string_size(args)) {
char* args_cstr = (char*)furi_string_get_cstr(args);
StrintParseError parse_err = StrintParseNoError;
parse_err |= strint_to_uint32(args_cstr, &args_cstr, &frequency, 10);
parse_err |= strint_to_uint32(args_cstr, &args_cstr, &repeat, 10);
parse_err |= strint_to_uint32(args_cstr, &args_cstr, &device_ind, 10);
if(parse_err) {
cli_print_usage(
Expand Down
33 changes: 10 additions & 23 deletions lib/lfrfid/protocols/protocol_noralsy.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,7 @@ bool protocol_noralsy_write_data(ProtocolNoralsy* protocol, void* data) {
return result;
}

static void protocol_noralsy_render_data_internal(
ProtocolNoralsy* protocol,
FuriString* result,
bool brief) {
static void protocol_noralsy_render_data_internal(ProtocolNoralsy* protocol, FuriString* result) {
UNUSED(protocol);
uint32_t raw2 = bit_lib_get_bits_32(protocol->data, 32, 32);
uint32_t raw3 = bit_lib_get_bits_32(protocol->data, 64, 32);
Expand All @@ -181,31 +178,21 @@ static void protocol_noralsy_render_data_internal(

uint8_t year = (raw2 & 0x000ff000) >> 12;
bool tag_is_gen_z = (year > 0x60);
if(brief) {
furi_string_printf(
result,
"Card ID: %07lx\n"
"Year: %s%02x",
cardid,
tag_is_gen_z ? "19" : "20",
year);
} else {
furi_string_printf(
result,
"Card ID: %07lx\n"
"Year: %s%02x",
cardid,
tag_is_gen_z ? "19" : "20",
year);
}
furi_string_printf(
result,
"Card ID: %07lx\n"
"Year: %s%02x",
cardid,
tag_is_gen_z ? "19" : "20",
year);
}

void protocol_noralsy_render_data(ProtocolNoralsy* protocol, FuriString* result) {
protocol_noralsy_render_data_internal(protocol, result, false);
protocol_noralsy_render_data_internal(protocol, result);
}

void protocol_noralsy_render_brief_data(ProtocolNoralsy* protocol, FuriString* result) {
protocol_noralsy_render_data_internal(protocol, result, true);
protocol_noralsy_render_data_internal(protocol, result);
}

const ProtocolBase protocol_noralsy = {
Expand Down

0 comments on commit 3698fc8

Please sign in to comment.