From b52e7b0bc8c4894072d6c0a53de9be8510953950 Mon Sep 17 00:00:00 2001 From: RobinVdB8 Date: Mon, 20 Nov 2023 15:42:43 +0100 Subject: [PATCH] Added support for gifs --- project/Core/Src/mug.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/project/Core/Src/mug.c b/project/Core/Src/mug.c index d6fa9f5..c6d0843 100644 --- a/project/Core/Src/mug.c +++ b/project/Core/Src/mug.c @@ -53,6 +53,8 @@ static void example_publish(mqtt_client_t *client, void *arg) { num_files = llfs_file_list(file_list, max_files, "*.bmp"); + strcpy(pub_payload, "\0"); + if(num_files == 0) { strcpy(pub_payload, "No images found"); } else { @@ -116,7 +118,12 @@ static void mqtt_incoming_data_cb(void *arg, const u8_t *data, u16_t len, u8_t f case 1: //places an image on the lcd LOG_INFO(TAG, "incoming data on input/setImage: %s.", data_buffer); - lcd_draw_img_from_fs((const char*)data_buffer, xpos, ypos); + if(data_buffer[len-3] == 'b') { + lcd_draw_img_from_fs((const char*)data_buffer, xpos, ypos); + } + if(data_buffer[len-3] == 'g') { + lcd_draw_gif_from_fs((const char*)data_buffer, xpos, ypos); + } break; case 2: //changes the text color on the lcd