updated tabs etc

This commit is contained in:
TeunBugwood
2023-12-11 14:03:42 +01:00
parent 5b0666920c
commit d1991d9abc
2 changed files with 171 additions and 194 deletions

View File

@@ -27,8 +27,6 @@
#include "llfs.h" #include "llfs.h"
#include "lcd_api.h" #include "lcd_api.h"
/** /**
* @fn void wbe_init(void) * @fn void wbe_init(void)
* @brief Initialise the http server. It also sets the beginning screen * @brief Initialise the http server. It also sets the beginning screen
@@ -36,7 +34,6 @@
*/ */
void wbe_init(void); void wbe_init(void);
/** /**
* @fn int fs_open_custom(struct fs_file*, const char*) * @fn int fs_open_custom(struct fs_file*, const char*)
* @brief Function is called when the frontend wants to reach/open a file * @brief Function is called when the frontend wants to reach/open a file
@@ -48,7 +45,6 @@ void wbe_init(void);
*/ */
int fs_open_custom(struct fs_file* file, const char* name); int fs_open_custom(struct fs_file* file, const char* name);
/** /**
* @fn void fs_close_custom(struct fs_file*) * @fn void fs_close_custom(struct fs_file*)
* @brief Called when closing files and endpoints * @brief Called when closing files and endpoints
@@ -57,7 +53,6 @@ int fs_open_custom(struct fs_file* file, const char* name);
*/ */
void fs_close_custom(struct fs_file* file); void fs_close_custom(struct fs_file* file);
/** /**
* @fn void httpd_cgi_handler(struct fs_file*, const char*, int, char**, char**) * @fn void httpd_cgi_handler(struct fs_file*, const char*, int, char**, char**)
* @brief When data is send from the frontend to the backend with the CGI * @brief When data is send from the frontend to the backend with the CGI
@@ -70,8 +65,7 @@ void fs_close_custom(struct fs_file* file);
* @param[in] pc_param, contains the name of each parameter * @param[in] pc_param, contains the name of each parameter
* @param[in] pc_value, is the value of each parameter * @param[in] pc_value, is the value of each parameter
*/ */
void httpd_cgi_handler(struct fs_file* file, const char* uri, int num_parm, char** pc_param, char** pc_value ); void httpd_cgi_handler(struct fs_file* file, const char* uri, int num_parm, char** pc_param, char** pc_value);
/** /**
* @fn void wbe_display(const char*, const uint32_t, const uint32_t, const char*) * @fn void wbe_display(const char*, const uint32_t, const uint32_t, const char*)
@@ -85,5 +79,4 @@ void httpd_cgi_handler(struct fs_file* file, const char* uri, int num_parm, char
*/ */
void wbe_display(const char* txt, const uint32_t txt_color, const uint32_t background_color, const char* image); void wbe_display(const char* txt, const uint32_t txt_color, const uint32_t background_color, const char* image);
#endif /* INC_WEBSITE_BACKEND_ */ #endif /* INC_WEBSITE_BACKEND_ */

View File

@@ -13,7 +13,6 @@ static inline void wbe_build_infostring(const llfs_file_t* file_list, char* info
static void wbe_decoding_url(const char* encoded, char* decoded); static void wbe_decoding_url(const char* encoded, char* decoded);
static uint32_t wbe_color_value(const char* rgb); static uint32_t wbe_color_value(const char* rgb);
void wbe_init(void) { void wbe_init(void) {
httpd_init(); httpd_init();
@@ -25,16 +24,13 @@ void wbe_init(void) {
return; return;
} }
int fs_open_custom(struct fs_file* file, const char* name) { int fs_open_custom(struct fs_file* file, const char* name) {
// Variables // Variables
llfs_file_t* wanted_file = llfs_file_open(name + 1); llfs_file_t *wanted_file = llfs_file_open(name + 1);
size_t buffer_len = 0; size_t buffer_len = 0;
static char image_stringbuffer[STR_MAX] = ""; static char image_stringbuffer[STR_MAX] = "";
// The wanted file was found in the filesystem // The wanted file was found in the filesystem
if (wanted_file != NULL) { if (wanted_file != NULL) {
@@ -52,7 +48,6 @@ int fs_open_custom(struct fs_file* file, const char* name) {
return 1; return 1;
} }
/* /*
* The endpoint '/images.info' is called when the client wants to call for the * The endpoint '/images.info' is called when the client wants to call for the
* information string that contains the names of the available images. * information string that contains the names of the available images.
@@ -73,7 +68,6 @@ int fs_open_custom(struct fs_file* file, const char* name) {
return 1; return 1;
} }
// Endpoint when client wants to send information to the backend // Endpoint when client wants to send information to the backend
if (strncmp(name, "/cgi", 3) == 0) { if (strncmp(name, "/cgi", 3) == 0) {
@@ -127,13 +121,12 @@ static size_t wbe_get_images(char* images_string, size_t file_count_fs) {
wbe_build_infostring(file_list, images_string, file_count_gif + file_count_bmp); wbe_build_infostring(file_list, images_string, file_count_gif + file_count_bmp);
// Debug info // Debug info
LOG_DEBUG("WBE", "Images string : %s ",images_string); LOG_DEBUG("WBE", "Images string : %s ", images_string);
// Return the length of the string // Return the length of the string
return strlen(images_string); return strlen(images_string);
} }
/** /**
* @fn void wbe_build_infostring(const llfs_file_t*, char*, const size_t) * @fn void wbe_build_infostring(const llfs_file_t*, char*, const size_t)
* @brief Function adds the names of the files in "file_list" and adds them in "infoStr". * @brief Function adds the names of the files in "file_list" and adds them in "infoStr".
@@ -157,8 +150,6 @@ static inline void wbe_build_infostring(const llfs_file_t* file_list, char* info
} }
void httpd_cgi_handler(struct fs_file* file, const char* uri, int num_parm, char** pc_param, char** pc_value) { void httpd_cgi_handler(struct fs_file* file, const char* uri, int num_parm, char** pc_param, char** pc_value) {
// Variables // Variables
@@ -171,7 +162,6 @@ void httpd_cgi_handler(struct fs_file* file, const char* uri, int num_parm, char
char s_vktxt[CLR_MAX]; // The color of the sentence. (in #RGB) char s_vktxt[CLR_MAX]; // The color of the sentence. (in #RGB)
char s_vka[CLR_MAX]; // Color of the background. (also in #RGB) char s_vka[CLR_MAX]; // Color of the background. (also in #RGB)
if (strcmp("/cgi", uri) == 0) { if (strcmp("/cgi", uri) == 0) {
for (size_t i = 0; i < num_parm; ++i) { for (size_t i = 0; i < num_parm; ++i) {
@@ -218,7 +208,6 @@ void httpd_cgi_handler(struct fs_file* file, const char* uri, int num_parm, char
} }
/** /**
* @fn void wbe_decoding_url(const char*, char*) * @fn void wbe_decoding_url(const char*, char*)
* @brief The given information from the CGI parameters are URL encoded. * @brief The given information from the CGI parameters are URL encoded.
@@ -232,7 +221,7 @@ void httpd_cgi_handler(struct fs_file* file, const char* uri, int num_parm, char
static void wbe_decoding_url(const char* encoded, char* decoded) { static void wbe_decoding_url(const char* encoded, char* decoded) {
// Variables // Variables
char* endptr; char *endptr;
size_t decoded_index = 0; size_t decoded_index = 0;
size_t encoded_length = strlen(encoded); size_t encoded_length = strlen(encoded);
uint32_t hex_val; uint32_t hex_val;
@@ -272,12 +261,10 @@ static void wbe_decoding_url(const char* encoded, char* decoded) {
} }
static uint32_t wbe_color_value(const char* rgb) { static uint32_t wbe_color_value(const char* rgb) {
// Variables // Variables
char* endptr; char *endptr;
uint32_t color = LCD_BLACK; uint32_t color = LCD_BLACK;
char argb[11] = "0xff"; char argb[11] = "0xff";
@@ -296,14 +283,11 @@ static uint32_t wbe_color_value(const char* rgb) {
return color; return color;
} }
void wbe_display(const char* txt, const uint32_t txt_color, const uint32_t bg_color, const char* image) { void wbe_display(const char* txt, const uint32_t txt_color, const uint32_t bg_color, const char* image) {
// Variables // Variables
lcd_gif_t* gif; lcd_gif_t *gif;
char* extension; char *extension;
// clear the screen // clear the screen
lcd_clear_text(); lcd_clear_text();