Add lcd_stop_all_gifs(void)

This commit is contained in:
xoreo
2023-11-20 14:38:04 +01:00
parent 758f1f47ca
commit a481f3b6fa
3 changed files with 31 additions and 8 deletions

View File

@@ -82,11 +82,11 @@ void lcd_task(void) {
}
}
void lcd_display_text(uint8_t* text, uint16_t x_pos, uint16_t y_pos, uint32_t color, sFONT* font) {
void lcd_display_text(const char* text, uint16_t x_pos, uint16_t y_pos, uint32_t color, sFONT* font) {
BSP_LCD_SelectLayer(1);
LOG_INFO(TAG, "Display text: %s @x=%d,y=%d", text, x_pos, y_pos);
uint16_t tot_length = x_pos + (strlen(text) * font->Width);
uint16_t tot_length = x_pos + ((uint16_t)strlen(text) * font->Width);
if ((x_pos % font->Width) != 0) {
x_pos -= (x_pos % font->Width);
}
@@ -96,23 +96,23 @@ void lcd_display_text(uint8_t* text, uint16_t x_pos, uint16_t y_pos, uint32_t co
BSP_LCD_SetFont(font);
if (tot_length > BSP_LCD_GetXSize()) {
for (int i = 0; i < strlen(text); i++) {
for (unsigned int i = 0; i < (unsigned int)strlen(text); i++) {
if ((x_pos) > BSP_LCD_GetXSize() - (font->Width) * 2) {
if (isalpha(text[i - 1]) && isalpha(text[i])) {
BSP_LCD_DisplayChar(x_pos, y_pos, '-');
BSP_LCD_DisplayChar(x_pos, y_pos, (uint8_t)'-');
} else {
BSP_LCD_DisplayChar(x_pos, y_pos, text[i]);
BSP_LCD_DisplayChar(x_pos, y_pos, (uint8_t)text[i]);
}
x_pos = 0;
y_pos += font->Height;
continue;
}
BSP_LCD_DisplayChar(x_pos, y_pos, text[i]);
BSP_LCD_DisplayChar(x_pos, y_pos, (uint8_t)text[i]);
x_pos += font->Width;
}
return;
}
BSP_LCD_DisplayStringAt(x_pos, y_pos, text, LEFT_MODE);
BSP_LCD_DisplayStringAt(x_pos, y_pos, (uint8_t*)text, LEFT_MODE);
}
void lcd_draw_raw_img(const void* p_src, uint32_t x_pos, uint32_t y_pos, uint32_t x_size, uint32_t y_size, uint32_t color_mode) {
@@ -179,6 +179,14 @@ void lcd_clear_images(void) {
BSP_LCD_Clear(0);
}
void lcd_stop_all_gifs(void) {
for (uint8_t i = 0; i < LCD_MAX_GIFS; i++) {
if (gifs[i].src != NULL) {
lcd_stop_gif(&gifs[i]);
}
}
}
lcd_gif_t* lcd_draw_gif(uint8_t* src, size_t size, uint32_t x_pos, uint32_t y_pos) {
BSP_LCD_SelectLayer(0);
lcd_gif_t* gif;