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

Commit

Permalink
V46 Release Candidate Changes (#236)
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored May 6, 2023
2 parents 326e114 + 075c52c commit 673d28c
Show file tree
Hide file tree
Showing 51 changed files with 1,022 additions and 703 deletions.
2 changes: 1 addition & 1 deletion .github/workflow_data/hotfix.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
body = body.replace("<!--- <HOTFIXES>\n", "")
body = body.replace("\n<HOTFIXES> -->", "")
insert = body.find("\n [//]: <NEXT_HOTFIX>\n")
body = body[:insert] + hotfix + body[:insert]
body = body[:insert] + hotfix + body[insert:]

req = requests.patch(
release["url"],
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
*.swp
*.swo
*.gdb_history
*.old


# LSP
Expand Down
6 changes: 2 additions & 4 deletions applications/external/hid_app/views/hid_mouse_jiggler.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

#define TAG "HidMouseJiggler"

#define LENGTH(x) (int)(sizeof(x) / sizeof((x)[0]))

struct HidMouseJiggler {
View* view;
Hid* hid;
Expand Down Expand Up @@ -44,7 +42,7 @@ static void hid_mouse_jiggler_draw_callback(Canvas* canvas, void* context) {
elements_multiline_text(canvas, AlignLeft, 26, "Interval (ms):");
canvas_set_font(canvas, FontSecondary);
if(model->interval_idx != 0) canvas_draw_icon(canvas, 74, 19, &I_ButtonLeft_4x7);
if(model->interval_idx != LENGTH(intervals) - 1)
if(model->interval_idx != (int)COUNT_OF(intervals) - 1)
canvas_draw_icon(canvas, 80, 19, &I_ButtonRight_4x7);
FuriString* interval_str = furi_string_alloc_printf("%d", intervals[model->interval_idx]);
elements_multiline_text(canvas, 91, 26, furi_string_get_cstr(interval_str));
Expand Down Expand Up @@ -116,7 +114,7 @@ static bool hid_mouse_jiggler_input_callback(InputEvent* event, void* context) {
consumed = true;
}
if(event->type == InputTypePress && event->key == InputKeyRight && !model->running &&
model->interval_idx < LENGTH(intervals) - 1) {
model->interval_idx < (int)COUNT_OF(intervals) - 1) {
model->interval_idx++;
consumed = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#define MENU_ITEMS 4u
#define UNLOCK_CNT 3

#define SUBGHZ_RAW_TRESHOLD_MIN -90.0f
#define SUBGHZ_RAW_THRESHOLD_MIN -90.0f

typedef struct {
FuriString* item_str;
Expand Down Expand Up @@ -69,10 +69,10 @@ void pcsg_receiver_rssi(PCSGReceiver* instance, float rssi) {
instance->view,
PCSGReceiverModel * model,
{
if(rssi < SUBGHZ_RAW_TRESHOLD_MIN) {
if(rssi < SUBGHZ_RAW_THRESHOLD_MIN) {
model->u_rssi = 0;
} else {
model->u_rssi = (uint8_t)(rssi - SUBGHZ_RAW_TRESHOLD_MIN);
model->u_rssi = (uint8_t)(rssi - SUBGHZ_RAW_THRESHOLD_MIN);
}
},
true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#define MENU_ITEMS 4u
#define UNLOCK_CNT 3

#define SUBGHZ_RAW_TRESHOLD_MIN -90.0f
#define SUBGHZ_RAW_THRESHOLD_MIN -90.0f
typedef struct {
FuriString* item_str;
uint8_t type;
Expand Down Expand Up @@ -69,10 +69,10 @@ void ws_view_receiver_set_rssi(WSReceiver* instance, float rssi) {
instance->view,
WSReceiverModel * model,
{
if(rssi < SUBGHZ_RAW_TRESHOLD_MIN) {
if(rssi < SUBGHZ_RAW_THRESHOLD_MIN) {
model->u_rssi = 0;
} else {
model->u_rssi = (uint8_t)(rssi - SUBGHZ_RAW_TRESHOLD_MIN);
model->u_rssi = (uint8_t)(rssi - SUBGHZ_RAW_THRESHOLD_MIN);
}
},
true);
Expand Down
28 changes: 9 additions & 19 deletions applications/main/subghz/scenes/subghz_scene_decode_raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,10 @@

static void subghz_scene_receiver_update_statusbar(void* context) {
SubGhz* subghz = context;
FuriString* history_stat_str;
history_stat_str = furi_string_alloc();
FuriString* history_stat_str = furi_string_alloc();
if(!subghz_history_get_text_space_left(subghz->txrx->history, history_stat_str)) {
FuriString* frequency_str;
FuriString* modulation_str;

frequency_str = furi_string_alloc();
modulation_str = furi_string_alloc();
FuriString* frequency_str = furi_string_alloc();
FuriString* modulation_str = furi_string_alloc();

subghz_get_frequency_modulation(subghz, frequency_str, modulation_str);

Expand Down Expand Up @@ -62,11 +58,9 @@ static void subghz_scene_add_to_history_callback(
void* context) {
furi_assert(context);
SubGhz* subghz = context;
FuriString* item_name;
FuriString* item_time;
FuriString* item_name = furi_string_alloc();
FuriString* item_time = furi_string_alloc();
uint16_t idx = subghz_history_get_item(subghz->txrx->history);
item_name = furi_string_alloc();
item_time = furi_string_alloc();

if(subghz_history_add_to_history(subghz->txrx->history, decoder_base, subghz->txrx->preset)) {
furi_string_reset(item_name);
Expand All @@ -90,8 +84,7 @@ static void subghz_scene_add_to_history_callback(
}

bool subghz_scene_decode_raw_start(SubGhz* subghz) {
FuriString* file_name;
file_name = furi_string_alloc();
FuriString* file_name = furi_string_alloc();
bool success = false;
do {
if(!flipper_format_rewind(subghz->txrx->fff_data)) {
Expand Down Expand Up @@ -148,8 +141,7 @@ bool subghz_scene_decode_raw_next(SubGhz* subghz) {
}

// Update progress info
FuriString* progress_str;
progress_str = furi_string_alloc();
FuriString* progress_str = furi_string_alloc();
subghz_file_encoder_worker_get_text_progress(
subghz->decode_raw_file_worker_encoder, progress_str);

Expand All @@ -164,10 +156,8 @@ bool subghz_scene_decode_raw_next(SubGhz* subghz) {
void subghz_scene_decode_raw_on_enter(void* context) {
SubGhz* subghz = context;

FuriString* item_name;
FuriString* item_time;
item_name = furi_string_alloc();
item_time = furi_string_alloc();
FuriString* item_name = furi_string_alloc();
FuriString* item_time = furi_string_alloc();

subghz_view_receiver_set_lock(subghz->subghz_receiver, subghz->lock);
subghz_view_receiver_set_mode(subghz->subghz_receiver, SubGhzViewReceiverModeFile);
Expand Down
10 changes: 3 additions & 7 deletions applications/main/subghz/scenes/subghz_scene_delete.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,9 @@ void subghz_scene_delete_callback(GuiButtonType result, InputType type, void* co

void subghz_scene_delete_on_enter(void* context) {
SubGhz* subghz = context;
FuriString* frequency_str;
FuriString* modulation_str;
FuriString* text;

frequency_str = furi_string_alloc();
modulation_str = furi_string_alloc();
text = furi_string_alloc();
FuriString* frequency_str = furi_string_alloc();
FuriString* modulation_str = furi_string_alloc();
FuriString* text = furi_string_alloc();

subghz_get_frequency_modulation(subghz, frequency_str, modulation_str);
widget_add_string_element(
Expand Down
7 changes: 2 additions & 5 deletions applications/main/subghz/scenes/subghz_scene_delete_raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@ void subghz_scene_delete_raw_callback(GuiButtonType result, InputType type, void

void subghz_scene_delete_raw_on_enter(void* context) {
SubGhz* subghz = context;
FuriString* frequency_str;
FuriString* modulation_str;

frequency_str = furi_string_alloc();
modulation_str = furi_string_alloc();
FuriString* frequency_str = furi_string_alloc();
FuriString* modulation_str = furi_string_alloc();

char delete_str[SUBGHZ_MAX_LEN_NAME + 16];
FuriString* file_name;
Expand Down
16 changes: 5 additions & 11 deletions applications/main/subghz/scenes/subghz_scene_read_raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
bool subghz_scene_read_raw_update_filename(SubGhz* subghz) {
bool ret = false;
//set the path to read the file
FuriString* temp_str;
temp_str = furi_string_alloc();
FuriString* temp_str = furi_string_alloc();
do {
if(!flipper_format_rewind(subghz->txrx->fff_data)) {
FURI_LOG_E(TAG, "Rewind error");
Expand All @@ -38,11 +37,8 @@ static void subghz_scene_read_raw_update_statusbar(void* context) {
furi_assert(context);
SubGhz* subghz = context;

FuriString* frequency_str;
FuriString* modulation_str;

frequency_str = furi_string_alloc();
modulation_str = furi_string_alloc();
FuriString* frequency_str = furi_string_alloc();
FuriString* modulation_str = furi_string_alloc();

#ifdef SUBGHZ_EXT_PRESET_NAME
subghz_get_frequency_modulation(subghz, frequency_str, NULL);
Expand Down Expand Up @@ -74,8 +70,7 @@ void subghz_scene_read_raw_callback_end_tx(void* context) {

void subghz_scene_read_raw_on_enter(void* context) {
SubGhz* subghz = context;
FuriString* file_name;
file_name = furi_string_alloc();
FuriString* file_name = furi_string_alloc();

switch(subghz->txrx->rx_key_state) {
case SubGhzRxKeyStateBack:
Expand Down Expand Up @@ -313,8 +308,7 @@ bool subghz_scene_read_raw_on_event(void* context, SceneManagerEvent event) {
subghz_protocol_raw_save_to_file_stop(
(SubGhzProtocolDecoderRAW*)subghz->txrx->decoder_result);

FuriString* temp_str;
temp_str = furi_string_alloc();
FuriString* temp_str = furi_string_alloc();
furi_string_printf(
temp_str, "%s/%s%s", SUBGHZ_RAW_FOLDER, RAW_FILE_NAME, SUBGHZ_APP_EXTENSION);
subghz_protocol_raw_gen_fff_data(
Expand Down
24 changes: 9 additions & 15 deletions applications/main/subghz/scenes/subghz_scene_receiver.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,10 @@ const NotificationSequence subghz_sequence_rx_locked = {

static void subghz_scene_receiver_update_statusbar(void* context) {
SubGhz* subghz = context;
FuriString* history_stat_str;
history_stat_str = furi_string_alloc();
FuriString* history_stat_str = furi_string_alloc();
if(!subghz_history_get_text_space_left(subghz->txrx->history, history_stat_str)) {
FuriString* frequency_str;
FuriString* modulation_str;

frequency_str = furi_string_alloc();
modulation_str = furi_string_alloc();
FuriString* frequency_str = furi_string_alloc();
FuriString* modulation_str = furi_string_alloc();

#ifdef SUBGHZ_EXT_PRESET_NAME
if(subghz_history_get_last_index(subghz->txrx->history) > 0) {
Expand Down Expand Up @@ -90,12 +86,12 @@ static void subghz_scene_add_to_history_callback(
SubGhzProtocolDecoderBase* decoder_base,
void* context) {
furi_assert(context);

SubGhz* subghz = context;
FuriString* item_name;
FuriString* item_time;

FuriString* item_name = furi_string_alloc();
FuriString* item_time = furi_string_alloc();
uint16_t idx = subghz_history_get_item(subghz->txrx->history);
item_name = furi_string_alloc();
item_time = furi_string_alloc();

if(subghz_history_add_to_history(subghz->txrx->history, decoder_base, subghz->txrx->preset)) {
furi_string_reset(item_name);
Expand All @@ -122,10 +118,8 @@ static void subghz_scene_add_to_history_callback(
void subghz_scene_receiver_on_enter(void* context) {
SubGhz* subghz = context;

FuriString* item_name;
FuriString* item_time;
item_name = furi_string_alloc();
item_time = furi_string_alloc();
FuriString* item_name = furi_string_alloc();
FuriString* item_time = furi_string_alloc();

if(subghz->txrx->rx_key_state == SubGhzRxKeyStateIDLE) {
subghz_preset_init(subghz, "AM650", subghz->last_settings->frequency, NULL, 0);
Expand Down
10 changes: 3 additions & 7 deletions applications/main/subghz/scenes/subghz_scene_receiver_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,9 @@ static bool subghz_scene_receiver_info_update_parser(void* context) {

void subghz_scene_receiver_info_draw_widget(SubGhz* subghz) {
if(subghz_scene_receiver_info_update_parser(subghz)) {
FuriString* frequency_str;
FuriString* modulation_str;
FuriString* text;

frequency_str = furi_string_alloc();
modulation_str = furi_string_alloc();
text = furi_string_alloc();
FuriString* frequency_str = furi_string_alloc();
FuriString* modulation_str = furi_string_alloc();
FuriString* text = furi_string_alloc();

subghz_get_frequency_modulation(subghz, frequency_str, modulation_str);
widget_add_string_element(
Expand Down
3 changes: 1 addition & 2 deletions applications/main/subghz/scenes/subghz_scene_rpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ bool subghz_scene_rpc_on_event(void* context, SceneManagerEvent event) {
subghz->scene_manager, SubGhzSceneRpc, SubGhzRpcStateLoaded);
furi_string_set(subghz->file_path, arg);
result = true;
FuriString* file_name;
file_name = furi_string_alloc();
FuriString* file_name = furi_string_alloc();
path_extract_filename(subghz->file_path, file_name, true);

snprintf(
Expand Down
8 changes: 3 additions & 5 deletions applications/main/subghz/scenes/subghz_scene_save_name.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,8 @@ void subghz_scene_save_name_on_enter(void* context) {
TextInput* text_input = subghz->text_input;
bool dev_name_empty = false;

FuriString* file_name;
FuriString* dir_name;
file_name = furi_string_alloc();
dir_name = furi_string_alloc();
FuriString* file_name = furi_string_alloc();
FuriString* dir_name = furi_string_alloc();

if(!subghz_path_is_file(subghz->file_path)) {
char file_name_buf[SUBGHZ_MAX_LEN_NAME] = {0};
Expand Down Expand Up @@ -109,7 +107,7 @@ void subghz_scene_save_name_on_enter(void* context) {
subghz_scene_save_name_text_input_callback,
subghz,
subghz->file_name_tmp,
MAX_TEXT_INPUT_LEN, // buffer size
MAX_TEXT_INPUT_LEN,
dev_name_empty);

ValidatorIsFile* validator_is_file = validator_is_file_alloc_init(
Expand Down
11 changes: 5 additions & 6 deletions applications/main/subghz/scenes/subghz_scene_show_error.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ void subghz_scene_show_error_on_enter(void* context) {

bool subghz_scene_show_error_on_event(void* context, SceneManagerEvent event) {
SubGhz* subghz = context;
SubGhzCustomEvent scene_state =
scene_manager_get_scene_state(subghz->scene_manager, SubGhzSceneShowError);
if(event.type == SceneManagerEventTypeBack) {
if(scene_manager_get_scene_state(subghz->scene_manager, SubGhzSceneShowError) ==
SubGhzCustomEventManagerSet) {
if(scene_state == SubGhzCustomEventManagerSet) {
return false;
} else {
scene_manager_search_and_switch_to_previous_scene(
Expand All @@ -61,14 +62,12 @@ bool subghz_scene_show_error_on_event(void* context, SceneManagerEvent event) {
return true;
} else if(event.type == SceneManagerEventTypeCustom) {
if(event.event == SubGhzCustomEventSceneShowErrorOk) {
if(scene_manager_get_scene_state(subghz->scene_manager, SubGhzSceneShowError) ==
SubGhzCustomEventManagerSet) {
if(scene_state == SubGhzCustomEventManagerSet) {
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneStart);
}
return true;
} else if(event.event == SubGhzCustomEventSceneShowErrorBack) {
if(scene_manager_get_scene_state(subghz->scene_manager, SubGhzSceneShowError) ==
SubGhzCustomEventManagerSet) {
if(scene_state == SubGhzCustomEventManagerSet) {
//exit app
if(!scene_manager_previous_scene(subghz->scene_manager)) {
scene_manager_stop(subghz->scene_manager);
Expand Down
13 changes: 5 additions & 8 deletions applications/main/subghz/scenes/subghz_scene_transmitter.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,19 @@ bool subghz_scene_transmitter_update_data_show(void* context) {
SubGhz* subghz = context;
bool ret = false;
if(subghz->txrx->decoder_result) {
FuriString* key_str;
FuriString* frequency_str;
FuriString* modulation_str;
FuriString* key_str = furi_string_alloc();
FuriString* frequency_str = furi_string_alloc();
FuriString* modulation_str = furi_string_alloc();

key_str = furi_string_alloc();
frequency_str = furi_string_alloc();
modulation_str = furi_string_alloc();
uint8_t show_button = 0;
bool show_button = false;

if(subghz_protocol_decoder_base_deserialize(
subghz->txrx->decoder_result, subghz->txrx->fff_data) == SubGhzProtocolStatusOk) {
subghz_protocol_decoder_base_get_string(subghz->txrx->decoder_result, key_str);

if((subghz->txrx->decoder_result->protocol->flag & SubGhzProtocolFlag_Send) ==
SubGhzProtocolFlag_Send) {
show_button = 1;
show_button = true;
}

subghz_get_frequency_modulation(subghz, frequency_str, modulation_str);
Expand Down
Loading

0 comments on commit 673d28c

Please sign in to comment.