Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
…irmware into xfw-dev
  • Loading branch information
Willy-JL committed Nov 12, 2023
2 parents aa1e50e + 49dcf81 commit 418f44f
Show file tree
Hide file tree
Showing 498 changed files with 4,785 additions and 2,170 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
steps:

- name: 'Checkout code'
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
Expand Down
35 changes: 21 additions & 14 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -67,22 +67,22 @@ if GetOption("fullenv") or any(
# Target for self-update package
dist_basic_arguments = [
"--bundlever",
'"${UPDATE_VERSION_STRING}"',
"${UPDATE_VERSION_STRING}",
]
dist_radio_arguments = [
"--radio",
'"${ROOT_DIR.abspath}/${COPRO_STACK_BIN_DIR}/${COPRO_STACK_BIN}"',
"${ROOT_DIR.abspath}/${COPRO_STACK_BIN_DIR}/${COPRO_STACK_BIN}",
"--radiotype",
"${COPRO_STACK_TYPE}",
"${COPRO_DISCLAIMER}",
"--obdata",
'"${ROOT_DIR.abspath}/${COPRO_OB_DATA}"',
"${ROOT_DIR.abspath}/${COPRO_OB_DATA}",
"--stackversion",
"${COPRO_CUBE_VERSION}",
]
dist_resource_arguments = [
"-r",
'"${ROOT_DIR.abspath}/assets/resources"',
firmware_env.subst("${RESOURCES_ROOT}"),
]
dist_splash_arguments = (
[
Expand All @@ -95,7 +95,7 @@ if GetOption("fullenv") or any(

selfupdate_dist = distenv.DistCommand(
"updater_package",
(distenv["DIST_DEPENDS"], firmware_env["FW_RESOURCES"]),
(distenv["DIST_DEPENDS"], firmware_env["FW_RESOURCES_MANIFEST"]),
DIST_EXTRA=[
*dist_basic_arguments,
*dist_radio_arguments,
Expand Down Expand Up @@ -128,7 +128,8 @@ if GetOption("fullenv") or any(

# Installation over USB & CLI
usb_update_package = distenv.AddUsbFlashTarget(
"#build/usbinstall.flag", (firmware_env["FW_RESOURCES"], selfupdate_dist)
"#build/usbinstall.flag",
(firmware_env["FW_RESOURCES_MANIFEST"], selfupdate_dist),
)
distenv.Alias("flash_usb_full", usb_update_package)

Expand Down Expand Up @@ -166,17 +167,25 @@ Depends(
list(app_artifact.validator for app_artifact in external_app_list),
)
Alias("fap_dist", fap_dist)
# distenv.Default(fap_dist)

distenv.Depends(firmware_env["FW_RESOURCES"], external_apps_artifacts.resources_dist)

# Copy all faps to device

fap_deploy = distenv.PhonyTarget(
"fap_deploy",
"${PYTHON3} ${FBT_SCRIPT_DIR}/storage.py -p ${FLIP_PORT} send ${SOURCE} /ext/apps",
source=Dir("#/assets/resources/apps"),
[
[
"${PYTHON3}",
"${FBT_SCRIPT_DIR}/storage.py",
"-p",
"${FLIP_PORT}",
"send",
"${SOURCE}",
"/ext/apps",
]
],
source=firmware_env.Dir(("${RESOURCES_ROOT}/apps")),
)
Depends(fap_deploy, firmware_env["FW_RESOURCES_MANIFEST"])


# Target for bundling core2 package for qFlipper
Expand Down Expand Up @@ -314,9 +323,7 @@ distenv.PhonyTarget(
)

# Start Flipper CLI via PySerial's miniterm
distenv.PhonyTarget(
"cli", "${PYTHON3} ${FBT_SCRIPT_DIR}/serial_cli.py -p ${FLIP_PORT}"
)
distenv.PhonyTarget("cli", "${PYTHON3} ${FBT_SCRIPT_DIR}/serial_cli.py -p ${FLIP_PORT}")

# Update WiFi devboard firmware
distenv.PhonyTarget("devboard_flash", "${PYTHON3} ${FBT_SCRIPT_DIR}/wifi_board.py")
Expand Down
2 changes: 1 addition & 1 deletion applications/debug/direct_draw/direct_draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ static void direct_draw_run(DirectDraw* instance) {
size_t counter = 0;
float fps = 0;

vTaskPrioritySet(furi_thread_get_current_id(), FuriThreadPriorityIdle);
furi_thread_set_current_priority(FuriThreadPriorityIdle);

do {
size_t elapsed = DWT->CYCCNT - start;
Expand Down
39 changes: 34 additions & 5 deletions applications/debug/rpc_debug_app/rpc_debug_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,51 @@ static void rpc_debug_app_tick_event_callback(void* context) {
scene_manager_handle_tick_event(app->scene_manager);
}

static void rpc_debug_app_rpc_command_callback(RpcAppSystemEvent event, void* context) {
static void
rpc_debug_app_format_hex(const uint8_t* data, size_t data_size, char* buf, size_t buf_size) {
if(data == NULL || data_size == 0) {
strncpy(buf, "<Data empty>", buf_size);
return;
}

const size_t byte_width = 3;
const size_t line_width = 7;

data_size = MIN(data_size, buf_size / (byte_width + 1));

for(size_t i = 0; i < data_size; ++i) {
char* p = buf + (i * byte_width);
char sep = !((i + 1) % line_width) ? '\n' : ' ';
snprintf(p, byte_width + 1, "%02X%c", data[i], sep);
}

buf[buf_size - 1] = '\0';
}

static void rpc_debug_app_rpc_command_callback(const RpcAppSystemEvent* event, void* context) {
furi_assert(context);
RpcDebugApp* app = context;
furi_assert(app->rpc);

if(event == RpcAppEventSessionClose) {
if(event->type == RpcAppEventTypeSessionClose) {
scene_manager_stop(app->scene_manager);
view_dispatcher_stop(app->view_dispatcher);
rpc_system_app_set_callback(app->rpc, NULL, NULL);
app->rpc = NULL;
} else if(event == RpcAppEventAppExit) {
} else if(event->type == RpcAppEventTypeAppExit) {
scene_manager_stop(app->scene_manager);
view_dispatcher_stop(app->view_dispatcher);
rpc_system_app_confirm(app->rpc, RpcAppEventAppExit, true);
rpc_system_app_confirm(app->rpc, true);
} else if(event->type == RpcAppEventTypeDataExchange) {
furi_assert(event->data.type == RpcAppSystemEventDataTypeBytes);

rpc_debug_app_format_hex(
event->data.bytes.ptr, event->data.bytes.size, app->text_store, TEXT_STORE_SIZE);

view_dispatcher_send_custom_event(
app->view_dispatcher, RpcDebugAppCustomEventRpcDataExchange);
} else {
rpc_system_app_confirm(app->rpc, event, false);
rpc_system_app_confirm(app->rpc, false);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,49 +1,12 @@
#include "../rpc_debug_app.h"

static void rpc_debug_app_scene_start_format_hex(
const uint8_t* data,
size_t data_size,
char* buf,
size_t buf_size) {
furi_assert(data);
furi_assert(buf);

const size_t byte_width = 3;
const size_t line_width = 7;

data_size = MIN(data_size, buf_size / (byte_width + 1));

for(size_t i = 0; i < data_size; ++i) {
char* p = buf + (i * byte_width);
char sep = !((i + 1) % line_width) ? '\n' : ' ';
snprintf(p, byte_width + 1, "%02X%c", data[i], sep);
}

buf[buf_size - 1] = '\0';
}

static void rpc_debug_app_scene_receive_data_exchange_callback(
const uint8_t* data,
size_t data_size,
void* context) {
RpcDebugApp* app = context;
if(data) {
rpc_debug_app_scene_start_format_hex(data, data_size, app->text_store, TEXT_STORE_SIZE);
} else {
strncpy(app->text_store, "<Data empty>", TEXT_STORE_SIZE);
}
view_dispatcher_send_custom_event(app->view_dispatcher, RpcDebugAppCustomEventRpcDataExchange);
}

void rpc_debug_app_scene_receive_data_exchange_on_enter(void* context) {
RpcDebugApp* app = context;
strncpy(app->text_store, "Received data will appear here...", TEXT_STORE_SIZE);

text_box_set_text(app->text_box, app->text_store);
text_box_set_font(app->text_box, TextBoxFontHex);

rpc_system_app_set_data_exchange_callback(
app->rpc, rpc_debug_app_scene_receive_data_exchange_callback, app);
view_dispatcher_switch_to_view(app->view_dispatcher, RpcDebugAppViewTextBox);
}

Expand All @@ -53,6 +16,7 @@ bool rpc_debug_app_scene_receive_data_exchange_on_event(void* context, SceneMana

if(event.type == SceneManagerEventTypeCustom) {
if(event.event == RpcDebugAppCustomEventRpcDataExchange) {
rpc_system_app_confirm(app->rpc, true);
notification_message(app->notifications, &sequence_blink_cyan_100);
notification_message(app->notifications, &sequence_display_backlight_on);
text_box_set_text(app->text_box, app->text_store);
Expand All @@ -66,5 +30,4 @@ bool rpc_debug_app_scene_receive_data_exchange_on_event(void* context, SceneMana
void rpc_debug_app_scene_receive_data_exchange_on_exit(void* context) {
RpcDebugApp* app = context;
text_box_reset(app->text_box);
rpc_system_app_set_data_exchange_callback(app->rpc, NULL, NULL);
}
1 change: 1 addition & 0 deletions applications/debug/unit_tests/application.fam
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ App(
cdefines=["APP_UNIT_TESTS"],
requires=["system_settings"],
provides=["delay_test"],
resources="resources",
order=100,
)

Expand Down
4 changes: 2 additions & 2 deletions applications/debug/unit_tests/bt/bt_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void bt_test_alloc() {
}

void bt_test_free() {
furi_assert(bt_test);
furi_check(bt_test);
free(bt_test->nvm_ram_buff_ref);
free(bt_test->nvm_ram_buff_dut);
bt_keys_storage_free(bt_test->bt_keys_storage);
Expand Down Expand Up @@ -89,7 +89,7 @@ static void bt_test_keys_remove_test_file() {
}

MU_TEST(bt_test_keys_storage_serial_profile) {
furi_assert(bt_test);
furi_check(bt_test);

bt_test_keys_remove_test_file();
bt_test_keys_storage_profile();
Expand Down
2 changes: 1 addition & 1 deletion applications/debug/unit_tests/infrared/infrared_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ static void infrared_test_alloc() {
}

static void infrared_test_free() {
furi_assert(test);
furi_check(test);
infrared_free_decoder(test->decoder_handler);
infrared_free_encoder(test->encoder_handler);
flipper_format_free(test->ff);
Expand Down
2 changes: 1 addition & 1 deletion applications/debug/unit_tests/manifest/manifest.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ MU_TEST(manifest_iteration_test) {
ResourceManifestReader* manifest_reader = resource_manifest_reader_alloc(storage);
do {
// Open manifest file
if(!resource_manifest_reader_open(manifest_reader, EXT_PATH("unit_tests/Manifest"))) {
if(!resource_manifest_reader_open(manifest_reader, EXT_PATH("unit_tests/Manifest_test"))) {
result = false;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion applications/debug/unit_tests/nfc/nfc_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static void nfc_test_alloc() {
}

static void nfc_test_free() {
furi_assert(nfc_test);
furi_check(nfc_test);

furi_record_close(RECORD_STORAGE);
free(nfc_test);
Expand Down
Loading

0 comments on commit 418f44f

Please sign in to comment.