fix c build warnings

This commit is contained in:
Siyuan 2025-09-26 08:37:39 +00:00
parent cf8e33b011
commit 29226a629c
5 changed files with 28 additions and 16 deletions

View File

@ -30,8 +30,17 @@ void jetkvm_set_video_handler(jetkvm_video_handler_t *handler) {
video_handler = handler;
}
static jetkvm_indev_handler_t *jetkvm_indev_handler = NULL;
static void jetkvm_indev_wrapper(lv_event_code_t code) {
if (jetkvm_indev_handler != NULL) {
(*jetkvm_indev_handler)((int)code);
}
}
void jetkvm_set_indev_handler(jetkvm_indev_handler_t *handler) {
lvgl_set_indev_handler(handler);
jetkvm_indev_handler = handler;
lvgl_set_indev_handler(jetkvm_indev_wrapper);
}
void jetkvm_set_rpc_handler(jetkvm_rpc_handler_t *handler) {
@ -45,8 +54,7 @@ void jetkvm_call_rpc_handler(const char *method, const char *params) {
}
const char *jetkvm_ui_event_code_to_name(int code) {
lv_event_code_t cCode = (lv_event_code_t)code;
return lv_event_code_get_name(code);
return lv_event_code_get_name((lv_event_code_t)code);
}
void video_report_format(bool ready, const char *error, u_int16_t width, u_int16_t height, double frame_per_second)
@ -386,7 +394,7 @@ char *jetkvm_video_get_edid_hex() {
if (edid_len < 0) {
return NULL;
}
return bytes_to_hex(edid, edid_len);
return (char *)bytes_to_hex(edid, edid_len);
}
jetkvm_video_state_t *jetkvm_video_get_status() {
@ -394,7 +402,7 @@ jetkvm_video_state_t *jetkvm_video_get_status() {
}
char *jetkvm_video_log_status() {
return videoc_log_status();
return (char *)videoc_log_status();
}
int jetkvm_video_init() {

View File

@ -117,8 +117,6 @@ const char *videoc_log_status()
{
int fd;
char *buffer = NULL;
size_t buffer_size = 0;
ssize_t bytes_read;
fd = open(V4L_SUBDEV, O_RDWR);
if (fd < 0)

View File

@ -11,8 +11,8 @@
#include "ui_index.h"
#include "ctrl.h"
#define DISP_BUF_SIZE (300 * 240 * 2)
static lv_color_t buf[DISP_BUF_SIZE];
// #define DISP_BUF_SIZE (300 * 240 * 2)
// static lv_color_t buf[DISP_BUF_SIZE];
indev_handler_t *indev_handler = NULL;
@ -97,8 +97,8 @@ void lvgl_set_rotation(lv_display_t *disp, u_int16_t rotation) {
}
log_info("refreshing objects");
lv_obj_report_style_change(&flex_screen_style);
lv_obj_report_style_change(&flex_screen_menu_style);
lv_obj_report_style_change(flex_screen_style);
lv_obj_report_style_change(flex_screen_menu_style);
}
uint32_t custom_tick_get(void)
@ -151,7 +151,7 @@ const char *ui_get_current_screen() {
return NULL;
}
lv_img_dsc_t *ui_get_image(const char *name) {
const lv_img_dsc_t *ui_get_image(const char *name) {
for (size_t i = 0; i < ui_images_size; i++) {
if (strcmp(ui_images[i].name, name) == 0) {
return ui_images[i].img;

View File

@ -41,8 +41,15 @@ lv_style_t *ui_get_style(const char *name);
* @brief Get the image with the given name
*
* @param name The name of the image
* @return lv_img_dsc_t* The image with the given name
* @return const lv_img_dsc_t* The image with the given name
*/
lv_img_dsc_t *ui_get_image(const char *name);
const lv_img_dsc_t *ui_get_image(const char *name);
/**
* @brief Get the current screen name
*
* @return const char* The name of the current screen
*/
const char *ui_get_current_screen();
#endif // SCREEN_H

View File

@ -1,6 +1,7 @@
#include "actions.h"
#include "screens.h"
#include <stdio.h>
#include <string.h>
#include "ui.h"
#include "vars.h"
@ -81,7 +82,6 @@ const int REBOOT_HOLD_TIME = 5;
void action_reset_config(lv_event_t * e) {
lv_event_code_t event_code = lv_event_get_code(e);
lv_obj_t *obj = lv_event_get_target(e);
if (event_code == LV_EVENT_PRESSED) {
t_reset_config = lv_tick_get();
@ -112,7 +112,6 @@ void action_reset_config(lv_event_t * e) {
void action_reboot(lv_event_t * e) {
lv_event_code_t event_code = lv_event_get_code(e);
lv_obj_t *obj = lv_event_get_target(e);
if (event_code == LV_EVENT_PRESSED) {
t_reboot = lv_tick_get();