mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-10 05:59:08 -07:00
Merge branch '420' of https://github.com/RogueMaster/flipperzero-firmware-wPlugins into dev
This commit is contained in:
@@ -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);
|
||||
int pin_mode; //-V779
|
||||
if(!args_read_int_and_trim(args, &pin_mode) || pin_mode < 0 || pin_mode > 1) {
|
||||
ret = GpioParseReturnValueError;
|
||||
break;
|
||||
}
|
||||
|
||||
if(!pin_name_to_int(pin_name, pin_num)) {
|
||||
furi_string_free(pin_name);
|
||||
return GpioParseReturnPinError;
|
||||
}
|
||||
*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);
|
||||
|
||||
@@ -364,7 +364,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]),
|
||||
@@ -379,13 +379,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,10 +244,8 @@ 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) {
|
||||
animation_manager->levelup_pending = true;
|
||||
}
|
||||
furi_check(blocking_animation);
|
||||
animation_manager->levelup_pending = true;
|
||||
}
|
||||
|
||||
if(blocking_animation) {
|
||||
@@ -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;
|
||||
}
|
||||
@@ -87,19 +87,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");
|
||||
|
||||
@@ -66,7 +66,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, FontBatteryPercent);
|
||||
|
||||
for(uint8_t i = 0; i < DesktopLockMenuIndexTotalCount; ++i) {
|
||||
for(size_t i = 0; i < DesktopLockMenuIndexTotalCount; ++i) {
|
||||
const char* str = NULL;
|
||||
|
||||
if(i == DesktopLockMenuIndexLock) {
|
||||
@@ -93,7 +93,7 @@ void desktop_lock_menu_draw_callback(Canvas* canvas, void* model) {
|
||||
}
|
||||
}
|
||||
|
||||
if(str)
|
||||
if(str) //-V547
|
||||
canvas_draw_str_aligned(
|
||||
canvas, 64, 9 + (i * 12) + STATUS_BAR_Y_SHIFT, AlignCenter, AlignCenter, str);
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ struct DesktopViewPinSetupDone {
|
||||
|
||||
static void desktop_view_pin_done_draw(Canvas* canvas, void* model) {
|
||||
furi_assert(canvas);
|
||||
furi_assert(model);
|
||||
UNUSED(model);
|
||||
|
||||
canvas_set_font(canvas, FontPrimary);
|
||||
elements_multiline_text_aligned(
|
||||
@@ -59,7 +59,6 @@ void desktop_view_pin_done_set_callback(
|
||||
DesktopViewPinSetupDone* desktop_view_pin_done_alloc() {
|
||||
DesktopViewPinSetupDone* view = malloc(sizeof(DesktopViewPinSetupDone));
|
||||
view->view = view_alloc();
|
||||
view_allocate_model(view->view, ViewModelTypeLockFree, 1);
|
||||
view_set_context(view->view, view);
|
||||
view_set_draw_callback(view->view, desktop_view_pin_done_draw);
|
||||
view_set_input_callback(view->view, desktop_view_pin_done_input);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -183,7 +183,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--;
|
||||
|
||||
@@ -147,7 +147,7 @@ DialogEx* dialog_ex_alloc() {
|
||||
DialogEx* dialog_ex = malloc(sizeof(DialogEx));
|
||||
dialog_ex->view = view_alloc();
|
||||
view_set_context(dialog_ex->view, dialog_ex);
|
||||
view_allocate_model(dialog_ex->view, ViewModelTypeLockFree, sizeof(DialogExModel));
|
||||
view_allocate_model(dialog_ex->view, ViewModelTypeLocking, sizeof(DialogExModel));
|
||||
view_set_draw_callback(dialog_ex->view, dialog_ex_view_draw_callback);
|
||||
view_set_input_callback(dialog_ex->view, dialog_ex_view_input_callback);
|
||||
with_view_model(
|
||||
|
||||
@@ -538,7 +538,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);
|
||||
@@ -693,9 +693,7 @@ 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);
|
||||
}
|
||||
file_browser_worker_folder_exit(browser->worker);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -379,7 +379,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);
|
||||
|
||||
@@ -400,7 +400,7 @@ BrowserWorker* file_browser_worker_alloc(
|
||||
furi_thread_start(browser->thread);
|
||||
|
||||
return browser;
|
||||
}
|
||||
} //-V773
|
||||
|
||||
void file_browser_worker_free(BrowserWorker* browser) {
|
||||
furi_assert(browser);
|
||||
|
||||
@@ -117,7 +117,7 @@ Popup* popup_alloc() {
|
||||
popup->timer_enabled = false;
|
||||
|
||||
view_set_context(popup->view, popup);
|
||||
view_allocate_model(popup->view, ViewModelTypeLockFree, sizeof(PopupModel));
|
||||
view_allocate_model(popup->view, ViewModelTypeLocking, sizeof(PopupModel));
|
||||
view_set_draw_callback(popup->view, popup_view_draw_callback);
|
||||
view_set_input_callback(popup->view, popup_view_input_callback);
|
||||
view_set_enter_callback(popup->view, popup_start_timer);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
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();
|
||||
|
||||
@@ -88,7 +88,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;
|
||||
}
|
||||
@@ -154,7 +154,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));
|
||||
}
|
||||
@@ -166,7 +166,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;
|
||||
@@ -212,7 +212,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;
|
||||
@@ -310,9 +310,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) {
|
||||
@@ -336,7 +336,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 {
|
||||
@@ -347,9 +347,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: ");
|
||||
|
||||
@@ -436,7 +436,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;
|
||||
@@ -511,7 +511,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;
|
||||
@@ -574,4 +574,4 @@ static void lfrfid_cli(Cli* cli, FuriString* args, void* context) {
|
||||
}
|
||||
|
||||
furi_string_free(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,7 +291,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,
|
||||
|
||||
Reference in New Issue
Block a user