style guide until Functions

This commit is contained in:
Obe Van Lierde
2023-11-16 16:46:05 +01:00
parent 1cac2eefbd
commit 500d3fd58d

View File

@@ -8,8 +8,11 @@ char registers[MAX_REG];
static err_t modbus_incomming_data(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err){ static err_t modbus_incomming_data(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err){
int i; int i;
int j;
int len; int len;
char *pc; char *pc;
char *textstring;
char text[200];
uint8_t bg_red = 0; uint8_t bg_red = 0;
uint8_t bg_green = 0; uint8_t bg_green = 0;
uint8_t bg_blue = 0; uint8_t bg_blue = 0;
@@ -19,12 +22,9 @@ static err_t modbus_incomming_data(void *arg, struct tcp_pcb *pcb, struct pbuf *
uint8_t nr_img = 0; uint8_t nr_img = 0;
uint32_t result_bg = 0; uint32_t result_bg = 0;
uint32_t result_txt = 0; uint32_t result_txt = 0;
uint32_t result = 0;
char text[200];
for(i = 0; i < 100; i++){ for(i = 0; i < 100; i++){
text[i] = 95; // _ text[i] = 95;
} }
text[199] = '\0'; text[199] = '\0';
@@ -51,11 +51,10 @@ static err_t modbus_incomming_data(void *arg, struct tcp_pcb *pcb, struct pbuf *
txt_green = (uint8_t)(registers[22]); // 05 txt_green = (uint8_t)(registers[22]); // 05
txt_blue = (uint8_t)(registers[24]); // 06 txt_blue = (uint8_t)(registers[24]); // 06
nr_img = (uint8_t)(registers[26]); // 07 nr_img = (uint8_t)(registers[26]); // 07
//registers[428] //208
printf("%d %d %d %d %d %d %d ",bg_red,bg_green,bg_blue,txt_red,txt_green,txt_blue,nr_img); printf("%d %d %d %d %d %d %d ",bg_red,bg_green,bg_blue,txt_red,txt_green,txt_blue,nr_img);
int j = 0; j = 0;
for(i = 28; i < 428; i++){ for(i = 28; i < 428; i++){
if(i % 2 == 0){ if(i % 2 == 0){
text[j] = registers[i]; text[j] = registers[i];
@@ -69,7 +68,7 @@ static err_t modbus_incomming_data(void *arg, struct tcp_pcb *pcb, struct pbuf *
printf("\n"); printf("\n");
// processing the text data to screen // processing the text data to screen
char *textstring = text; textstring = text;
result_bg = 0xff000000; result_bg = 0xff000000;
result_bg |= ((uint32_t)bg_red) << 16; result_bg |= ((uint32_t)bg_red) << 16;
@@ -84,7 +83,6 @@ static err_t modbus_incomming_data(void *arg, struct tcp_pcb *pcb, struct pbuf *
lcd_display_text(textstring, 10, 50, result_txt, result_bg, LCD_FONT24); lcd_display_text(textstring, 10, 50, result_txt, result_bg, LCD_FONT24);
// proccesing the image index // proccesing the image index
size_t number_of_files = llfs_file_count(); // hoeveel files er zijn size_t number_of_files = llfs_file_count(); // hoeveel files er zijn
llfs_file_t file_list[number_of_files]; // geheugen vrijmaken voor files llfs_file_t file_list[number_of_files]; // geheugen vrijmaken voor files