diff --git a/project/Core/Src/main.c b/project/Core/Src/main.c index 1aece27..b3d7e43 100644 --- a/project/Core/Src/main.c +++ b/project/Core/Src/main.c @@ -130,7 +130,10 @@ int main(void) /* Initialize the filesystem */ llfs_init(); + + /*initialize modbus*/ modbus_init(); + /* USER CODE END 2 */ /* Infinite loop */ diff --git a/project/Core/Src/modbus-tcp.c b/project/Core/Src/modbus-tcp.c index 7c06df4..884901b 100644 --- a/project/Core/Src/modbus-tcp.c +++ b/project/Core/Src/modbus-tcp.c @@ -1,7 +1,5 @@ #include "modbus-tcp.h" -char tcp_buffer[1024]; - #define MAX_REG 250 char registers[MAX_REG]; @@ -68,8 +66,7 @@ static err_t modbus_incomming_data(void *arg, struct tcp_pcb *pcb, struct pbuf * printf("%c ", text[i]); } printf("\n"); - - // processing the text data to screen + // processing the text data to screen textstring = text; result_bg = 0xff000000; @@ -81,9 +78,6 @@ static err_t modbus_incomming_data(void *arg, struct tcp_pcb *pcb, struct pbuf * result_txt |= ((uint32_t)txt_red) << 16; result_txt |= ((uint32_t)txt_green) << 8; result_txt |= txt_blue; - - lcd_display_text(textstring, 10, 10, result_txt, result_bg, LCD_FONT24); - // proccesing the image index size_t number_of_files = llfs_file_count(); // hoeveel files er zijn @@ -98,10 +92,14 @@ static err_t modbus_incomming_data(void *arg, struct tcp_pcb *pcb, struct pbuf * 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 + lcd_clear(LCD_BLACK); + lcd_display_text(textstring, 10, 10, result_txt, result_bg, LCD_FONT24); + lcd_gif_t* gif = lcd_draw_gif_from_fs(file_list[nr_img - 1].name, 0, 75); //GIF on screen } if(strcmp(extention,"bmp") == 0){ - lcd_draw_img_from_fs(file_list[nr_img - 1].name, 10, 30); //BMP on screen + lcd_clear(LCD_BLACK); + lcd_display_text(textstring, 10, 10, result_txt, result_bg, LCD_FONT24); + lcd_draw_img_from_fs(file_list[nr_img - 1].name, 0, 75); //BMP on screen } } else if (err == ERR_OK){