Merge branch 'UNLEASHED' into 420

This commit is contained in:
RogueMaster
2022-11-23 15:28:31 -05:00
63 changed files with 973 additions and 247 deletions

View File

@@ -1,6 +1,6 @@
kind: pipeline
type: docker
name: "Build firmware"
name: "Release firmware"
steps:
- name: "Update submodules"
@@ -11,19 +11,19 @@ steps:
- git submodule foreach git config --local gc.auto 0
- git log -1 --format='%H'
- name: "Build default FW"
- name: "Build firmware"
image: hfdj/fztools
pull: never
commands:
- export DIST_SUFFIX=${DRONE_TAG}
- export WORKFLOW_BRANCH_OR_TAG=dev-cfw
- export WORKFLOW_BRANCH_OR_TAG=release-cfw
- ./fbt COMPACT=1 DEBUG=0 updater_package
- mkdir artifacts-default
- mv dist/f7-C/* artifacts-default/
- ls -laS artifacts-default
- ls -laS artifacts-default/f7-update-${DRONE_TAG}
- sed -i 's/(version)/'${DRONE_TAG}'/g' CHANGELOG.md
- echo '# [Install via Web Updater](https://lab.flipper.net/?url=https://unleashedflip.com/builds/flipper-z-f7-update-'${DRONE_TAG}'.tgz&channel=dev-cfw&version='${DRONE_TAG}')' >> CHANGELOG.md
- echo '# [Install via Web Updater](https://lab.flipper.net/?url=https://unleashedflip.com/fw/${DRONE_TAG}/flipper-z-f7-update-'${DRONE_TAG}'.tgz&channel=release-cfw&version='${DRONE_TAG}')' >> CHANGELOG.md
environment:
FBT_TOOLS_CUSTOM_LINK:
from_secret: fbt_link
@@ -34,15 +34,15 @@ steps:
commands:
- rm -f assets/dolphin/external/manifest.txt
- cp .ci_files/anims_ofw.txt assets/dolphin/external/manifest.txt
- export DIST_SUFFIX=${DRONE_TAG}
- export WORKFLOW_BRANCH_OR_TAG=dev-cfw
- export DIST_SUFFIX=${DRONE_TAG}n
- export WORKFLOW_BRANCH_OR_TAG=no-custom-anims
- ./fbt COMPACT=1 DEBUG=0 updater_package
- mkdir artifacts-ofw-anims
- mv dist/f7-C/* artifacts-ofw-anims/
- ls -laS artifacts-ofw-anims
- ls -laS artifacts-ofw-anims/f7-update-${DRONE_TAG}
- ls -laS artifacts-ofw-anims/f7-update-${DRONE_TAG}n
- echo '' >> CHANGELOG.md
- echo '### [Version without custom animations - Install via Web Updater](https://lab.flipper.net/?url=https://unleashedflip.com/builds/flipper-z-f7-update-noanims-'${DRONE_TAG}'.tgz&channel=dev-cfw&version='${DRONE_TAG}')' >> CHANGELOG.md
- echo '### [Version without custom animations - Install via Web Updater](https://lab.flipper.net/?url=https://unleashedflip.com/fw_no_anim/flipper-z-f7-update-'${DRONE_TAG}'n.tgz&channel=release-cfw&version='${DRONE_TAG}'n)' >> CHANGELOG.md
environment:
FBT_TOOLS_CUSTOM_LINK:
from_secret: fbt_link
@@ -50,15 +50,17 @@ steps:
- name: "Bundle self-update packages"
image: kramos/alpine-zip
commands:
- mv artifacts-ofw-anims/flipper-z-f7-update-${DRONE_TAG}.tgz artifacts-ofw-anims/flipper-z-f7-update-noanims-${DRONE_TAG}.tgz
- cp artifacts-ofw-anims/flipper-z-f7-update-noanims-${DRONE_TAG}.tgz .
- cp artifacts-ofw-anims/flipper-z-f7-update-${DRONE_TAG}n.tgz .
- cp artifacts-default/flipper-z-f7-update-${DRONE_TAG}.tgz .
- zip -r artifacts-ofw-anims/flipper-z-f7-update-noanims-${DRONE_TAG}.zip artifacts-ofw-anims/f7-update-${DRONE_TAG}
- zip -r artifacts-ofw-anims/flipper-z-f7-update-${DRONE_TAG}n.zip artifacts-ofw-anims/f7-update-${DRONE_TAG}n
- zip -r artifacts-default/flipper-z-f7-update-${DRONE_TAG}.zip artifacts-default/f7-update-${DRONE_TAG}
- tar czpf artifacts-default/flipper-z-any-scripts-${DRONE_TAG}.tgz scripts debug
- rm -rf artifacts-ofw-anims/f7-update-${DRONE_TAG}
- rm -rf artifacts-default/f7-update-${DRONE_TAG}
- ls -laS artifacts-ofw-anims
- ls -laS artifacts-default
- mv artifacts-default/ ${DRONE_TAG}
- ls -laS ${DRONE_TAG}
- name: "Upload default to updates srv"
image: appleboy/drone-scp
@@ -72,8 +74,14 @@ steps:
port:
from_secret: dep_port
target:
from_secret: dep_target
source: flipper-z-f7-update-${DRONE_TAG}.tgz
from_secret: dep_target_new
source:
- ${DRONE_TAG}/*.tgz
- ${DRONE_TAG}/*.zip
- ${DRONE_TAG}/*.json
- ${DRONE_TAG}/*.elf
- ${DRONE_TAG}/*.dfu
- ${DRONE_TAG}/*.bin
- name: "Upload no-anims to updates srv"
image: appleboy/drone-scp
@@ -87,8 +95,19 @@ steps:
port:
from_secret: dep_port
target:
from_secret: dep_target
source: flipper-z-f7-update-noanims-${DRONE_TAG}.tgz
from_secret: dep_target_noanim
source: flipper-z-f7-update-${DRONE_TAG}n.tgz
- name: "Trigger update server reindex"
image: hfdj/fztools
pull: never
environment:
UPD_KEY:
from_secret: git_update_serv_token
UPD_URL:
from_secret: git_update_server_url
commands:
- curl -X POST -F 'key='$UPD_KEY'' $UPD_URL
- name: "Do Github release"
image: ddplugins/github-release
@@ -100,8 +119,8 @@ steps:
api_key:
from_secret: github_apikey
files:
- artifacts-default/*.tgz
- artifacts-default/*.zip
- ${DRONE_TAG}/*.tgz
- ${DRONE_TAG}/*.zip
- artifacts-ofw-anims/*.tgz
title: ${DRONE_TAG}
note: CHANGELOG.md
@@ -130,12 +149,12 @@ steps:
[-How to install firmware-](https://github.com/DarkFlippers/unleashed-firmware/blob/dev/documentation/HowToInstall.md)
[-Version without custom animations - Install via Web Updater-](https://lab.flipper.net/?url=https://unleashedflip.com/builds/flipper-z-f7-update-noanims-${DRONE_TAG}.tgz&channel=dev-cfw&version=${DRONE_TAG})
[-Version without custom animations - Install via Web Updater-](https://lab.flipper.net/?url=https://unleashedflip.com/fw_no_anim/flipper-z-f7-update-${DRONE_TAG}n.tgz&channel=release-cfw&version=${DRONE_TAG}n)
[-Install via Web Updater-](https://lab.flipper.net/?url=https://unleashedflip.com/builds/flipper-z-f7-update-${DRONE_TAG}.tgz&channel=dev-cfw&version=${DRONE_TAG})"
[-Install via Web Updater-](https://lab.flipper.net/?url=https://unleashedflip.com/fw/${DRONE_TAG}/flipper-z-f7-update-${DRONE_TAG}.tgz&channel=release-cfw&version=${DRONE_TAG})"
document:
- artifacts-default/flipper-z-f7-update-${DRONE_TAG}.tgz
- ${DRONE_TAG}/flipper-z-f7-update-${DRONE_TAG}.tgz
- name: "Send discord notification"
image: appleboy/drone-discord
@@ -156,14 +175,134 @@ steps:
[-How to install firmware-](https://github.com/DarkFlippers/unleashed-firmware/blob/dev/documentation/HowToInstall.md)
[-Version without custom animations - Install via Web Updater-](https://lab.flipper.net/?url=https://unleashedflip.com/builds/flipper-z-f7-update-noanims-${DRONE_TAG}.tgz&channel=dev-cfw&version=${DRONE_TAG})
[-Version without custom animations - Install via Web Updater-](https://lab.flipper.net/?url=https://unleashedflip.com/fw_no_anim/flipper-z-f7-update-${DRONE_TAG}n.tgz&channel=release-cfw&version=${DRONE_TAG}n)
[-Install via Web Updater-](https://lab.flipper.net/?url=https://unleashedflip.com/builds/flipper-z-f7-update-${DRONE_TAG}.tgz&channel=dev-cfw&version=${DRONE_TAG})"
[-Install via Web Updater-](https://lab.flipper.net/?url=https://unleashedflip.com/fw/${DRONE_TAG}/flipper-z-f7-update-${DRONE_TAG}.tgz&channel=release-cfw&version=${DRONE_TAG})"
trigger:
branch:
- release
event:
- tag
node:
typ: haupt
---
kind: pipeline
type: docker
name: "Dev build"
steps:
- name: "Update submodules"
image: alpine/git
commands:
- git submodule sync
- git -c protocol.version=2 submodule update --init --force --recursive
- git submodule foreach git config --local gc.auto 0
- git log -1 --format='%H'
- name: "Build dev FW"
image: hfdj/fztools
pull: never
commands:
- export DIST_SUFFIX=${DRONE_BUILD_NUMBER}
- export WORKFLOW_BRANCH_OR_TAG=dev-cfw
- ./fbt COMPACT=1 DEBUG=0 updater_package
- mkdir artifacts-default
- mv dist/f7-C/* artifacts-default/
- ls -laS artifacts-default
- ls -laS artifacts-default/f7-update-${DRONE_BUILD_NUMBER}
environment:
FBT_TOOLS_CUSTOM_LINK:
from_secret: fbt_link
- name: "Bundle self-update packages"
image: kramos/alpine-zip
commands:
- cp artifacts-default/flipper-z-f7-update-${DRONE_BUILD_NUMBER}.tgz .
- rm -rf artifacts-default/f7-update-${DRONE_BUILD_NUMBER}
- ls -laS artifacts-default
- mv artifacts-default/ dev
- ls -laS dev
- name: "Clean dev folder"
image: appleboy/drone-ssh
settings:
host:
from_secret: dep_host
username:
from_secret: dep_user
password:
from_secret: dep_passwd
port:
from_secret: dep_port
command_timeout: 30s
script:
- cd web/unleashedflip.com/public_html/fw/dev
- rm -f ./*
- name: "Upload default to updates srv"
image: appleboy/drone-scp
settings:
host:
from_secret: dep_host
username:
from_secret: dep_user
password:
from_secret: dep_passwd
port:
from_secret: dep_port
target:
from_secret: dep_target_new
source:
- dev/*.tgz
- dev/*.zip
- dev/*.json
- dev/*.elf
- dev/*.dfu
- dev/*.bin
- name: "Trigger update server reindex"
image: hfdj/fztools
pull: never
environment:
UPD_KEY:
from_secret: git_update_serv_token
UPD_URL:
from_secret: git_update_server_url
commands:
- curl -X POST -F 'key='$UPD_KEY'' $UPD_URL
- name: "Send files to telegram"
image: appleboy/drone-telegram
settings:
token:
from_secret: tgtoken
to:
from_secret: tgid_dev
format: markdown
message: "Unleashed firmware dev build successful!
Build: {{build.number}}
SHA: {{commit.sha}}
Commit: {{commit.message}}
[-Install via Web Updater-](https://lab.flipper.net/?url=https://unleashedflip.com/fw/dev/flipper-z-f7-update-${DRONE_BUILD_NUMBER}.tgz&channel=dev-cfw&version=${DRONE_BUILD_NUMBER})"
document:
- dev/flipper-z-f7-update-${DRONE_BUILD_NUMBER}.tgz
trigger:
branch:
- dev
event:
- push
node:
typ: haupt

View File

@@ -220,11 +220,7 @@ static UartEchoApp* uart_echo_app_alloc() {
furi_hal_uart_set_br(FuriHalUartIdUSART1, 115200);
furi_hal_uart_set_irq_cb(FuriHalUartIdUSART1, uart_echo_on_irq_cb, app);
app->worker_thread = furi_thread_alloc();
furi_thread_set_name(app->worker_thread, "UsbUartWorker");
furi_thread_set_stack_size(app->worker_thread, 1024);
furi_thread_set_context(app->worker_thread, app);
furi_thread_set_callback(app->worker_thread, uart_echo_worker);
app->worker_thread = furi_thread_alloc_ex("UsbUartWorker", 1024, uart_echo_worker, app);
furi_thread_start(app->worker_thread);
return app;

View File

@@ -43,11 +43,8 @@ MU_TEST(storage_file_open_lock) {
File* file = storage_file_alloc(storage);
// file_locker thread start
FuriThread* locker_thread = furi_thread_alloc();
furi_thread_set_name(locker_thread, "StorageFileLocker");
furi_thread_set_stack_size(locker_thread, 2048);
furi_thread_set_context(locker_thread, semaphore);
furi_thread_set_callback(locker_thread, storage_file_locker);
FuriThread* locker_thread =
furi_thread_alloc_ex("StorageFileLocker", 2048, storage_file_locker, semaphore);
furi_thread_start(locker_thread);
// wait for file lock
@@ -133,11 +130,8 @@ MU_TEST(storage_dir_open_lock) {
File* file = storage_file_alloc(storage);
// file_locker thread start
FuriThread* locker_thread = furi_thread_alloc();
furi_thread_set_name(locker_thread, "StorageDirLocker");
furi_thread_set_stack_size(locker_thread, 2048);
furi_thread_set_context(locker_thread, semaphore);
furi_thread_set_callback(locker_thread, storage_dir_locker);
FuriThread* locker_thread =
furi_thread_alloc_ex("StorageDirLocker", 2048, storage_dir_locker, semaphore);
furi_thread_start(locker_thread);
// wait for dir lock

View File

@@ -680,12 +680,7 @@ BadUsbScript* bad_usb_script_open(FuriString* file_path) {
bad_usb->st.state = BadUsbStateInit;
bad_usb->st.error[0] = '\0';
bad_usb->thread = furi_thread_alloc();
furi_thread_set_name(bad_usb->thread, "BadUsbWorker");
furi_thread_set_stack_size(bad_usb->thread, 2048);
furi_thread_set_context(bad_usb->thread, bad_usb);
furi_thread_set_callback(bad_usb->thread, bad_usb_worker);
bad_usb->thread = furi_thread_alloc_ex("BadUsbWorker", 2048, bad_usb_worker, bad_usb);
furi_thread_start(bad_usb->thread);
return bad_usb;
}

View File

@@ -159,11 +159,8 @@ static int32_t usb_uart_worker(void* context) {
usb_uart->tx_sem = furi_semaphore_alloc(1, 1);
usb_uart->usb_mutex = furi_mutex_alloc(FuriMutexTypeNormal);
usb_uart->tx_thread = furi_thread_alloc();
furi_thread_set_name(usb_uart->tx_thread, "UsbUartTxWorker");
furi_thread_set_stack_size(usb_uart->tx_thread, 512);
furi_thread_set_context(usb_uart->tx_thread, usb_uart);
furi_thread_set_callback(usb_uart->tx_thread, usb_uart_tx_thread);
usb_uart->tx_thread =
furi_thread_alloc_ex("UsbUartTxWorker", 512, usb_uart_tx_thread, usb_uart);
usb_uart_vcp_init(usb_uart, usb_uart->cfg.vcp_ch);
usb_uart_serial_init(usb_uart, usb_uart->cfg.uart_ch);
@@ -338,11 +335,7 @@ UsbUartBridge* usb_uart_enable(UsbUartConfig* cfg) {
memcpy(&(usb_uart->cfg_new), cfg, sizeof(UsbUartConfig));
usb_uart->thread = furi_thread_alloc();
furi_thread_set_name(usb_uart->thread, "UsbUartWorker");
furi_thread_set_stack_size(usb_uart->thread, 1024);
furi_thread_set_context(usb_uart->thread, usb_uart);
furi_thread_set_callback(usb_uart->thread, usb_uart_worker);
usb_uart->thread = furi_thread_alloc_ex("UsbUartWorker", 1024, usb_uart_worker, usb_uart);
furi_thread_start(usb_uart->thread);
return usb_uart;

View File

@@ -59,11 +59,8 @@ SubGhzChatWorker* subghz_chat_worker_alloc(Cli* cli) {
instance->cli = cli;
instance->thread = furi_thread_alloc();
furi_thread_set_name(instance->thread, "SubGhzChat");
furi_thread_set_stack_size(instance->thread, 2048);
furi_thread_set_context(instance->thread, instance);
furi_thread_set_callback(instance->thread, subghz_chat_worker_thread);
instance->thread =
furi_thread_alloc_ex("SubGhzChat", 2048, subghz_chat_worker_thread, instance);
instance->subghz_txrx = subghz_tx_rx_worker_alloc();
instance->event_queue = furi_message_queue_alloc(80, sizeof(SubGhzChatEvent));
return instance;

View File

@@ -5,8 +5,6 @@
#define TAG "SubghzFrequencyAnalyzerWorker"
#define SUBGHZ_FREQUENCY_ANALYZER_THRESHOLD -97.0f
static const uint8_t subghz_preset_ook_58khz[][2] = {
{CC1101_MDMCFG4, 0b11110111}, // Rx BW filter is 58.035714kHz
/* End */
@@ -72,7 +70,7 @@ static int32_t subghz_frequency_analyzer_worker_thread(void* context) {
.frequency_coarse = 0, .rssi_coarse = 0, .frequency_fine = 0, .rssi_fine = 0};
float rssi = 0;
uint32_t frequency = 0;
float rssi_temp = 0;
float rssi_temp = -127.0f;
uint32_t frequency_temp = 0;
CC1101Status status;
@@ -197,7 +195,7 @@ static int32_t subghz_frequency_analyzer_worker_thread(void* context) {
TAG, "=:%lu:%f", frequency_rssi.frequency_fine, (double)frequency_rssi.rssi_fine);
instance->sample_hold_counter = 20;
rssi_temp = frequency_rssi.rssi_fine;
rssi_temp = (rssi_temp + frequency_rssi.rssi_fine) / 2;
frequency_temp = frequency_rssi.frequency_fine;
if(instance->filVal) {
@@ -208,10 +206,7 @@ static int32_t subghz_frequency_analyzer_worker_thread(void* context) {
// Deliver callback
if(instance->pair_callback) {
instance->pair_callback(
instance->context,
frequency_rssi.frequency_fine,
frequency_rssi.rssi_fine,
true);
instance->context, frequency_rssi.frequency_fine, rssi_temp, true);
}
} else if( // Deliver results coarse
(frequency_rssi.rssi_coarse > instance->trigger_level) &&
@@ -223,7 +218,7 @@ static int32_t subghz_frequency_analyzer_worker_thread(void* context) {
(double)frequency_rssi.rssi_coarse);
instance->sample_hold_counter = 20;
rssi_temp = frequency_rssi.rssi_coarse;
rssi_temp = (rssi_temp + frequency_rssi.rssi_coarse) / 2;
frequency_temp = frequency_rssi.frequency_coarse;
if(instance->filVal) {
frequency_rssi.frequency_coarse =
@@ -233,15 +228,12 @@ static int32_t subghz_frequency_analyzer_worker_thread(void* context) {
// Deliver callback
if(instance->pair_callback) {
instance->pair_callback(
instance->context,
frequency_rssi.frequency_coarse,
frequency_rssi.rssi_coarse,
true);
instance->context, frequency_rssi.frequency_coarse, rssi_temp, true);
}
} else {
if(instance->sample_hold_counter > 0) {
instance->sample_hold_counter--;
if(instance->sample_hold_counter == 18) {
if(instance->sample_hold_counter == 15) {
if(instance->pair_callback) {
instance->pair_callback(
instance->context, frequency_temp, rssi_temp, false);
@@ -249,8 +241,8 @@ static int32_t subghz_frequency_analyzer_worker_thread(void* context) {
}
} else {
instance->filVal = 0;
if(instance->pair_callback)
instance->pair_callback(instance->context, 0, 0, false);
rssi_temp = -127.0f;
instance->pair_callback(instance->context, 0, 0, false);
}
}
}
@@ -266,12 +258,8 @@ SubGhzFrequencyAnalyzerWorker* subghz_frequency_analyzer_worker_alloc(void* cont
furi_assert(context);
SubGhzFrequencyAnalyzerWorker* instance = malloc(sizeof(SubGhzFrequencyAnalyzerWorker));
instance->thread = furi_thread_alloc();
furi_thread_set_name(instance->thread, "SubGhzFAWorker");
furi_thread_set_stack_size(instance->thread, 2048);
furi_thread_set_context(instance->thread, instance);
furi_thread_set_callback(instance->thread, subghz_frequency_analyzer_worker_thread);
instance->thread = furi_thread_alloc_ex(
"SubGhzFAWorker", 2048, subghz_frequency_analyzer_worker_thread, instance);
SubGhz* subghz = context;
instance->setting = subghz->setting;
instance->trigger_level = subghz->last_settings->frequency_analyzer_trigger;

View File

@@ -3,6 +3,8 @@
#include <furi_hal.h>
#include "../subghz_i.h"
#define SUBGHZ_FREQUENCY_ANALYZER_THRESHOLD -97.0f
typedef struct SubGhzFrequencyAnalyzerWorker SubGhzFrequencyAnalyzerWorker;
typedef void (*SubGhzFrequencyAnalyzerWorkerPairCallback)(

View File

@@ -14,7 +14,7 @@
#define SUBGHZ_LAST_SETTING_DEFAULT_PRESET 1
#define SUBGHZ_LAST_SETTING_DEFAULT_FREQUENCY 433920000
#define SUBGHZ_LAST_SETTING_FREQUENCY_ANALYZER_FEEDBACK_LEVEL 2
#define SUBGHZ_LAST_SETTING_FREQUENCY_ANALYZER_TRIGGER -97.0f
#define SUBGHZ_LAST_SETTING_FREQUENCY_ANALYZER_TRIGGER -93.0f
#ifdef SUBGHZ_SAVE_DETECT_RAW_SETTING
#define SUBGHZ_LAST_SETTING_DEFAULT_READ_RAW 0

View File

@@ -297,11 +297,7 @@ U2fHid* u2f_hid_start(U2fData* u2f_inst) {
u2f_hid->u2f_instance = u2f_inst;
u2f_hid->thread = furi_thread_alloc();
furi_thread_set_name(u2f_hid->thread, "U2fHidWorker");
furi_thread_set_stack_size(u2f_hid->thread, 2048);
furi_thread_set_context(u2f_hid->thread, u2f_hid);
furi_thread_set_callback(u2f_hid->thread, u2f_hid_worker);
u2f_hid->thread = furi_thread_alloc_ex("U2fHidWorker", 2048, u2f_hid_worker, u2f_hid);
furi_thread_start(u2f_hid->thread);
return u2f_hid;
}

View File

@@ -441,19 +441,6 @@ static int32_t cdc_process(void* p) {
/******************************* MAIN APP **********************************/
/***************************************************************************/
static FuriThread* furi_thread_alloc_ex(
const char* name,
uint32_t stack_size,
FuriThreadCallback callback,
void* context) {
FuriThread* thread = furi_thread_alloc();
furi_thread_set_name(thread, name);
furi_thread_set_stack_size(thread, stack_size);
furi_thread_set_callback(thread, callback);
furi_thread_set_context(thread, context);
return thread;
}
static DapApp* dap_app_alloc() {
DapApp* dap_app = malloc(sizeof(DapApp));
dap_app->dap_thread = furi_thread_alloc_ex("DAP Process", 1024, dap_process, dap_app);

View File

@@ -11,6 +11,7 @@ typedef enum {
DTMF_DOLPHIN_TONE_BLOCK_REDBOX_US,
DTMF_DOLPHIN_TONE_BLOCK_REDBOX_CA,
DTMF_DOLPHIN_TONE_BLOCK_REDBOX_UK,
DTMF_DOLPHIN_TONE_BLOCK_REDBOX_CA,
DTMF_DOLPHIN_TONE_BLOCK_MISC,
} DTMFDolphinToneSection;

View File

@@ -8,6 +8,7 @@ typedef enum {
DTMFDolphinEventStartBluebox,
DTMFDolphinEventStartRedboxUS,
DTMFDolphinEventStartRedboxUK,
DTMFDolphinEventStartRedboxCA,
DTMFDolphinEventStartMisc,
DTMFDolphinEventPlayTones,
DTMFDolphinEventStopTones,

View File

@@ -22,6 +22,7 @@ enum DTMFDolphinSceneState {
DTMFDolphinSceneStateBluebox,
DTMFDolphinSceneStateRedboxUS,
DTMFDolphinSceneStateRedboxUK,
DTMFDolphinSceneStateRedboxCA,
DTMFDolphinSceneStateMisc,
};

View File

@@ -17,6 +17,9 @@ void dtmf_dolphin_scene_dialer_on_enter(void* context) {
case DTMFDolphinSceneStateRedboxUK:
dtmf_dolphin_data_set_current_section(DTMF_DOLPHIN_TONE_BLOCK_REDBOX_UK);
break;
case DTMFDolphinSceneStateRedboxCA:
dtmf_dolphin_data_set_current_section(DTMF_DOLPHIN_TONE_BLOCK_REDBOX_CA);
break;
case DTMFDolphinSceneStateMisc:
dtmf_dolphin_data_set_current_section(DTMF_DOLPHIN_TONE_BLOCK_MISC);
break;

View File

@@ -17,6 +17,9 @@ static void dtmf_dolphin_scene_start_main_menu_enter_callback(void* context, uin
cust_event = DTMFDolphinEventStartRedboxUK;
break;
case 4:
cust_event = DTMFDolphinEventStartRedboxCA;
break;
case 5:
cust_event = DTMFDolphinEventStartMisc;
break;
default:
@@ -38,6 +41,7 @@ void dtmf_dolphin_scene_start_on_enter(void* context) {
variable_item_list_add(var_item_list, "Bluebox", 0, NULL, context);
variable_item_list_add(var_item_list, "Redbox (US)", 0, NULL, context);
variable_item_list_add(var_item_list, "Redbox (UK)", 0, NULL, context);
variable_item_list_add(var_item_list, "Redbox (CA)", 0, NULL, context);
variable_item_list_add(var_item_list, "Misc", 0, NULL, context);
variable_item_list_set_selected_item(
@@ -67,6 +71,9 @@ bool dtmf_dolphin_scene_start_on_event(void* context, SceneManagerEvent event) {
case DTMFDolphinEventStartRedboxUK:
sc_state = DTMFDolphinSceneStateRedboxUK;
break;
case DTMFDolphinEventStartRedboxCA:
sc_state = DTMFDolphinSceneStateRedboxCA;
break;
case DTMFDolphinEventStartMisc:
sc_state = DTMFDolphinSceneStateMisc;
break;

View File

@@ -1,5 +1,7 @@
# flipperzero-i2ctools
[Original link](https://github.com/NaejEL/flipperzero-i2ctools)
Set of i2c tools for Flipper Zero
![Preview](i2ctools.gif)

View File

@@ -97,11 +97,8 @@ MusicPlayerWorker* music_player_worker_alloc() {
NoteBlockArray_init(instance->notes);
instance->thread = furi_thread_alloc();
furi_thread_set_name(instance->thread, "MusicPlayerWorker");
furi_thread_set_stack_size(instance->thread, 1024);
furi_thread_set_context(instance->thread, instance);
furi_thread_set_callback(instance->thread, music_player_worker_thread_callback);
instance->thread = furi_thread_alloc_ex(
"MusicPlayerWorker", 1024, music_player_worker_thread_callback, instance);
instance->volume = 1.0f;

View File

@@ -15,11 +15,8 @@ NfcMagicWorker* nfc_magic_worker_alloc() {
NfcMagicWorker* nfc_magic_worker = malloc(sizeof(NfcMagicWorker));
// Worker thread attributes
nfc_magic_worker->thread = furi_thread_alloc();
furi_thread_set_name(nfc_magic_worker->thread, "NfcMagicWorker");
furi_thread_set_stack_size(nfc_magic_worker->thread, 8192);
furi_thread_set_callback(nfc_magic_worker->thread, nfc_magic_worker_task);
furi_thread_set_context(nfc_magic_worker->thread, nfc_magic_worker);
nfc_magic_worker->thread =
furi_thread_alloc_ex("NfcMagicWorker", 8192, nfc_magic_worker_task, nfc_magic_worker);
nfc_magic_worker->callback = NULL;
nfc_magic_worker->context = NULL;

View File

@@ -25,11 +25,8 @@ PicopassWorker* picopass_worker_alloc() {
PicopassWorker* picopass_worker = malloc(sizeof(PicopassWorker));
// Worker thread attributes
picopass_worker->thread = furi_thread_alloc();
furi_thread_set_name(picopass_worker->thread, "PicopassWorker");
furi_thread_set_stack_size(picopass_worker->thread, 8192);
furi_thread_set_callback(picopass_worker->thread, picopass_worker_task);
furi_thread_set_context(picopass_worker->thread, picopass_worker);
picopass_worker->thread =
furi_thread_alloc_ex("PicopassWorker", 8192, picopass_worker_task, picopass_worker);
picopass_worker->callback = NULL;
picopass_worker->context = NULL;

View File

@@ -0,0 +1,50 @@
#pragma once
#include <gui/gui.h>
#include "../types/plugin_state.h"
#include "../types/plugin_event.h"
#include "totp_scenes_enum.h"
/**
* @brief Activates scene
* @param plugin_state application state
* @param scene scene to be activated
* @param context scene context to be passed to the scene activation method
*/
void totp_scene_director_activate_scene(
PluginState* const plugin_state,
Scene scene,
const void* context);
/**
* @brief Deactivate current scene
* @param plugin_state application state
*/
void totp_scene_director_deactivate_active_scene(PluginState* const plugin_state);
/**
* @brief Initializes all the available scenes
* @param plugin_state application state
*/
void totp_scene_director_init_scenes(PluginState* const plugin_state);
/**
* @brief Renders current scene
* @param canvas canvas to render at
* @param plugin_state application state
*/
void totp_scene_director_render(Canvas* const canvas, PluginState* const plugin_state);
/**
* @brief Disposes all the available scenes
* @param plugin_state application state
*/
void totp_scene_director_dispose(const PluginState* const plugin_state);
/**
* @brief Handles application event for the current scene
* @param event event to be handled
* @param plugin_state application state
* @return \c true if event handled and applilcation should continue; \c false if application should be closed
*/
bool totp_scene_director_handle_event(PluginEvent* const event, PluginState* const plugin_state);

View File

@@ -0,0 +1,36 @@
#pragma once
/**
* @brief TOTP application scenes
*/
typedef enum {
/**
* @brief Empty scene which does nothing
*/
TotpSceneNone,
/**
* @brief Scene where user have to enter PIN to authenticate
*/
TotpSceneAuthentication,
/**
* @brief Scene where actual TOTP token is getting generated and displayed to the user
*/
TotpSceneGenerateToken,
/**
* @brief Scene where user can add new token
*/
TotpSceneAddNewToken,
/**
* @brief Scene with a menu for given token, allowing user to do multiple actions
*/
TotpSceneTokenMenu,
/**
* @brief Scene where user can change application settings
*/
TotpSceneAppSettings
} Scene;

View File

@@ -0,0 +1,164 @@
#include "move.h"
#include <stdlib.h>
#include <lib/toolbox/args.h>
#include "../../../list/list.h"
#include "../../../../types/token_info.h"
#include "../../../config/config.h"
#include "../../cli_helpers.h"
#include "../../../../scenes/scene_director.h"
#define TOTP_CLI_COMMAND_MOVE_ARG_INDEX "index"
#define TOTP_CLI_COMMAND_MOVE_ARG_NEW_NAME "name"
#define TOTP_CLI_COMMAND_MOVE_ARG_NEW_NAME_PREFIX "-n"
#define TOTP_CLI_COMMAND_MOVE_ARG_NEW_INDEX "index"
#define TOTP_CLI_COMMAND_MOVE_ARG_NEW_INDEX_PREFIX "-i"
void totp_cli_command_move_docopt_commands() {
TOTP_CLI_PRINTF(" " TOTP_CLI_COMMAND_MOVE ", " TOTP_CLI_COMMAND_MOVE_ALT
" Move\\rename token\r\n");
}
void totp_cli_command_move_docopt_usage() {
TOTP_CLI_PRINTF(
" " TOTP_CLI_COMMAND_NAME
" " DOCOPT_REQUIRED(TOTP_CLI_COMMAND_MOVE " | " TOTP_CLI_COMMAND_MOVE_ALT) " " DOCOPT_ARGUMENT(TOTP_CLI_COMMAND_MOVE_ARG_INDEX) " " DOCOPT_OPTIONAL(
DOCOPT_OPTION(
TOTP_CLI_COMMAND_MOVE_ARG_NEW_NAME_PREFIX,
DOCOPT_ARGUMENT(
TOTP_CLI_COMMAND_MOVE_ARG_NEW_NAME))) " " DOCOPT_OPTIONAL(DOCOPT_OPTION(TOTP_CLI_COMMAND_MOVE_ARG_NEW_INDEX_PREFIX, DOCOPT_ARGUMENT(TOTP_CLI_COMMAND_MOVE_ARG_NEW_INDEX))) "\r\n");
}
void totp_cli_command_move_docopt_options() {
TOTP_CLI_PRINTF(" " DOCOPT_OPTION(
TOTP_CLI_COMMAND_MOVE_ARG_NEW_NAME_PREFIX,
DOCOPT_ARGUMENT(TOTP_CLI_COMMAND_MOVE_ARG_NEW_NAME)) " New token name.\r\n");
TOTP_CLI_PRINTF(" " DOCOPT_OPTION(
TOTP_CLI_COMMAND_MOVE_ARG_NEW_INDEX_PREFIX,
DOCOPT_ARGUMENT(TOTP_CLI_COMMAND_MOVE_ARG_NEW_INDEX)) " New token index.\r\n");
}
void totp_cli_command_move_handle(PluginState* plugin_state, FuriString* args, Cli* cli) {
int token_index;
if(!args_read_int_and_trim(args, &token_index)) {
TOTP_CLI_PRINT_INVALID_ARGUMENTS();
return;
}
if(!totp_cli_ensure_authenticated(plugin_state, cli)) {
return;
}
if(token_index < 1 || token_index > plugin_state->tokens_count) {
TOTP_CLI_PRINT_INVALID_ARGUMENTS();
return;
}
FuriString* temp_str = furi_string_alloc();
char* new_token_name = NULL;
int new_token_index = 0;
while(args_read_string_and_trim(args, temp_str)) {
bool parsed = false;
if(furi_string_cmpi_str(temp_str, TOTP_CLI_COMMAND_MOVE_ARG_NEW_NAME_PREFIX) == 0) {
if(!args_read_string_and_trim(args, temp_str)) {
TOTP_CLI_PRINTF(
"Missed value for argument \"" TOTP_CLI_COMMAND_MOVE_ARG_NEW_NAME_PREFIX
"\"\r\n");
} else {
if(new_token_name != NULL) {
free(new_token_name);
}
new_token_name = malloc(furi_string_size(temp_str) + 1);
if(new_token_name == NULL) {
furi_string_free(temp_str);
return;
}
strlcpy(
new_token_name,
furi_string_get_cstr(temp_str),
furi_string_size(temp_str) + 1);
parsed = true;
}
} else if(furi_string_cmpi_str(temp_str, TOTP_CLI_COMMAND_MOVE_ARG_NEW_INDEX_PREFIX) == 0) {
if(!args_read_int_and_trim(args, &new_token_index)) {
TOTP_CLI_PRINTF(
"Missed value for argument \"" TOTP_CLI_COMMAND_MOVE_ARG_NEW_INDEX_PREFIX
"\"\r\n");
} else if(new_token_index < 1 || new_token_index > plugin_state->tokens_count) {
TOTP_CLI_PRINTF(
"\"%" PRId16
"\" is incorrect value for argument \"" TOTP_CLI_COMMAND_MOVE_ARG_NEW_INDEX_PREFIX
"\"\r\n",
new_token_index);
} else {
parsed = true;
}
} else {
TOTP_CLI_PRINTF("Unknown argument \"%s\"\r\n", furi_string_get_cstr(temp_str));
}
if(!parsed) {
TOTP_CLI_PRINT_INVALID_ARGUMENTS();
furi_string_free(temp_str);
if(new_token_name != NULL) {
free(new_token_name);
}
return;
}
}
if(!totp_cli_ensure_authenticated(plugin_state, cli)) {
furi_string_free(temp_str);
if(new_token_name != NULL) {
free(new_token_name);
}
return;
}
bool activate_generate_token_scene = false;
if(plugin_state->current_scene != TotpSceneAuthentication) {
totp_scene_director_activate_scene(plugin_state, TotpSceneNone, NULL);
activate_generate_token_scene = true;
}
bool token_updated = false;
TokenInfo* token_info = NULL;
if(new_token_index > 0) {
plugin_state->tokens_list =
list_remove_at(plugin_state->tokens_list, token_index - 1, (void**)&token_info);
furi_check(token_info != NULL);
plugin_state->tokens_list =
list_insert_at(plugin_state->tokens_list, new_token_index - 1, token_info);
token_updated = true;
} else {
token_info = list_element_at(plugin_state->tokens_list, token_index - 1)->data;
}
if(new_token_name != NULL) {
free(token_info->name);
token_info->name = new_token_name;
token_updated = true;
}
if(token_updated) {
totp_full_save_config_file(plugin_state);
}
if(activate_generate_token_scene) {
totp_scene_director_activate_scene(plugin_state, TotpSceneGenerateToken, NULL);
}
if(token_updated) {
TOTP_CLI_PRINTF("Token \"%s\" has been successfully updated\r\n", token_info->name);
} else {
TOTP_CLI_PRINT_INVALID_ARGUMENTS();
}
furi_string_free(temp_str);
}

View File

@@ -0,0 +1,12 @@
#pragma once
#include <cli/cli.h>
#include "../../../../types/plugin_state.h"
#define TOTP_CLI_COMMAND_MOVE "move"
#define TOTP_CLI_COMMAND_MOVE_ALT "mv"
void totp_cli_command_move_handle(PluginState* plugin_state, FuriString* args, Cli* cli);
void totp_cli_command_move_docopt_commands();
void totp_cli_command_move_docopt_usage();
void totp_cli_command_move_docopt_options();

View File

@@ -0,0 +1,23 @@
#pragma once
#include <errno.h>
#include <stdint.h>
#ifndef _RSIZE_T_DECLARED
typedef uint64_t rsize_t;
#define _RSIZE_T_DECLARED
#endif
#ifndef _ERRNOT_DECLARED
typedef int16_t errno_t; //-V677
#define _ERRNOT_DECLARED
#endif
/**
* @brief Copies the value \p c into each of the first \p n characters of the object pointed to by \p s.
* @param s pointer to the object to fill
* @param smax size of the destination object
* @param c fill byte
* @param n number of bytes to fill
* @return \c 0 on success; non-zero otherwise
*/
errno_t memset_s(void* s, rsize_t smax, int c, rsize_t n);

View File

@@ -0,0 +1,94 @@
#pragma once
#include <stdlib.h>
#include <inttypes.h>
/**
* @brief Single linked list node
*/
typedef struct ListNode {
/**
* @brief Pointer to the data assigned to the current list node
*/
void* data;
/**
* @brief Pointer to the next list node
*/
struct ListNode* next;
} ListNode;
/**
* @brief Initializes a new list node head
* @param data data to be assigned to the head list node
* @return Head list node
*/
ListNode* list_init_head(void* data);
/**
* @brief Adds new list node to the end of the list
* @param head head list node
* @param data data to be assigned to the newly added list node
* @return Head list node
*/
ListNode* list_add(
ListNode* head,
void* data); /* adds element with specified data to the end of the list and returns new head node. */
/**
* @brief Searches list node with the given assigned \p data in the list
* @param head head list node
* @param data data to be searched
* @return List node containing \p data if there is such a node in the list; \c NULL otherwise
*/
ListNode* list_find(ListNode* head, const void* data);
/**
* @brief Searches list node with the given \p index in the list
* @param head head list node
* @param index desired list node index
* @return List node with the given \p index in the list if there is such a list node; \c NULL otherwise
*/
ListNode* list_element_at(ListNode* head, uint16_t index);
/**
* @brief Removes list node from the list
* @param head head list node
* @param ep list node to be removed
* @return Head list node
*/
ListNode* list_remove(ListNode* head, ListNode* ep);
/**
* @brief Removes list node with the given \p index in the list from the list
* @param head head list node
* @param index index of the node to be removed
* @param[out] removed_node_data data which was assigned to the removed list node
* @return Head list node
*/
ListNode* list_remove_at(ListNode* head, uint16_t index, void** removed_node_data);
/**
* @brief Inserts new list node at the given index
* @param head head list node
* @param index index in the list where the new list node should be inserted
* @param data data to be assgned to the new list node
* @return Head list node
*/
ListNode* list_insert_at(ListNode* head, uint16_t index, void* data);
/**
* @brief Disposes all the list nodes in the list
* @param head head list node
*/
void list_free(ListNode* head);
#define TOTP_LIST_INIT_OR_ADD(head, item, assert) \
do { \
if(head == NULL) { \
head = list_init_head(item); \
assert(head != NULL); \
} else { \
assert(list_add(head, item) != NULL); \
} \
} while(false)

View File

@@ -0,0 +1,56 @@
#pragma once
#include <stdint.h>
typedef enum {
/**
* @brief Do not change value if it reached constraint
*/
RollOverflowBehaviorStop,
/**
* @brief Set value to opposite constraint value if it reached constraint
*/
RollOverflowBehaviorRoll
} TotpRollValueOverflowBehavior;
#define TOTP_ROLL_VALUE_FN_HEADER(type, step_type) \
void totp_roll_value_##type( \
type* value, \
step_type step, \
type min, \
type max, \
TotpRollValueOverflowBehavior overflow_behavior)
/**
* @brief Rolls \c int8_t \p value using \p min and \p max as an value constraints with \p step step.
* When value reaches constraint value \p overflow_behavior defines what to do next.
* @param[in,out] value value to roll
* @param step step to be used to change value
* @param min minimal possible value
* @param max maximum possible value
* @param overflow_behavior defines what to do when value reaches constraint value
*/
TOTP_ROLL_VALUE_FN_HEADER(int8_t, int8_t);
/**
* @brief Rolls \c uint8_t \p value using \p min and \p max as an value constraints with \p step step.
* When value reaches constraint value \p overflow_behavior defines what to do next.
* @param[in,out] value value to roll
* @param step step to be used to change value
* @param min minimal possible value
* @param max maximum possible value
* @param overflow_behavior defines what to do when value reaches constraint value
*/
TOTP_ROLL_VALUE_FN_HEADER(uint8_t, int8_t);
/**
* @brief Rolls \c uint16_t \p value using \p min and \p max as an value constraints with \p step step.
* When value reaches constraint value \p overflow_behavior defines what to do next.
* @param[in,out] value value to roll
* @param step step to be used to change value
* @param min minimal possible value
* @param max maximum possible value
* @param overflow_behavior defines what to do when value reaches constraint value
*/
TOTP_ROLL_VALUE_FN_HEADER(uint16_t, int16_t);

View File

@@ -0,0 +1,18 @@
#pragma once
#include <inttypes.h>
/**
* @brief Calculates timezone offset in seconds given timezone offset in hours.
* @param hours timezone offset in hours
* @return Timezone offset in seconds.
*/
int32_t timezone_offset_from_hours(float hours);
/**
* @brief Applies timezone offset to a given time.
* @param time time to apply offset to.
* @param offset timezone offset in seconds.
* @return Time with timezone offset applied.
*/
uint64_t timezone_offset_apply(uint64_t time, int32_t offset);

View File

@@ -0,0 +1,53 @@
#pragma once
#include <inttypes.h>
#include <gui/gui.h>
/**
* @brief Renders TextBox control
* @param canvas canvas to render control at
* @param y vertical position of a control to be rendered at
* @param text text to be rendered inside control
* @param is_selected whether control should be rendered as focused or not
*/
void ui_control_text_box_render(
Canvas* const canvas,
int16_t y,
const char* text,
bool is_selected);
/**
* @brief Renders Button control
* @param canvas canvas to render control at
* @param x horizontal position of a control to be rendered at
* @param y vertical position of a control to be rendered at
* @param width control width
* @param height control height
* @param text text to be rendered inside control
* @param is_selected whether control should be rendered as focused or not
*/
void ui_control_button_render(
Canvas* const canvas,
int16_t x,
int16_t y,
uint8_t width,
uint8_t height,
const char* text,
bool is_selected);
/**
* @brief Renders Select control
* @param canvas canvas to render control at
* @param x horizontal position of a control to be rendered at
* @param y vertical position of a control to be rendered at
* @param width control width
* @param text text to be rendered inside control
* @param is_selected whether control should be rendered as focused or not
*/
void ui_control_select_render(
Canvas* const canvas,
int16_t x,
int16_t y,
uint8_t width,
const char* text,
bool is_selected);

View File

@@ -136,6 +136,16 @@ void cli_command_date(Cli* cli, FuriString* args, void* context) {
}
}
void cli_command_src(Cli* cli, FuriString* args, void* context) {
// Quality of life feaature for people exploring CLI on lab.flipper.net/cli
// By Yousef AK
UNUSED(cli);
UNUSED(args);
UNUSED(context);
printf("https://github.com/DarkFlippers/unleashed-firmware");
}
#define CLI_COMMAND_LOG_RING_SIZE 2048
#define CLI_COMMAND_LOG_BUFFER_SIZE 64
@@ -412,6 +422,8 @@ void cli_command_i2c(Cli* cli, FuriString* args, void* context) {
void cli_commands_init(Cli* cli) {
cli_add_command(cli, "!", CliCommandFlagParallelSafe, cli_command_device_info, NULL);
cli_add_command(cli, "device_info", CliCommandFlagParallelSafe, cli_command_device_info, NULL);
cli_add_command(cli, "src", CliCommandFlagParallelSafe, cli_command_src, NULL);
cli_add_command(cli, "source", CliCommandFlagParallelSafe, cli_command_src, NULL);
cli_add_command(cli, "?", CliCommandFlagParallelSafe, cli_command_help, NULL);
cli_add_command(cli, "help", CliCommandFlagParallelSafe, cli_command_help, NULL);

View File

@@ -68,10 +68,7 @@ static void cli_vcp_init() {
vcp->connected = false;
vcp->thread = furi_thread_alloc();
furi_thread_set_name(vcp->thread, "CliVcpWorker");
furi_thread_set_stack_size(vcp->thread, 1024);
furi_thread_set_callback(vcp->thread, vcp_worker);
vcp->thread = furi_thread_alloc_ex("CliVcpWorker", 1024, vcp_worker, NULL);
furi_thread_start(vcp->thread);
FURI_LOG_I(TAG, "Init OK");

View File

@@ -371,11 +371,7 @@ BrowserWorker*
browser->skip_assets = skip_assets;
browser->path_next = furi_string_alloc_set(path);
browser->thread = furi_thread_alloc();
furi_thread_set_name(browser->thread, "BrowserWorker");
furi_thread_set_stack_size(browser->thread, 2048);
furi_thread_set_context(browser->thread, browser);
furi_thread_set_callback(browser->thread, browser_worker);
browser->thread = furi_thread_alloc_ex("BrowserWorker", 2048, browser_worker, browser);
furi_thread_start(browser->thread);
return browser;

View File

@@ -370,11 +370,7 @@ RpcSession* rpc_session_open(Rpc* rpc) {
};
rpc_add_handler(session, PB_Main_stop_session_tag, &rpc_handler);
session->thread = furi_thread_alloc();
furi_thread_set_name(session->thread, "RpcSessionWorker");
furi_thread_set_stack_size(session->thread, 3072);
furi_thread_set_context(session->thread, session);
furi_thread_set_callback(session->thread, rpc_session_worker);
session->thread = furi_thread_alloc_ex("RpcSessionWorker", 3072, rpc_session_worker, session);
furi_thread_set_state_context(session->thread, session);
furi_thread_set_state_callback(session->thread, rpc_session_free_callback);

View File

@@ -88,12 +88,8 @@ static void rpc_system_gui_start_screen_stream_process(const PB_Main* request, v
malloc(PB_BYTES_ARRAY_T_ALLOCSIZE(framebuffer_size));
rpc_gui->transmit_frame->content.gui_screen_frame.data->size = framebuffer_size;
// Transmission thread for async TX
rpc_gui->transmit_thread = furi_thread_alloc();
furi_thread_set_name(rpc_gui->transmit_thread, "GuiRpcWorker");
furi_thread_set_callback(
rpc_gui->transmit_thread, rpc_system_gui_screen_stream_frame_transmit_thread);
furi_thread_set_context(rpc_gui->transmit_thread, rpc_gui);
furi_thread_set_stack_size(rpc_gui->transmit_thread, 1024);
rpc_gui->transmit_thread = furi_thread_alloc_ex(
"GuiRpcWorker", 1024, rpc_system_gui_screen_stream_frame_transmit_thread, rpc_gui);
furi_thread_start(rpc_gui->transmit_thread);
// GUI framebuffer callback
gui_add_framebuffer_callback(

View File

@@ -110,11 +110,8 @@ static void updater_start_app() {
* inside loader process, at startup.
* So, accessing its record would cause a deadlock
*/
FuriThread* thread = furi_thread_alloc();
furi_thread_set_name(thread, "UpdateAppSpawner");
furi_thread_set_stack_size(thread, 768);
furi_thread_set_callback(thread, updater_spawner_thread_worker);
FuriThread* thread =
furi_thread_alloc_ex("UpdateAppSpawner", 768, updater_spawner_thread_worker, NULL);
furi_thread_set_state_callback(thread, updater_spawner_thread_cleanup);
furi_thread_set_state_context(thread, thread);
furi_thread_start(thread);

View File

@@ -216,11 +216,8 @@ UpdateTask* update_task_alloc() {
update_task->boot_mode = furi_hal_rtc_get_boot_mode();
update_task->update_path = furi_string_alloc();
FuriThread* thread = update_task->thread = furi_thread_alloc();
furi_thread_set_name(thread, "UpdateWorker");
furi_thread_set_stack_size(thread, 5120);
furi_thread_set_context(thread, update_task);
FuriThread* thread = update_task->thread =
furi_thread_alloc_ex("UpdateWorker", 5120, NULL, update_task);
furi_thread_set_state_callback(thread, update_task_worker_thread_cb);
furi_thread_set_state_context(thread, update_task);

View File

@@ -1,6 +1,30 @@
Filetype: IR library file
Version: 1
# Last Updated 30th Oct, 2022
# Last Updated 14th Nov, 2022
#
name: POWER
type: raw
frequency: 38000
duty_cycle: 0.330000
data: 3480 1701 468 1248 467 1250 465 407 460 411 467 405 462 1255 460 412 466 405 462 1255 460 1257 468 404 463 1253 462 410 468 404 463 1253 462 1255 470 402 465 1252 463 1254 461 411 467 405 462 1254 461 411 467 405 462 1254 461 411 467 405 462 409 469 403 464 407 460 411 467 405 462 409 469 403 464 407 461 411 467 405 462 409 469 403 464 407 460 411 467 404 463 1254 461 410 468 404 463 1254 461 410 468 404 463 408 460 412 466 406 462 1255 460 412 466 406 461 410 468 404 463 1253 462 1255 470 1247 468 404 463 409 469 402 465 406 461 411 467 1250 465 407 460 1256 469 1248 467 1250 465 1252 463 410 468 403 464 408 460 412 466 406 461 410 468 404 463 408 460 412 466 406 461 410 468 404 463 408 459 412 466 405 462 409 469 403 464 407 460 411 467 405 462 409 469 403 464 407 460 411 467 405 462 409 469 402 465 407 460 411 467 404 463 1253 462 1255 470 402 465 406 461 1256 469 402 465 1252 463 408 470 1248 467 1250 465 407 460 1256 469
#
name: TEMP+
type: raw
frequency: 38000
duty_cycle: 0.330000
data: 3477 1704 465 1251 463 1254 460 411 467 405 462 410 468 1249 465 406 461 410 468 1249 465 1252 462 409 469 1248 466 406 461 410 468 1249 465 1252 462 409 469 1248 466 1251 463 408 470 402 465 1252 462 409 469 403 464 1253 461 410 468 404 463 408 470 402 465 407 460 411 467 405 462 409 469 403 464 407 460 412 466 405 462 410 468 404 463 408 459 412 465 406 461 1255 470 402 465 407 460 1256 469 403 464 407 460 411 467 405 462 410 468 1249 465 406 461 410 468 404 463 408 470 1248 466 1250 464 1252 462 410 468 1249 465 407 460 411 467 405 462 1255 459 412 466 1251 463 1254 460 1256 469 1248 466 406 461 410 468 404 463 409 469 403 464 407 460 411 467 405 462 409 469 403 464 407 460 412 466 405 462 410 468 404 463 408 459 412 466 406 461 410 468 404 463 408 470 402 465 406 461 411 467 404 463 409 469 402 465 407 460 411 467 405 462 1254 460 1256 469 403 464 407 460 1257 468 404 463 1254 460 411 467 405 462 409 469 1249 465 1251 463
#
name: TEMP-
type: raw
frequency: 38000
duty_cycle: 0.330000
data: 3477 1703 466 1251 463 1253 461 411 467 404 463 409 469 1248 466 405 462 409 469 1249 465 1251 463 408 470 1248 466 405 462 409 469 1248 466 1251 463 408 459 1258 467 1250 464 407 460 411 467 1251 463 408 459 412 466 1251 463 408 470 402 465 406 461 411 467 405 462 409 469 403 464 407 460 411 467 405 462 409 469 403 464 407 460 411 467 405 462 409 469 403 464 1252 462 409 469 403 464 1253 461 410 468 404 463 408 470 402 465 407 460 1256 469 402 465 407 460 411 467 405 462 1254 460 1257 468 1249 465 406 461 411 467 1250 464 407 460 412 466 1251 463 408 470 1247 467 1250 464 1252 462 1255 470 402 465 406 461 411 467 405 462 409 469 403 464 407 460 411 467 405 462 409 469 403 464 408 459 412 466 406 461 410 468 404 463 408 459 412 466 406 461 410 468 404 463 408 470 402 465 406 461 410 468 404 463 409 469 402 465 407 460 411 467 1250 464 1252 462 409 469 403 464 1253 461 410 468 1250 464 407 460 1256 469 403 464 1253 461 1256 469
#
name: MODE
type: raw
frequency: 38000
duty_cycle: 0.330000
data: 3484 1696 462 1254 460 1257 468 404 463 408 470 402 465 1252 462 410 468 404 463 1253 461 1256 469 403 464 1253 461 410 468 404 463 1254 460 1257 468 403 464 1253 461 1256 469 403 464 407 460 1257 468 404 463 408 470 1248 466 405 462 409 469 403 464 408 459 412 466 406 461 410 468 404 463 409 469 403 464 407 460 411 467 405 462 410 468 404 463 408 459 412 465 1251 463 408 470 402 465 1252 462 409 469 403 464 1253 461 1256 469 403 464 407 460 411 466 406 461 410 468 404 463 409 469 1248 466 405 462 1254 460 412 465 406 461 410 468 404 463 1254 460 411 467 1250 464 1253 461 1256 469 1248 466 405 462 410 468 404 463 409 469 403 464 407 460 411 467 405 462 410 468 403 464 408 459 412 466 406 461 410 468 404 463 408 459 412 466 406 461 411 467 405 462 409 469 403 464 407 460 411 466 405 462 410 468 404 463 408 459 412 466 406 461 1255 470 1247 467 405 462 409 469 1249 465 1251 463 409 469 402 465 1252 462 1255 470 402 465 1252 462
#
# POWER_ON
name: POWER

View File

@@ -1,6 +1,37 @@
Filetype: IR library file
Version: 1
# Last Updated 20th Oct, 2022
# Last Updated 14th Nov, 2022
#
name: VOL+
type: parsed
protocol: NEC
address: 20 00 00 00
command: 14 00 00 00
#
name: VOL-
type: parsed
protocol: NEC
address: 20 00 00 00
command: 10 00 00 00
#
# ON
name: POWER
type: parsed
protocol: RC5
address: 10 00 00 00
command: 0E 00 00 00
#
name: VOL-
type: parsed
protocol: NECext
address: 10 E7 00 00
command: 0C F3 00 00
#
name: VOL+
type: parsed
protocol: NECext
address: 10 E7 00 00
command: 09 F6 00 00
#
name: POWER
type: raw
@@ -1568,3 +1599,10 @@ protocol: NECext
address: 12 36 00 00
command: 01 FE 00 00
#
# OFF
name: POWER
type: parsed
protocol: RC5
address: 10 00 00 00
command: 0F 00 00 00
#

View File

@@ -1,6 +1,37 @@
Filetype: IR library file
Version: 1
# Last Updated 30th Oct, 2022
# Last Updated 14th Nov, 2022
#
name: POWER
type: raw
frequency: 38000
duty_cycle: 0.330000
data: 2262 692 881 585 883 583 903 564 903 1294 882 584 881 584 882 559 820 673 895 1300 882 611 881 584 882 584 882 584 882 585 881 584 881 584 882 585 880 1317 879 586 829 1371 827 640 825 51208 2245 690 772 1424 831 50893 2240 691 772 1429 771 50906 2244 690 773 1400 772
#
name: SPEED+
type: raw
frequency: 38000
duty_cycle: 0.330000
data: 2264 668 770 721 745 694 772 694 796 1401 826 639 771 694 771 693 772 694 771 1426 798 668 769 1429 795 670 795 1404 794 672 794 1405 767 1431 767 1430 794 672 794 1404 794 1404 794 1404 766 50878 2261 645 817 1405 794 50857 2238 668 795 1428 769
#
name: SPEED-
type: raw
frequency: 38000
duty_cycle: 0.330000
data: 2264 642 823 669 797 643 822 644 822 1376 822 642 799 668 797 669 823 645 820 1401 796 670 794 1379 792 700 793 1381 790 1407 793 674 791 700 793 1406 792 673 793 673 792 673 793 673 792 50785 2262 666 796 1401 797
#
name: ROTATE
type: raw
frequency: 38000
duty_cycle: 0.330000
data: 2323 611 796 669 800 664 802 692 773 1424 774 691 801 664 774 691 774 692 773 1423 800 668 822 667 798 1376 769 1427 771 696 769 696 770 1429 795 1404 794 672 794 1404 794 671 795 1404 794 51269 2214 691 769 1427 796
#
# ON/SPEED
name: POWER
type: parsed
protocol: NECext
address: 00 FC 00 00
command: 84 7B 00 00
#
name: POWER
type: raw

View File

@@ -1,6 +1,78 @@
Filetype: IR library file
Version: 1
# Last Updated 15th Oct, 2022
# Last Updated 14th Nov, 2022
#
name: MUTE
type: parsed
protocol: NECext
address: 00 FB 00 00
command: 0F F0 00 00
#
name: POWER
type: parsed
protocol: NECext
address: 00 FB 00 00
command: 0A F5 00 00
#
name: VOL+
type: parsed
protocol: NECext
address: 00 FB 00 00
command: 58 A7 00 00
#
name: VOL-
type: parsed
protocol: NECext
address: 00 FB 00 00
command: 4B B4 00 00
#
name: CH+
type: parsed
protocol: NECext
address: 00 FB 00 00
command: 1F E0 00 00
#
name: CH-
type: parsed
protocol: NECext
address: 00 FB 00 00
command: 1E E1 00 00
#
name: POWER
type: parsed
protocol: NECext
address: 00 DF 00 00
command: 1C E3 00 00
#
name: VOL+
type: parsed
protocol: NECext
address: 00 DF 00 00
command: 4B B4 00 00
#
name: VOL-
type: parsed
protocol: NECext
address: 00 DF 00 00
command: 4F B0 00 00
#
name: MUTE
type: parsed
protocol: NECext
address: 00 DF 00 00
command: 08 F7 00 00
#
name: CH+
type: parsed
protocol: NECext
address: 00 DF 00 00
command: 09 F6 00 00
#
name: CH-
type: parsed
protocol: NECext
address: 00 DF 00 00
command: 05 FA 00 00
#
name: POWER
type: raw

View File

@@ -64,7 +64,6 @@ Frequency: 928000000
Hopper_frequency: 310000000
Hopper_frequency: 313000000
Hopper_frequency: 315000000
Hopper_frequency: 318000000
Hopper_frequency: 390000000
Hopper_frequency: 433920000
Hopper_frequency: 434420000

View File

@@ -26,10 +26,7 @@ int main() {
// Flipper critical FURI HAL
furi_hal_init_early();
FuriThread* main_thread = furi_thread_alloc();
furi_thread_set_name(main_thread, "Init");
furi_thread_set_stack_size(main_thread, 4096);
furi_thread_set_callback(main_thread, init_task);
FuriThread* main_thread = furi_thread_alloc_ex("Init", 4096, init_task, NULL);
#ifdef FURI_RAM_EXEC
furi_thread_start(main_thread);

View File

@@ -1,5 +1,5 @@
entry,status,name,type,params
Version,+,7.53,,
Version,+,7.52,,
Header,+,applications/services/bt/bt_service/bt.h,,
Header,+,applications/services/cli/cli.h,,
Header,+,applications/services/cli/cli_vcp.h,,
@@ -1492,6 +1492,7 @@ Function,+,furi_string_utf8_length,size_t,FuriString*
Function,+,furi_string_utf8_push,void,"FuriString*, FuriStringUnicodeValue"
Function,+,furi_string_vprintf,int,"FuriString*, const char[], va_list"
Function,+,furi_thread_alloc,FuriThread*,
Function,+,furi_thread_alloc_ex,FuriThread*,"const char*, uint32_t, FuriThreadCallback, void*"
Function,+,furi_thread_catch,void,
Function,-,furi_thread_disable_heap_trace,void,FuriThread*
Function,+,furi_thread_enable_heap_trace,void,FuriThread*
1 entry status name type params
2 Version + 7.53 7.52
3 Header + applications/services/bt/bt_service/bt.h
4 Header + applications/services/cli/cli.h
5 Header + applications/services/cli/cli_vcp.h
1492 Function + furi_string_utf8_push void FuriString*, FuriStringUnicodeValue
1493 Function + furi_string_vprintf int FuriString*, const char[], va_list
1494 Function + furi_thread_alloc FuriThread*
1495 Function + furi_thread_alloc_ex FuriThread* const char*, uint32_t, FuriThreadCallback, void*
1496 Function + furi_thread_catch void
1497 Function - furi_thread_disable_heap_trace void FuriThread*
1498 Function + furi_thread_enable_heap_trace void FuriThread*

View File

@@ -40,11 +40,7 @@ bool ble_app_init() {
ble_app->hci_mtx = furi_mutex_alloc(FuriMutexTypeNormal);
ble_app->hci_sem = furi_semaphore_alloc(1, 0);
// HCI transport layer thread to handle user asynch events
ble_app->thread = furi_thread_alloc();
furi_thread_set_name(ble_app->thread, "BleHciDriver");
furi_thread_set_stack_size(ble_app->thread, 1024);
furi_thread_set_context(ble_app->thread, ble_app);
furi_thread_set_callback(ble_app->thread, ble_app_hci_thread);
ble_app->thread = furi_thread_alloc_ex("BleHciDriver", 1024, ble_app_hci_thread, ble_app);
furi_thread_start(ble_app->thread);
// Initialize Ble Transport Layer

View File

@@ -78,11 +78,7 @@ void ble_glue_init() {
ble_glue->shci_sem = furi_semaphore_alloc(1, 0);
// FreeRTOS system task creation
ble_glue->thread = furi_thread_alloc();
furi_thread_set_name(ble_glue->thread, "BleShciDriver");
furi_thread_set_stack_size(ble_glue->thread, 1024);
furi_thread_set_context(ble_glue->thread, ble_glue);
furi_thread_set_callback(ble_glue->thread, ble_glue_shci_thread);
ble_glue->thread = furi_thread_alloc_ex("BleShciDriver", 1024, ble_glue_shci_thread, ble_glue);
furi_thread_start(ble_glue->thread);
// System channel initialization

View File

@@ -492,11 +492,7 @@ bool gap_init(GapConfig* config, GapEventCallback on_event_cb, void* context) {
gap->enable_adv = true;
// Thread configuration
gap->thread = furi_thread_alloc();
furi_thread_set_name(gap->thread, "BleGapDriver");
furi_thread_set_stack_size(gap->thread, 1024);
furi_thread_set_context(gap->thread, gap);
furi_thread_set_callback(gap->thread, gap_app);
gap->thread = furi_thread_alloc_ex("BleGapDriver", 1024, gap_app, gap);
furi_thread_start(gap->thread);
// Command queue allocation

View File

@@ -60,27 +60,25 @@ void furi_hal_init() {
furi_hal_crypto_init();
// USB
#ifndef FURI_RAM_EXEC
// TODO: call furi_hal_memory_init before furi_hal_usb_init, to get more memory
furi_hal_usb_init();
FURI_LOG_I(TAG, "USB OK");
#endif
furi_hal_i2c_init();
// High Level
furi_hal_power_init();
furi_hal_light_init();
furi_hal_bt_init();
furi_hal_memory_init();
furi_hal_compress_icon_init();
#ifndef FURI_RAM_EXEC
// USB
furi_hal_usb_init();
FURI_LOG_I(TAG, "USB OK");
furi_hal_vibro_init();
furi_hal_subghz_init();
furi_hal_nfc_init();
furi_hal_rfid_init();
#endif
furi_hal_bt_init();
furi_hal_memory_init(); // must be called after furi_hal_bt_init
furi_hal_compress_icon_init();
// FatFS driver initialization
MX_FATFS_Init();

View File

@@ -80,10 +80,8 @@ void furi_hal_usb_init(void) {
NVIC_EnableIRQ(USB_LP_IRQn);
NVIC_EnableIRQ(USB_HP_IRQn);
usb.thread = furi_thread_alloc();
furi_thread_set_name(usb.thread, "UsbDriver");
furi_thread_set_stack_size(usb.thread, 1024);
furi_thread_set_callback(usb.thread, furi_hal_usb_thread);
usb.thread = furi_thread_alloc_ex("UsbDriver", 1024, furi_hal_usb_thread, NULL);
furi_thread_mark_as_service(usb.thread);
furi_thread_start(usb.thread);
FURI_LOG_I(TAG, "Init OK");

View File

@@ -135,6 +135,19 @@ FuriThread* furi_thread_alloc() {
return thread;
}
FuriThread* furi_thread_alloc_ex(
const char* name,
uint32_t stack_size,
FuriThreadCallback callback,
void* context) {
FuriThread* thread = furi_thread_alloc();
furi_thread_set_name(thread, name);
furi_thread_set_stack_size(thread, stack_size);
furi_thread_set_callback(thread, callback);
furi_thread_set_context(thread, context);
return thread;
}
void furi_thread_free(FuriThread* thread) {
furi_assert(thread);
furi_assert(thread->state == FuriThreadStateStopped);

View File

@@ -60,6 +60,20 @@ typedef void (*FuriThreadStateCallback)(FuriThreadState state, void* context);
*/
FuriThread* furi_thread_alloc();
/** Allocate FuriThread, shortcut version
*
* @param name
* @param stack_size
* @param callback
* @param context
* @return FuriThread*
*/
FuriThread* furi_thread_alloc_ex(
const char* name,
uint32_t stack_size,
FuriThreadCallback callback,
void* context);
/** Release FuriThread
*
* @param thread FuriThread instance

View File

@@ -34,11 +34,11 @@ void flipper_init() {
for(size_t i = 0; i < FLIPPER_SERVICES_COUNT; i++) {
FURI_LOG_I(TAG, "starting service %s", FLIPPER_SERVICES[i].name);
FuriThread* thread = furi_thread_alloc();
furi_thread_set_name(thread, FLIPPER_SERVICES[i].name);
furi_thread_set_stack_size(thread, FLIPPER_SERVICES[i].stack_size);
furi_thread_set_callback(thread, FLIPPER_SERVICES[i].app);
FuriThread* thread = furi_thread_alloc_ex(
FLIPPER_SERVICES[i].name,
FLIPPER_SERVICES[i].stack_size,
FLIPPER_SERVICES[i].app,
NULL);
furi_thread_mark_as_service(thread);
furi_thread_start(thread);

View File

@@ -45,11 +45,9 @@ void platformDisableIrqCallback() {
void platformSetIrqCallback(PlatformIrqCallback callback) {
rfal_platform.callback = callback;
rfal_platform.thread = furi_thread_alloc();
furi_thread_set_name(rfal_platform.thread, "RfalIrqDriver");
furi_thread_set_callback(rfal_platform.thread, rfal_platform_irq_thread);
furi_thread_set_stack_size(rfal_platform.thread, 1024);
rfal_platform.thread =
furi_thread_alloc_ex("RfalIrqDriver", 1024, rfal_platform_irq_thread, NULL);
furi_thread_mark_as_service(rfal_platform.thread);
furi_thread_set_priority(rfal_platform.thread, FuriThreadPriorityIsr);
furi_thread_start(rfal_platform.thread);

View File

@@ -104,11 +104,8 @@ FuriThread* flipper_application_spawn(FlipperApplication* app, void* args) {
const FlipperApplicationManifest* manifest = flipper_application_get_manifest(app);
furi_check(manifest->stack_size > 0);
app->thread = furi_thread_alloc();
furi_thread_set_stack_size(app->thread, manifest->stack_size);
furi_thread_set_name(app->thread, manifest->name);
furi_thread_set_callback(app->thread, flipper_application_thread);
furi_thread_set_context(app->thread, args);
app->thread = furi_thread_alloc_ex(
manifest->name, manifest->stack_size, flipper_application_thread, args);
return app->thread;
}

View File

@@ -223,10 +223,7 @@ void infrared_worker_rx_set_received_signal_callback(
InfraredWorker* infrared_worker_alloc() {
InfraredWorker* instance = malloc(sizeof(InfraredWorker));
instance->thread = furi_thread_alloc();
furi_thread_set_name(instance->thread, "InfraredWorker");
furi_thread_set_stack_size(instance->thread, 2048);
furi_thread_set_context(instance->thread, instance);
instance->thread = furi_thread_alloc_ex("InfraredWorker", 2048, NULL, instance);
size_t buffer_size =
MAX(sizeof(InfraredWorkerTiming) * (MAX_TIMINGS_AMOUNT + 1),

View File

@@ -61,10 +61,7 @@ static int32_t lfrfid_raw_emulate_worker_thread(void* thread_context);
LFRFIDRawWorker* lfrfid_raw_worker_alloc() {
LFRFIDRawWorker* worker = malloc(sizeof(LFRFIDRawWorker));
worker->thread = furi_thread_alloc();
furi_thread_set_name(worker->thread, "lfrfid_raw_worker");
furi_thread_set_context(worker->thread, worker);
furi_thread_set_stack_size(worker->thread, 2048);
worker->thread = furi_thread_alloc_ex("LfrfidRawWorker", 2048, NULL, worker);
worker->events = furi_event_flag_alloc(NULL);

View File

@@ -29,11 +29,7 @@ LFRFIDWorker* lfrfid_worker_alloc(ProtocolDict* dict) {
worker->raw_filename = NULL;
worker->mode_storage = NULL;
worker->thread = furi_thread_alloc();
furi_thread_set_name(worker->thread, "lfrfid_worker");
furi_thread_set_callback(worker->thread, lfrfid_worker_thread);
furi_thread_set_context(worker->thread, worker);
furi_thread_set_stack_size(worker->thread, 2048);
worker->thread = furi_thread_alloc_ex("LfrfidWorker", 2048, lfrfid_worker_thread, worker);
worker->protocols = dict;

View File

@@ -108,11 +108,8 @@ ReaderAnalyzer* reader_analyzer_alloc() {
instance->stream =
furi_stream_buffer_alloc(READER_ANALYZER_MAX_BUFF_SIZE, sizeof(ReaderAnalyzerHeader));
instance->thread = furi_thread_alloc();
furi_thread_set_name(instance->thread, "ReaderAnalyzerWorker");
furi_thread_set_stack_size(instance->thread, 2048);
furi_thread_set_callback(instance->thread, reader_analyzer_thread);
furi_thread_set_context(instance->thread, instance);
instance->thread =
furi_thread_alloc_ex("ReaderAnalyzerWorker", 2048, reader_analyzer_thread, instance);
furi_thread_set_priority(instance->thread, FuriThreadPriorityLow);
return instance;

View File

@@ -12,11 +12,7 @@ NfcWorker* nfc_worker_alloc() {
NfcWorker* nfc_worker = malloc(sizeof(NfcWorker));
// Worker thread attributes
nfc_worker->thread = furi_thread_alloc();
furi_thread_set_name(nfc_worker->thread, "NfcWorker");
furi_thread_set_stack_size(nfc_worker->thread, 8192);
furi_thread_set_callback(nfc_worker->thread, nfc_worker_task);
furi_thread_set_context(nfc_worker->thread, nfc_worker);
nfc_worker->thread = furi_thread_alloc_ex("NfcWorker", 8192, nfc_worker_task, nfc_worker);
nfc_worker->callback = NULL;
nfc_worker->context = NULL;

View File

@@ -37,11 +37,7 @@ iButtonWorker* ibutton_worker_alloc() {
worker->emulate_cb = NULL;
worker->cb_ctx = NULL;
worker->thread = furi_thread_alloc();
furi_thread_set_name(worker->thread, "ibutton_worker");
furi_thread_set_callback(worker->thread, ibutton_worker_thread);
furi_thread_set_context(worker->thread, worker);
furi_thread_set_stack_size(worker->thread, 2048);
worker->thread = furi_thread_alloc_ex("iButtonWorker", 2048, ibutton_worker_thread, worker);
worker->protocols = protocol_dict_alloc(ibutton_protocols, iButtonProtocolMax);

View File

@@ -77,7 +77,7 @@ const SubGhzProtocol subghz_protocol_star_line = {
.name = SUBGHZ_PROTOCOL_STAR_LINE_NAME,
.type = SubGhzProtocolTypeDynamic,
.flag = SubGhzProtocolFlag_433 | SubGhzProtocolFlag_AM | SubGhzProtocolFlag_Decodable |
SubGhzProtocolFlag_Load | SubGhzProtocolFlag_Save,
SubGhzProtocolFlag_Load | SubGhzProtocolFlag_Save | SubGhzProtocolFlag_Send,
.decoder = &subghz_protocol_star_line_decoder,
.encoder = &subghz_protocol_star_line_encoder,
@@ -236,7 +236,7 @@ static bool subghz_protocol_encoder_star_line_get_upload(
}
size_t index = 0;
size_t size_upload = 6 * 2 + (instance->generic.data_count_bit * 2) + 4;
size_t size_upload = 6 * 2 + (instance->generic.data_count_bit * 2);
if(size_upload > instance->encoder.size_upload) {
FURI_LOG_E(TAG, "Size upload exceeds allocated encoder buffer.");
return false;
@@ -763,8 +763,7 @@ void subghz_protocol_decoder_star_line_get_string(void* context, FuriString* out
"Key:%08lX%08lX\r\n"
"Fix:0x%08lX Cnt:%04lX\r\n"
"Hop:0x%08lX Btn:%02X\r\n"
"MF:%s\r\n"
"Sn:0x%07lX \r\n",
"MF:%s\r\n",
instance->generic.protocol_name,
instance->generic.data_count_bit,
code_found_hi,
@@ -773,6 +772,5 @@ void subghz_protocol_decoder_star_line_get_string(void* context, FuriString* out
instance->generic.cnt,
code_found_reverse_lo,
instance->generic.btn,
instance->manufacture_name,
instance->generic.serial);
instance->manufacture_name);
}

View File

@@ -186,11 +186,8 @@ static int32_t subghz_file_encoder_worker_thread(void* context) {
SubGhzFileEncoderWorker* subghz_file_encoder_worker_alloc() {
SubGhzFileEncoderWorker* instance = malloc(sizeof(SubGhzFileEncoderWorker));
instance->thread = furi_thread_alloc();
furi_thread_set_name(instance->thread, "SubGhzFEWorker");
furi_thread_set_stack_size(instance->thread, 2048);
furi_thread_set_context(instance->thread, instance);
furi_thread_set_callback(instance->thread, subghz_file_encoder_worker_thread);
instance->thread =
furi_thread_alloc_ex("SubGhzFEWorker", 2048, subghz_file_encoder_worker_thread, instance);
instance->stream = furi_stream_buffer_alloc(sizeof(int32_t) * 2048, sizeof(int32_t));
instance->storage = furi_record_open(RECORD_STORAGE);

View File

@@ -201,11 +201,8 @@ static int32_t subghz_tx_rx_worker_thread(void* context) {
SubGhzTxRxWorker* subghz_tx_rx_worker_alloc() {
SubGhzTxRxWorker* instance = malloc(sizeof(SubGhzTxRxWorker));
instance->thread = furi_thread_alloc();
furi_thread_set_name(instance->thread, "SubGhzTxRxWorker");
furi_thread_set_stack_size(instance->thread, 2048);
furi_thread_set_context(instance->thread, instance);
furi_thread_set_callback(instance->thread, subghz_tx_rx_worker_thread);
instance->thread =
furi_thread_alloc_ex("SubGhzTxRxWorker", 2048, subghz_tx_rx_worker_thread, instance);
instance->stream_tx =
furi_stream_buffer_alloc(sizeof(uint8_t) * SUBGHZ_TXRX_WORKER_BUF_SIZE, sizeof(uint8_t));
instance->stream_rx =

View File

@@ -88,11 +88,8 @@ static int32_t subghz_worker_thread_callback(void* context) {
SubGhzWorker* subghz_worker_alloc() {
SubGhzWorker* instance = malloc(sizeof(SubGhzWorker));
instance->thread = furi_thread_alloc();
furi_thread_set_name(instance->thread, "SubGhzWorker");
furi_thread_set_stack_size(instance->thread, 2048);
furi_thread_set_context(instance->thread, instance);
furi_thread_set_callback(instance->thread, subghz_worker_thread_callback);
instance->thread =
furi_thread_alloc_ex("SubGhzWorker", 2048, subghz_worker_thread_callback, instance);
instance->stream =
furi_stream_buffer_alloc(sizeof(LevelDuration) * 4096, sizeof(LevelDuration));