mirror of
https://github.com/CovidBraceletPrj/CovidBracelet.git
synced 2025-04-18 07:57:36 +02:00
Apply suggested changes from review
This commit is contained in:
parent
158a8c54b1
commit
66510253b8
@ -169,10 +169,10 @@ int init_display() {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int display_set_message(char* msg) {
|
|
||||||
#ifdef DISPLAY
|
#ifdef DISPLAY
|
||||||
|
|
||||||
|
int display_set_message(char* msg) {
|
||||||
lv_label_set_text(display_msg_label, msg);
|
lv_label_set_text(display_msg_label, msg);
|
||||||
#endif
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,39 +181,22 @@ int display_set_time(int time) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int display_set_bat(int bat) {
|
int display_set_bat(int bat) {
|
||||||
#ifdef DISPLAY
|
|
||||||
lv_label_set_text_fmt(display_battery_label, "Bat: %d%%", bat);
|
lv_label_set_text_fmt(display_battery_label, "Bat: %d%%", bat);
|
||||||
#endif
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int display_set_mem(int mem) {
|
int display_set_mem(int mem) {
|
||||||
#ifdef DISPLAY
|
|
||||||
lv_label_set_text_fmt(display_memory_label, "Mem: %d%%", mem);
|
lv_label_set_text_fmt(display_memory_label, "Mem: %d%%", mem);
|
||||||
#endif
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int display_set_contacts(int contacts) {
|
int display_set_contacts(int contacts) {
|
||||||
#ifdef DISPLAY
|
lv_label_set_text_fmt(display_contacts_label, "Number of registered contacts %d, from which", contacts);
|
||||||
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
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int display_set_risk_contacts(int risk_contacts) {
|
int display_set_risk_contacts(int risk_contacts) {
|
||||||
#ifdef DISPLAY
|
lv_label_set_text_fmt(display_risk_contacts_label, "%d are risk contacts.", risk_contacts);
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (risk_contacts == 0) {
|
if (risk_contacts == 0) {
|
||||||
// Set Button green
|
// 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_reset_style_list(risk_contacts_button, LV_OBJ_PART_MAIN);
|
||||||
lv_obj_add_style(risk_contacts_button, LV_BTN_PART_MAIN, &red_button_style);
|
lv_obj_add_style(risk_contacts_button, LV_BTN_PART_MAIN, &red_button_style);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return 0;
|
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
|
||||||
|
@ -19,6 +19,10 @@
|
|||||||
#include "io.h"
|
#include "io.h"
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
|
|
||||||
|
#ifndef BLUETOOTH
|
||||||
|
#define BLUETOOTH 1
|
||||||
|
#endif
|
||||||
|
|
||||||
K_THREAD_STACK_DEFINE(display_stack_area, 500);
|
K_THREAD_STACK_DEFINE(display_stack_area, 500);
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
@ -47,7 +51,7 @@ void main(void) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NATIVE_POSIX
|
#if BLUETOOTH
|
||||||
/* Initialize the Bluetooth Subsystem */
|
/* Initialize the Bluetooth Subsystem */
|
||||||
err = bt_enable(NULL);
|
err = bt_enable(NULL);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -7,7 +7,11 @@ CONFIG_LVGL_POINTER_KSCAN=y
|
|||||||
CONFIG_LVGL_HOR_RES_MAX=240
|
CONFIG_LVGL_HOR_RES_MAX=240
|
||||||
CONFIG_LVGL_VER_RES_MAX=240
|
CONFIG_LVGL_VER_RES_MAX=240
|
||||||
CONFIG_LVGL_DPI=100
|
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=y
|
||||||
CONFIG_DISPLAY_LOG_LEVEL_ERR=y
|
CONFIG_DISPLAY_LOG_LEVEL_ERR=y
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
BLUETOOTH=${1:-0}
|
||||||
rm -rf build
|
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"
|
echo "Run ./build/zephyr/zephyr.elf --bt-dev=hci0"
|
@ -41,8 +41,3 @@ CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
|
|||||||
CONFIG_ENS_MAX_CONTACTS=65536
|
CONFIG_ENS_MAX_CONTACTS=65536
|
||||||
|
|
||||||
CONFIG_LOG=y
|
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
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user