Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/release-candidate' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
skotopes committed Aug 15, 2024
2 parents ee1b8b9 + 726bc4c commit 8ea6a3d
Show file tree
Hide file tree
Showing 1,544 changed files with 6,447 additions and 4,631 deletions.
3 changes: 0 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,3 @@ charset = utf-8
[*.{cpp,h,c,py,sh}]
indent_style = space
indent_size = 4

[{Makefile,*.mk}]
indent_size = tab
16 changes: 16 additions & 0 deletions .github/workflows/lint_and_submodule_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,22 @@ jobs:
echo "C Lint: all good ✨" >> $GITHUB_STEP_SUMMARY;
fi
- name: 'Check image assets'
if: always()
run: |
set +e;
./fbt -s lint_img 2>&1 | tee lint-assets.log;
if [ "${PIPESTATUS[0]}" -ne 0 ]; then
# Save multiline output
echo "errors=1" >> $GITHUB_OUTPUT;
printf "Image Lint errors:\n\`\`\`\n" >> $GITHUB_STEP_SUMMARY;
echo "$(cat lint-assets.log)" >> $GITHUB_STEP_SUMMARY;
printf "\n\`\`\`\n" >> $GITHUB_STEP_SUMMARY;
exit 1;
else
echo "Image Lint: all good ✨" >> $GITHUB_STEP_SUMMARY;
fi
- name: Report code formatting errors
if: ( steps.syntax_check_py.outputs.errors || steps.syntax_check_cpp.outputs.errors ) && github.event.pull_request
run: |
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
[submodule "lib/mlib"]
path = lib/mlib
url = https://github.com/P-p-H-d/mlib.git
[submodule "lib/littlefs"]
path = lib/littlefs
url = https://github.com/littlefs-project/littlefs.git
[submodule "lib/nanopb"]
path = lib/nanopb
url = https://github.com/nanopb/nanopb.git
Expand Down
2 changes: 1 addition & 1 deletion .pvsoptions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
--ignore-ccache -C gccarm --rules-config .pvsconfig -e lib/cmsis_core -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/microtar -e lib/mlib -e lib/stm32wb_cmsis -e lib/stm32wb_copro -e lib/stm32wb_hal -e lib/u8g2 -e lib/nanopb -e lib/mjs -e */arm-none-eabi/*
--ignore-ccache -C gccarm --rules-config .pvsconfig -e lib/cmsis_core -e lib/fatfs -e lib/fnv1a-hash -e lib/FreeRTOS-Kernel -e lib/heatshrink -e lib/libusb_stm32 -e lib/mbedtls -e lib/microtar -e lib/mlib -e lib/stm32wb_cmsis -e lib/stm32wb_copro -e lib/stm32wb_hal -e lib/u8g2 -e lib/nanopb -e lib/mjs -e */arm-none-eabi/*
4 changes: 1 addition & 3 deletions .sublime-project
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@
"clangd": {
"enabled": true,
"initializationOptions": {
// Use with toolchain version 39+
// Set `"binary": "custom",` option in LSP-clangd config to use toolchain clangd
// "custom_command": ["toolchain/current/bin/clangd"],

"custom_command": ["toolchain/current/bin/clangd"],
"clangd.compile-commands-dir": "build/latest",
"clangd.header-insertion": "never",
"clangd.query-driver": "**/arm-none-eabi-*",
Expand Down
2 changes: 1 addition & 1 deletion .vscode/example/settings.json.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"SConstruct": "python",
"*.fam": "python"
},
// "clangd.path": "${workspaceFolder}/toolchain/current/bin/clangd@FBT_PLATFORM_EXECUTABLE_EXT@",
"clangd.path": "${workspaceFolder}/toolchain/current/bin/clangd@FBT_PLATFORM_EXECUTABLE_EXT@",
"clangd.arguments": [
"--query-driver=**/arm-none-eabi-*",
"--compile-commands-dir=${workspaceFolder}/build/latest",
Expand Down
46 changes: 23 additions & 23 deletions .vscode/example/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,29 +63,23 @@
"type": "shell",
"command": "./fbt updater_all"
},
{
"label": "[Debug] Flash (USB, w/o resources)",
"group": "build",
"type": "shell",
"command": "./fbt FORCE=1 flash_usb"
},
{
"label": "[Release] Flash (USB, w/o resources)",
"group": "build",
"type": "shell",
"command": "./fbt COMPACT=1 DEBUG=0 FORCE=1 flash_usb"
},
{
"label": "[Debug:unit_tests] Flash (USB)",
"label": "[Debug] Flash (USB, w/o resources)",
"group": "build",
"type": "shell",
"command": "./fbt FIRMWARE_APP_SET=unit_tests FORCE=1 flash_usb_full"
"command": "./fbt FORCE=1 flash_usb"
},
{
"label": "[Debug] Flash (USB, with resources)",
"label": "[Debug:unit_tests] Flash (USB)",
"group": "build",
"type": "shell",
"command": "./fbt FORCE=1 flash_usb_full"
"command": "./fbt FIRMWARE_APP_SET=unit_tests FORCE=1 flash_usb_full"
},
{
"label": "[Release] Flash (USB, with resources)",
Expand All @@ -94,16 +88,16 @@
"command": "./fbt COMPACT=1 DEBUG=0 FORCE=1 flash_usb_full"
},
{
"label": "[Debug] Create PVS-Studio report",
"label": "[Debug] Flash (USB, with resources)",
"group": "build",
"type": "shell",
"command": "./fbt firmware_pvs"
"command": "./fbt FORCE=1 flash_usb_full"
},
{
"label": "[Debug] Build FAPs",
"label": "[Debug] Create PVS-Studio report",
"group": "build",
"type": "shell",
"command": "./fbt fap_dist"
"command": "./fbt firmware_pvs"
},
{
"label": "[Release] Build FAPs",
Expand All @@ -112,10 +106,10 @@
"command": "./fbt COMPACT=1 DEBUG=0 fap_dist"
},
{
"label": "[Debug] Build App",
"label": "[Debug] Build FAPs",
"group": "build",
"type": "shell",
"command": "./fbt build APPSRC=${relativeFileDirname}"
"command": "./fbt fap_dist"
},
{
"label": "[Release] Build App",
Expand All @@ -124,17 +118,23 @@
"command": "./fbt COMPACT=1 DEBUG=0 build APPSRC=${relativeFileDirname}"
},
{
"label": "[Debug] Launch App on Flipper",
"label": "[Debug] Build App",
"group": "build",
"type": "shell",
"command": "./fbt launch APPSRC=${relativeFileDirname}"
"command": "./fbt build APPSRC=${relativeFileDirname}"
},
{
"label": "[Release] Launch App on Flipper",
"group": "build",
"type": "shell",
"command": "./fbt COMPACT=1 DEBUG=0 launch APPSRC=${relativeFileDirname}"
},
{
"label": "[Debug] Launch App on Flipper",
"group": "build",
"type": "shell",
"command": "./fbt launch APPSRC=${relativeFileDirname}"
},
{
"label": "[Debug] Launch App on Flipper with Serial Console",
"dependsOrder": "sequence",
Expand All @@ -145,16 +145,16 @@
]
},
{
"label": "[Debug] Build and upload all FAPs to Flipper over USB",
"label": "[Release] Build and upload all FAPs to Flipper over USB",
"group": "build",
"type": "shell",
"command": "./fbt fap_deploy"
"command": "./fbt COMPACT=1 DEBUG=0 fap_deploy"
},
{
"label": "[Release] Build and upload all FAPs to Flipper over USB",
"label": "[Debug] Build and upload all FAPs to Flipper over USB",
"group": "build",
"type": "shell",
"command": "./fbt COMPACT=1 DEBUG=0 fap_deploy"
"command": "./fbt fap_deploy"
},
{
// Press Ctrl+] to quit
Expand All @@ -180,4 +180,4 @@
}
}
]
}
}
40 changes: 39 additions & 1 deletion SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,12 @@ firmware_env.Append(
"SConstruct",
"firmware.scons",
"fbt_options.py",
]
],
IMG_LINT_SOURCES=[
# Image assets
"applications",
"assets",
],
)


Expand Down Expand Up @@ -359,6 +364,39 @@ distenv.PhonyTarget(
PY_LINT_SOURCES=firmware_env["PY_LINT_SOURCES"],
)

# Image assets linting
distenv.PhonyTarget(
"lint_img",
[
[
"${PYTHON3}",
"${FBT_SCRIPT_DIR}/imglint.py",
"check",
"${IMG_LINT_SOURCES}",
"${ARGS}",
]
],
IMG_LINT_SOURCES=firmware_env["IMG_LINT_SOURCES"],
)

distenv.PhonyTarget(
"format_img",
[
[
"${PYTHON3}",
"${FBT_SCRIPT_DIR}/imglint.py",
"format",
"${IMG_LINT_SOURCES}",
"${ARGS}",
]
],
IMG_LINT_SOURCES=firmware_env["IMG_LINT_SOURCES"],
)

distenv.Alias("lint_all", ["lint", "lint_py", "lint_img"])
distenv.Alias("format_all", ["format", "format_py", "format_img"])


# Start Flipper CLI via PySerial's miniterm
distenv.PhonyTarget(
"cli",
Expand Down
54 changes: 26 additions & 28 deletions applications/debug/accessor/accessor_view_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,45 +5,49 @@
AccessorAppViewManager::AccessorAppViewManager() {
event_queue = furi_message_queue_alloc(10, sizeof(AccessorEvent));

view_dispatcher = view_dispatcher_alloc();
auto callback = cbc::obtain_connector(this, &AccessorAppViewManager::previous_view_callback);
view_holder = view_holder_alloc();
auto callback =
cbc::obtain_connector(this, &AccessorAppViewManager::view_holder_back_callback);

// allocate views
submenu = submenu_alloc();
add_view(ViewType::Submenu, submenu_get_view(submenu));

popup = popup_alloc();
add_view(ViewType::Popup, popup_get_view(popup));

gui = static_cast<Gui*>(furi_record_open(RECORD_GUI));
view_dispatcher_attach_to_gui(view_dispatcher, gui, ViewDispatcherTypeFullscreen);
// set back callback
view_holder_set_back_callback(view_holder, callback, NULL);

// set previous view callback for all views
view_set_previous_callback(submenu_get_view(submenu), callback);
view_set_previous_callback(popup_get_view(popup), callback);
gui = static_cast<Gui*>(furi_record_open(RECORD_GUI));
view_holder_attach_to_gui(view_holder, gui);
}

AccessorAppViewManager::~AccessorAppViewManager() {
// remove views
view_dispatcher_remove_view(
view_dispatcher, static_cast<uint32_t>(AccessorAppViewManager::ViewType::Submenu));
view_dispatcher_remove_view(
view_dispatcher, static_cast<uint32_t>(AccessorAppViewManager::ViewType::Popup));

// remove current view
view_holder_set_view(view_holder, NULL);
// free view modules
furi_record_close(RECORD_GUI);
submenu_free(submenu);
popup_free(popup);

// free dispatcher
view_dispatcher_free(view_dispatcher);

// free view holder
view_holder_free(view_holder);
// free event queue
furi_message_queue_free(event_queue);
}

void AccessorAppViewManager::switch_to(ViewType type) {
view_dispatcher_switch_to_view(view_dispatcher, static_cast<uint32_t>(type));
View* view;

switch(type) {
case ViewType::Submenu:
view = submenu_get_view(submenu);
break;
case ViewType::Popup:
view = popup_get_view(popup);
break;
default:
furi_crash();
}

view_holder_set_view(view_holder, view);
}

Submenu* AccessorAppViewManager::get_submenu() {
Expand All @@ -65,16 +69,10 @@ void AccessorAppViewManager::send_event(AccessorEvent* event) {
furi_check(result == FuriStatusOk);
}

uint32_t AccessorAppViewManager::previous_view_callback(void*) {
void AccessorAppViewManager::view_holder_back_callback(void*) {
if(event_queue != NULL) {
AccessorEvent event;
event.type = AccessorEvent::Type::Back;
send_event(&event);
}

return VIEW_IGNORE;
}

void AccessorAppViewManager::add_view(ViewType view_type, View* view) {
view_dispatcher_add_view(view_dispatcher, static_cast<uint32_t>(view_type), view);
}
8 changes: 3 additions & 5 deletions applications/debug/accessor/accessor_view_manager.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#include <furi.h>
#include <gui/view_dispatcher.h>
#include <gui/view_holder.h>
#include <gui/modules/submenu.h>
#include <gui/modules/popup.h>
#include "accessor_event.h"
Expand All @@ -10,7 +10,6 @@ class AccessorAppViewManager {
enum class ViewType : uint8_t {
Submenu,
Popup,
Tune,
};

FuriMessageQueue* event_queue;
Expand All @@ -27,11 +26,10 @@ class AccessorAppViewManager {
Popup* get_popup(void);

private:
ViewDispatcher* view_dispatcher;
Gui* gui;
ViewHolder* view_holder;

uint32_t previous_view_callback(void* context);
void add_view(ViewType view_type, View* view);
void view_holder_back_callback(void* context);

// view elements
Submenu* submenu;
Expand Down
1 change: 0 additions & 1 deletion applications/debug/battery_test_app/battery_test_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ BatteryTestApp* battery_test_alloc(void) {

// View dispatcher
app->view_dispatcher = view_dispatcher_alloc();
view_dispatcher_enable_queue(app->view_dispatcher);
view_dispatcher_set_event_callback_context(app->view_dispatcher, app);
view_dispatcher_set_tick_event_callback(
app->view_dispatcher, battery_test_battery_info_update_model, 500);
Expand Down
1 change: 0 additions & 1 deletion applications/debug/bt_debug_app/bt_debug_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ BtDebugApp* bt_debug_app_alloc(void) {

// View dispatcher
app->view_dispatcher = view_dispatcher_alloc();
view_dispatcher_enable_queue(app->view_dispatcher);
view_dispatcher_attach_to_gui(app->view_dispatcher, app->gui, ViewDispatcherTypeFullscreen);

// Views
Expand Down
Loading

0 comments on commit 8ea6a3d

Please sign in to comment.