Skip to content

Commit

Permalink
feat: Add scrolling
Browse files Browse the repository at this point in the history
  • Loading branch information
JahazielLem committed Oct 18, 2024
1 parent efd3d09 commit 8f7c09e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
10 changes: 4 additions & 6 deletions firmware/components/buzzer/buzzer.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ void buzzer_play_for_task(void* duration) {
return;
#endif

uint32_t dur = *(uint32_t*) duration;
uint32_t dur = (uint32_t) duration;
buzzer_play();
vTaskDelay(*(uint32_t*) duration / portTICK_PERIOD_MS);
vTaskDelay(dur / portTICK_PERIOD_MS);
buzzer_stop();
vTaskDelete(NULL);
}
Expand All @@ -119,10 +119,8 @@ void buzzer_play_for(uint32_t duration) {
if (!buzzer.enabled) {
return;
}
uint32_t* duration_ptr = malloc(sizeof(uint32_t));
*duration_ptr = duration;
xTaskCreate(buzzer_play_for_task, "buzzer_play_for_task", 2048, duration_ptr,
5, NULL);
xTaskCreate(buzzer_play_for_task, "buzzer_play_for_task", 2048,
(void*) duration, 5, NULL);
}

void buzzer_stop() {
Expand Down
14 changes: 10 additions & 4 deletions firmware/main/general/general_screens.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,16 @@ static void general_screen_display_scrolling() {
}

for (uint16_t i = scrolling_option; i < end_index; i++) {
oled_screen_display_text(
scrolling_menu_ctx->menu_items[i], 3,
(i - scrolling_option) + (ITEMOFFSET + screen_title),
OLED_DISPLAY_NORMAL);
if (i == scrolling_option) {
general_screen_display_selected_item(
scrolling_menu_ctx->menu_items[i],
(i - scrolling_option) + (ITEMOFFSET + screen_title));
} else {
oled_screen_display_text(
scrolling_menu_ctx->menu_items[i], 3,
(i - scrolling_option) + (ITEMOFFSET + screen_title),
OLED_DISPLAY_NORMAL);
}
}
oled_screen_display_show();
}
Expand Down

0 comments on commit 8f7c09e

Please sign in to comment.