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

Commit

Permalink
Fix string handling in tuning fork
Browse files Browse the repository at this point in the history
  • Loading branch information
Willy-JL committed Jun 13, 2023
1 parent 40cff8a commit 4402385
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions applications/external/tuning_fork/tuning_fork.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,7 @@ static void render_callback(Canvas* const canvas, void* ctx) {
TuningForkState* tuning_fork_state = ctx;
furi_mutex_acquire(tuning_fork_state->mutex, FuriWaitForever);

string_t tempStr;
string_init(tempStr);
FuriString* tempStr = furi_string_alloc();

canvas_draw_frame(canvas, 0, 0, 128, 64);

Expand All @@ -148,23 +147,24 @@ static void render_callback(Canvas* const canvas, void* ctx) {
if(tuning_fork_state->page == Tunings) {
char tuningLabel[20];
current_tuning_label(tuning_fork_state, tuningLabel);
string_printf(tempStr, "< %s >", tuningLabel);
furi_string_printf(tempStr, "< %s >", tuningLabel);
canvas_draw_str_aligned(
canvas, 64, 28, AlignCenter, AlignCenter, string_get_cstr(tempStr));
string_reset(tempStr);
canvas, 64, 28, AlignCenter, AlignCenter, furi_string_get_cstr(tempStr));
furi_string_reset(tempStr);
} else {
char tuningLabel[20];
current_tuning_label(tuning_fork_state, tuningLabel);
string_printf(tempStr, "%s", tuningLabel);
canvas_draw_str_aligned(canvas, 64, 8, AlignCenter, AlignCenter, string_get_cstr(tempStr));
string_reset(tempStr);
furi_string_printf(tempStr, "%s", tuningLabel);
canvas_draw_str_aligned(
canvas, 64, 8, AlignCenter, AlignCenter, furi_string_get_cstr(tempStr));
furi_string_reset(tempStr);

char tuningNoteLabel[20];
current_tuning_note_label(tuning_fork_state, tuningNoteLabel);
string_printf(tempStr, "< %s >", tuningNoteLabel);
furi_string_printf(tempStr, "< %s >", tuningNoteLabel);
canvas_draw_str_aligned(
canvas, 64, 24, AlignCenter, AlignCenter, string_get_cstr(tempStr));
string_reset(tempStr);
canvas, 64, 24, AlignCenter, AlignCenter, furi_string_get_cstr(tempStr));
furi_string_reset(tempStr);
}

canvas_set_font(canvas, FontSecondary);
Expand All @@ -184,7 +184,7 @@ static void render_callback(Canvas* const canvas, void* ctx) {
elements_progress_bar(canvas, 8, 36, 112, tuning_fork_state->volume);
}

string_clear(tempStr);
furi_string_free(tempStr);
furi_mutex_release(tuning_fork_state->mutex);
}

Expand Down

0 comments on commit 4402385

Please sign in to comment.