mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-10 06:54:19 +00:00
[FL-2811] Fix PVS-Studio warnings (#2142)
Co-authored-by: あく <alleteam@gmail.com> Co-authored-by: gornekich <n.gorbadey@gmail.com>
This commit is contained in:
parent
ad3bff0b67
commit
8582670a34
201 changed files with 719 additions and 743 deletions
3
.github/workflows/pvs_studio.yml
vendored
3
.github/workflows/pvs_studio.yml
vendored
|
@ -50,7 +50,7 @@ jobs:
|
|||
|
||||
- name: 'Generate compile_comands.json'
|
||||
run: |
|
||||
./fbt COMPACT=1 version_json proto_ver icons firmware_cdb dolphin_internal dolphin_blocking _fap_icons
|
||||
./fbt COMPACT=1 version_json proto_ver icons firmware_cdb dolphin_internal dolphin_blocking _fap_icons api_syms
|
||||
|
||||
- name: 'Static code analysis'
|
||||
run: |
|
||||
|
@ -58,6 +58,7 @@ jobs:
|
|||
pvs-studio-analyzer credentials ${{ secrets.PVS_STUDIO_CREDENTIALS }}
|
||||
pvs-studio-analyzer analyze \
|
||||
@.pvsoptions \
|
||||
-C gccarm \
|
||||
-j$(grep -c processor /proc/cpuinfo) \
|
||||
-f build/f7-firmware-DC/compile_commands.json \
|
||||
-o PVS-Studio.log
|
||||
|
|
23
.pvsconfig
23
.pvsconfig
|
@ -1,4 +1,5 @@
|
|||
# MLib macros we can't do much about.
|
||||
//-V:M_LET:1048,1044
|
||||
//-V:M_EACH:1048,1044
|
||||
//-V:ARRAY_DEF:760,747,568,776,729,712,654
|
||||
//-V:LIST_DEF:760,747,568,712,729,654,776
|
||||
|
@ -16,8 +17,30 @@
|
|||
# Potentially null argument warnings
|
||||
//-V:memset:575
|
||||
//-V:memcpy:575
|
||||
//-V:memcmp:575
|
||||
//-V:strlen:575
|
||||
//-V:strcpy:575
|
||||
//-V:strncpy:575
|
||||
//-V:strchr:575
|
||||
|
||||
# For loop warning on M_FOREACH
|
||||
//-V:for:1044
|
||||
|
||||
# Bitwise OR
|
||||
//-V:bit:792
|
||||
|
||||
# Do not complain about similar code
|
||||
//-V::525
|
||||
|
||||
# Common embedded development pointer operations
|
||||
//-V::566
|
||||
//-V::1032
|
||||
|
||||
# Warnings about length mismatch
|
||||
//-V:property_value_out:666
|
||||
|
||||
# Model-related warnings
|
||||
//-V:with_view_model:1044,1048
|
||||
|
||||
# Functions that always return the same error code
|
||||
//-V:picopass_device_decrypt:1048
|
||||
|
|
|
@ -1 +1 @@
|
|||
--rules-config .pvsconfig -e lib/fatfs -e lib/fnv1a-hash -e lib/FreeRTOS-Kernel -e lib/heatshrink -e lib/libusb_stm32 -e lib/littlefs -e lib/mbedtls -e lib/micro-ecc -e lib/microtar -e lib/mlib -e lib/qrcode -e lib/ST25RFAL002 -e lib/STM32CubeWB -e lib/u8g2 -e */arm-none-eabi/*
|
||||
--rules-config .pvsconfig -e lib/fatfs -e lib/fnv1a-hash -e lib/FreeRTOS-Kernel -e lib/heatshrink -e lib/libusb_stm32 -e lib/littlefs -e lib/mbedtls -e lib/micro-ecc -e lib/microtar -e lib/mlib -e lib/qrcode -e lib/ST25RFAL002 -e lib/STM32CubeWB -e lib/u8g2 -e lib/nanopb -e */arm-none-eabi/* -e applications/plugins/dap_link/lib/free-dap
|
||||
|
|
60
applications/debug/unit_tests/float_tools/float_tools_test.c
Normal file
60
applications/debug/unit_tests/float_tools/float_tools_test.c
Normal file
|
@ -0,0 +1,60 @@
|
|||
#include <float.h>
|
||||
#include <float_tools.h>
|
||||
|
||||
#include "../minunit.h"
|
||||
|
||||
MU_TEST(float_tools_equal_test) {
|
||||
mu_check(float_is_equal(FLT_MAX, FLT_MAX));
|
||||
mu_check(float_is_equal(FLT_MIN, FLT_MIN));
|
||||
mu_check(float_is_equal(-FLT_MAX, -FLT_MAX));
|
||||
mu_check(float_is_equal(-FLT_MIN, -FLT_MIN));
|
||||
|
||||
mu_check(!float_is_equal(FLT_MIN, FLT_MAX));
|
||||
mu_check(!float_is_equal(-FLT_MIN, FLT_MAX));
|
||||
mu_check(!float_is_equal(FLT_MIN, -FLT_MAX));
|
||||
mu_check(!float_is_equal(-FLT_MIN, -FLT_MAX));
|
||||
|
||||
const float pi = 3.14159f;
|
||||
mu_check(float_is_equal(pi, pi));
|
||||
mu_check(float_is_equal(-pi, -pi));
|
||||
mu_check(!float_is_equal(pi, -pi));
|
||||
mu_check(!float_is_equal(-pi, pi));
|
||||
|
||||
const float one_third = 1.f / 3.f;
|
||||
const float one_third_dec = 0.3333333f;
|
||||
mu_check(one_third != one_third_dec);
|
||||
mu_check(float_is_equal(one_third, one_third_dec));
|
||||
|
||||
const float big_num = 1.e12f;
|
||||
const float med_num = 95.389f;
|
||||
const float smol_num = 1.e-12f;
|
||||
mu_check(float_is_equal(big_num, big_num));
|
||||
mu_check(float_is_equal(med_num, med_num));
|
||||
mu_check(float_is_equal(smol_num, smol_num));
|
||||
mu_check(!float_is_equal(smol_num, big_num));
|
||||
mu_check(!float_is_equal(med_num, smol_num));
|
||||
mu_check(!float_is_equal(big_num, med_num));
|
||||
|
||||
const float more_than_one = 1.f + FLT_EPSILON;
|
||||
const float less_than_one = 1.f - FLT_EPSILON;
|
||||
mu_check(!float_is_equal(more_than_one, less_than_one));
|
||||
mu_check(!float_is_equal(more_than_one, -less_than_one));
|
||||
mu_check(!float_is_equal(-more_than_one, less_than_one));
|
||||
mu_check(!float_is_equal(-more_than_one, -less_than_one));
|
||||
|
||||
const float slightly_more_than_one = 1.f + FLT_EPSILON / 2.f;
|
||||
const float slightly_less_than_one = 1.f - FLT_EPSILON / 2.f;
|
||||
mu_check(float_is_equal(slightly_more_than_one, slightly_less_than_one));
|
||||
mu_check(float_is_equal(-slightly_more_than_one, -slightly_less_than_one));
|
||||
mu_check(!float_is_equal(slightly_more_than_one, -slightly_less_than_one));
|
||||
mu_check(!float_is_equal(-slightly_more_than_one, slightly_less_than_one));
|
||||
}
|
||||
|
||||
MU_TEST_SUITE(float_tools_suite) {
|
||||
MU_RUN_TEST(float_tools_equal_test);
|
||||
}
|
||||
|
||||
int run_minunit_test_float_tools() {
|
||||
MU_RUN_SUITE(float_tools_suite);
|
||||
return MU_EXIT_CODE;
|
||||
}
|
|
@ -24,6 +24,7 @@ int run_minunit_test_protocol_dict();
|
|||
int run_minunit_test_lfrfid_protocols();
|
||||
int run_minunit_test_nfc();
|
||||
int run_minunit_test_bit_lib();
|
||||
int run_minunit_test_float_tools();
|
||||
int run_minunit_test_bt();
|
||||
|
||||
typedef int (*UnitTestEntry)();
|
||||
|
@ -50,6 +51,7 @@ const UnitTest unit_tests[] = {
|
|||
{.name = "protocol_dict", .entry = run_minunit_test_protocol_dict},
|
||||
{.name = "lfrfid", .entry = run_minunit_test_lfrfid_protocols},
|
||||
{.name = "bit_lib", .entry = run_minunit_test_bit_lib},
|
||||
{.name = "float_tools", .entry = run_minunit_test_float_tools},
|
||||
{.name = "bt", .entry = run_minunit_test_bt},
|
||||
};
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ ArchiveAppTypeEnum archive_get_app_type(const char* path) {
|
|||
}
|
||||
app_name++;
|
||||
|
||||
for(size_t i = 0; i < COUNT_OF(known_apps); i++) {
|
||||
for(size_t i = 0; i < COUNT_OF(known_apps); i++) { //-V1008
|
||||
if(strncmp(app_name, known_apps[i], strlen(known_apps[i])) == 0) {
|
||||
return i;
|
||||
}
|
||||
|
|
|
@ -177,7 +177,7 @@ bool archive_favorites_read(void* context) {
|
|||
|
||||
archive_set_item_count(browser, file_count);
|
||||
|
||||
if(need_refresh) {
|
||||
if(need_refresh) { //-V547
|
||||
archive_favourites_rescan();
|
||||
}
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ bool archive_scene_browser_on_event(void* context, SceneManagerEvent event) {
|
|||
case ArchiveBrowserEventFileMenuPin: {
|
||||
const char* name = archive_get_name(browser);
|
||||
if(favorites) {
|
||||
archive_favorites_delete(name);
|
||||
archive_favorites_delete("%s", name);
|
||||
archive_file_array_rm_selected(browser);
|
||||
archive_show_file_menu(browser, false);
|
||||
} else if(archive_is_known_app(selected->type)) {
|
||||
|
|
|
@ -218,8 +218,8 @@ static bool ducky_string(const char* param) {
|
|||
}
|
||||
|
||||
static uint16_t ducky_get_keycode(const char* param, bool accept_chars) {
|
||||
for(uint8_t i = 0; i < (sizeof(ducky_keys) / sizeof(ducky_keys[0])); i++) {
|
||||
uint8_t key_cmd_len = strlen(ducky_keys[i].name);
|
||||
for(size_t i = 0; i < (sizeof(ducky_keys) / sizeof(ducky_keys[0])); i++) {
|
||||
size_t key_cmd_len = strlen(ducky_keys[i].name);
|
||||
if((strncmp(param, ducky_keys[i].name, key_cmd_len) == 0) &&
|
||||
(ducky_is_line_end(param[key_cmd_len]))) {
|
||||
return ducky_keys[i].keycode;
|
||||
|
@ -417,7 +417,7 @@ static int32_t ducky_script_execute_next(BadUsbScript* bad_usb, File* script_fil
|
|||
return 0;
|
||||
} else if(delay_val < 0) { // Script error
|
||||
bad_usb->st.error_line = bad_usb->st.line_cur - 1;
|
||||
FURI_LOG_E(WORKER_TAG, "Unknown command at line %u", bad_usb->st.line_cur - 1);
|
||||
FURI_LOG_E(WORKER_TAG, "Unknown command at line %u", bad_usb->st.line_cur - 1U);
|
||||
return SCRIPT_STATE_ERROR;
|
||||
} else {
|
||||
return (delay_val + bad_usb->defdelay);
|
||||
|
@ -596,7 +596,9 @@ static int32_t bad_usb_worker(void* context) {
|
|||
}
|
||||
bad_usb->st.state = worker_state;
|
||||
continue;
|
||||
} else if((flags == FuriFlagErrorTimeout) || (flags == FuriFlagErrorResource)) {
|
||||
} else if(
|
||||
(flags == (unsigned)FuriFlagErrorTimeout) ||
|
||||
(flags == (unsigned)FuriFlagErrorResource)) {
|
||||
if(delay_val > 0) {
|
||||
bad_usb->st.delay_remain--;
|
||||
continue;
|
||||
|
@ -650,7 +652,7 @@ static int32_t bad_usb_worker(void* context) {
|
|||
BadUsbScript* bad_usb_script_open(FuriString* file_path) {
|
||||
furi_assert(file_path);
|
||||
|
||||
BadUsbScript* bad_usb = malloc(sizeof(BadUsbScript)); //-V773
|
||||
BadUsbScript* bad_usb = malloc(sizeof(BadUsbScript));
|
||||
bad_usb->file_path = furi_string_alloc();
|
||||
furi_string_set(bad_usb->file_path, file_path);
|
||||
|
||||
|
@ -660,7 +662,7 @@ BadUsbScript* bad_usb_script_open(FuriString* file_path) {
|
|||
bad_usb->thread = furi_thread_alloc_ex("BadUsbWorker", 2048, bad_usb_worker, bad_usb);
|
||||
furi_thread_start(bad_usb->thread);
|
||||
return bad_usb;
|
||||
}
|
||||
} //-V773
|
||||
|
||||
void bad_usb_script_close(BadUsbScript* bad_usb) {
|
||||
furi_assert(bad_usb);
|
||||
|
|
|
@ -156,7 +156,7 @@ static bool fap_loader_select_app(FapLoader* loader) {
|
|||
}
|
||||
|
||||
static FapLoader* fap_loader_alloc(const char* path) {
|
||||
FapLoader* loader = malloc(sizeof(FapLoader)); //-V773
|
||||
FapLoader* loader = malloc(sizeof(FapLoader)); //-V799
|
||||
loader->fap_path = furi_string_alloc_set(path);
|
||||
loader->storage = furi_record_open(RECORD_STORAGE);
|
||||
loader->dialogs = furi_record_open(RECORD_DIALOGS);
|
||||
|
@ -167,7 +167,7 @@ static FapLoader* fap_loader_alloc(const char* path) {
|
|||
loader->view_dispatcher, loader->gui, ViewDispatcherTypeFullscreen);
|
||||
view_dispatcher_add_view(loader->view_dispatcher, 0, loading_get_view(loader->loading));
|
||||
return loader;
|
||||
}
|
||||
} //-V773
|
||||
|
||||
static void fap_loader_free(FapLoader* loader) {
|
||||
view_dispatcher_remove_view(loader->view_dispatcher, 0);
|
||||
|
|
|
@ -278,7 +278,7 @@ bool ibutton_save_key(iButton* ibutton, const char* key_name) {
|
|||
|
||||
flipper_format_free(file);
|
||||
|
||||
if(!result) {
|
||||
if(!result) { //-V547
|
||||
dialog_message_show_storage_error(ibutton->dialogs, "Cannot save\nkey file");
|
||||
}
|
||||
|
||||
|
@ -302,7 +302,7 @@ void ibutton_text_store_set(iButton* ibutton, const char* text, ...) {
|
|||
}
|
||||
|
||||
void ibutton_text_store_clear(iButton* ibutton) {
|
||||
memset(ibutton->text_store, 0, IBUTTON_TEXT_STORE_SIZE);
|
||||
memset(ibutton->text_store, 0, IBUTTON_TEXT_STORE_SIZE + 1);
|
||||
}
|
||||
|
||||
void ibutton_notification_message(iButton* ibutton, uint32_t message) {
|
||||
|
@ -343,7 +343,7 @@ int32_t ibutton_app(void* p) {
|
|||
} else {
|
||||
view_dispatcher_attach_to_gui(
|
||||
ibutton->view_dispatcher, ibutton->gui, ViewDispatcherTypeFullscreen);
|
||||
if(key_loaded) {
|
||||
if(key_loaded) { //-V547
|
||||
scene_manager_next_scene(ibutton->scene_manager, iButtonSceneEmulate);
|
||||
DOLPHIN_DEED(DolphinDeedIbuttonEmulate);
|
||||
} else {
|
||||
|
|
|
@ -360,7 +360,7 @@ void infrared_text_store_set(Infrared* infrared, uint32_t bank, const char* text
|
|||
}
|
||||
|
||||
void infrared_text_store_clear(Infrared* infrared, uint32_t bank) {
|
||||
memset(infrared->text_store[bank], 0, INFRARED_TEXT_STORE_SIZE);
|
||||
memset(infrared->text_store[bank], 0, INFRARED_TEXT_STORE_SIZE + 1);
|
||||
}
|
||||
|
||||
void infrared_play_notification_message(Infrared* infrared, uint32_t message) {
|
||||
|
@ -455,7 +455,7 @@ int32_t infrared_app(void* p) {
|
|||
} else {
|
||||
view_dispatcher_attach_to_gui(
|
||||
infrared->view_dispatcher, infrared->gui, ViewDispatcherTypeFullscreen);
|
||||
if(is_remote_loaded) {
|
||||
if(is_remote_loaded) { //-V547
|
||||
scene_manager_next_scene(infrared->scene_manager, InfraredSceneRemote);
|
||||
} else {
|
||||
scene_manager_next_scene(infrared->scene_manager, InfraredSceneStart);
|
||||
|
|
|
@ -65,7 +65,7 @@ bool infrared_brute_force_calculate_messages(InfraredBruteForce* brute_force) {
|
|||
while(flipper_format_read_string(ff, "name", signal_name)) {
|
||||
InfraredBruteForceRecord* record =
|
||||
InfraredBruteForceRecordDict_get(brute_force->records, signal_name);
|
||||
if(record) {
|
||||
if(record) { //-V547
|
||||
++(record->count);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ static void signal_received_callback(void* context, InfraredWorkerSignal* receiv
|
|||
size_t timings_cnt;
|
||||
infrared_worker_get_raw_signal(received_signal, &timings, &timings_cnt);
|
||||
|
||||
buf_cnt = snprintf(buf, sizeof(buf), "RAW, %d samples:\r\n", timings_cnt);
|
||||
buf_cnt = snprintf(buf, sizeof(buf), "RAW, %zu samples:\r\n", timings_cnt);
|
||||
cli_write(cli, (uint8_t*)buf, buf_cnt);
|
||||
for(size_t i = 0; i < timings_cnt; ++i) {
|
||||
buf_cnt = snprintf(buf, sizeof(buf), "%lu ", timings[i]);
|
||||
|
@ -276,7 +276,9 @@ static bool infrared_cli_decode_file(FlipperFormat* input_file, FlipperFormat* o
|
|||
}
|
||||
InfraredRawSignal* raw_signal = infrared_signal_get_raw_signal(signal);
|
||||
printf(
|
||||
"Raw signal: %s, %u samples\r\n", furi_string_get_cstr(tmp), raw_signal->timings_size);
|
||||
"Raw signal: %s, %zu samples\r\n",
|
||||
furi_string_get_cstr(tmp),
|
||||
raw_signal->timings_size);
|
||||
if(!infrared_cli_decode_raw_signal(
|
||||
raw_signal, decoder, output_file, furi_string_get_cstr(tmp)))
|
||||
break;
|
||||
|
@ -382,7 +384,7 @@ static void infrared_cli_list_remote_signals(FuriString* remote_name) {
|
|||
while(flipper_format_read_string(ff, "name", signal_name)) {
|
||||
furi_string_set_str(key, furi_string_get_cstr(signal_name));
|
||||
int* v = dict_signals_get(signals_dict, key);
|
||||
if(v != NULL) {
|
||||
if(v != NULL) { //-V547
|
||||
(*v)++;
|
||||
max = M_MAX(*v, max);
|
||||
} else {
|
||||
|
@ -436,7 +438,7 @@ static void
|
|||
break;
|
||||
}
|
||||
|
||||
printf("Sending %ld signal(s)...\r\n", record_count);
|
||||
printf("Sending %lu signal(s)...\r\n", record_count);
|
||||
printf("Press Ctrl-C to stop.\r\n");
|
||||
|
||||
int records_sent = 0;
|
||||
|
|
|
@ -145,15 +145,14 @@ bool infrared_remote_load(InfraredRemote* remote, FuriString* path) {
|
|||
buf = furi_string_alloc();
|
||||
|
||||
FURI_LOG_I(TAG, "load file: \'%s\'", furi_string_get_cstr(path));
|
||||
bool success = flipper_format_buffered_file_open_existing(ff, furi_string_get_cstr(path));
|
||||
bool success = false;
|
||||
|
||||
if(success) {
|
||||
do {
|
||||
if(!flipper_format_buffered_file_open_existing(ff, furi_string_get_cstr(path))) break;
|
||||
uint32_t version;
|
||||
success = flipper_format_read_header(ff, buf, &version) &&
|
||||
!furi_string_cmp(buf, "IR signals file") && (version == 1);
|
||||
}
|
||||
if(!flipper_format_read_header(ff, buf, &version)) break;
|
||||
if(!furi_string_equal(buf, "IR signals file") || (version != 1)) break;
|
||||
|
||||
if(success) {
|
||||
path_extract_filename(path, buf, true);
|
||||
infrared_remote_clear_buttons(remote);
|
||||
infrared_remote_set_name(remote, furi_string_get_cstr(buf));
|
||||
|
@ -169,7 +168,8 @@ bool infrared_remote_load(InfraredRemote* remote, FuriString* path) {
|
|||
infrared_remote_button_free(button);
|
||||
}
|
||||
}
|
||||
}
|
||||
success = true;
|
||||
} while(false);
|
||||
|
||||
furi_string_free(buf);
|
||||
flipper_format_free(ff);
|
||||
|
|
|
@ -74,7 +74,7 @@ static bool infrared_signal_is_raw_valid(InfraredRawSignal* raw) {
|
|||
} else if((raw->timings_size <= 0) || (raw->timings_size > MAX_TIMINGS_AMOUNT)) {
|
||||
FURI_LOG_E(
|
||||
TAG,
|
||||
"Timings amount is out of range (0 - %X): %X",
|
||||
"Timings amount is out of range (0 - %X): %zX",
|
||||
MAX_TIMINGS_AMOUNT,
|
||||
raw->timings_size);
|
||||
return false;
|
||||
|
@ -275,8 +275,8 @@ bool infrared_signal_search_and_read(
|
|||
is_name_found = furi_string_equal(name, tmp);
|
||||
if(is_name_found) break;
|
||||
}
|
||||
if(!is_name_found) break;
|
||||
if(!infrared_signal_read_body(signal, ff)) break;
|
||||
if(!is_name_found) break; //-V547
|
||||
if(!infrared_signal_read_body(signal, ff)) break; //-V779
|
||||
success = true;
|
||||
} while(false);
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ bool infrared_scene_debug_on_event(void* context, SceneManagerEvent event) {
|
|||
InfraredRawSignal* raw = infrared_signal_get_raw_signal(signal);
|
||||
infrared_debug_view_set_text(debug_view, "RAW\n%d samples\n", raw->timings_size);
|
||||
|
||||
printf("RAW, %d samples:\r\n", raw->timings_size);
|
||||
printf("RAW, %zu samples:\r\n", raw->timings_size);
|
||||
for(size_t i = 0; i < raw->timings_size; ++i) {
|
||||
printf("%lu ", raw->timings[i]);
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ static void rpc_command_callback(RpcAppSystemEvent rpc_event, void* context) {
|
|||
}
|
||||
|
||||
static LfRfid* lfrfid_alloc() {
|
||||
LfRfid* lfrfid = malloc(sizeof(LfRfid)); //-V773
|
||||
LfRfid* lfrfid = malloc(sizeof(LfRfid));
|
||||
|
||||
lfrfid->storage = furi_record_open(RECORD_STORAGE);
|
||||
lfrfid->dialogs = furi_record_open(RECORD_DIALOGS);
|
||||
|
@ -100,7 +100,7 @@ static LfRfid* lfrfid_alloc() {
|
|||
lfrfid->view_dispatcher, LfRfidViewRead, lfrfid_view_read_get_view(lfrfid->read_view));
|
||||
|
||||
return lfrfid;
|
||||
}
|
||||
} //-V773
|
||||
|
||||
static void lfrfid_free(LfRfid* lfrfid) {
|
||||
furi_assert(lfrfid);
|
||||
|
|
|
@ -87,7 +87,7 @@ static void lfrfid_cli_read(Cli* cli, FuriString* args) {
|
|||
uint32_t flags =
|
||||
furi_event_flag_wait(context.event, available_flags, FuriFlagWaitAny, 100);
|
||||
|
||||
if(flags != FuriFlagErrorTimeout) {
|
||||
if(flags != (unsigned)FuriFlagErrorTimeout) {
|
||||
if(FURI_BIT(flags, LFRFIDWorkerReadDone)) {
|
||||
break;
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ static bool lfrfid_cli_parse_args(FuriString* args, ProtocolDict* dict, Protocol
|
|||
|
||||
for(ProtocolId i = 0; i < LFRFIDProtocolMax; i++) {
|
||||
printf(
|
||||
"\t%s, %d bytes long\r\n",
|
||||
"\t%s, %zu bytes long\r\n",
|
||||
protocol_dict_get_name(dict, i),
|
||||
protocol_dict_get_data_size(dict, i));
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ static bool lfrfid_cli_parse_args(FuriString* args, ProtocolDict* dict, Protocol
|
|||
// check data arg
|
||||
if(!args_read_hex_bytes(data_text, data, data_size)) {
|
||||
printf(
|
||||
"%s data needs to be %d bytes long\r\n",
|
||||
"%s data needs to be %zu bytes long\r\n",
|
||||
protocol_dict_get_name(dict, *protocol),
|
||||
data_size);
|
||||
break;
|
||||
|
@ -211,7 +211,7 @@ static void lfrfid_cli_write(Cli* cli, FuriString* args) {
|
|||
|
||||
while(!cli_cmd_interrupt_received(cli)) {
|
||||
uint32_t flags = furi_event_flag_wait(event, available_flags, FuriFlagWaitAny, 100);
|
||||
if(flags != FuriFlagErrorTimeout) {
|
||||
if(flags != (unsigned)FuriFlagErrorTimeout) {
|
||||
if(FURI_BIT(flags, LFRFIDWorkerWriteOK)) {
|
||||
printf("Written!\r\n");
|
||||
break;
|
||||
|
@ -309,9 +309,9 @@ static void lfrfid_cli_raw_analyze(Cli* cli, FuriString* args) {
|
|||
warn = true;
|
||||
}
|
||||
|
||||
furi_string_printf(info_string, "[%ld %ld]", pulse, duration);
|
||||
furi_string_printf(info_string, "[%lu %lu]", pulse, duration);
|
||||
printf("%-16s", furi_string_get_cstr(info_string));
|
||||
furi_string_printf(info_string, "[%ld %ld]", pulse, duration - pulse);
|
||||
furi_string_printf(info_string, "[%lu %lu]", pulse, duration - pulse);
|
||||
printf("%-16s", furi_string_get_cstr(info_string));
|
||||
|
||||
if(warn) {
|
||||
|
@ -335,7 +335,7 @@ static void lfrfid_cli_raw_analyze(Cli* cli, FuriString* args) {
|
|||
total_pulse += pulse;
|
||||
total_duration += duration;
|
||||
|
||||
if(total_protocol != PROTOCOL_NO) {
|
||||
if(total_protocol != PROTOCOL_NO) { //-V1051
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
|
@ -346,9 +346,9 @@ static void lfrfid_cli_raw_analyze(Cli* cli, FuriString* args) {
|
|||
|
||||
printf(" Frequency: %f\r\n", (double)frequency);
|
||||
printf(" Duty Cycle: %f\r\n", (double)duty_cycle);
|
||||
printf(" Warns: %ld\r\n", total_warns);
|
||||
printf(" Pulse sum: %ld\r\n", total_pulse);
|
||||
printf("Duration sum: %ld\r\n", total_duration);
|
||||
printf(" Warns: %lu\r\n", total_warns);
|
||||
printf(" Pulse sum: %lu\r\n", total_pulse);
|
||||
printf("Duration sum: %lu\r\n", total_duration);
|
||||
printf(" Average: %f\r\n", (double)((float)total_pulse / (float)total_duration));
|
||||
printf(" Protocol: ");
|
||||
|
||||
|
@ -435,7 +435,7 @@ static void lfrfid_cli_raw_read(Cli* cli, FuriString* args) {
|
|||
while(true) {
|
||||
uint32_t flags = furi_event_flag_wait(event, available_flags, FuriFlagWaitAny, 100);
|
||||
|
||||
if(flags != FuriFlagErrorTimeout) {
|
||||
if(flags != (unsigned)FuriFlagErrorTimeout) {
|
||||
if(FURI_BIT(flags, LFRFIDWorkerReadRawFileError)) {
|
||||
printf("File is not RFID raw file\r\n");
|
||||
break;
|
||||
|
@ -510,7 +510,7 @@ static void lfrfid_cli_raw_emulate(Cli* cli, FuriString* args) {
|
|||
while(true) {
|
||||
uint32_t flags = furi_event_flag_wait(event, available_flags, FuriFlagWaitAny, 100);
|
||||
|
||||
if(flags != FuriFlagErrorTimeout) {
|
||||
if(flags != (unsigned)FuriFlagErrorTimeout) {
|
||||
if(FURI_BIT(flags, LFRFIDWorkerEmulateRawFileError)) {
|
||||
printf("File is not RFID raw file\r\n");
|
||||
break;
|
||||
|
|
|
@ -39,7 +39,7 @@ static void nfc_scene_emulate_uid_widget_config(Nfc* nfc, bool data_received) {
|
|||
|
||||
widget_add_icon_element(widget, 0, 3, &I_NFC_dolphin_emulation_47x61);
|
||||
widget_add_string_element(widget, 57, 13, AlignLeft, AlignTop, FontPrimary, "Emulating UID");
|
||||
if(strcmp(nfc->dev->dev_name, "")) {
|
||||
if(strcmp(nfc->dev->dev_name, "") != 0) {
|
||||
furi_string_printf(info_str, "%s", nfc->dev->dev_name);
|
||||
} else {
|
||||
for(uint8_t i = 0; i < data->uid_len; i++) {
|
||||
|
|
|
@ -18,7 +18,7 @@ void nfc_scene_mf_classic_emulate_on_enter(void* context) {
|
|||
// Setup view
|
||||
Popup* popup = nfc->popup;
|
||||
popup_set_header(popup, "Emulating", 67, 13, AlignLeft, AlignTop);
|
||||
if(strcmp(nfc->dev->dev_name, "")) {
|
||||
if(strcmp(nfc->dev->dev_name, "") != 0) {
|
||||
nfc_text_store_set(nfc, "%s", nfc->dev->dev_name);
|
||||
} else {
|
||||
nfc_text_store_set(nfc, "MIFARE\nClassic");
|
||||
|
|
|
@ -28,9 +28,9 @@ void nfc_scene_mf_classic_keys_on_enter(void* context) {
|
|||
widget_add_string_element(
|
||||
nfc->widget, 0, 0, AlignLeft, AlignTop, FontPrimary, "Mifare Classic Keys");
|
||||
char temp_str[32];
|
||||
snprintf(temp_str, sizeof(temp_str), "Flipper list: %ld", flipper_dict_keys_total);
|
||||
snprintf(temp_str, sizeof(temp_str), "Flipper list: %lu", flipper_dict_keys_total);
|
||||
widget_add_string_element(nfc->widget, 0, 20, AlignLeft, AlignTop, FontSecondary, temp_str);
|
||||
snprintf(temp_str, sizeof(temp_str), "User list: %ld", user_dict_keys_total);
|
||||
snprintf(temp_str, sizeof(temp_str), "User list: %lu", user_dict_keys_total);
|
||||
widget_add_string_element(nfc->widget, 0, 32, AlignLeft, AlignTop, FontSecondary, temp_str);
|
||||
widget_add_button_element(
|
||||
nfc->widget, GuiButtonTypeCenter, "Add", nfc_scene_mf_classic_keys_widget_callback, nfc);
|
||||
|
|
|
@ -27,7 +27,7 @@ void nfc_scene_mf_classic_keys_list_prepare(Nfc* nfc, MfClassicDict* dict) {
|
|||
char* current_key = (char*)malloc(sizeof(char) * 13);
|
||||
strncpy(current_key, furi_string_get_cstr(temp_key), 12);
|
||||
MfClassicUserKeys_push_back(nfc->mfc_key_strs, current_key);
|
||||
FURI_LOG_D("ListKeys", "Key %ld: %s", index, current_key);
|
||||
FURI_LOG_D("ListKeys", "Key %lu: %s", index, current_key);
|
||||
submenu_add_item(
|
||||
submenu, current_key, index++, nfc_scene_mf_classic_keys_list_submenu_callback, nfc);
|
||||
}
|
||||
|
|
|
@ -26,13 +26,13 @@ void nfc_scene_mf_desfire_read_success_on_enter(void* context) {
|
|||
furi_string_cat_printf(temp_str, " %02X", nfc_data->uid[i]);
|
||||
}
|
||||
|
||||
uint32_t bytes_total = 1 << (data->version.sw_storage >> 1);
|
||||
uint32_t bytes_total = 1UL << (data->version.sw_storage >> 1);
|
||||
uint32_t bytes_free = data->free_memory ? data->free_memory->bytes : 0;
|
||||
furi_string_cat_printf(temp_str, "\n%ld", bytes_total);
|
||||
furi_string_cat_printf(temp_str, "\n%lu", bytes_total);
|
||||
if(data->version.sw_storage & 1) {
|
||||
furi_string_push_back(temp_str, '+');
|
||||
}
|
||||
furi_string_cat_printf(temp_str, " bytes, %ld bytes free\n", bytes_free);
|
||||
furi_string_cat_printf(temp_str, " bytes, %lu bytes free\n", bytes_free);
|
||||
|
||||
uint16_t n_apps = 0;
|
||||
uint16_t n_files = 0;
|
||||
|
|
|
@ -21,7 +21,7 @@ void nfc_scene_mf_ultralight_emulate_on_enter(void* context) {
|
|||
(type == MfUltralightTypeUnknown);
|
||||
Popup* popup = nfc->popup;
|
||||
popup_set_header(popup, "Emulating", 67, 13, AlignLeft, AlignTop);
|
||||
if(strcmp(nfc->dev->dev_name, "")) {
|
||||
if(strcmp(nfc->dev->dev_name, "") != 0) {
|
||||
nfc_text_store_set(nfc, "%s", nfc->dev->dev_name);
|
||||
} else if(is_ultralight) {
|
||||
nfc_text_store_set(nfc, "MIFARE\nUltralight");
|
||||
|
|
|
@ -57,13 +57,13 @@ void nfc_scene_nfc_data_info_on_enter(void* context) {
|
|||
// Set application specific data
|
||||
if(protocol == NfcDeviceProtocolMifareDesfire) {
|
||||
MifareDesfireData* data = &dev_data->mf_df_data;
|
||||
uint32_t bytes_total = 1 << (data->version.sw_storage >> 1);
|
||||
uint32_t bytes_total = 1UL << (data->version.sw_storage >> 1);
|
||||
uint32_t bytes_free = data->free_memory ? data->free_memory->bytes : 0;
|
||||
furi_string_cat_printf(temp_str, "\n%ld", bytes_total);
|
||||
furi_string_cat_printf(temp_str, "\n%lu", bytes_total);
|
||||
if(data->version.sw_storage & 1) {
|
||||
furi_string_push_back(temp_str, '+');
|
||||
}
|
||||
furi_string_cat_printf(temp_str, " bytes, %ld bytes free\n", bytes_free);
|
||||
furi_string_cat_printf(temp_str, " bytes, %lu bytes free\n", bytes_free);
|
||||
|
||||
uint16_t n_apps = 0;
|
||||
uint16_t n_files = 0;
|
||||
|
|
|
@ -71,7 +71,7 @@ bool nfc_scene_read_on_event(void* context, SceneManagerEvent event) {
|
|||
} else if(event.event == NfcWorkerEventReadMfUltralight) {
|
||||
notification_message(nfc->notifications, &sequence_success);
|
||||
// Set unlock password input to 0xFFFFFFFF only on fresh read
|
||||
memset(nfc->byte_input_store, 0xFF, 4);
|
||||
memset(nfc->byte_input_store, 0xFF, sizeof(nfc->byte_input_store));
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneMfUltralightReadSuccess);
|
||||
DOLPHIN_DEED(DolphinDeedNfcReadSuccess);
|
||||
consumed = true;
|
||||
|
|
|
@ -55,7 +55,7 @@ bool nfc_scene_save_name_on_event(void* context, SceneManagerEvent event) {
|
|||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
if(event.event == NfcCustomEventTextInputDone) {
|
||||
if(strcmp(nfc->dev->dev_name, "")) {
|
||||
if(strcmp(nfc->dev->dev_name, "") != 0) {
|
||||
nfc_device_delete(nfc->dev, true);
|
||||
}
|
||||
if(scene_manager_has_previous_scene(nfc->scene_manager, NfcSceneSetUid)) {
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include <lib/drivers/cc1101.h>
|
||||
|
||||
#include <furi.h>
|
||||
#include <float_tools.h>
|
||||
|
||||
#define TAG "SubghzFrequencyAnalyzerWorker"
|
||||
|
||||
|
@ -197,7 +198,7 @@ static int32_t subghz_frequency_analyzer_worker_thread(void* context) {
|
|||
rssi_temp = (rssi_temp + frequency_rssi.rssi_fine) / 2;
|
||||
frequency_temp = frequency_rssi.frequency_fine;
|
||||
|
||||
if(instance->filVal) {
|
||||
if(!float_is_equal(instance->filVal, 0.f)) {
|
||||
frequency_rssi.frequency_fine =
|
||||
subghz_frequency_analyzer_worker_expRunningAverageAdaptive(
|
||||
instance, frequency_rssi.frequency_fine);
|
||||
|
@ -219,7 +220,7 @@ static int32_t subghz_frequency_analyzer_worker_thread(void* context) {
|
|||
instance->sample_hold_counter = 20;
|
||||
rssi_temp = (rssi_temp + frequency_rssi.rssi_coarse) / 2;
|
||||
frequency_temp = frequency_rssi.frequency_coarse;
|
||||
if(instance->filVal) {
|
||||
if(!float_is_equal(instance->filVal, 0.f)) {
|
||||
frequency_rssi.frequency_coarse =
|
||||
subghz_frequency_analyzer_worker_expRunningAverageAdaptive(
|
||||
instance, frequency_rssi.frequency_coarse);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <dolphin/dolphin.h>
|
||||
#include <lib/subghz/protocols/raw.h>
|
||||
#include <lib/toolbox/path.h>
|
||||
#include <float_tools.h>
|
||||
|
||||
#define RAW_FILE_NAME "Raw_signal_"
|
||||
#define TAG "SubGhzSceneReadRAW"
|
||||
|
@ -358,7 +359,7 @@ bool subghz_scene_read_raw_on_event(void* context, SceneManagerEvent event) {
|
|||
|
||||
float rssi = furi_hal_subghz_get_rssi();
|
||||
|
||||
if(subghz->txrx->raw_threshold_rssi == SUBGHZ_RAW_TRESHOLD_MIN) {
|
||||
if(float_is_equal(subghz->txrx->raw_threshold_rssi, SUBGHZ_RAW_TRESHOLD_MIN)) {
|
||||
subghz_read_raw_add_data_rssi(subghz->subghz_read_raw, rssi, true);
|
||||
subghz_protocol_raw_save_to_file_pause(
|
||||
(SubGhzProtocolDecoderRAW*)subghz->txrx->decoder_result, false);
|
||||
|
|
|
@ -94,7 +94,7 @@ bool subghz_scene_save_name_on_event(void* context, SceneManagerEvent event) {
|
|||
return true;
|
||||
} else if(event.type == SceneManagerEventTypeCustom) {
|
||||
if(event.event == SubGhzCustomEventSceneSaveName) {
|
||||
if(strcmp(subghz->file_name_tmp, "")) {
|
||||
if(strcmp(subghz->file_name_tmp, "") != 0) {
|
||||
furi_string_cat_printf(
|
||||
subghz->file_path, "/%s%s", subghz->file_name_tmp, SUBGHZ_APP_EXTENSION);
|
||||
if(subghz_path_is_file(subghz->file_path_tmp)) {
|
||||
|
|
|
@ -46,7 +46,7 @@ bool subghz_scene_set_type_submenu_gen_data_protocol(
|
|||
|
||||
uint8_t key_data[sizeof(uint64_t)] = {0};
|
||||
for(size_t i = 0; i < sizeof(uint64_t); i++) {
|
||||
key_data[sizeof(uint64_t) - i - 1] = (key >> i * 8) & 0xFF;
|
||||
key_data[sizeof(uint64_t) - i - 1] = (key >> (i * 8)) & 0xFF;
|
||||
}
|
||||
if(!flipper_format_update_hex(subghz->txrx->fff_data, "Key", key_data, sizeof(uint64_t))) {
|
||||
FURI_LOG_E(TAG, "Unable to update Key");
|
||||
|
|
|
@ -152,11 +152,11 @@ void subghz_cli_command_tx(Cli* cli, FuriString* args, void* context) {
|
|||
"Protocol: Princeton\n"
|
||||
"Bit: 24\n"
|
||||
"Key: 00 00 00 00 00 %02X %02X %02X\n"
|
||||
"TE: %ld\n"
|
||||
"Repeat: %ld\n",
|
||||
(uint8_t)((key >> 16) & 0xFF),
|
||||
(uint8_t)((key >> 8) & 0xFF),
|
||||
(uint8_t)(key & 0xFF),
|
||||
"TE: %lu\n"
|
||||
"Repeat: %lu\n",
|
||||
(uint8_t)((key >> 16) & 0xFFU),
|
||||
(uint8_t)((key >> 8) & 0xFFU),
|
||||
(uint8_t)(key & 0xFFU),
|
||||
te,
|
||||
repeat);
|
||||
FlipperFormat* flipper_format = flipper_format_string_alloc();
|
||||
|
@ -300,7 +300,7 @@ void subghz_cli_command_rx(Cli* cli, FuriString* args, void* context) {
|
|||
|
||||
furi_hal_power_suppress_charge_exit();
|
||||
|
||||
printf("\r\nPackets received %u\r\n", instance->packet_count);
|
||||
printf("\r\nPackets received %zu\r\n", instance->packet_count);
|
||||
|
||||
// Cleanup
|
||||
subghz_receiver_free(receiver);
|
||||
|
@ -787,8 +787,9 @@ static bool subghz_on_system_start_istream_decode_band(
|
|||
}
|
||||
|
||||
region->bands_count += 1;
|
||||
region =
|
||||
realloc(region, sizeof(FuriHalRegion) + sizeof(FuriHalRegionBand) * region->bands_count);
|
||||
region = realloc( //-V701
|
||||
region,
|
||||
sizeof(FuriHalRegion) + sizeof(FuriHalRegionBand) * region->bands_count);
|
||||
size_t pos = region->bands_count - 1;
|
||||
region->bands[pos].start = band.start;
|
||||
region->bands[pos].end = band.end;
|
||||
|
@ -798,7 +799,7 @@ static bool subghz_on_system_start_istream_decode_band(
|
|||
|
||||
FURI_LOG_I(
|
||||
"SubGhzOnStart",
|
||||
"Add allowed band: start %ldHz, stop %ldHz, power_limit %ddBm, duty_cycle %d%%",
|
||||
"Add allowed band: start %luHz, stop %luHz, power_limit %ddBm, duty_cycle %u%%",
|
||||
band.start,
|
||||
band.end,
|
||||
band.power_limit,
|
||||
|
|
|
@ -164,7 +164,7 @@ bool subghz_tx_start(SubGhz* subghz, FlipperFormat* flipper_format) {
|
|||
|
||||
if(subghz->txrx->transmitter) {
|
||||
if(subghz_transmitter_deserialize(subghz->txrx->transmitter, flipper_format)) {
|
||||
if(strcmp(furi_string_get_cstr(subghz->txrx->preset->name), "")) {
|
||||
if(strcmp(furi_string_get_cstr(subghz->txrx->preset->name), "") != 0) {
|
||||
subghz_begin(
|
||||
subghz,
|
||||
subghz_setting_get_preset_data_by_name(
|
||||
|
@ -544,11 +544,8 @@ void subghz_hopper_update(SubGhz* subghz) {
|
|||
|
||||
switch(subghz->txrx->hopper_state) {
|
||||
case SubGhzHopperStateOFF:
|
||||
return;
|
||||
break;
|
||||
case SubGhzHopperStatePause:
|
||||
return;
|
||||
break;
|
||||
case SubGhzHopperStateRSSITimeOut:
|
||||
if(subghz->txrx->hopper_timeout != 0) {
|
||||
subghz->txrx->hopper_timeout--;
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "../helpers/subghz_frequency_analyzer_log_item_array.h"
|
||||
|
||||
#include <assets_icons.h>
|
||||
#include <float_tools.h>
|
||||
|
||||
#define LOG_FREQUENCY_MAX_ITEMS 60 // uint8_t (limited by 'seq' of SubGhzFrequencyAnalyzerLogItem)
|
||||
|
||||
|
@ -47,7 +48,8 @@ typedef struct {
|
|||
} SubGhzFrequencyAnalyzerModel;
|
||||
|
||||
static inline uint8_t rssi_sanitize(float rssi) {
|
||||
return (rssi ? (uint8_t)(rssi - SUBGHZ_FREQUENCY_ANALYZER_THRESHOLD) : 0);
|
||||
return (
|
||||
!float_is_equal(rssi, 0.f) ? (uint8_t)(rssi - SUBGHZ_FREQUENCY_ANALYZER_THRESHOLD) : 0);
|
||||
}
|
||||
|
||||
void subghz_frequency_analyzer_set_callback(
|
||||
|
@ -294,9 +296,6 @@ static bool subghz_frequency_analyzer_log_frequency_insert(SubGhzFrequencyAnalyz
|
|||
if(items_count < LOG_FREQUENCY_MAX_ITEMS) {
|
||||
SubGhzFrequencyAnalyzerLogItem_t* item =
|
||||
SubGhzFrequencyAnalyzerLogItemArray_push_new(model->log_frequency);
|
||||
if(item == NULL) {
|
||||
return false;
|
||||
}
|
||||
(*item)->frequency = model->frequency;
|
||||
(*item)->count = 1;
|
||||
(*item)->rssi_max = model->rssi;
|
||||
|
@ -340,7 +339,7 @@ void subghz_frequency_analyzer_pair_callback(
|
|||
float rssi,
|
||||
bool signal) {
|
||||
SubGhzFrequencyAnalyzer* instance = context;
|
||||
if((rssi == 0.f) && (instance->locked)) {
|
||||
if(float_is_equal(rssi, 0.f) && instance->locked) {
|
||||
if(instance->callback) {
|
||||
instance->callback(SubGhzCustomEventSceneAnalyzerUnlock, instance->context);
|
||||
}
|
||||
|
@ -355,13 +354,13 @@ void subghz_frequency_analyzer_pair_callback(
|
|||
model->history_frequency[0] = model->frequency;
|
||||
},
|
||||
false);
|
||||
} else if((rssi != 0.f) && (!instance->locked)) {
|
||||
} else if(!float_is_equal(rssi, 0.f) && !instance->locked) {
|
||||
if(instance->callback) {
|
||||
instance->callback(SubGhzCustomEventSceneAnalyzerLock, instance->context);
|
||||
}
|
||||
}
|
||||
|
||||
instance->locked = (rssi != 0.f);
|
||||
instance->locked = !float_is_equal(rssi, 0.f);
|
||||
with_view_model(
|
||||
instance->view,
|
||||
SubGhzFrequencyAnalyzerModel * model,
|
||||
|
|
|
@ -91,7 +91,7 @@ void subghz_read_raw_update_sample_write(SubGhzReadRAW* instance, size_t sample)
|
|||
with_view_model(
|
||||
instance->view,
|
||||
SubGhzReadRAWModel * model,
|
||||
{ furi_string_printf(model->sample_write, "%d spl.", sample); },
|
||||
{ furi_string_printf(model->sample_write, "%zu spl.", sample); },
|
||||
false);
|
||||
}
|
||||
|
||||
|
@ -161,7 +161,7 @@ void subghz_read_raw_draw_sin(Canvas* canvas, SubGhzReadRAWModel* model) {
|
|||
canvas_draw_line(
|
||||
canvas,
|
||||
i + 1,
|
||||
32 - subghz_read_raw_tab_sin((i + model->ind_sin * 16)) / SUBGHZ_RAW_SIN_AMPLITUDE,
|
||||
32 - subghz_read_raw_tab_sin(i + model->ind_sin * 16) / SUBGHZ_RAW_SIN_AMPLITUDE,
|
||||
i + 2,
|
||||
32 + subghz_read_raw_tab_sin((i + model->ind_sin * 16 + 1) * 2) /
|
||||
SUBGHZ_RAW_SIN_AMPLITUDE);
|
||||
|
|
|
@ -114,7 +114,7 @@ static void subghz_test_packet_draw(Canvas* canvas, SubGhzTestPacketModel* model
|
|||
snprintf(buffer, sizeof(buffer), "Path: %d - %s", model->path, path_name);
|
||||
canvas_draw_str(canvas, 0, 31, buffer);
|
||||
|
||||
snprintf(buffer, sizeof(buffer), "Packets: %d", model->packets);
|
||||
snprintf(buffer, sizeof(buffer), "Packets: %zu", model->packets);
|
||||
canvas_draw_str(canvas, 0, 42, buffer);
|
||||
|
||||
if(model->status == SubGhzTestPacketModelStatusRx) {
|
||||
|
|
|
@ -58,7 +58,7 @@ bool u2f_scene_main_on_event(void* context, SceneManagerEvent event) {
|
|||
app->event_cur = event.event;
|
||||
if(event.event == U2fCustomEventRegister)
|
||||
u2f_view_set_state(app->u2f_view, U2fMsgRegister);
|
||||
else if(event.event == U2fCustomEventAuth)
|
||||
else if(event.event == U2fCustomEventAuth) //-V547
|
||||
u2f_view_set_state(app->u2f_view, U2fMsgAuth);
|
||||
notification_message(app->notifications, &sequence_display_backlight_on);
|
||||
notification_message(app->notifications, &sequence_single_vibro);
|
||||
|
|
|
@ -402,9 +402,9 @@ bool u2f_data_cnt_read(uint32_t* cnt_val) {
|
|||
FURI_LOG_E(TAG, "Unable to load encryption key");
|
||||
break;
|
||||
}
|
||||
memset(&cnt, 0, 32);
|
||||
if(!furi_hal_crypto_decrypt(cnt_encr, (uint8_t*)&cnt, 32)) {
|
||||
memset(&cnt, 0, 32);
|
||||
memset(&cnt, 0, sizeof(U2fCounterData));
|
||||
if(!furi_hal_crypto_decrypt(cnt_encr, (uint8_t*)&cnt, sizeof(U2fCounterData))) {
|
||||
memset(&cnt, 0, sizeof(U2fCounterData));
|
||||
FURI_LOG_E(TAG, "Decryption failed");
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ static void u2f_hid_send_response(U2fHid* u2f_hid) {
|
|||
uint16_t data_ptr = 0;
|
||||
|
||||
memset(packet_buf, 0, HID_U2F_PACKET_LEN);
|
||||
memcpy(packet_buf, &(u2f_hid->packet.cid), 4);
|
||||
memcpy(packet_buf, &(u2f_hid->packet.cid), sizeof(uint32_t)); //-V1086
|
||||
|
||||
// Init packet
|
||||
packet_buf[4] = u2f_hid->packet.cmd;
|
||||
|
@ -166,7 +166,7 @@ static bool u2f_hid_parse_request(U2fHid* u2f_hid) {
|
|||
return false;
|
||||
u2f_hid->packet.len = 17;
|
||||
uint32_t random_cid = furi_hal_random_get();
|
||||
memcpy(&(u2f_hid->packet.payload[8]), &random_cid, 4);
|
||||
memcpy(&(u2f_hid->packet.payload[8]), &random_cid, sizeof(uint32_t)); //-V1086
|
||||
u2f_hid->packet.payload[12] = 2; // Protocol version
|
||||
u2f_hid->packet.payload[13] = 1; // Device version major
|
||||
u2f_hid->packet.payload[14] = 0; // Device version minor
|
||||
|
@ -177,7 +177,7 @@ static bool u2f_hid_parse_request(U2fHid* u2f_hid) {
|
|||
} else if(u2f_hid->packet.cmd == U2F_HID_WINK) { // WINK - notify user
|
||||
if(u2f_hid->packet.len != 0) return false;
|
||||
u2f_wink(u2f_hid->u2f_instance);
|
||||
u2f_hid->packet.len = 0;
|
||||
u2f_hid->packet.len = 0; //-V1048
|
||||
u2f_hid_send_response(u2f_hid);
|
||||
} else
|
||||
return false;
|
||||
|
|
|
@ -568,12 +568,12 @@ void dap_common_usb_set_state_callback(DapStateCallback callback) {
|
|||
static void* dap_usb_alloc_string_descr(const char* str) {
|
||||
furi_assert(str);
|
||||
|
||||
uint8_t len = strlen(str);
|
||||
uint8_t wlen = (len + 1) * sizeof(uint16_t);
|
||||
size_t len = strlen(str);
|
||||
size_t wlen = (len + 1) * sizeof(uint16_t);
|
||||
struct usb_string_descriptor* dev_str_desc = malloc(wlen);
|
||||
dev_str_desc->bLength = wlen;
|
||||
dev_str_desc->bDescriptorType = USB_DTYPE_STRING;
|
||||
for(uint8_t i = 0; i < len; i++) {
|
||||
for(size_t i = 0; i < len; i++) {
|
||||
dev_str_desc->wString[i] = str[i];
|
||||
}
|
||||
|
||||
|
|
|
@ -249,30 +249,19 @@ static void hid_keyboard_draw_callback(Canvas* canvas, void* context) {
|
|||
|
||||
static uint8_t hid_keyboard_get_selected_key(HidKeyboardModel* model) {
|
||||
HidKeyboardKey key = hid_keyboard_keyset[model->y][model->x];
|
||||
// Use upper case if shift is toggled
|
||||
bool useUppercase = model->shift;
|
||||
// Check if the key has an upper case version
|
||||
bool hasUppercase = key.shift_key != 0;
|
||||
if(useUppercase && hasUppercase)
|
||||
return key.value;
|
||||
else
|
||||
return key.value;
|
||||
}
|
||||
|
||||
static void hid_keyboard_get_select_key(HidKeyboardModel* model, HidKeyboardPoint delta) {
|
||||
// Keep going until a valid spot is found, this allows for nulls and zero width keys in the map
|
||||
do {
|
||||
if(((int8_t)model->y) + delta.y < 0)
|
||||
model->y = ROW_COUNT - 1;
|
||||
else
|
||||
model->y = (model->y + delta.y) % ROW_COUNT;
|
||||
const int delta_sum = model->y + delta.y;
|
||||
model->y = delta_sum < 0 ? ROW_COUNT - 1 : delta_sum % ROW_COUNT;
|
||||
} while(delta.y != 0 && hid_keyboard_keyset[model->y][model->x].value == 0);
|
||||
|
||||
do {
|
||||
if(((int8_t)model->x) + delta.x < 0)
|
||||
model->x = COLUMN_COUNT - 1;
|
||||
else
|
||||
model->x = (model->x + delta.x) % COLUMN_COUNT;
|
||||
const int delta_sum = model->x + delta.x;
|
||||
model->x = delta_sum < 0 ? COLUMN_COUNT - 1 : delta_sum % COLUMN_COUNT;
|
||||
} while(delta.x != 0 && hid_keyboard_keyset[model->y][model->x].width ==
|
||||
0); // Skip zero width keys, pretend they are one key
|
||||
}
|
||||
|
|
|
@ -180,7 +180,7 @@ static void render_callback(Canvas* canvas, void* ctx) {
|
|||
|
||||
// note stack view_port
|
||||
x_pos = 73;
|
||||
y_pos = 0;
|
||||
y_pos = 0; //-V1048
|
||||
canvas_set_color(canvas, ColorBlack);
|
||||
canvas_set_font(canvas, FontPrimary);
|
||||
canvas_draw_frame(canvas, x_pos, y_pos, 49, 64);
|
||||
|
|
|
@ -111,9 +111,9 @@ static void init_opt_select_LUT(void) {
|
|||
***********************************************************************************/
|
||||
|
||||
#define loclass_opt__select(x, y, r) \
|
||||
(4 & (((r & (r << 2)) >> 5) ^ ((r & ~(r << 2)) >> 4) ^ ((r | r << 2) >> 3))) | \
|
||||
(2 & (((r | r << 2) >> 6) ^ ((r | r << 2) >> 1) ^ (r >> 5) ^ r ^ ((x ^ y) << 1))) | \
|
||||
(1 & (((r & ~(r << 2)) >> 4) ^ ((r & (r << 2)) >> 3) ^ r ^ x))
|
||||
(4 & ((((r) & ((r) << 2)) >> 5) ^ (((r) & ~((r) << 2)) >> 4) ^ (((r) | (r) << 2) >> 3))) | \
|
||||
(2 & ((((r) | (r) << 2) >> 6) ^ (((r) | (r) << 2) >> 1) ^ ((r) >> 5) ^ (r) ^ (((x) ^ (y)) << 1))) | \
|
||||
(1 & ((((r) & ~((r) << 2)) >> 4) ^ (((r) & ((r) << 2)) >> 3) ^ (r) ^ (x)))
|
||||
|
||||
static void loclass_opt_successor(const uint8_t* k, LoclassState_t* s, uint8_t y) {
|
||||
uint16_t Tt = s->t & 0xc533;
|
||||
|
@ -149,30 +149,11 @@ static void loclass_opt_suc(
|
|||
uint8_t length,
|
||||
bool add32Zeroes) {
|
||||
for(int i = 0; i < length; i++) {
|
||||
uint8_t head;
|
||||
head = in[i];
|
||||
uint8_t head = in[i];
|
||||
for(int j = 0; j < 8; j++) {
|
||||
loclass_opt_successor(k, s, head);
|
||||
|
||||
head >>= 1;
|
||||
loclass_opt_successor(k, s, head);
|
||||
|
||||
head >>= 1;
|
||||
loclass_opt_successor(k, s, head);
|
||||
|
||||
head >>= 1;
|
||||
loclass_opt_successor(k, s, head);
|
||||
|
||||
head >>= 1;
|
||||
loclass_opt_successor(k, s, head);
|
||||
|
||||
head >>= 1;
|
||||
loclass_opt_successor(k, s, head);
|
||||
|
||||
head >>= 1;
|
||||
loclass_opt_successor(k, s, head);
|
||||
|
||||
head >>= 1;
|
||||
loclass_opt_successor(k, s, head);
|
||||
}
|
||||
}
|
||||
//For tag MAC, an additional 32 zeroes
|
||||
if(add32Zeroes) {
|
||||
|
|
|
@ -143,7 +143,7 @@ ReturnCode picopass_read_preauth(PicopassBlock* AA1) {
|
|||
AA1[PICOPASS_CSN_BLOCK_INDEX].data[7]);
|
||||
|
||||
rfalPicoPassReadBlockRes cfg = {0};
|
||||
err = rfalPicoPassPollerReadBlock(PICOPASS_CONFIG_BLOCK_INDEX, &cfg);
|
||||
rfalPicoPassPollerReadBlock(PICOPASS_CONFIG_BLOCK_INDEX, &cfg);
|
||||
memcpy(AA1[PICOPASS_CONFIG_BLOCK_INDEX].data, cfg.data, sizeof(cfg.data));
|
||||
FURI_LOG_D(
|
||||
TAG,
|
||||
|
@ -158,7 +158,7 @@ ReturnCode picopass_read_preauth(PicopassBlock* AA1) {
|
|||
AA1[PICOPASS_CONFIG_BLOCK_INDEX].data[7]);
|
||||
|
||||
rfalPicoPassReadBlockRes aia;
|
||||
err = rfalPicoPassPollerReadBlock(PICOPASS_AIA_BLOCK_INDEX, &aia);
|
||||
rfalPicoPassPollerReadBlock(PICOPASS_AIA_BLOCK_INDEX, &aia);
|
||||
memcpy(AA1[PICOPASS_AIA_BLOCK_INDEX].data, aia.data, sizeof(aia.data));
|
||||
FURI_LOG_D(
|
||||
TAG,
|
||||
|
@ -221,7 +221,7 @@ ReturnCode picopass_auth(PicopassBlock* AA1, PicopassPacs* pacs) {
|
|||
while(iclass_elite_dict_get_next_key(dict, key)) {
|
||||
FURI_LOG_D(
|
||||
TAG,
|
||||
"Try to auth with key %d %02x%02x%02x%02x%02x%02x%02x%02x",
|
||||
"Try to auth with key %zu %02x%02x%02x%02x%02x%02x%02x%02x",
|
||||
index++,
|
||||
key[0],
|
||||
key[1],
|
||||
|
@ -249,9 +249,7 @@ ReturnCode picopass_auth(PicopassBlock* AA1, PicopassPacs* pacs) {
|
|||
}
|
||||
}
|
||||
|
||||
if(dict) {
|
||||
iclass_elite_dict_free(dict);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ bool picopass_scene_save_name_on_event(void* context, SceneManagerEvent event) {
|
|||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
if(event.event == PicopassCustomEventTextInputDone) {
|
||||
if(strcmp(picopass->dev->dev_name, "")) {
|
||||
if(strcmp(picopass->dev->dev_name, "") != 0) {
|
||||
// picopass_device_delete(picopass->dev, true);
|
||||
}
|
||||
strlcpy(
|
||||
|
|
|
@ -15,12 +15,12 @@ static void
|
|||
app->pwm_freq = freq;
|
||||
app->pwm_duty = duty;
|
||||
|
||||
if(app->pwm_ch != pwm_ch_id[channel_id]) {
|
||||
if(app->pwm_ch != pwm_ch_id[channel_id]) { //-V1051
|
||||
app->pwm_ch_prev = app->pwm_ch;
|
||||
app->pwm_ch = pwm_ch_id[channel_id];
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, SignalGenPwmEventChannelChange);
|
||||
} else {
|
||||
app->pwm_ch = pwm_ch_id[channel_id];
|
||||
app->pwm_ch = pwm_ch_id[channel_id]; //-V1048
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, SignalGenPwmEventUpdate);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -127,12 +127,12 @@ static void signal_gen_pwm_draw_callback(Canvas* canvas, void* _model) {
|
|||
char* line_label = NULL;
|
||||
char val_text[16];
|
||||
|
||||
for(uint8_t line = 0; line < LineIndexTotalCount; line++) {
|
||||
for(size_t line = 0; line < LineIndexTotalCount; line++) {
|
||||
if(line == LineIndexChannel) {
|
||||
line_label = "GPIO Pin";
|
||||
} else if(line == LineIndexFrequency) {
|
||||
line_label = "Frequency";
|
||||
} else if(line == LineIndexDuty) {
|
||||
} else if(line == LineIndexDuty) { //-V547
|
||||
line_label = "Pulse width";
|
||||
}
|
||||
|
||||
|
@ -169,7 +169,7 @@ static void signal_gen_pwm_draw_callback(Canvas* canvas, void* _model) {
|
|||
canvas_draw_icon(canvas, icon_x, text_y - 9, &I_SmallArrowUp_3x5);
|
||||
canvas_draw_icon(canvas, icon_x, text_y + 5, &I_SmallArrowDown_3x5);
|
||||
}
|
||||
} else if(line == LineIndexDuty) {
|
||||
} else if(line == LineIndexDuty) { //-V547
|
||||
snprintf(val_text, sizeof(val_text), "%d%%", model->duty);
|
||||
canvas_draw_str_aligned(canvas, VALUE_X, text_y, AlignCenter, AlignCenter, val_text);
|
||||
if(model->duty != 0) {
|
||||
|
|
|
@ -130,7 +130,7 @@ static void snake_game_render_callback(Canvas* const canvas, void* ctx) {
|
|||
|
||||
canvas_set_font(canvas, FontSecondary);
|
||||
char buffer[12];
|
||||
snprintf(buffer, sizeof(buffer), "Score: %u", snake_state->len - 7);
|
||||
snprintf(buffer, sizeof(buffer), "Score: %u", snake_state->len - 7U);
|
||||
canvas_draw_str_aligned(canvas, 64, 41, AlignCenter, AlignBottom, buffer);
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ static void snake_game_update_timer_callback(FuriMessageQueue* event_queue) {
|
|||
|
||||
static void snake_game_init_game(SnakeState* const snake_state) {
|
||||
Point p[] = {{8, 6}, {7, 6}, {6, 6}, {5, 6}, {4, 6}, {3, 6}, {2, 6}};
|
||||
memcpy(snake_state->points, p, sizeof(p));
|
||||
memcpy(snake_state->points, p, sizeof(p)); //-V1086
|
||||
|
||||
snake_state->len = 7;
|
||||
|
||||
|
|
|
@ -343,7 +343,7 @@ bool ws_protocol_decoder_oregon2_deserialize(void* context, FlipperFormat* flipp
|
|||
flipper_format,
|
||||
"VarData",
|
||||
(uint8_t*)&instance->var_data,
|
||||
sizeof(instance->var_data))) {
|
||||
sizeof(instance->var_data))) { //-V1051
|
||||
FURI_LOG_E(TAG, "Missing VarData");
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ static void ws_protocol_oregon_v1_remote_controller(WSBlockGeneric* instance) {
|
|||
instance->temp = -temp_raw;
|
||||
}
|
||||
|
||||
instance->battery_low = !(instance->data >> 23) & 1;
|
||||
instance->battery_low = !((instance->data >> 23) & 1ULL);
|
||||
|
||||
instance->btn = WS_NO_BTN;
|
||||
instance->humidity = WS_NO_HUMIDITY;
|
||||
|
|
|
@ -79,7 +79,7 @@ bool ws_block_generic_serialize(
|
|||
|
||||
uint8_t key_data[sizeof(uint64_t)] = {0};
|
||||
for(size_t i = 0; i < sizeof(uint64_t); i++) {
|
||||
key_data[sizeof(uint64_t) - i - 1] = (instance->data >> i * 8) & 0xFF;
|
||||
key_data[sizeof(uint64_t) - i - 1] = (instance->data >> (i * 8)) & 0xFF;
|
||||
}
|
||||
|
||||
if(!flipper_format_write_hex(flipper_format, "Data", key_data, sizeof(uint64_t))) {
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
#include "../protocols/ws_generic.h"
|
||||
#include <input/input.h>
|
||||
#include <gui/elements.h>
|
||||
|
||||
#define abs(x) ((x) > 0 ? (x) : -(x))
|
||||
#include <float_tools.h>
|
||||
|
||||
struct WSReceiverInfo {
|
||||
View* view;
|
||||
|
@ -79,7 +78,7 @@ void ws_view_receiver_info_draw(Canvas* canvas, WSReceiverInfoModel* model) {
|
|||
elements_bold_rounded_frame(canvas, 0, 38, 127, 25);
|
||||
canvas_set_font(canvas, FontPrimary);
|
||||
|
||||
if(model->generic->temp != WS_NO_TEMPERATURE) {
|
||||
if(!float_is_equal(model->generic->temp, WS_NO_TEMPERATURE)) {
|
||||
canvas_draw_icon(canvas, 6, 43, &I_Therm_7x16);
|
||||
|
||||
uint8_t temp_x1 = 0;
|
||||
|
|
|
@ -111,11 +111,8 @@ void ws_hopper_update(WeatherStationApp* app) {
|
|||
|
||||
switch(app->txrx->hopper_state) {
|
||||
case WSHopperStateOFF:
|
||||
return;
|
||||
break;
|
||||
case WSHopperStatePause:
|
||||
return;
|
||||
break;
|
||||
case WSHopperStateRSSITimeOut:
|
||||
if(app->txrx->hopper_timeout != 0) {
|
||||
app->txrx->hopper_timeout--;
|
||||
|
|
|
@ -186,7 +186,7 @@ WSHistoryStateAddKey
|
|||
}
|
||||
|
||||
// or add new record
|
||||
if(!sensor_found) {
|
||||
if(!sensor_found) { //-V547
|
||||
WSHistoryItem* item = WSHistoryItemArray_push_raw(instance->history->data);
|
||||
item->preset = malloc(sizeof(SubGhzRadioPreset));
|
||||
item->type = decoder_base->protocol->type;
|
||||
|
|
|
@ -36,7 +36,7 @@ static void bt_pin_code_view_port_draw_callback(Canvas* canvas, void* context) {
|
|||
Bt* bt = context;
|
||||
char pin_code_info[24];
|
||||
canvas_draw_icon(canvas, 0, 0, &I_BLE_Pairing_128x64);
|
||||
snprintf(pin_code_info, sizeof(pin_code_info), "Pairing code\n%06ld", bt->pin_code);
|
||||
snprintf(pin_code_info, sizeof(pin_code_info), "Pairing code\n%06lu", bt->pin_code);
|
||||
elements_multiline_text_aligned(canvas, 64, 4, AlignCenter, AlignTop, pin_code_info);
|
||||
elements_button_left(canvas, "Quit");
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ static bool bt_pin_code_verify_event_handler(Bt* bt, uint32_t pin) {
|
|||
notification_message(bt->notification, &sequence_display_backlight_on);
|
||||
FuriString* pin_str;
|
||||
dialog_message_set_icon(bt->dialog_message, &I_BLE_Pairing_128x64, 0, 0);
|
||||
pin_str = furi_string_alloc_printf("Verify code\n%06ld", pin);
|
||||
pin_str = furi_string_alloc_printf("Verify code\n%06lu", pin);
|
||||
dialog_message_set_text(
|
||||
bt->dialog_message, furi_string_get_cstr(pin_str), 64, 4, AlignCenter, AlignTop);
|
||||
dialog_message_set_buttons(bt->dialog_message, "Cancel", "OK", NULL);
|
||||
|
@ -163,7 +163,7 @@ static uint16_t bt_serial_event_callback(SerialServiceEvent event, void* context
|
|||
rpc_session_feed(bt->rpc_session, event.data.buffer, event.data.size, 1000);
|
||||
if(bytes_processed != event.data.size) {
|
||||
FURI_LOG_E(
|
||||
TAG, "Only %d of %d bytes processed by RPC", bytes_processed, event.data.size);
|
||||
TAG, "Only %zu of %u bytes processed by RPC", bytes_processed, event.data.size);
|
||||
}
|
||||
ret = rpc_session_get_available_size(bt->rpc_session);
|
||||
} else if(event.event == SerialServiceEventTypeDataSent) {
|
||||
|
|
|
@ -115,7 +115,7 @@ bool bt_keys_storage_update(BtKeysStorage* instance, uint8_t* start_addr, uint32
|
|||
|
||||
FURI_LOG_I(
|
||||
TAG,
|
||||
"Base address: %p. Start update address: %p. Size changed: %ld",
|
||||
"Base address: %p. Start update address: %p. Size changed: %lu",
|
||||
(void*)instance->nvm_sram_buff,
|
||||
start_addr,
|
||||
size);
|
||||
|
|
|
@ -225,7 +225,7 @@ static void cli_handle_enter(Cli* cli) {
|
|||
furi_check(furi_mutex_acquire(cli->mutex, FuriWaitForever) == FuriStatusOk);
|
||||
CliCommand* cli_command_ptr = CliCommandTree_get(cli->commands, command);
|
||||
|
||||
if(cli_command_ptr) {
|
||||
if(cli_command_ptr) { //-V547
|
||||
CliCommand cli_command;
|
||||
memcpy(&cli_command, cli_command_ptr, sizeof(CliCommand));
|
||||
furi_check(furi_mutex_release(cli->mutex) == FuriStatusOk);
|
||||
|
@ -353,7 +353,7 @@ void cli_process_input(Cli* cli) {
|
|||
cli_handle_backspace(cli);
|
||||
} else if(in_chr == CliSymbolAsciiCR) {
|
||||
cli_handle_enter(cli);
|
||||
} else if(in_chr >= 0x20 && in_chr < 0x7F) {
|
||||
} else if(in_chr >= 0x20 && in_chr < 0x7F) { //-V560
|
||||
if(cli->cursor_position == furi_string_size(cli->line)) {
|
||||
furi_string_push_back(cli->line, in_chr);
|
||||
cli_putc(cli, in_chr);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "cli_command_gpio.h"
|
||||
|
||||
#include "core/string.h"
|
||||
#include <furi.h>
|
||||
#include <furi_hal.h>
|
||||
#include <lib/toolbox/args.h>
|
||||
|
@ -36,26 +37,24 @@ void cli_command_gpio_print_usage() {
|
|||
}
|
||||
|
||||
static bool pin_name_to_int(FuriString* pin_name, size_t* result) {
|
||||
bool found = false;
|
||||
bool debug = furi_hal_rtc_is_flag_set(FuriHalRtcFlagDebug);
|
||||
bool is_debug_mode = furi_hal_rtc_is_flag_set(FuriHalRtcFlagDebug);
|
||||
for(size_t i = 0; i < COUNT_OF(cli_command_gpio_pins); i++) {
|
||||
if(!furi_string_cmp(pin_name, cli_command_gpio_pins[i].name)) {
|
||||
if(!cli_command_gpio_pins[i].debug || debug) {
|
||||
if(furi_string_equal(pin_name, cli_command_gpio_pins[i].name)) {
|
||||
if(!cli_command_gpio_pins[i].debug || is_debug_mode) {
|
||||
*result = i;
|
||||
found = true;
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return found;
|
||||
return false;
|
||||
}
|
||||
|
||||
static void gpio_print_pins(void) {
|
||||
printf("Wrong pin name. Available pins: ");
|
||||
bool debug = furi_hal_rtc_is_flag_set(FuriHalRtcFlagDebug);
|
||||
bool is_debug_mode = furi_hal_rtc_is_flag_set(FuriHalRtcFlagDebug);
|
||||
for(size_t i = 0; i < COUNT_OF(cli_command_gpio_pins); i++) {
|
||||
if(!cli_command_gpio_pins[i].debug || debug) {
|
||||
if(!cli_command_gpio_pins[i].debug || is_debug_mode) {
|
||||
printf("%s ", cli_command_gpio_pins[i].name);
|
||||
}
|
||||
}
|
||||
|
@ -69,34 +68,29 @@ typedef enum {
|
|||
} GpioParseReturn;
|
||||
|
||||
static GpioParseReturn gpio_command_parse(FuriString* args, size_t* pin_num, uint8_t* value) {
|
||||
FuriString* pin_name;
|
||||
pin_name = furi_string_alloc();
|
||||
GpioParseReturn ret = GpioParseReturnOk;
|
||||
FuriString* pin_name = furi_string_alloc();
|
||||
|
||||
size_t ws = furi_string_search_char(args, ' ');
|
||||
if(ws == FURI_STRING_FAILURE) {
|
||||
return GpioParseReturnCmdSyntaxError;
|
||||
do {
|
||||
if(!args_read_string_and_trim(args, pin_name)) {
|
||||
ret = GpioParseReturnCmdSyntaxError;
|
||||
break;
|
||||
} else if(!pin_name_to_int(pin_name, pin_num)) {
|
||||
ret = GpioParseReturnPinError;
|
||||
break;
|
||||
}
|
||||
|
||||
furi_string_set_n(pin_name, args, 0, ws);
|
||||
furi_string_right(args, ws);
|
||||
furi_string_trim(args);
|
||||
|
||||
if(!pin_name_to_int(pin_name, pin_num)) {
|
||||
furi_string_free(pin_name);
|
||||
return GpioParseReturnPinError;
|
||||
int pin_mode; //-V779
|
||||
if(!args_read_int_and_trim(args, &pin_mode) || pin_mode < 0 || pin_mode > 1) {
|
||||
ret = GpioParseReturnValueError;
|
||||
break;
|
||||
}
|
||||
|
||||
*value = pin_mode;
|
||||
} while(false);
|
||||
|
||||
furi_string_free(pin_name);
|
||||
|
||||
if(!furi_string_cmp(args, "0")) {
|
||||
*value = 0;
|
||||
} else if(!furi_string_cmp(args, "1")) {
|
||||
*value = 1;
|
||||
} else {
|
||||
return GpioParseReturnValueError;
|
||||
}
|
||||
|
||||
return GpioParseReturnOk;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void cli_command_gpio_mode(Cli* cli, FuriString* args, void* context) {
|
||||
|
@ -111,7 +105,7 @@ void cli_command_gpio_mode(Cli* cli, FuriString* args, void* context) {
|
|||
if(err == GpioParseReturnCmdSyntaxError) {
|
||||
cli_print_usage("gpio mode", "<pin_name> <0|1>", furi_string_get_cstr(args));
|
||||
return;
|
||||
} else if(err == GpioParseReturnPinError) {
|
||||
} else if(err == GpioParseReturnPinError) { //-V547
|
||||
gpio_print_pins();
|
||||
return;
|
||||
} else if(err == GpioParseReturnValueError) {
|
||||
|
@ -119,7 +113,7 @@ void cli_command_gpio_mode(Cli* cli, FuriString* args, void* context) {
|
|||
return;
|
||||
}
|
||||
|
||||
if(cli_command_gpio_pins[num].debug) {
|
||||
if(cli_command_gpio_pins[num].debug) { //-V779
|
||||
printf(
|
||||
"Changing this pin mode may damage hardware. Are you sure you want to continue? (y/n)?\r\n");
|
||||
char c = cli_getc(cli);
|
||||
|
@ -149,7 +143,7 @@ void cli_command_gpio_read(Cli* cli, FuriString* args, void* context) {
|
|||
return;
|
||||
}
|
||||
|
||||
if(LL_GPIO_MODE_INPUT !=
|
||||
if(LL_GPIO_MODE_INPUT != //-V779
|
||||
LL_GPIO_GetPinMode(
|
||||
cli_command_gpio_pins[num].pin->port, cli_command_gpio_pins[num].pin->pin)) {
|
||||
printf("Err: pin %s is not set as an input.", cli_command_gpio_pins[num].name);
|
||||
|
@ -171,7 +165,7 @@ void cli_command_gpio_set(Cli* cli, FuriString* args, void* context) {
|
|||
if(err == GpioParseReturnCmdSyntaxError) {
|
||||
cli_print_usage("gpio set", "<pin_name> <0|1>", furi_string_get_cstr(args));
|
||||
return;
|
||||
} else if(err == GpioParseReturnPinError) {
|
||||
} else if(err == GpioParseReturnPinError) { //-V547
|
||||
gpio_print_pins();
|
||||
return;
|
||||
} else if(err == GpioParseReturnValueError) {
|
||||
|
@ -179,7 +173,7 @@ void cli_command_gpio_set(Cli* cli, FuriString* args, void* context) {
|
|||
return;
|
||||
}
|
||||
|
||||
if(LL_GPIO_MODE_OUTPUT !=
|
||||
if(LL_GPIO_MODE_OUTPUT != //-V779
|
||||
LL_GPIO_GetPinMode(
|
||||
cli_command_gpio_pins[num].pin->port, cli_command_gpio_pins[num].pin->pin)) {
|
||||
printf("Err: pin %s is not set as an output.", cli_command_gpio_pins[num].name);
|
||||
|
|
|
@ -354,7 +354,7 @@ void cli_command_ps(Cli* cli, FuriString* args, void* context) {
|
|||
for(uint8_t i = 0; i < thread_num; i++) {
|
||||
TaskControlBlock* tcb = (TaskControlBlock*)threads_ids[i];
|
||||
printf(
|
||||
"%-20s 0x%-12lx %-8d %-8ld %-8ld\r\n",
|
||||
"%-20s 0x%-12lx %-8zu %-8lu %-8lu\r\n",
|
||||
furi_thread_get_name(threads_ids[i]),
|
||||
(uint32_t)tcb->pxStack,
|
||||
memmgr_heap_get_thread_memory(threads_ids[i]),
|
||||
|
@ -369,13 +369,13 @@ void cli_command_free(Cli* cli, FuriString* args, void* context) {
|
|||
UNUSED(args);
|
||||
UNUSED(context);
|
||||
|
||||
printf("Free heap size: %d\r\n", memmgr_get_free_heap());
|
||||
printf("Total heap size: %d\r\n", memmgr_get_total_heap());
|
||||
printf("Minimum heap size: %d\r\n", memmgr_get_minimum_free_heap());
|
||||
printf("Maximum heap block: %d\r\n", memmgr_heap_get_max_free_block());
|
||||
printf("Free heap size: %zu\r\n", memmgr_get_free_heap());
|
||||
printf("Total heap size: %zu\r\n", memmgr_get_total_heap());
|
||||
printf("Minimum heap size: %zu\r\n", memmgr_get_minimum_free_heap());
|
||||
printf("Maximum heap block: %zu\r\n", memmgr_heap_get_max_free_block());
|
||||
|
||||
printf("Pool free: %d\r\n", memmgr_pool_get_free());
|
||||
printf("Maximum pool block: %d\r\n", memmgr_pool_get_max_block());
|
||||
printf("Pool free: %zu\r\n", memmgr_pool_get_free());
|
||||
printf("Maximum pool block: %zu\r\n", memmgr_pool_get_max_block());
|
||||
}
|
||||
|
||||
void cli_command_free_blocks(Cli* cli, FuriString* args, void* context) {
|
||||
|
|
|
@ -142,7 +142,7 @@ void crypto_cli_decrypt(Cli* cli, FuriString* args) {
|
|||
if(args_read_hex_bytes(hex_input, input, size)) {
|
||||
if(furi_hal_crypto_decrypt(input, output, size)) {
|
||||
printf("Decrypted data:\r\n");
|
||||
printf("%s\r\n", output);
|
||||
printf("%s\r\n", output); //-V576
|
||||
} else {
|
||||
printf("Failed to decrypt\r\n");
|
||||
}
|
||||
|
|
|
@ -244,11 +244,9 @@ static bool animation_manager_check_blocking(AnimationManager* animation_manager
|
|||
furi_record_close(RECORD_DOLPHIN);
|
||||
if(!blocking_animation && stats.level_up_is_pending) {
|
||||
blocking_animation = animation_storage_find_animation(NEW_MAIL_ANIMATION_NAME);
|
||||
furi_assert(blocking_animation);
|
||||
if(blocking_animation) {
|
||||
furi_check(blocking_animation);
|
||||
animation_manager->levelup_pending = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(blocking_animation) {
|
||||
furi_timer_stop(animation_manager->idle_animation_timer);
|
||||
|
@ -448,7 +446,7 @@ void animation_manager_unload_and_stall_animation(AnimationManager* animation_ma
|
|||
|
||||
if(animation_manager->state == AnimationManagerStateBlocked) {
|
||||
animation_manager->state = AnimationManagerStateFreezedBlocked;
|
||||
} else if(animation_manager->state == AnimationManagerStateIdle) {
|
||||
} else if(animation_manager->state == AnimationManagerStateIdle) { //-V547
|
||||
animation_manager->state = AnimationManagerStateFreezedIdle;
|
||||
|
||||
animation_manager->freezed_animation_time_left =
|
||||
|
@ -491,7 +489,7 @@ void animation_manager_load_and_continue_animation(AnimationManager* animation_m
|
|||
furi_assert(restore_animation);
|
||||
animation_manager_replace_current_animation(animation_manager, restore_animation);
|
||||
animation_manager->state = AnimationManagerStateBlocked;
|
||||
} else if(animation_manager->state == AnimationManagerStateFreezedIdle) {
|
||||
} else if(animation_manager->state == AnimationManagerStateFreezedIdle) { //-V547
|
||||
/* check if we missed some system notifications, and set current_animation */
|
||||
bool blocked = animation_manager_check_blocking(animation_manager);
|
||||
if(!blocked) {
|
||||
|
|
|
@ -360,7 +360,6 @@ static bool animation_storage_load_bubbles(BubbleAnimation* animation, FlipperFo
|
|||
if(u32value > 20) break;
|
||||
animation->frame_bubble_sequences_count = u32value;
|
||||
if(animation->frame_bubble_sequences_count == 0) {
|
||||
animation->frame_bubble_sequences = NULL;
|
||||
success = true;
|
||||
break;
|
||||
}
|
||||
|
@ -481,7 +480,7 @@ static BubbleAnimation* animation_storage_load_animation(const char* name) {
|
|||
if(!animation_storage_load_frames(storage, name, animation, u32array, width, height))
|
||||
break;
|
||||
|
||||
if(!flipper_format_read_uint32(ff, "Active cycles", &u32value, 1)) break;
|
||||
if(!flipper_format_read_uint32(ff, "Active cycles", &u32value, 1)) break; //-V779
|
||||
animation->active_cycles = u32value;
|
||||
if(!flipper_format_read_uint32(ff, "Frame rate", &u32value, 1)) break;
|
||||
FURI_CONST_ASSIGN(animation->icon_animation.frame_rate, u32value);
|
||||
|
@ -500,7 +499,7 @@ static BubbleAnimation* animation_storage_load_animation(const char* name) {
|
|||
free(u32array);
|
||||
}
|
||||
|
||||
if(!success) {
|
||||
if(!success) { //-V547
|
||||
if(animation->frame_order) {
|
||||
free((void*)animation->frame_order);
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ Slideshow* slideshow_alloc() {
|
|||
|
||||
void slideshow_free(Slideshow* slideshow) {
|
||||
Icon* icon = &slideshow->icon;
|
||||
if(icon) {
|
||||
if(icon) { //-V547
|
||||
for(int frame_idx = 0; frame_idx < icon->frame_count; ++frame_idx) {
|
||||
uint8_t* frame_data = (uint8_t*)icon->frames[frame_idx];
|
||||
free(frame_data);
|
||||
|
|
|
@ -52,7 +52,7 @@ void desktop_debug_render(Canvas* canvas, void* model) {
|
|||
#ifdef SRV_BT
|
||||
c2_ver = ble_glue_get_c2_info();
|
||||
#endif
|
||||
if(!ver) {
|
||||
if(!ver) { //-V1051
|
||||
canvas_draw_str(canvas, 0, 30 + STATUS_BAR_Y_SHIFT, "No info");
|
||||
return;
|
||||
}
|
||||
|
@ -88,19 +88,19 @@ void desktop_debug_render(Canvas* canvas, void* model) {
|
|||
uint32_t remaining = dolphin_state_xp_to_levelup(m->icounter);
|
||||
|
||||
canvas_set_font(canvas, FontSecondary);
|
||||
snprintf(buffer, sizeof(buffer), "Icounter: %ld Butthurt %ld", m->icounter, m->butthurt);
|
||||
snprintf(buffer, sizeof(buffer), "Icounter: %lu Butthurt %lu", m->icounter, m->butthurt);
|
||||
canvas_draw_str(canvas, 5, 19 + STATUS_BAR_Y_SHIFT, buffer);
|
||||
|
||||
snprintf(
|
||||
buffer,
|
||||
sizeof(buffer),
|
||||
"Level: %ld To level up: %ld",
|
||||
"Level: %lu To level up: %lu",
|
||||
current_lvl,
|
||||
(remaining == (uint32_t)(-1) ? remaining : 0));
|
||||
canvas_draw_str(canvas, 5, 29 + STATUS_BAR_Y_SHIFT, buffer);
|
||||
|
||||
// even if timestamp is uint64_t, it's safe to cast it to uint32_t, because furi_hal_rtc_datetime_to_timestamp only returns uint32_t
|
||||
snprintf(buffer, sizeof(buffer), "%ld", (uint32_t)m->timestamp);
|
||||
snprintf(buffer, sizeof(buffer), "%lu", (uint32_t)m->timestamp);
|
||||
|
||||
canvas_draw_str(canvas, 5, 39 + STATUS_BAR_Y_SHIFT, buffer);
|
||||
canvas_draw_str(canvas, 0, 49 + STATUS_BAR_Y_SHIFT, "[< >] icounter value [ok] save");
|
||||
|
|
|
@ -53,7 +53,7 @@ void desktop_lock_menu_draw_callback(Canvas* canvas, void* model) {
|
|||
canvas_draw_icon(canvas, 116, 0 + STATUS_BAR_Y_SHIFT, &I_DoorRight_70x55);
|
||||
canvas_set_font(canvas, FontSecondary);
|
||||
|
||||
for(uint8_t i = 0; i < DesktopLockMenuIndexTotalCount; ++i) {
|
||||
for(size_t i = 0; i < DesktopLockMenuIndexTotalCount; ++i) {
|
||||
const char* str = NULL;
|
||||
|
||||
if(i == DesktopLockMenuIndexLock) {
|
||||
|
@ -64,7 +64,7 @@ void desktop_lock_menu_draw_callback(Canvas* canvas, void* model) {
|
|||
} else {
|
||||
str = "Set PIN";
|
||||
}
|
||||
} else if(i == DesktopLockMenuIndexDummy) {
|
||||
} else if(i == DesktopLockMenuIndexDummy) { //-V547
|
||||
if(m->dummy_mode) {
|
||||
str = "Brainiac Mode";
|
||||
} else {
|
||||
|
@ -72,7 +72,7 @@ void desktop_lock_menu_draw_callback(Canvas* canvas, void* model) {
|
|||
}
|
||||
}
|
||||
|
||||
if(str)
|
||||
if(str) //-V547
|
||||
canvas_draw_str_aligned(
|
||||
canvas, 64, 9 + (i * 17) + STATUS_BAR_Y_SHIFT, AlignCenter, AlignCenter, str);
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ static void desktop_view_pin_timeout_draw(Canvas* canvas, void* _model) {
|
|||
|
||||
canvas_set_font(canvas, FontSecondary);
|
||||
char str[30] = {0};
|
||||
snprintf(str, sizeof(str), "Timeout: %lds", model->time_left);
|
||||
snprintf(str, sizeof(str), "Timeout: %lus", model->time_left);
|
||||
canvas_draw_str_aligned(canvas, 64, 38, AlignCenter, AlignCenter, str);
|
||||
}
|
||||
|
||||
|
|
|
@ -171,7 +171,7 @@ void dolphin_state_on_deed(DolphinState* dolphin_state, DolphinDeed deed) {
|
|||
|
||||
FURI_LOG_D(
|
||||
TAG,
|
||||
"icounter %ld, butthurt %ld",
|
||||
"icounter %lu, butthurt %ld",
|
||||
dolphin_state->data.icounter,
|
||||
dolphin_state->data.butthurt);
|
||||
}
|
||||
|
|
|
@ -291,11 +291,11 @@ void elements_multiline_text(Canvas* canvas, uint8_t x, uint8_t y, const char* t
|
|||
end = strchr(start, '\n');
|
||||
if(end) {
|
||||
furi_string_set_strn(str, start, end - start);
|
||||
start = end + 1;
|
||||
} else {
|
||||
furi_string_set(str, start);
|
||||
}
|
||||
canvas_draw_str(canvas, x, y, furi_string_get_cstr(str));
|
||||
start = end + 1;
|
||||
y += font_height;
|
||||
} while(end && y < 64);
|
||||
furi_string_free(str);
|
||||
|
|
|
@ -172,7 +172,7 @@ void button_panel_add_item(
|
|||
void* callback_context) {
|
||||
furi_assert(button_panel);
|
||||
|
||||
with_view_model(
|
||||
with_view_model( //-V773
|
||||
button_panel->view,
|
||||
ButtonPanelModel * model,
|
||||
{
|
||||
|
|
|
@ -71,11 +71,13 @@ static uint8_t byte_input_get_row_size(uint8_t row_index) {
|
|||
|
||||
switch(row_index + 1) {
|
||||
case 1:
|
||||
row_size = sizeof(keyboard_keys_row_1) / sizeof(ByteInputKey);
|
||||
row_size = COUNT_OF(keyboard_keys_row_1);
|
||||
break;
|
||||
case 2:
|
||||
row_size = sizeof(keyboard_keys_row_2) / sizeof(ByteInputKey);
|
||||
row_size = COUNT_OF(keyboard_keys_row_2);
|
||||
break;
|
||||
default:
|
||||
furi_crash(NULL);
|
||||
}
|
||||
|
||||
return row_size;
|
||||
|
@ -97,6 +99,8 @@ static const ByteInputKey* byte_input_get_row(uint8_t row_index) {
|
|||
case 2:
|
||||
row = keyboard_keys_row_2;
|
||||
break;
|
||||
default:
|
||||
furi_crash(NULL);
|
||||
}
|
||||
|
||||
return row;
|
||||
|
@ -383,6 +387,7 @@ static void byte_input_dec_selected_byte(ByteInputModel* model) {
|
|||
if(model->selected_byte > 0) {
|
||||
model->selected_byte -= 1;
|
||||
|
||||
furi_assert(model->selected_byte >= model->first_visible_byte);
|
||||
if(model->selected_byte - model->first_visible_byte < 1) {
|
||||
if(model->first_visible_byte > 0) {
|
||||
model->first_visible_byte--;
|
||||
|
|
|
@ -514,7 +514,7 @@ static void browser_draw_list(Canvas* canvas, FileBrowserModel* model) {
|
|||
scroll_counter = 0;
|
||||
}
|
||||
|
||||
if(custom_icon_data) {
|
||||
if(custom_icon_data) { //-V547
|
||||
// Currently only 10*10 icons are supported
|
||||
canvas_draw_bitmap(
|
||||
canvas, 2, Y_OFFSET + 1 + i * FRAME_HEIGHT, 10, 10, custom_icon_data);
|
||||
|
@ -657,12 +657,10 @@ static bool file_browser_view_input_callback(InputEvent* event, void* context) {
|
|||
|
||||
if(!is_root && !file_browser_worker_is_in_start_folder(browser->worker)) {
|
||||
consumed = true;
|
||||
if(!is_root) {
|
||||
file_browser_worker_folder_exit(browser->worker);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return consumed;
|
||||
}
|
||||
|
|
|
@ -375,7 +375,7 @@ BrowserWorker* file_browser_worker_alloc(
|
|||
const char* filter_ext,
|
||||
bool skip_assets,
|
||||
bool hide_dot_files) {
|
||||
BrowserWorker* browser = malloc(sizeof(BrowserWorker)); //-V773
|
||||
BrowserWorker* browser = malloc(sizeof(BrowserWorker));
|
||||
|
||||
idx_last_array_init(browser->idx_last);
|
||||
|
||||
|
@ -395,7 +395,7 @@ BrowserWorker* file_browser_worker_alloc(
|
|||
furi_thread_start(browser->thread);
|
||||
|
||||
return browser;
|
||||
}
|
||||
} //-V773
|
||||
|
||||
void file_browser_worker_free(BrowserWorker* browser) {
|
||||
furi_assert(browser);
|
||||
|
|
|
@ -225,8 +225,11 @@ void submenu_set_selected_item(Submenu* submenu, uint32_t index) {
|
|||
|
||||
if(items_size <= items_on_screen) {
|
||||
model->window_position = 0;
|
||||
} else if(model->window_position >= items_size - items_on_screen) {
|
||||
model->window_position = items_size - items_on_screen;
|
||||
} else {
|
||||
const size_t pos = items_size - items_on_screen;
|
||||
if(model->window_position > pos) {
|
||||
model->window_position = pos;
|
||||
}
|
||||
}
|
||||
},
|
||||
true);
|
||||
|
@ -242,8 +245,7 @@ void submenu_process_up(Submenu* submenu) {
|
|||
|
||||
if(model->position > 0) {
|
||||
model->position--;
|
||||
if((model->position - model->window_position < 1) &&
|
||||
(model->window_position > 0)) {
|
||||
if((model->position == model->window_position) && (model->window_position > 0)) {
|
||||
model->window_position--;
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -92,14 +92,16 @@ static uint8_t get_row_size(uint8_t row_index) {
|
|||
|
||||
switch(row_index + 1) {
|
||||
case 1:
|
||||
row_size = sizeof(keyboard_keys_row_1) / sizeof(TextInputKey);
|
||||
row_size = COUNT_OF(keyboard_keys_row_1);
|
||||
break;
|
||||
case 2:
|
||||
row_size = sizeof(keyboard_keys_row_2) / sizeof(TextInputKey);
|
||||
row_size = COUNT_OF(keyboard_keys_row_2);
|
||||
break;
|
||||
case 3:
|
||||
row_size = sizeof(keyboard_keys_row_3) / sizeof(TextInputKey);
|
||||
row_size = COUNT_OF(keyboard_keys_row_3);
|
||||
break;
|
||||
default:
|
||||
furi_crash(NULL);
|
||||
}
|
||||
|
||||
return row_size;
|
||||
|
@ -118,6 +120,8 @@ static const TextInputKey* get_row(uint8_t row_index) {
|
|||
case 3:
|
||||
row = keyboard_keys_row_3;
|
||||
break;
|
||||
default:
|
||||
furi_crash(NULL);
|
||||
}
|
||||
|
||||
return row;
|
||||
|
@ -184,7 +188,7 @@ static void text_input_view_draw_callback(Canvas* canvas, void* _model) {
|
|||
|
||||
canvas_set_font(canvas, FontKeyboard);
|
||||
|
||||
for(uint8_t row = 0; row <= keyboard_row_count; row++) {
|
||||
for(uint8_t row = 0; row < keyboard_row_count; row++) {
|
||||
const uint8_t column_count = get_row_size(row);
|
||||
const TextInputKey* keys = get_row(row);
|
||||
|
||||
|
@ -303,7 +307,7 @@ static void text_input_handle_right(TextInput* text_input, TextInputModel* model
|
|||
|
||||
static void text_input_handle_ok(TextInput* text_input, TextInputModel* model, bool shift) {
|
||||
char selected = get_selected_char(model);
|
||||
uint8_t text_length = strlen(model->text_buffer);
|
||||
size_t text_length = strlen(model->text_buffer);
|
||||
|
||||
if(shift) {
|
||||
selected = char_to_uppercase(selected);
|
||||
|
@ -481,7 +485,6 @@ void text_input_reset(TextInput* text_input) {
|
|||
text_input->view,
|
||||
TextInputModel * model,
|
||||
{
|
||||
model->text_buffer_size = 0;
|
||||
model->header = "";
|
||||
model->selected_row = 0;
|
||||
model->selected_column = 0;
|
||||
|
|
|
@ -18,15 +18,12 @@ bool validator_is_file_callback(const char* text, FuriString* error, void* conte
|
|||
}
|
||||
}
|
||||
|
||||
bool ret = true;
|
||||
FuriString* path = furi_string_alloc_printf(
|
||||
"%s/%s%s", instance->app_path_folder, text, instance->app_extension);
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
if(storage_common_stat(storage, furi_string_get_cstr(path), NULL) == FSE_OK) {
|
||||
ret = false;
|
||||
const bool ret = storage_common_stat(storage, furi_string_get_cstr(path), NULL) != FSE_OK;
|
||||
if(!ret) {
|
||||
furi_string_printf(error, "This name\nexists!\nChoose\nanother one.");
|
||||
} else {
|
||||
ret = true;
|
||||
}
|
||||
furi_string_free(path);
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
|
|
@ -188,8 +188,8 @@ void variable_item_list_process_up(VariableItemList* variable_item_list) {
|
|||
uint8_t items_on_screen = 4;
|
||||
if(model->position > 0) {
|
||||
model->position--;
|
||||
if(((model->position - model->window_position) < 1) &&
|
||||
model->window_position > 0) {
|
||||
|
||||
if((model->position == model->window_position) && (model->window_position > 0)) {
|
||||
model->window_position--;
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -60,7 +60,7 @@ WidgetElement* widget_element_button_create(
|
|||
ButtonCallback callback,
|
||||
void* context) {
|
||||
// Allocate and init model
|
||||
GuiButtonModel* model = malloc(sizeof(GuiButtonModel)); //-V773
|
||||
GuiButtonModel* model = malloc(sizeof(GuiButtonModel));
|
||||
model->button_type = button_type;
|
||||
model->callback = callback;
|
||||
model->context = context;
|
||||
|
@ -75,4 +75,4 @@ WidgetElement* widget_element_button_create(
|
|||
gui_button->model = model;
|
||||
|
||||
return gui_button;
|
||||
}
|
||||
} //-V773
|
||||
|
|
|
@ -62,4 +62,4 @@ WidgetElement* widget_element_string_create(
|
|||
gui_string->model = model;
|
||||
|
||||
return gui_string;
|
||||
}
|
||||
} //-V773
|
||||
|
|
|
@ -63,4 +63,4 @@ WidgetElement* widget_element_string_multiline_create(
|
|||
gui_string->model = model;
|
||||
|
||||
return gui_string;
|
||||
}
|
||||
} //-V773
|
||||
|
|
|
@ -71,4 +71,4 @@ WidgetElement* widget_element_text_box_create(
|
|||
gui_string->model = model;
|
||||
|
||||
return gui_string;
|
||||
}
|
||||
} //-V773
|
||||
|
|
|
@ -241,4 +241,4 @@ WidgetElement* widget_element_text_scroll_create(
|
|||
text_scroll->model_mutex = furi_mutex_alloc(FuriMutexTypeNormal);
|
||||
|
||||
return text_scroll;
|
||||
}
|
||||
} //-V773
|
||||
|
|
|
@ -86,7 +86,7 @@ void view_allocate_model(View* view, ViewModelType type, size_t size) {
|
|||
model->data = malloc(size);
|
||||
view->model = model;
|
||||
} else {
|
||||
furi_assert(false);
|
||||
furi_crash(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@ void view_free_model(View* view) {
|
|||
free(model);
|
||||
view->model = NULL;
|
||||
} else {
|
||||
furi_assert(false);
|
||||
furi_crash(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -80,9 +80,7 @@ int32_t input_srv(void* p) {
|
|||
|
||||
#ifdef SRV_CLI
|
||||
input->cli = furi_record_open(RECORD_CLI);
|
||||
if(input->cli) {
|
||||
cli_add_command(input->cli, "input", CliCommandFlagParallelSafe, input_cli, input);
|
||||
}
|
||||
#endif
|
||||
|
||||
input->pin_states = malloc(input_pins_count * sizeof(InputPinState));
|
||||
|
|
|
@ -89,7 +89,7 @@ static void input_cli_send(Cli* cli, FuriString* args, Input* input) {
|
|||
parsed = true;
|
||||
} while(false);
|
||||
|
||||
if(parsed) {
|
||||
if(parsed) { //-V547
|
||||
furi_pubsub_publish(input->event_pubsub, &event);
|
||||
} else {
|
||||
input_cli_send_print_usage();
|
||||
|
|
|
@ -280,7 +280,7 @@ static void loader_thread_state_callback(FuriThreadState thread_state, void* con
|
|||
furi_hal_power_insomnia_enter();
|
||||
}
|
||||
} else if(thread_state == FuriThreadStateStopped) {
|
||||
FURI_LOG_I(TAG, "Application stopped. Free heap: %d", memmgr_get_free_heap());
|
||||
FURI_LOG_I(TAG, "Application stopped. Free heap: %zu", memmgr_get_free_heap());
|
||||
|
||||
if(loader_instance->application_arguments) {
|
||||
free(loader_instance->application_arguments);
|
||||
|
|
|
@ -26,7 +26,7 @@ static void power_off_draw_callback(Canvas* canvas, void* _model) {
|
|||
|
||||
canvas_set_font(canvas, FontSecondary);
|
||||
if(model->response == PowerOffResponseDefault) {
|
||||
snprintf(buff, sizeof(buff), "Charge me!\nOff in %lds!", model->time_left_sec);
|
||||
snprintf(buff, sizeof(buff), "Charge me!\nOff in %lus!", model->time_left_sec);
|
||||
elements_multiline_text_aligned(canvas, 70, 23, AlignLeft, AlignTop, buff);
|
||||
|
||||
elements_button_left(canvas, "Cancel");
|
||||
|
|
|
@ -39,9 +39,9 @@ static void rpc_system_app_start_process(const PB_Main* request, void* context)
|
|||
furi_assert(!rpc_app->last_id);
|
||||
furi_assert(!rpc_app->last_data);
|
||||
|
||||
FURI_LOG_D(TAG, "StartProcess: id %ld", request->command_id);
|
||||
FURI_LOG_D(TAG, "StartProcess: id %lu", request->command_id);
|
||||
|
||||
PB_CommandStatus result = PB_CommandStatus_ERROR_APP_CANT_START;
|
||||
PB_CommandStatus result;
|
||||
|
||||
Loader* loader = furi_record_open(RECORD_LOADER);
|
||||
const char* app_name = request->content.app_start_request.name;
|
||||
|
@ -62,7 +62,7 @@ static void rpc_system_app_start_process(const PB_Main* request, void* context)
|
|||
} else if(status == LoaderStatusOk) {
|
||||
result = PB_CommandStatus_OK;
|
||||
} else {
|
||||
furi_crash("Programming Error");
|
||||
furi_crash(NULL);
|
||||
}
|
||||
} else {
|
||||
result = PB_CommandStatus_ERROR_INVALID_PARAMETERS;
|
||||
|
@ -70,7 +70,7 @@ static void rpc_system_app_start_process(const PB_Main* request, void* context)
|
|||
|
||||
furi_record_close(RECORD_LOADER);
|
||||
|
||||
FURI_LOG_D(TAG, "StartProcess: response id %ld, result %d", request->command_id, result);
|
||||
FURI_LOG_D(TAG, "StartProcess: response id %lu, result %d", request->command_id, result);
|
||||
rpc_send_and_release_empty(session, request->command_id, result);
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,7 @@ static void rpc_system_app_exit_request(const PB_Main* request, void* context) {
|
|||
PB_CommandStatus status;
|
||||
|
||||
if(rpc_app->app_callback) {
|
||||
FURI_LOG_D(TAG, "ExitRequest: id %ld", request->command_id);
|
||||
FURI_LOG_D(TAG, "ExitRequest: id %lu", request->command_id);
|
||||
furi_assert(!rpc_app->last_id);
|
||||
furi_assert(!rpc_app->last_data);
|
||||
rpc_app->last_id = request->command_id;
|
||||
|
@ -125,7 +125,7 @@ static void rpc_system_app_exit_request(const PB_Main* request, void* context) {
|
|||
} else {
|
||||
status = PB_CommandStatus_ERROR_APP_NOT_RUNNING;
|
||||
FURI_LOG_E(
|
||||
TAG, "ExitRequest: APP_NOT_RUNNING, id %ld, status: %d", request->command_id, status);
|
||||
TAG, "ExitRequest: APP_NOT_RUNNING, id %lu, status: %d", request->command_id, status);
|
||||
rpc_send_and_release_empty(session, request->command_id, status);
|
||||
}
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ static void rpc_system_app_load_file(const PB_Main* request, void* context) {
|
|||
|
||||
PB_CommandStatus status;
|
||||
if(rpc_app->app_callback) {
|
||||
FURI_LOG_D(TAG, "LoadFile: id %ld", request->command_id);
|
||||
FURI_LOG_D(TAG, "LoadFile: id %lu", request->command_id);
|
||||
furi_assert(!rpc_app->last_id);
|
||||
furi_assert(!rpc_app->last_data);
|
||||
rpc_app->last_id = request->command_id;
|
||||
|
@ -151,7 +151,7 @@ static void rpc_system_app_load_file(const PB_Main* request, void* context) {
|
|||
} else {
|
||||
status = PB_CommandStatus_ERROR_APP_NOT_RUNNING;
|
||||
FURI_LOG_E(
|
||||
TAG, "LoadFile: APP_NOT_RUNNING, id %ld, status: %d", request->command_id, status);
|
||||
TAG, "LoadFile: APP_NOT_RUNNING, id %lu, status: %d", request->command_id, status);
|
||||
rpc_send_and_release_empty(session, request->command_id, status);
|
||||
}
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ static void rpc_system_app_button_press(const PB_Main* request, void* context) {
|
|||
} else {
|
||||
status = PB_CommandStatus_ERROR_APP_NOT_RUNNING;
|
||||
FURI_LOG_E(
|
||||
TAG, "ButtonPress: APP_NOT_RUNNING, id %ld, status: %d", request->command_id, status);
|
||||
TAG, "ButtonPress: APP_NOT_RUNNING, id %lu, status: %d", request->command_id, status);
|
||||
rpc_send_and_release_empty(session, request->command_id, status);
|
||||
}
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ static void rpc_system_app_button_release(const PB_Main* request, void* context)
|
|||
} else {
|
||||
status = PB_CommandStatus_ERROR_APP_NOT_RUNNING;
|
||||
FURI_LOG_E(
|
||||
TAG, "ButtonRelease: APP_NOT_RUNNING, id %ld, status: %d", request->command_id, status);
|
||||
TAG, "ButtonRelease: APP_NOT_RUNNING, id %lu, status: %d", request->command_id, status);
|
||||
rpc_send_and_release_empty(session, request->command_id, status);
|
||||
}
|
||||
}
|
||||
|
@ -300,7 +300,7 @@ void rpc_system_app_confirm(RpcAppSystem* rpc_app, RpcAppSystemEvent event, bool
|
|||
free(rpc_app->last_data);
|
||||
rpc_app->last_data = NULL;
|
||||
}
|
||||
FURI_LOG_D(TAG, "AppConfirm: event %d last_id %ld status %d", event, last_id, status);
|
||||
FURI_LOG_D(TAG, "AppConfirm: event %d last_id %lu status %d", event, last_id, status);
|
||||
rpc_send_and_release_empty(session, last_id, status);
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -44,7 +44,7 @@ void rpc_cli_command_start_session(Cli* cli, FuriString* args, void* context) {
|
|||
Rpc* rpc = context;
|
||||
|
||||
uint32_t mem_before = memmgr_get_free_heap();
|
||||
FURI_LOG_D(TAG, "Free memory %ld", mem_before);
|
||||
FURI_LOG_D(TAG, "Free memory %lu", mem_before);
|
||||
|
||||
furi_hal_usb_lock();
|
||||
RpcSession* rpc_session = rpc_session_open(rpc);
|
||||
|
|
|
@ -10,7 +10,7 @@ static size_t rpc_debug_print_file_msg(
|
|||
for(size_t i = 0; i < msg_files_size; ++i, ++msg_file) {
|
||||
furi_string_cat_printf(
|
||||
str,
|
||||
"%s[%c] size: %5ld",
|
||||
"%s[%c] size: %5lu",
|
||||
prefix,
|
||||
msg_file->type == PB_Storage_File_FileType_DIR ? 'd' : 'f',
|
||||
msg_file->size);
|
||||
|
@ -40,7 +40,7 @@ void rpc_debug_print_data(const char* prefix, uint8_t* buffer, size_t size) {
|
|||
str = furi_string_alloc();
|
||||
furi_string_reserve(str, 100 + size * 5);
|
||||
|
||||
furi_string_cat_printf(str, "\r\n%s DEC(%d): {", prefix, size);
|
||||
furi_string_cat_printf(str, "\r\n%s DEC(%zu): {", prefix, size);
|
||||
for(size_t i = 0; i < size; ++i) {
|
||||
furi_string_cat_printf(str, "%d, ", buffer[i]);
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ void rpc_debug_print_data(const char* prefix, uint8_t* buffer, size_t size) {
|
|||
furi_string_reset(str);
|
||||
furi_string_reserve(str, 100 + size * 3);
|
||||
|
||||
furi_string_cat_printf(str, "%s HEX(%d): {", prefix, size);
|
||||
furi_string_cat_printf(str, "%s HEX(%zu): {", prefix, size);
|
||||
for(size_t i = 0; i < size; ++i) {
|
||||
furi_string_cat_printf(str, "%02X", buffer[i]);
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ void rpc_debug_print_message(const PB_Main* message) {
|
|||
|
||||
furi_string_cat_printf(
|
||||
str,
|
||||
"PB_Main: {\r\n\tresult: %d cmd_id: %ld (%s)\r\n",
|
||||
"PB_Main: {\r\n\tresult: %d cmd_id: %lu (%s)\r\n",
|
||||
message->command_status,
|
||||
message->command_id,
|
||||
message->has_next ? "has_next" : "last");
|
||||
|
@ -110,9 +110,9 @@ void rpc_debug_print_message(const PB_Main* message) {
|
|||
}
|
||||
case PB_Main_storage_md5sum_response_tag: {
|
||||
furi_string_cat_printf(str, "\tmd5sum_response {\r\n");
|
||||
const char* path = message->content.storage_md5sum_response.md5sum;
|
||||
if(path) {
|
||||
furi_string_cat_printf(str, "\t\tmd5sum: %s\r\n", path);
|
||||
const char* md5sum = message->content.storage_md5sum_response.md5sum;
|
||||
if(md5sum) { //-V547
|
||||
furi_string_cat_printf(str, "\t\tmd5sum: %s\r\n", md5sum);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -597,7 +597,7 @@ static void rpc_system_storage_md5sum_process(const PB_Main* request, void* cont
|
|||
char* md5sum = response.content.storage_md5sum_response.md5sum;
|
||||
size_t md5sum_size = sizeof(response.content.storage_md5sum_response.md5sum);
|
||||
(void)md5sum_size;
|
||||
furi_assert(hash_size <= ((md5sum_size - 1) / 2));
|
||||
furi_assert(hash_size <= ((md5sum_size - 1) / 2)); //-V547
|
||||
for(uint8_t i = 0; i < hash_size; i++) {
|
||||
md5sum += snprintf(md5sum, md5sum_size, "%02x", hash[i]);
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@ static void rpc_system_system_ping_process(const PB_Main* request, void* context
|
|||
}
|
||||
|
||||
PB_Main response = PB_Main_init_default;
|
||||
response.has_next = false;
|
||||
response.command_status = PB_CommandStatus_OK;
|
||||
response.command_id = request->command_id;
|
||||
response.which_content = PB_Main_system_ping_response_tag;
|
||||
|
|
|
@ -385,9 +385,7 @@ FS_Error storage_common_remove(Storage* storage, const char* path) {
|
|||
FS_Error storage_common_rename(Storage* storage, const char* old_path, const char* new_path) {
|
||||
FS_Error error = storage_common_copy(storage, old_path, new_path);
|
||||
if(error == FSE_OK) {
|
||||
if(storage_simply_remove_recursive(storage, old_path)) {
|
||||
error = FSE_OK;
|
||||
} else {
|
||||
if(!storage_simply_remove_recursive(storage, old_path)) {
|
||||
error = FSE_INTERNAL;
|
||||
}
|
||||
}
|
||||
|
@ -743,7 +741,7 @@ bool storage_simply_remove_recursive(Storage* storage, const char* path) {
|
|||
return true;
|
||||
}
|
||||
|
||||
char* name = malloc(MAX_NAME_LENGTH + 1);
|
||||
char* name = malloc(MAX_NAME_LENGTH + 1); //-V799
|
||||
File* dir = storage_file_alloc(storage);
|
||||
cur_dir = furi_string_alloc_set(path);
|
||||
bool go_deeper = false;
|
||||
|
@ -790,7 +788,7 @@ bool storage_simply_remove_recursive(Storage* storage, const char* path) {
|
|||
furi_string_free(cur_dir);
|
||||
free(name);
|
||||
return result;
|
||||
}
|
||||
} //-V773
|
||||
|
||||
bool storage_simply_remove(Storage* storage, const char* path) {
|
||||
FS_Error result;
|
||||
|
|
|
@ -17,7 +17,7 @@ void storage_file_init_set(StorageFile* obj, const StorageFile* src) {
|
|||
obj->path = furi_string_alloc_set(src->path);
|
||||
}
|
||||
|
||||
void storage_file_set(StorageFile* obj, const StorageFile* src) {
|
||||
void storage_file_set(StorageFile* obj, const StorageFile* src) { //-V524
|
||||
obj->file = src->file;
|
||||
obj->type = src->type;
|
||||
obj->file_data = src->file_data;
|
||||
|
@ -172,7 +172,6 @@ void storage_push_storage_file(
|
|||
StorageType type,
|
||||
StorageData* storage) {
|
||||
StorageFile* storage_file = StorageFileList_push_new(storage->files);
|
||||
furi_check(storage_file != NULL);
|
||||
|
||||
file->file_id = (uint32_t)storage_file;
|
||||
storage_file->file = file;
|
||||
|
|
|
@ -77,7 +77,7 @@ static int storage_int_device_read(
|
|||
|
||||
FURI_LOG_T(
|
||||
TAG,
|
||||
"Device read: block %ld, off %ld, buffer: %p, size %ld, translated address: %p",
|
||||
"Device read: block %lu, off %lu, buffer: %p, size %lu, translated address: %p",
|
||||
block,
|
||||
off,
|
||||
buffer,
|
||||
|
@ -100,7 +100,7 @@ static int storage_int_device_prog(
|
|||
|
||||
FURI_LOG_T(
|
||||
TAG,
|
||||
"Device prog: block %ld, off %ld, buffer: %p, size %ld, translated address: %p",
|
||||
"Device prog: block %lu, off %lu, buffer: %p, size %lu, translated address: %p",
|
||||
block,
|
||||
off,
|
||||
buffer,
|
||||
|
@ -122,7 +122,7 @@ static int storage_int_device_erase(const struct lfs_config* c, lfs_block_t bloc
|
|||
LFSData* lfs_data = c->context;
|
||||
size_t page = lfs_data->start_page + block;
|
||||
|
||||
FURI_LOG_D(TAG, "Device erase: page %ld, translated page: %x", block, page);
|
||||
FURI_LOG_D(TAG, "Device erase: page %lu, translated page: %zx", block, page);
|
||||
|
||||
furi_hal_flash_erase(page);
|
||||
return 0;
|
||||
|
@ -240,56 +240,38 @@ static void storage_int_lfs_mount(LFSData* lfs_data, StorageData* storage) {
|
|||
/****************** Common Functions ******************/
|
||||
|
||||
static FS_Error storage_int_parse_error(int error) {
|
||||
FS_Error result = FSE_INTERNAL;
|
||||
FS_Error result;
|
||||
|
||||
if(error >= LFS_ERR_OK) {
|
||||
result = FSE_OK;
|
||||
} else {
|
||||
switch(error) {
|
||||
case LFS_ERR_IO:
|
||||
result = FSE_INTERNAL;
|
||||
break;
|
||||
case LFS_ERR_CORRUPT:
|
||||
result = FSE_INTERNAL;
|
||||
break;
|
||||
case LFS_ERR_NOENT:
|
||||
result = FSE_NOT_EXIST;
|
||||
break;
|
||||
case LFS_ERR_EXIST:
|
||||
result = FSE_EXIST;
|
||||
break;
|
||||
case LFS_ERR_NOTDIR:
|
||||
result = FSE_INVALID_NAME;
|
||||
break;
|
||||
case LFS_ERR_ISDIR:
|
||||
result = FSE_INVALID_NAME;
|
||||
break;
|
||||
case LFS_ERR_NOTEMPTY:
|
||||
result = FSE_DENIED;
|
||||
break;
|
||||
case LFS_ERR_BADF:
|
||||
result = FSE_INVALID_NAME;
|
||||
break;
|
||||
case LFS_ERR_FBIG:
|
||||
result = FSE_INTERNAL;
|
||||
break;
|
||||
case LFS_ERR_INVAL:
|
||||
result = FSE_INVALID_PARAMETER;
|
||||
break;
|
||||
case LFS_ERR_NOSPC:
|
||||
result = FSE_INTERNAL;
|
||||
break;
|
||||
case LFS_ERR_NOMEM:
|
||||
result = FSE_INTERNAL;
|
||||
break;
|
||||
case LFS_ERR_NOATTR:
|
||||
result = FSE_INVALID_PARAMETER;
|
||||
break;
|
||||
case LFS_ERR_BADF:
|
||||
case LFS_ERR_ISDIR:
|
||||
case LFS_ERR_NOTDIR:
|
||||
case LFS_ERR_NAMETOOLONG:
|
||||
result = FSE_INVALID_NAME;
|
||||
break;
|
||||
case LFS_ERR_IO:
|
||||
case LFS_ERR_FBIG:
|
||||
case LFS_ERR_NOSPC:
|
||||
case LFS_ERR_NOMEM:
|
||||
case LFS_ERR_CORRUPT:
|
||||
default:
|
||||
break;
|
||||
result = FSE_INTERNAL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -740,7 +722,7 @@ void storage_int_init(StorageData* storage) {
|
|||
LFSData* lfs_data = storage_int_lfs_data_alloc();
|
||||
FURI_LOG_I(
|
||||
TAG,
|
||||
"Config: start %p, read %ld, write %ld, page size: %ld, page count: %ld, cycles: %ld",
|
||||
"Config: start %p, read %lu, write %lu, page size: %lu, page count: %lu, cycles: %ld",
|
||||
(void*)lfs_data->start_address,
|
||||
lfs_data->config.read_size,
|
||||
lfs_data->config.prog_size,
|
||||
|
|
|
@ -119,7 +119,7 @@ static DialogMessageButton fw_version_screen(DialogsApp* dialogs, DialogMessage*
|
|||
c2_ver = ble_glue_get_c2_info();
|
||||
#endif
|
||||
|
||||
if(!ver) {
|
||||
if(!ver) { //-V1051
|
||||
furi_string_cat_printf(buffer, "No info\n");
|
||||
} else {
|
||||
furi_string_cat_printf(
|
||||
|
|
|
@ -84,7 +84,7 @@ bool desktop_settings_scene_favorite_on_event(void* context, SceneManagerEvent e
|
|||
scene_manager_get_scene_state(app->scene_manager, DesktopSettingsAppSceneFavorite);
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
if(strcmp(FLIPPER_APPS[event.event].name, FAP_LOADER_APP_NAME)) {
|
||||
if(strcmp(FLIPPER_APPS[event.event].name, FAP_LOADER_APP_NAME) != 0) {
|
||||
if(primary_favorite) {
|
||||
app->settings.favorite_primary.is_external = false;
|
||||
strncpy(
|
||||
|
|
|
@ -32,9 +32,7 @@ bool desktop_settings_scene_pin_setup_howto_on_event(void* context, SceneManager
|
|||
consumed = true;
|
||||
break;
|
||||
default:
|
||||
furi_assert(0);
|
||||
consumed = true;
|
||||
break;
|
||||
furi_crash(NULL);
|
||||
}
|
||||
}
|
||||
return consumed;
|
||||
|
|
|
@ -52,9 +52,7 @@ bool desktop_settings_scene_pin_setup_howto2_on_event(void* context, SceneManage
|
|||
break;
|
||||
}
|
||||
default:
|
||||
furi_assert(0);
|
||||
consumed = true;
|
||||
break;
|
||||
furi_crash(NULL);
|
||||
}
|
||||
}
|
||||
return consumed;
|
||||
|
|
|
@ -49,7 +49,7 @@ static void draw_battery(Canvas* canvas, BatteryInfoModel* data, int x, int y) {
|
|||
snprintf(
|
||||
value,
|
||||
sizeof(value),
|
||||
"%ld.%ldV %ldmA",
|
||||
"%lu.%luV %lumA",
|
||||
(uint32_t)(data->vbus_voltage),
|
||||
(uint32_t)(data->vbus_voltage * 10) % 10,
|
||||
charge_current);
|
||||
|
@ -75,7 +75,7 @@ static void draw_battery(Canvas* canvas, BatteryInfoModel* data, int x, int y) {
|
|||
snprintf(
|
||||
value,
|
||||
sizeof(value),
|
||||
"%ld.%ldV",
|
||||
"%lu.%luV",
|
||||
(uint32_t)(data->charging_voltage),
|
||||
(uint32_t)(data->charging_voltage * 10) % 10);
|
||||
} else {
|
||||
|
@ -100,14 +100,14 @@ static void battery_info_draw_callback(Canvas* canvas, void* context) {
|
|||
char voltage[10];
|
||||
char health[10];
|
||||
|
||||
snprintf(batt_level, sizeof(batt_level), "%ld%%", (uint32_t)model->charge);
|
||||
snprintf(temperature, sizeof(temperature), "%ld C", (uint32_t)model->gauge_temperature);
|
||||
snprintf(batt_level, sizeof(batt_level), "%lu%%", (uint32_t)model->charge);
|
||||
snprintf(temperature, sizeof(temperature), "%lu C", (uint32_t)model->gauge_temperature);
|
||||
snprintf(
|
||||
voltage,
|
||||
sizeof(voltage),
|
||||
"%ld.%01ld V",
|
||||
"%lu.%01lu V",
|
||||
(uint32_t)model->gauge_voltage,
|
||||
(uint32_t)(model->gauge_voltage * 10) % 10);
|
||||
(uint32_t)(model->gauge_voltage * 10) % 10UL);
|
||||
snprintf(health, sizeof(health), "%d%%", model->health);
|
||||
|
||||
draw_stat(canvas, 8, 42, &I_Battery_16x16, batt_level);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue