diff --git a/src/display.c b/src/display.c index 95507f1..e3b32b8 100644 --- a/src/display.c +++ b/src/display.c @@ -169,10 +169,10 @@ int init_display() { return 0; } +#ifdef DISPLAY + int display_set_message(char* msg) { - #ifdef DISPLAY lv_label_set_text(display_msg_label, msg); - #endif return 0; } @@ -181,39 +181,22 @@ int display_set_time(int time) { } int display_set_bat(int bat) { - #ifdef DISPLAY lv_label_set_text_fmt(display_battery_label, "Bat: %d%%", bat); - #endif return 0; } int display_set_mem(int mem) { - #ifdef DISPLAY lv_label_set_text_fmt(display_memory_label, "Mem: %d%%", mem); - #endif return 0; } int display_set_contacts(int contacts) { - #ifdef DISPLAY - if (contacts == 1) { - lv_label_set_text_fmt(display_contacts_label, "%d Kontakt erkannt, davon", contacts); - } else { - lv_label_set_text_fmt(display_contacts_label, "%d Kontakte erkannt, davon", contacts); - } - #endif + lv_label_set_text_fmt(display_contacts_label, "Number of registered contacts %d, from which", contacts); return 0; } int display_set_risk_contacts(int risk_contacts) { - #ifdef DISPLAY - if (risk_contacts == 0) { - lv_label_set_text(display_risk_contacts_label, "keine Risiko-Kontakte"); - } else if (risk_contacts == 1) { - lv_label_set_text(display_risk_contacts_label, "1 Risiko-Kontakt"); - } else { - lv_label_set_text_fmt(display_risk_contacts_label, "%d Risiko-Kontakte", risk_contacts); - } + lv_label_set_text_fmt(display_risk_contacts_label, "%d are risk contacts.", risk_contacts); if (risk_contacts == 0) { // Set Button green @@ -228,6 +211,33 @@ int display_set_risk_contacts(int risk_contacts) { lv_obj_reset_style_list(risk_contacts_button, LV_OBJ_PART_MAIN); lv_obj_add_style(risk_contacts_button, LV_BTN_PART_MAIN, &red_button_style); } - #endif return 0; } + +#else + +int display_set_message(char* msg) { + return 0; +} + +int display_set_time(int time) { + return 0; +} + +int display_set_bat(int bat) { + return 0; +} + +int display_set_mem(int mem) { + return 0; +} + +int display_set_contacts(int contacts) { + return 0; +} + +int display_set_risk_contacts(int risk_contacts) { + return 0; +} + +#endif diff --git a/src/main.c b/src/main.c index 78c6bb3..fcb8c3b 100644 --- a/src/main.c +++ b/src/main.c @@ -19,6 +19,10 @@ #include "io.h" #include "display.h" +#ifndef BLUETOOTH +#define BLUETOOTH 1 +#endif + K_THREAD_STACK_DEFINE(display_stack_area, 500); void main(void) { @@ -47,7 +51,7 @@ void main(void) { return; } - #ifndef NATIVE_POSIX + #if BLUETOOTH /* Initialize the Bluetooth Subsystem */ err = bt_enable(NULL); if (err) { diff --git a/zephyr/boards/native_posix_64.conf b/zephyr/boards/native_posix_64.conf index f1001e5..fa733ac 100644 --- a/zephyr/boards/native_posix_64.conf +++ b/zephyr/boards/native_posix_64.conf @@ -7,7 +7,11 @@ CONFIG_LVGL_POINTER_KSCAN=y CONFIG_LVGL_HOR_RES_MAX=240 CONFIG_LVGL_VER_RES_MAX=240 CONFIG_LVGL_DPI=100 - +CONFIG_LVGL=y +CONFIG_LVGL_USE_LABEL=y +CONFIG_LVGL_USE_CONT=y +CONFIG_LVGL_USE_BTN=y +CONFIG_LVGL_USE_THEME_MATERIAL=y CONFIG_DISPLAY=y CONFIG_DISPLAY_LOG_LEVEL_ERR=y diff --git a/zephyr/build_native.sh b/zephyr/build_native.sh index abb3f4f..48444cc 100755 --- a/zephyr/build_native.sh +++ b/zephyr/build_native.sh @@ -1,5 +1,6 @@ #!/bin/bash +BLUETOOTH=${1:-0} rm -rf build -west build -b native_posix_64 . -- -DCMAKE_C_FLAGS="-DNATIVE_POSIX -I../../include/tls_config -DDISPLAY" +west build -b native_posix_64 . -- -DCMAKE_C_FLAGS="-DNATIVE_POSIX -I../../include/tls_config -DDISPLAY -DBLUETOOTH=$BLUETOOTH" echo "Run ./build/zephyr/zephyr.elf --bt-dev=hci0" \ No newline at end of file diff --git a/zephyr/prj.conf b/zephyr/prj.conf index 8a823b5..3afd1be 100644 --- a/zephyr/prj.conf +++ b/zephyr/prj.conf @@ -41,8 +41,3 @@ CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 CONFIG_ENS_MAX_CONTACTS=65536 CONFIG_LOG=y -CONFIG_LVGL=y -CONFIG_LVGL_USE_LABEL=y -CONFIG_LVGL_USE_CONT=y -CONFIG_LVGL_USE_BTN=y -CONFIG_LVGL_USE_THEME_MATERIAL=y