gif + bmp on screen, checking the extension

This commit is contained in:
Obe Van Lierde
2023-11-20 15:11:39 +01:00
parent d36517020f
commit d25c833f3c

View File

@@ -10,6 +10,8 @@ static err_t modbus_incomming_data(void *arg, struct tcp_pcb *pcb, struct pbuf *
int i;
int j;
int len;
int lenght;
char extention[4];
char *pc;
char *textstring;
char text[200];
@@ -90,7 +92,17 @@ static err_t modbus_incomming_data(void *arg, struct tcp_pcb *pcb, struct pbuf *
number_of_files = llfs_file_list(file_list, number_of_files, NULL); // vrijgemaakt geheugen invullen met de lijst
lcd_draw_img_from_fs(file_list[nr_img - 1].name, 10, 30); //BMP on screen
lenght = strlen(file_list[nr_img - 1].name); //lenght from filename
strncpy(extention, file_list[nr_img - 1].name + lenght - 3, 3); //putting the last tree digits in string
extention[3] = '\0'; //adding the \0
if(strcmp(extention,"gif") == 0){
lcd_gif_t* gif = lcd_draw_gif_from_fs(file_list[nr_img - 1].name, 10, 30); //GIF on screen
}
if(strcmp(extention,"bmp") == 0){
lcd_draw_img_from_fs(file_list[nr_img - 1].name, 10, 30); //BMP on screen
}
} else if (err == ERR_OK){
tcp_close(pcb); // when everithing was ok close the tcpconnection