Compare commits
7 Commits
99914fe090
...
780baa4f78
Author | SHA1 | Date |
---|---|---|
imi415 | 780baa4f78 | |
imi415 | f51897532c | |
imi415 | 75180ca809 | |
imi415 | 40a995e18f | |
imi415 | 680ba3f068 | |
imi415 | 6763430766 | |
imi415 | 718f37f262 |
|
@ -0,0 +1 @@
|
|||
-*lib/LittleVGL/src/*
|
|
@ -10,19 +10,32 @@ jobs:
|
|||
steps:
|
||||
- name: "Update package cache"
|
||||
run: "sudo apt-get update"
|
||||
|
||||
- name: "Setup dependencies"
|
||||
run: "sudo apt-get -y install build-essential cmake libmosquitto-dev libconfig-dev libgpiod-dev libiio-dev"
|
||||
env:
|
||||
DEBIAN_FRONTEND: "noninteractive"
|
||||
|
||||
- name: "Checkout repository"
|
||||
uses: "actions/checkout@v2"
|
||||
with:
|
||||
submodules: "true"
|
||||
|
||||
- name: "Create build directory"
|
||||
run: "mkdir build"
|
||||
|
||||
- name: "Configure cmake"
|
||||
run: "cmake .."
|
||||
working-directory: "build"
|
||||
|
||||
- name: "Build project"
|
||||
run: "make"
|
||||
working-directory: "build"
|
||||
working-directory: "build"
|
||||
|
||||
- name: "Store native binary"
|
||||
uses: "actions/upload-artifact@v2"
|
||||
with:
|
||||
name: "sa-native-binary-ubuntu"
|
||||
path: "build/SystemAgent"
|
||||
retention-days: 30
|
||||
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
|
||||
name: "Run static check on repository"
|
||||
on:
|
||||
push:
|
||||
branches: ["master"]
|
||||
|
||||
jobs:
|
||||
static-check:
|
||||
runs-on: "ubuntu-latest"
|
||||
steps:
|
||||
- name: "Update package cache"
|
||||
run: "sudo apt-get update"
|
||||
|
||||
- name: "Setup dependencies"
|
||||
run: "sudo apt-get -y install build-essential cmake clang clang-tidy libmosquitto-dev libconfig-dev libgpiod-dev libiio-dev"
|
||||
env:
|
||||
DEBIAN_FRONTEND: "noninteractive"
|
||||
|
||||
- name: "Install CodeChecker"
|
||||
run: "sudo snap install codechecker --classic"
|
||||
|
||||
- name: "Checkout repository"
|
||||
uses: "actions/checkout@v2"
|
||||
with:
|
||||
submodules: "true"
|
||||
|
||||
- name: "Create build directory"
|
||||
run: "mkdir build"
|
||||
|
||||
- name: "Configure cmake"
|
||||
run: "cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=yes .."
|
||||
working-directory: "build"
|
||||
|
||||
- name: "Run CodeChecker"
|
||||
run: "codechecker analyze compile_commands.json -o results -i ../.codechecker-skip.txt --ctu"
|
||||
working-directory: "build"
|
||||
|
||||
- name: "Generate HTML reports"
|
||||
run: "codechecker parse -e html ./results -o ./report"
|
||||
working-directory: "build"
|
||||
|
||||
- name: "Save HTML reports to artifact"
|
||||
uses: "actions/upload-artifact@v2"
|
||||
with:
|
||||
name: "static-check-report"
|
||||
path: "build/report"
|
||||
retention-days: 30
|
||||
|
||||
- name: "Dump report to stderr"
|
||||
run: "codechecker parse --print-steps ./results"
|
||||
working-directory: "build"
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
#define __USER_CONFIG_DRIVER_H
|
||||
|
||||
#include <libconfig.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef struct {
|
||||
config_t *libconfig_cfg;
|
||||
|
@ -11,6 +12,7 @@ int user_config_init(user_config_t *config, char *config_file);
|
|||
char *user_config_lookup_string(user_config_t *config, char *path);
|
||||
int user_config_lookup_int(user_config_t *config, char *path, int *value);
|
||||
int user_config_lookup_double(user_config_t *config, char *path, double *value);
|
||||
int user_config_lookup_bool(user_config_t *config, char *path, bool *value);
|
||||
int user_config_deinit(user_config_t *config);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "lvgl.h"
|
||||
|
||||
void user_lvgl_impl_init(void);
|
||||
int user_lvgl_impl_init(void);
|
||||
|
||||
void user_lvgl_impl_flush_cb(lv_disp_drv_t *disp_drv, const lv_area_t *area,
|
||||
lv_color_t *color_p);
|
||||
|
|
|
@ -54,7 +54,7 @@ ccs811_ret_t _ccs811_app_start(ccs811_t *ccs) {
|
|||
if(ccs->cb.read_register_cb(ccs->user_data, 0x00, &status, 0x01) == CCS_FAIL) {
|
||||
return CCS_FAIL;
|
||||
}
|
||||
if(status & 0x10 == 0) {
|
||||
if((status & 0x10) == 0) {
|
||||
return CCS_FAIL;
|
||||
}
|
||||
return ccs->cb.write_register_cb(ccs->user_data, 0xF4, (uint8_t *)0x00, 0x00);
|
||||
|
|
|
@ -17,9 +17,12 @@ static int concat_string(char *dest, int dest_length, char *append) {
|
|||
} else
|
||||
break;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
mqtt_influx_ret_t mqtt_influx_init(mqtt_influx_t *influx) {
|
||||
if(influx == (void *)0) return MQTT_INFLUX_ERROR;
|
||||
return MQTT_INFLUX_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -70,6 +70,7 @@ agent: {
|
|||
libraries: {
|
||||
lvgl: {
|
||||
fs_base = ""; # This will be used as LVGL base file system and will be mounted at drive A:
|
||||
logging_enabled = true;
|
||||
};
|
||||
mqtt: {
|
||||
client: {
|
||||
|
|
|
@ -70,6 +70,7 @@ agent: {
|
|||
libraries: {
|
||||
lvgl: {
|
||||
fs_base = "lvgl_fs";
|
||||
logging_enabled = false;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -70,6 +70,7 @@ agent: {
|
|||
libraries: {
|
||||
lvgl: {
|
||||
fs_base = "lvgl_fs";
|
||||
logging_enabled = false;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -48,6 +48,13 @@ int user_config_lookup_double(user_config_t *config, char *path,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int user_config_lookup_bool(user_config_t *config, char *path, bool *value) {
|
||||
if(config_lookup_bool(config->libconfig_cfg, path, (int *)value) == 0) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int user_config_deinit(user_config_t *config) {
|
||||
config_destroy(config->libconfig_cfg);
|
||||
|
||||
|
|
|
@ -81,9 +81,7 @@ int user_gpio_intr_poll(user_gpio_t *gpio, uint32_t timeout_ms,
|
|||
int ret = gpiod_line_event_wait(gpio->line, &ts);
|
||||
if(ret > 0) {
|
||||
ret = gpiod_line_event_read(gpio->line, &ev);
|
||||
}
|
||||
|
||||
if(ret < 0) return ret;
|
||||
} else return ret;
|
||||
|
||||
if(ev.event_type == GPIOD_LINE_EVENT_RISING_EDGE) {
|
||||
*event = USER_GPIO_INTR_RISING;
|
||||
|
|
|
@ -33,11 +33,31 @@ st7789_lcd_t g_lcd = {
|
|||
};
|
||||
|
||||
static user_stick_key_t s_previous_key = USER_STICK_NONE;
|
||||
static bool s_lv_log_enabled = false;
|
||||
|
||||
void user_lvgl_impl_init(void) {
|
||||
user_st7789_impl_init(&g_lcd_impl);
|
||||
user_stick_impl_init(&g_stick_impl);
|
||||
st7789_lcd_init(&g_lcd);
|
||||
int user_lvgl_impl_init(void) {
|
||||
if(user_st7789_impl_init(&g_lcd_impl) != 0) {
|
||||
USER_LOG(USER_LOG_ERROR,
|
||||
"ST7789 support library initialization failed");
|
||||
return -1;
|
||||
};
|
||||
if(user_stick_impl_init(&g_stick_impl) != 0) {
|
||||
USER_LOG(USER_LOG_ERROR,
|
||||
"Control stick support library initialization failed");
|
||||
return -1;
|
||||
}
|
||||
if(st7789_lcd_init(&g_lcd) != ST7789_OK) {
|
||||
USER_LOG(USER_LOG_ERROR, "ST7789 driver initialization failed.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(user_config_lookup_bool(&g_config, "agent.libraries.lvgl.logging_enabled",
|
||||
&s_lv_log_enabled) != 0) {
|
||||
USER_LOG(USER_LOG_WARN,
|
||||
"LVGL log level not found, fallback to default(off).");
|
||||
};
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void user_lvgl_impl_flush_cb(lv_disp_drv_t *disp_drv, const lv_area_t *area,
|
||||
|
@ -79,12 +99,13 @@ void user_lvgl_impl_indev_read_cb(lv_indev_drv_t *drv, lv_indev_data_t *data) {
|
|||
break;
|
||||
}
|
||||
s_previous_key = key;
|
||||
USER_LOG(USER_LOG_INFO, "Stick event: %d, key: %d", data->state, data->key);
|
||||
USER_LOG(USER_LOG_INFO, "Stick event: %d, key: %d", data->state,
|
||||
data->key);
|
||||
}
|
||||
}
|
||||
|
||||
void user_lvgl_impl_log_cb(const char *buf) {
|
||||
USER_LOG(USER_LOG_INFO, "LVGL: %s", buf);
|
||||
if(s_lv_log_enabled) USER_LOG(USER_LOG_INFO, "LVGL: %s", buf);
|
||||
}
|
||||
|
||||
void *user_lvgl_impl_fs_open_cb(lv_fs_drv_t *drv, const char *path,
|
||||
|
|
39
src/main.c
39
src/main.c
|
@ -48,23 +48,48 @@ int main(int argc, const char *argv[]) {
|
|||
user_system_get_systemd_unique_id(system_uuid);
|
||||
USER_LOG(USER_LOG_INFO, "System UUID: %s", system_uuid);
|
||||
|
||||
user_mqtt_task_init();
|
||||
user_lvgl_task_init();
|
||||
user_base_task_init();
|
||||
user_clock_task_init();
|
||||
user_dht_task_init();
|
||||
user_tvoc_task_init();
|
||||
int rc;
|
||||
if((rc = user_mqtt_task_init()) != 0) {
|
||||
USER_LOG(USER_LOG_FATAL, "MQTT task initialization failed(%d).", rc);
|
||||
goto mqtt_task_init_failed;
|
||||
}
|
||||
if((rc = user_lvgl_task_init()) != 0) {
|
||||
USER_LOG(USER_LOG_FATAL, "LVGL task initialization failed(%d).", rc);
|
||||
goto lvgl_task_init_failed;
|
||||
}
|
||||
if((rc = user_base_task_init()) != 0) {
|
||||
USER_LOG(USER_LOG_FATAL, "BASE task initialization failed(%d).", rc);
|
||||
goto base_task_init_failed;
|
||||
}
|
||||
if((rc = user_clock_task_init()) != 0) {
|
||||
USER_LOG(USER_LOG_FATAL, "CLOCK task initialization failed(%d).", rc);
|
||||
goto clock_task_init_failed;
|
||||
}
|
||||
if((rc = user_dht_task_init()) != 0) {
|
||||
USER_LOG(USER_LOG_FATAL, "DHT task initialization failed(%d).", rc);
|
||||
goto dht_task_init_failed;
|
||||
}
|
||||
if((rc = user_tvoc_task_init()) != 0) {
|
||||
USER_LOG(USER_LOG_FATAL, "TVOC task initialization failed(%d).", rc);
|
||||
goto tvoc_task_init_failed;
|
||||
}
|
||||
|
||||
USER_LOG(USER_LOG_INFO, "Initialized, main thread sleeping.");
|
||||
USER_LOG(USER_LOG_INFO, "Initialized, main thread now going to sleep.");
|
||||
while(g_running) {
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
tvoc_task_init_failed:
|
||||
user_tvoc_task_deinit();
|
||||
dht_task_init_failed:
|
||||
user_dht_task_deinit();
|
||||
clock_task_init_failed:
|
||||
user_clock_task_deinit();
|
||||
base_task_init_failed:
|
||||
user_base_task_deinit();
|
||||
lvgl_task_init_failed:
|
||||
user_lvgl_task_deinit();
|
||||
mqtt_task_init_failed:
|
||||
user_mqtt_task_deinit();
|
||||
|
||||
user_config_deinit(&g_config);
|
||||
|
|
|
@ -40,6 +40,7 @@ int user_lvgl_task_init(void) {
|
|||
s_disp_drv.ver_res = 240;
|
||||
s_disp_drv.flush_cb = user_lvgl_impl_flush_cb;
|
||||
lv_disp_t *disp = lv_disp_drv_register(&s_disp_drv);
|
||||
if(disp == NULL) return -2;
|
||||
|
||||
lv_indev_drv_init(&s_indev_drv);
|
||||
s_indev_drv.type = LV_INDEV_TYPE_KEYPAD;
|
||||
|
|
Loading…
Reference in New Issue