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 Apr 25, 2022
2 parents d294b5e + 1ad81aa commit d21e5bd
Show file tree
Hide file tree
Showing 168 changed files with 2,706 additions and 2,192 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ jobs:
with:
run: |
set -e
make -C assets clean
make -C assets
make assets_rebuild assets_manifest
git diff --quiet || ( echo "Assets recompilation required."; exit 255 )
- name: 'Build the firmware in docker'
uses: ./.github/actions/docker
Expand Down Expand Up @@ -117,7 +117,6 @@ jobs:
- name: 'Bundle resources'
if: ${{ !github.event.pull_request.head.repo.fork }}
run: |
./scripts/assets.py manifest assets/resources
tar czpf artifacts/flipper-z-any-resources-${{steps.names.outputs.suffix}}.tgz -C assets resources
- name: 'Bundle core2 firmware'
Expand Down
25 changes: 20 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ flash: firmware_flash
debug:
@$(MAKE) -C firmware -j$(NPROCS) debug

.PHONY: debug_other
debug_other:
@$(MAKE) -C firmware -j$(NPROCS) debug_other

.PHONY: blackmagic
blackmagic:
@$(MAKE) -C firmware -j$(NPROCS) blackmagic
Expand All @@ -75,7 +79,6 @@ ifeq ($(FORCE), 1)
endif
@$(MAKE) -C $(PROJECT_ROOT)/firmware -j$(NPROCS) flash


.PHONY: updater
updater:
@$(MAKE) -C $(PROJECT_ROOT)/firmware -j$(NPROCS) RAM_EXEC=1 all
Expand All @@ -88,10 +91,22 @@ updater_clean:
updater_debug:
@$(MAKE) -C $(PROJECT_ROOT)/firmware -j$(NPROCS) RAM_EXEC=1 debug

.PHONY: updater_package
updater_package: firmware_all updater
.PHONY: updater_package_bin
updater_package_bin: firmware_all updater
@$(PROJECT_ROOT)/scripts/dist.py copy -t $(TARGET) -p firmware updater -s $(DIST_SUFFIX) --bundlever "$(VERSION_STRING)"

.PHONY: updater_package
updater_package: firmware_all updater assets_manifest
@$(PROJECT_ROOT)/scripts/dist.py copy -t $(TARGET) -p firmware updater -s $(DIST_SUFFIX) -r $(PROJECT_ROOT)/assets/resources --bundlever "$(VERSION_STRING)"

.PHONY: assets_manifest
assets_manifest:
@$(MAKE) -C $(PROJECT_ROOT)/assets manifest

.PHONY: assets_rebuild
assets_rebuild:
@$(MAKE) -C $(PROJECT_ROOT)/assets clean all

.PHONY: flash_radio
flash_radio:
@$(PROJECT_ROOT)/scripts/flash.py core2radio 0x080D7000 $(COPRO_DIR)/stm32wb5x_BLE_Stack_light_fw.bin
Expand All @@ -110,8 +125,8 @@ flash_radio_fus:

.PHONY: flash_radio_fus_please_i_m_not_going_to_complain
flash_radio_fus_please_i_m_not_going_to_complain:
@$(PROJECT_ROOT)/scripts/flash.py core2fus 0x080EC000 --statement=AGREE_TO_LOOSE_FLIPPER_FEATURES_THAT_USES_CRYPTO_ENCLAVE $(COPRO_DIR)/stm32wb5x_FUS_fw_for_fus_0_5_3.bin
@$(PROJECT_ROOT)/scripts/flash.py core2fus 0x080EC000 --statement=AGREE_TO_LOOSE_FLIPPER_FEATURES_THAT_USES_CRYPTO_ENCLAVE $(COPRO_DIR)/stm32wb5x_FUS_fw.bin
@$(PROJECT_ROOT)/scripts/flash.py core2fus 0x080EC000 --statement=AGREE_TO_LOSE_FLIPPER_FEATURES_THAT_USE_CRYPTO_ENCLAVE $(COPRO_DIR)/stm32wb5x_FUS_fw_for_fus_0_5_3.bin
@$(PROJECT_ROOT)/scripts/flash.py core2fus 0x080EC000 --statement=AGREE_TO_LOSE_FLIPPER_FEATURES_THAT_USE_CRYPTO_ENCLAVE $(COPRO_DIR)/stm32wb5x_FUS_fw.bin
@$(PROJECT_ROOT)/scripts/ob.py set

.PHONY: lint
Expand Down
5 changes: 5 additions & 0 deletions applications/applications.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ extern int32_t usb_test_app(void* p);
extern int32_t vibro_test_app(void* p);
extern int32_t bt_hid_app(void* p);
extern int32_t battery_test_app(void* p);
extern int32_t text_box_test_app(void* p);

// Plugins
extern int32_t music_player_app(void* p);
Expand Down Expand Up @@ -304,6 +305,10 @@ const FlipperApplication FLIPPER_DEBUG_APPS[] = {
#ifdef APP_BATTERY_TEST
{.app = battery_test_app, .name = "Battery Test", .stack_size = 1024, .icon = NULL},
#endif

#ifdef APP_TEXT_BOX_TEST
{.app = text_box_test_app, .name = "Text Box Test", .stack_size = 1024, .icon = NULL},
#endif
};

const size_t FLIPPER_DEBUG_APPS_COUNT = COUNT_OF(FLIPPER_DEBUG_APPS);
Expand Down
6 changes: 6 additions & 0 deletions applications/applications.mk
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,12 @@ CFLAGS += -DAPP_DISPLAY_TEST
SRV_GUI = 1
endif

APP_TEXT_BOX_TEST ?= 0
ifeq ($(APP_TEXT_BOX_TEST), 1)
CFLAGS += -DAPP_TEXT_BOX_TEST
SRV_GUI = 1
endif

APP_BATTERY_TEST ?= 0
ifeq ($(APP_BATTERY_TEST), 1)
CFLAGS += -DAPP_BATTERY_TEST
Expand Down
9 changes: 1 addition & 8 deletions applications/archive/helpers/archive_browser.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,14 +391,7 @@ void archive_enter_dir(ArchiveBrowserView* browser, string_t name) {
furi_assert(browser);
furi_assert(name);

uint8_t browser_depth = 0;
with_view_model(
browser->view, (ArchiveBrowserViewModel * model) {
browser_depth = idx_last_array_size(model->idx_last);
return false;
});

if(browser_depth > BROWSER_DEPTH_MAX) {
if(string_size(name) >= (MAX_NAME_LEN - 1)) {
return;
}

Expand Down
1 change: 0 additions & 1 deletion applications/archive/helpers/archive_browser.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#define TAB_RIGHT InputKeyRight //default tab swith direction
#define FILE_LIST_BUF_LEN 100
#define BROWSER_DEPTH_MAX 8

static const char* tab_default_paths[] = {
[ArchiveTabFavorites] = "/any/favorites",
Expand Down
5 changes: 3 additions & 2 deletions applications/archive/scenes/archive_scene_delete.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ void archive_scene_delete_on_enter(void* context) {
ArchiveApp* app = (ArchiveApp*)context;

widget_add_button_element(
app->widget, GuiButtonTypeLeft, "Back", archive_scene_delete_widget_callback, app);
app->widget, GuiButtonTypeLeft, "Cancel", archive_scene_delete_widget_callback, app);
widget_add_button_element(
app->widget, GuiButtonTypeRight, "Delete", archive_scene_delete_widget_callback, app);

Expand All @@ -33,7 +33,8 @@ void archive_scene_delete_on_enter(void* context) {

char delete_str[64];
snprintf(delete_str, sizeof(delete_str), "\e#Delete %s?\e#", name);
widget_add_text_box_element(app->widget, 0, 0, 128, 23, AlignCenter, AlignCenter, delete_str);
widget_add_text_box_element(
app->widget, 0, 0, 128, 23, AlignCenter, AlignCenter, delete_str, false);

view_dispatcher_switch_to_view(app->view_dispatcher, ArchiveViewWidget);
}
Expand Down
7 changes: 4 additions & 3 deletions applications/bt/bt_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ static void bt_cli_print_usage() {
}

static void bt_cli(Cli* cli, string_t args, void* context) {
furi_record_open("bt");

string_t cmd;
string_init(cmd);
BtSettings bt_settings;
Expand Down Expand Up @@ -235,16 +237,15 @@ static void bt_cli(Cli* cli, string_t args, void* context) {
}

string_clear(cmd);
furi_record_close("bt");
}

void bt_on_system_start() {
#ifdef SRV_CLI
Cli* cli = furi_record_open("cli");
furi_record_open("bt");
cli_add_command(cli, "bt", CliCommandFlagDefault, bt_cli, NULL);
furi_record_close("bt");
furi_record_close("cli");
#else
UNUSED(bt_cli);
#endif
}
}
6 changes: 3 additions & 3 deletions applications/bt/bt_service/bt.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ int32_t bt_srv() {
Bt* bt = bt_alloc();

// Read keys
if(!bt_load_key_storage(bt)) {
if(!bt_keys_storage_load(bt)) {
FURI_LOG_W(TAG, "Failed to load bonding keys");
}

Expand Down Expand Up @@ -365,11 +365,11 @@ int32_t bt_srv() {
// Display PIN code
bt_pin_code_show(bt, message.data.pin_code);
} else if(message.type == BtMessageTypeKeysStorageUpdated) {
bt_save_key_storage(bt);
bt_keys_storage_save(bt);
} else if(message.type == BtMessageTypeSetProfile) {
bt_change_profile(bt, &message);
} else if(message.type == BtMessageTypeForgetBondedDevices) {
bt_delete_key_storage(bt);
bt_keys_storage_delete(bt);
}
}
return 0;
Expand Down
51 changes: 26 additions & 25 deletions applications/bt/bt_service/bt_keys_storage.c
Original file line number Diff line number Diff line change
@@ -1,46 +1,47 @@
#include "bt_keys_storage.h"

#include <furi.h>
#include <file_worker.h>
#include <lib/toolbox/saved_struct.h>

#define BT_KEYS_STORAGE_TAG "bt keys storage"
#define BT_KEYS_STORAGE_PATH "/int/bt.keys"
#define BT_KEYS_STORAGE_VERSION (0)
#define BT_KEYS_STORAGE_MAGIC (0x18)

bool bt_load_key_storage(Bt* bt) {
bool bt_keys_storage_load(Bt* bt) {
furi_assert(bt);

bool file_loaded = false;

furi_hal_bt_get_key_storage_buff(&bt->bt_keys_addr_start, &bt->bt_keys_size);
furi_hal_bt_nvm_sram_sem_acquire();
file_loaded = saved_struct_load(
BT_KEYS_STORAGE_PATH,
bt->bt_keys_addr_start,
bt->bt_keys_size,
BT_KEYS_STORAGE_MAGIC,
BT_KEYS_STORAGE_VERSION);
furi_hal_bt_nvm_sram_sem_release();

FileWorker* file_worker = file_worker_alloc(true);
if(file_worker_open(file_worker, BT_KEYS_STORAGE_PATH, FSAM_READ, FSOM_OPEN_EXISTING)) {
furi_hal_bt_nvm_sram_sem_acquire();
if(file_worker_read(file_worker, bt->bt_keys_addr_start, bt->bt_keys_size)) {
file_loaded = true;
}
furi_hal_bt_nvm_sram_sem_release();
}
file_worker_free(file_worker);
return file_loaded;
}

bool bt_save_key_storage(Bt* bt) {
bool bt_keys_storage_save(Bt* bt) {
furi_assert(bt);
furi_assert(bt->bt_keys_addr_start);

bool file_saved = false;
FileWorker* file_worker = file_worker_alloc(true);
if(file_worker_open(file_worker, BT_KEYS_STORAGE_PATH, FSAM_WRITE, FSOM_OPEN_ALWAYS)) {
furi_hal_bt_nvm_sram_sem_acquire();
if(file_worker_write(file_worker, bt->bt_keys_addr_start, bt->bt_keys_size)) {
file_saved = true;
}
furi_hal_bt_nvm_sram_sem_release();
}
file_worker_free(file_worker);

furi_hal_bt_nvm_sram_sem_acquire();
file_saved = saved_struct_save(
BT_KEYS_STORAGE_PATH,
bt->bt_keys_addr_start,
bt->bt_keys_size,
BT_KEYS_STORAGE_MAGIC,
BT_KEYS_STORAGE_VERSION);
furi_hal_bt_nvm_sram_sem_release();

return file_saved;
}

bool bt_delete_key_storage(Bt* bt) {
bool bt_keys_storage_delete(Bt* bt) {
furi_assert(bt);
bool delete_succeed = false;
bool bt_is_active = furi_hal_bt_is_active();
Expand Down
6 changes: 3 additions & 3 deletions applications/bt/bt_service/bt_keys_storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

#include "bt_i.h"

bool bt_load_key_storage(Bt* bt);
bool bt_keys_storage_load(Bt* bt);

bool bt_save_key_storage(Bt* bt);
bool bt_keys_storage_save(Bt* bt);

bool bt_delete_key_storage(Bt* bt);
bool bt_keys_storage_delete(Bt* bt);
44 changes: 8 additions & 36 deletions applications/bt/bt_settings.c
Original file line number Diff line number Diff line change
@@ -1,50 +1,22 @@
#include "bt_settings.h"

#include <furi.h>
#include <file_worker.h>
#include <lib/toolbox/saved_struct.h>

#define TAG "BtSettings"
#define BT_SETTINGS_PATH "/int/bt.settings"
#define BT_SETTINGS_VERSION (0)
#define BT_SETTINGS_MAGIC (0x19)

bool bt_settings_load(BtSettings* bt_settings) {
furi_assert(bt_settings);
bool file_loaded = false;
BtSettings settings = {};

FURI_LOG_I(TAG, "Loading settings from \"%s\"", BT_SETTINGS_PATH);
FileWorker* file_worker = file_worker_alloc(true);
if(file_worker_open(file_worker, BT_SETTINGS_PATH, FSAM_READ, FSOM_OPEN_EXISTING)) {
if(file_worker_read(file_worker, &settings, sizeof(settings))) {
file_loaded = true;
}
}
file_worker_free(file_worker);

if(file_loaded) {
FURI_LOG_I(TAG, "Settings load success");
if(settings.version != BT_SETTINGS_VERSION) {
FURI_LOG_E(TAG, "Settings version mismatch");
} else {
osKernelLock();
*bt_settings = settings;
osKernelUnlock();
}
} else {
FURI_LOG_E(TAG, "Settings load failed");
}
return file_loaded;
return saved_struct_load(
BT_SETTINGS_PATH, bt_settings, sizeof(BtSettings), BT_SETTINGS_MAGIC, BT_SETTINGS_VERSION);
}

bool bt_settings_save(BtSettings* bt_settings) {
furi_assert(bt_settings);
bool result = false;

FileWorker* file_worker = file_worker_alloc(true);
if(file_worker_open(file_worker, BT_SETTINGS_PATH, FSAM_WRITE, FSOM_OPEN_ALWAYS)) {
if(file_worker_write(file_worker, bt_settings, sizeof(BtSettings))) {
FURI_LOG_I(TAG, "Settings saved to \"%s\"", BT_SETTINGS_PATH);
result = true;
}
}
file_worker_free(file_worker);
return result;
return saved_struct_save(
BT_SETTINGS_PATH, bt_settings, sizeof(BtSettings), BT_SETTINGS_MAGIC, BT_SETTINGS_VERSION);
}
3 changes: 0 additions & 3 deletions applications/bt/bt_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
#include <stdint.h>
#include <stdbool.h>

#define BT_SETTINGS_VERSION (0)

typedef struct {
uint8_t version;
bool enabled;
} BtSettings;

Expand Down
Loading

0 comments on commit d21e5bd

Please sign in to comment.