Skip to content

Commit

Permalink
Merge branch 'release-candidate' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
skotopes committed May 12, 2022
2 parents d3c0618 + f82484d commit cb6cf95
Show file tree
Hide file tree
Showing 566 changed files with 7,503 additions and 3,591 deletions.
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@ SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp03
TabWidth: 4
UseTab: Never
UseTab: Never
2 changes: 1 addition & 1 deletion .github/workflows/build_toolchain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
cache-from: type=registry,ref=flipperdevices/flipperzero-toolchain:buildcache
cache-to: type=registry,ref=flipperdevices/flipperzero-toolchain:buildcache,mode=max
cache-to: type=registry,ref=flipperdevices/flipperzero-toolchain:buildcache,mode=max
2 changes: 1 addition & 1 deletion .github/workflows/check_submodules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ jobs:
with:
path: assets/protobuf
branch: dev
fetch_depth: 50
fetch_depth: 50
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,7 @@ format:
guruguru:
@echo "ぐるぐる回る"
@$(PROJECT_ROOT)/scripts/guruguru.py $(PROJECT_ROOT)

.PHONY: generate_compile_db
generate_compile_db:
@$(MAKE) -C $(PROJECT_ROOT)/firmware -j$(NPROCS) generate_compile_db
1 change: 1 addition & 0 deletions applications/about/about.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ const AboutDialogScreen about_screens[] = {
const size_t about_screens_count = sizeof(about_screens) / sizeof(AboutDialogScreen);

int32_t about_settings_app(void* p) {
UNUSED(p);
DialogsApp* dialogs = furi_record_open("dialogs");
DialogMessage* message = dialog_message_alloc();

Expand Down
3 changes: 2 additions & 1 deletion applications/accessor/accessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

// app enter function
extern "C" int32_t accessor_app(void* p) {
UNUSED(p);
AccessorApp* app = new AccessorApp();
app->run();
delete app;

return 255;
}
}
2 changes: 1 addition & 1 deletion applications/accessor/accessor_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ class AccessorApp {
OneWireHost* onewire_host;

NotificationApp* notification;
};
};
4 changes: 2 additions & 2 deletions applications/accessor/accessor_view_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void AccessorAppViewManager::send_event(AccessorEvent* event) {
furi_check(result == osOK);
}

uint32_t AccessorAppViewManager::previous_view_callback(void* context) {
uint32_t AccessorAppViewManager::previous_view_callback(void*) {
if(event_queue != NULL) {
AccessorEvent event;
event.type = AccessorEvent::Type::Back;
Expand All @@ -76,4 +76,4 @@ uint32_t AccessorAppViewManager::previous_view_callback(void* context) {

void AccessorAppViewManager::add_view(ViewType view_type, View* view) {
view_dispatcher_add_view(view_dispatcher, static_cast<uint32_t>(view_type), view);
}
}
2 changes: 1 addition & 1 deletion applications/accessor/accessor_view_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ class AccessorAppViewManager {
// view elements
Submenu* submenu;
Popup* popup;
};
};
2 changes: 1 addition & 1 deletion applications/accessor/helpers/wiegand.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ class WIEGAND {
static int _wiegandType;
static unsigned long _code;
static unsigned long _codeHigh;
};
};
2 changes: 1 addition & 1 deletion applications/accessor/scene/accessor_scene_generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ class AccessorScene {
virtual void on_exit(AccessorApp* app) = 0;

private:
};
};
2 changes: 1 addition & 1 deletion applications/accessor/scene/accessor_scene_start.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ class AccessorSceneStart : public AccessorScene {
void on_enter(AccessorApp* app) final;
bool on_event(AccessorApp* app, AccessorEvent* event) final;
void on_exit(AccessorApp* app) final;
};
};
7 changes: 6 additions & 1 deletion applications/applications.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ extern void crypto_on_system_start();
extern void ibutton_on_system_start();
extern void infrared_on_system_start();
extern void lfrfid_on_system_start();
extern void music_player_on_system_start();
extern void nfc_on_system_start();
extern void storage_on_system_start();
extern void subghz_on_system_start();
Expand Down Expand Up @@ -280,6 +281,10 @@ const FlipperOnStartHook FLIPPER_ON_SYSTEM_START[] = {
infrared_on_system_start,
#endif

#ifdef APP_MUSIC_PLAYER
music_player_on_system_start,
#endif

#ifdef APP_NFC
nfc_on_system_start,
#endif
Expand Down Expand Up @@ -332,7 +337,7 @@ const FlipperApplication FLIPPER_PLUGINS[] = {
#ifdef APP_MUSIC_PLAYER
{.app = music_player_app,
.name = "Music Player",
.stack_size = 1024,
.stack_size = 2048,
.icon = &A_Plugins_14,
.flags = FlipperApplicationFlagDefault},
#endif
Expand Down
1 change: 1 addition & 0 deletions applications/archive/archive.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ void archive_free(ArchiveApp* archive) {
}

int32_t archive_app(void* p) {
UNUSED(p);
ArchiveApp* archive = archive_alloc();
scene_manager_next_scene(archive->scene_manager, ArchiveAppSceneBrowser);
view_dispatcher_run(archive->view_dispatcher);
Expand Down
5 changes: 3 additions & 2 deletions applications/archive/helpers/archive_apps.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ static const char* known_apps[] = {
};

ArchiveAppTypeEnum archive_get_app_type(const char* path) {
for(size_t i = 0; i < SIZEOF_ARRAY(known_apps); i++) {
if(strncmp(path, known_apps[i], strlen(known_apps[i])) != STRING_FAILURE) {
for(size_t i = 0; i < COUNT_OF(known_apps); i++) {
if(strncmp(path, known_apps[i], strlen(known_apps[i])) == 0) {
return i;
}
}
return ArchiveAppTypeUnknown;
}

bool archive_app_is_available(void* context, const char* path) {
UNUSED(context);
furi_assert(path);

ArchiveAppTypeEnum app = archive_get_app_type(path);
Expand Down
2 changes: 1 addition & 1 deletion applications/archive/helpers/archive_apps.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ static const ArchiveFileTypeEnum app_file_types[] = {
[ArchiveAppTypeUnknown] = ArchiveFileTypeUnknown,
};

static inline const ArchiveFileTypeEnum archive_get_app_filetype(ArchiveAppTypeEnum app) {
static inline ArchiveFileTypeEnum archive_get_app_filetype(ArchiveAppTypeEnum app) {
return app_file_types[app];
}

Expand Down
28 changes: 16 additions & 12 deletions applications/archive/helpers/archive_browser.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
bool archive_is_item_in_array(ArchiveBrowserViewModel* model, uint32_t idx) {
size_t array_size = files_array_size(model->files);

if((idx >= model->array_offset + array_size) || (idx < model->array_offset)) {
if((idx >= (uint32_t)model->array_offset + array_size) ||
(idx < (uint32_t)model->array_offset)) {
return false;
}

Expand All @@ -20,12 +21,14 @@ void archive_update_offset(ArchiveBrowserView* browser) {
browser->view, (ArchiveBrowserViewModel * model) {
uint16_t bounds = model->item_cnt > 3 ? 2 : model->item_cnt;

if(model->item_cnt > 3 && model->item_idx >= model->item_cnt - 1) {
if((model->item_cnt > 3u) && (model->item_idx >= ((int32_t)model->item_cnt - 1))) {
model->list_offset = model->item_idx - 3;
} else if(model->list_offset < model->item_idx - bounds) {
model->list_offset = CLAMP(model->item_idx - 2, model->item_cnt - bounds, 0);
model->list_offset =
CLAMP(model->item_idx - 2, (int32_t)model->item_cnt - bounds, 0);
} else if(model->list_offset > model->item_idx - bounds) {
model->list_offset = CLAMP(model->item_idx - 1, model->item_cnt - bounds, 0);
model->list_offset =
CLAMP(model->item_idx - 1, (int32_t)model->item_cnt - bounds, 0);
}

return true;
Expand Down Expand Up @@ -77,9 +80,10 @@ void archive_set_item_count(ArchiveBrowserView* browser, uint32_t count) {
with_view_model(
browser->view, (ArchiveBrowserViewModel * model) {
model->item_cnt = count;
model->item_idx = CLAMP(model->item_idx, model->item_cnt - 1, 0);
model->item_idx = CLAMP(model->item_idx, (int32_t)model->item_cnt - 1, 0);
return false;
});
archive_update_offset(browser);
}

void archive_file_array_rm_selected(ArchiveBrowserView* browser) {
Expand All @@ -93,7 +97,7 @@ void archive_file_array_rm_selected(ArchiveBrowserView* browser) {
model->item_idx - model->array_offset,
model->item_idx - model->array_offset + 1);
model->item_cnt--;
model->item_idx = CLAMP(model->item_idx, model->item_cnt - 1, 0);
model->item_idx = CLAMP(model->item_idx, (int32_t)model->item_cnt - 1, 0);
items_cnt = model->item_cnt;
return false;
});
Expand All @@ -112,14 +116,14 @@ void archive_file_array_swap(ArchiveBrowserView* browser, int8_t dir) {
browser->view, (ArchiveBrowserViewModel * model) {
ArchiveFile_t temp;
size_t array_size = files_array_size(model->files) - 1;
uint8_t swap_idx = CLAMP(model->item_idx + dir, array_size, 0);
uint8_t swap_idx = CLAMP((size_t)(model->item_idx + dir), array_size, 0u);

if(model->item_idx == 0 && dir < 0) {
ArchiveFile_t_init(&temp);
files_array_pop_at(&temp, model->files, array_size);
files_array_push_at(model->files, model->item_idx, temp);
ArchiveFile_t_clear(&temp);
} else if(model->item_idx == array_size && dir > 0) {
} else if(((uint32_t)model->item_idx == array_size) && (dir > 0)) {
ArchiveFile_t_init(&temp);
files_array_pop_at(&temp, model->files, 0);
files_array_push_at(model->files, array_size, temp);
Expand Down Expand Up @@ -156,7 +160,7 @@ bool archive_file_array_load(ArchiveBrowserView* browser, int8_t dir) {
} else {
offset_new = model->item_idx - FILE_LIST_BUF_LEN / 4 * 1;
}
offset_new = CLAMP(offset_new, model->item_cnt - FILE_LIST_BUF_LEN, 0);
offset_new = CLAMP(offset_new, (int32_t)model->item_cnt - FILE_LIST_BUF_LEN, 0);
}
return false;
});
Expand Down Expand Up @@ -195,7 +199,7 @@ ArchiveFile_t* archive_get_file_at(ArchiveBrowserView* browser, size_t idx) {

with_view_model(
browser->view, (ArchiveBrowserViewModel * model) {
idx = CLAMP(idx - model->array_offset, files_array_size(model->files), 0);
idx = CLAMP(idx - model->array_offset, files_array_size(model->files), 0u);
selected = files_array_size(model->files) ? files_array_get(model->files, idx) : NULL;
return false;
});
Expand Down Expand Up @@ -246,6 +250,7 @@ void archive_set_tab(ArchiveBrowserView* browser, ArchiveTabEnum tab) {
});
}
void archive_set_last_tab(ArchiveBrowserView* browser, ArchiveTabEnum tab) {
UNUSED(tab); // FIXME?
furi_assert(browser);

with_view_model(
Expand Down Expand Up @@ -396,8 +401,6 @@ void archive_enter_dir(ArchiveBrowserView* browser, string_t name) {
return;
}

archive_dir_count_items(browser, string_get_cstr(name));

if(string_cmp(browser->path, name) != 0) {
with_view_model(
browser->view, (ArchiveBrowserViewModel * model) {
Expand All @@ -410,6 +413,7 @@ void archive_enter_dir(ArchiveBrowserView* browser, string_t name) {
string_set(browser->path, name);
}

archive_dir_count_items(browser, string_get_cstr(name));
archive_switch_dir(browser, string_get_cstr(browser->path));
}

Expand Down
2 changes: 1 addition & 1 deletion applications/archive/helpers/archive_browser.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ static const ArchiveFileTypeEnum known_type[] = {
[ArchiveTabBrowser] = ArchiveFileTypeUnknown,
};

static inline const ArchiveFileTypeEnum archive_get_tab_filetype(ArchiveTabEnum tab) {
static inline ArchiveFileTypeEnum archive_get_tab_filetype(ArchiveTabEnum tab) {
return known_type[tab];
}

Expand Down
2 changes: 1 addition & 1 deletion applications/archive/helpers/archive_files.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void archive_set_file_type(ArchiveFile_t* file, FileInfo* file_info, const char*
} else {
furi_assert(file_info);

for(size_t i = 0; i < SIZEOF_ARRAY(known_ext); i++) {
for(size_t i = 0; i < COUNT_OF(known_ext); i++) {
if((known_ext[i][0] == '?') || (known_ext[i][0] == '*')) continue;
if(string_search_str(file->name, known_ext[i], 0) != STRING_FAILURE) {
if(i == ArchiveFileTypeBadUsb) {
Expand Down
2 changes: 2 additions & 0 deletions applications/archive/scenes/archive_scene_browser.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ static void archive_loader_callback(const void* message, void* context) {
}

static void archive_run_in_app(ArchiveBrowserView* browser, ArchiveFile_t* selected) {
UNUSED(browser);
Loader* loader = furi_record_open("loader");

LoaderStatus status;
Expand Down Expand Up @@ -95,6 +96,7 @@ bool archive_scene_browser_on_event(void* context, SceneManagerEvent event) {
if(known_app) {
archive_run_in_app(browser, selected);
}
archive_show_file_menu(browser, false);
consumed = true;
break;
case ArchiveBrowserEventFileMenuPin:
Expand Down
36 changes: 18 additions & 18 deletions applications/archive/views/archive_browser_view.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,17 @@ static void draw_list(Canvas* canvas, ArchiveBrowserViewModel* model) {
size_t array_size = files_array_size(model->files);
bool scrollbar = model->item_cnt > 4;

for(size_t i = 0; i < MIN(model->item_cnt, MENU_ITEMS); ++i) {
for(uint32_t i = 0; i < MIN(model->item_cnt, MENU_ITEMS); ++i) {
string_t str_buff;
char cstr_buff[MAX_NAME_LEN];
size_t idx = CLAMP(i + model->list_offset, model->item_cnt, 0);
int32_t idx = CLAMP((uint32_t)(i + model->list_offset), model->item_cnt, 0u);
uint8_t x_offset = (model->move_fav && model->item_idx == idx) ? MOVE_OFFSET : 0;

ArchiveFileTypeEnum file_type = ArchiveFileTypeLoading;

if(archive_is_item_in_array(model, idx)) {
ArchiveFile_t* file =
files_array_get(model->files, CLAMP(idx - model->array_offset, array_size - 1, 0));
ArchiveFile_t* file = files_array_get(
model->files, CLAMP(idx - model->array_offset, (int32_t)(array_size - 1), 0));
strlcpy(cstr_buff, string_get_cstr(file->name), string_size(file->name) + 1);
archive_trim_file_path(cstr_buff, archive_is_known_app(file->type));
string_init_set_str(str_buff, cstr_buff);
Expand Down Expand Up @@ -161,21 +161,21 @@ static void archive_render_status_bar(Canvas* canvas, ArchiveBrowserViewModel* m
canvas_draw_box(canvas, 107, 0, 20, 13);

canvas_set_color(canvas, ColorBlack);
canvas_draw_frame(canvas, 1, 0, 50, 12);
canvas_draw_line(canvas, 0, 1, 0, 11);
canvas_draw_line(canvas, 1, 12, 49, 12);
canvas_draw_str_aligned(canvas, 26, 9, AlignCenter, AlignBottom, tab_name);
canvas_draw_rframe(canvas, 0, 0, 51, 13, 1); // frame
canvas_draw_line(canvas, 49, 1, 49, 11); // shadow right
canvas_draw_line(canvas, 1, 11, 49, 11); // shadow bottom
canvas_draw_str_aligned(canvas, 25, 9, AlignCenter, AlignBottom, tab_name);

canvas_draw_frame(canvas, 108, 0, 20, 12);
canvas_draw_line(canvas, 107, 1, 107, 11);
canvas_draw_line(canvas, 108, 12, 126, 12);
canvas_draw_rframe(canvas, 107, 0, 21, 13, 1);
canvas_draw_line(canvas, 126, 1, 126, 11);
canvas_draw_line(canvas, 108, 11, 126, 11);

if(model->move_fav) {
canvas_draw_icon(canvas, 111, 4, &I_ButtonUp_7x4);
canvas_draw_icon(canvas, 118, 4, &I_ButtonDown_7x4);
canvas_draw_icon(canvas, 110, 4, &I_ButtonUp_7x4);
canvas_draw_icon(canvas, 117, 4, &I_ButtonDown_7x4);
} else {
canvas_draw_icon(canvas, 112, 2, &I_ButtonLeft_4x7);
canvas_draw_icon(canvas, 120, 2, &I_ButtonRight_4x7);
canvas_draw_icon(canvas, 111, 2, &I_ButtonLeft_4x7);
canvas_draw_icon(canvas, 119, 2, &I_ButtonRight_4x7);
}

canvas_set_color(canvas, ColorWhite);
Expand Down Expand Up @@ -216,7 +216,7 @@ static bool is_file_list_load_required(ArchiveBrowserViewModel* model) {
}

if(((model->array_offset + array_size) < model->item_cnt) &&
(model->item_idx > (model->array_offset + array_size - FILE_LIST_BUF_LEN / 4))) {
(model->item_idx > (int32_t)(model->array_offset + array_size - FILE_LIST_BUF_LEN / 4))) {
return true;
}

Expand Down Expand Up @@ -347,7 +347,7 @@ ArchiveBrowserView* browser_alloc() {
browser->view = view_alloc();
view_allocate_model(browser->view, ViewModelTypeLocking, sizeof(ArchiveBrowserViewModel));
view_set_context(browser->view, browser);
view_set_draw_callback(browser->view, (ViewDrawCallback)archive_view_render);
view_set_draw_callback(browser->view, archive_view_render);
view_set_input_callback(browser->view, archive_view_input);

string_init(browser->path);
Expand Down Expand Up @@ -376,4 +376,4 @@ void browser_free(ArchiveBrowserView* browser) {

view_free(browser->view);
free(browser);
}
}
4 changes: 2 additions & 2 deletions applications/archive/views/archive_browser_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
#define MAX_NAME_LEN 255
#define MAX_EXT_LEN 6
#define FRAME_HEIGHT 12
#define MENU_ITEMS 4
#define MOVE_OFFSET 5
#define MENU_ITEMS 4u
#define MOVE_OFFSET 5u

typedef enum {
ArchiveTabFavorites,
Expand Down
Loading

0 comments on commit cb6cf95

Please sign in to comment.