From 46b1e76c9761d97b2b641b1bf2b37ed99e4aeebe Mon Sep 17 00:00:00 2001 From: Christos Themelis Date: Sat, 24 Jan 2026 22:10:45 +0200 Subject: [PATCH] UI updates --- examples/simple_secure_chat_ui/main.cpp | 157 +++--- examples/simple_secure_chat_ui/task_clock.cpp | 37 +- examples/simple_secure_chat_ui/task_lvgl.cpp | 4 +- .../task_openWeather.cpp | 32 -- examples/simple_secure_chat_ui/uiManager.cpp | 101 ++-- examples/simple_secure_chat_ui/uiTasks.cpp | 35 +- include/openWeather.h | 60 --- include/uiConfiguration.h | 4 - include/uiDefines.h | 1 + include/uiExternals.h | 4 +- include/uiTasks.h | 6 +- include/uiVars.h | 11 +- include/user_setup.h.example | 20 - lib/lvgl/lv_conf.h | 4 +- src/UI/ui.c | 44 +- src/UI/ui.h | 34 +- src/UI/ui_Screen1.c | 467 +++++++++++++++++- src/UI/ui_events.cpp | 4 - src/UI/ui_events.h | 2 - src/helpers/wifi/MyWiFi.h | 51 -- src/helpers/wifi/myWiFi.cpp | 191 ------- variants/elecrow_espnow/platformio.ini | 4 +- 22 files changed, 672 insertions(+), 601 deletions(-) delete mode 100644 examples/simple_secure_chat_ui/task_openWeather.cpp delete mode 100644 include/openWeather.h delete mode 100644 include/user_setup.h.example delete mode 100644 src/helpers/wifi/MyWiFi.h delete mode 100644 src/helpers/wifi/myWiFi.cpp diff --git a/examples/simple_secure_chat_ui/main.cpp b/examples/simple_secure_chat_ui/main.cpp index 4eaa9fa60..3fc565cb6 100644 --- a/examples/simple_secure_chat_ui/main.cpp +++ b/examples/simple_secure_chat_ui/main.cpp @@ -42,7 +42,7 @@ #include - +#include "esp_log.h" #include #include #include @@ -59,6 +59,8 @@ #include "../include/uiTasks.h" #include "uiTouch.h" +#define TAG "main" + #define SEND_TIMEOUT_BASE_MILLIS 500 #define FLOOD_SEND_TIMEOUT_FACTOR 16.0f #define DIRECT_SEND_PERHOP_FACTOR 6.0f @@ -79,6 +81,7 @@ static lv_color_t disp_draw_buf[800 * 480 / 10]; static lv_disp_drv_t disp_drv; UIManager *uiManager; + SemaphoreHandle_t semaphoreData; TwoWire I2Cone = TwoWire(0); @@ -95,6 +98,10 @@ void format_time(uint32_t ts, char *buf, size_t len) strftime(buf, len, "%H:%M:%S", tm_info); } +void onDayLightPressed(bool pressed) { + //mySettings->writeBool(PREF_DAYLIGHT, pressed); +} + void parse_group_message(const char *input, char *sender_out, size_t sender_len, char *msg_out, size_t msg_len) @@ -327,6 +334,7 @@ void initializeUI() { Serial.println("initialize UI..."); ui_init(); + setNightMode(false); //ui_init_screen_events(); /* @@ -344,58 +352,6 @@ void initializeUI() { uiManager = new UIManager(); } -void configureDisplay() { - Serial.println("Configuring display..."); - - screenWidth = lcd.width(); - screenHeight = lcd.height(); - - lv_disp_draw_buf_init(&draw_buf, disp_draw_buf, NULL, screenWidth * screenHeight / 10); - - /* Initialize the display */ - lv_disp_drv_init(&disp_drv); - /* Change the following line to your display resolution */ - disp_drv.hor_res = screenWidth; - disp_drv.ver_res = screenHeight; - disp_drv.flush_cb = my_disp_flush; - disp_drv.draw_buf = &draw_buf; - lv_disp_drv_register(&disp_drv); - - /* Initialize the (dummy) input device driver */ - static lv_indev_drv_t indev_drv; - lv_indev_drv_init(&indev_drv); - indev_drv.type = LV_INDEV_TYPE_POINTER; - indev_drv.read_cb = my_touchpad_read; - lv_indev_drv_register(&indev_drv); -#ifdef TFT_BL - pinMode(TFT_BL, OUTPUT); - digitalWrite(TFT_BL, HIGH); -#endif - - lcd.fillScreen(0x000000u); -} - -void onWaitRelayPressed(bool pressed) { - //mySettings->writeBool(PREF_WAIT_RELAY, pressed); -} - -void initializeDisplay() { - Serial.println("Initializing display..."); - lcd.begin(); - lcd.fillScreen(0x000000u); - lcd.setTextSize(2); - //lcd.setBrightness(127); -} - -void initializeTouchScreen() { - Serial.println("Initializing touch screen..."); - touch_init(); -} - -void initializeLVGL() { - Serial.println("Initializing LVGL..."); - lv_init(); -} void createSemaphores() { semaphoreData = xSemaphoreCreateMutex(); @@ -694,11 +650,11 @@ public: #endif if (!store.load("_main", self_id, _prefs.node_name, sizeof(_prefs.node_name))) { // legacy: node_name was from identity file // Need way to get some entropy to seed RNG - Serial.println("Press ENTER to generate key:"); - char c = 0; - while (c != '\n') { // wait for ENTER to be pressed - if (Serial.available()) c = Serial.read(); - } + // Serial.println("Press ENTER to generate key:"); + // char c = 0; + // while (c != '\n') { // wait for ENTER to be pressed + // if (Serial.available()) c = Serial.read(); + // } ((StdRNG *)getRNG())->begin(millis()); self_id = mesh::LocalIdentity(getRNG()); // create new random identity @@ -941,9 +897,56 @@ void halt() { while (1) ; } -void setup() { - Serial.begin(115200); +void configureDisplay() { + ESP_LOGI(TAG, "Configuring display..."); + screenWidth = lcd.width(); + screenHeight = lcd.height(); + + lv_disp_draw_buf_init(&draw_buf, disp_draw_buf, NULL, screenWidth * screenHeight / 10); + + /* Initialize the display */ + lv_disp_drv_init(&disp_drv); + /* Change the following line to your display resolution */ + disp_drv.hor_res = screenWidth; + disp_drv.ver_res = screenHeight; + disp_drv.flush_cb = my_disp_flush; + disp_drv.draw_buf = &draw_buf; + lv_disp_drv_register(&disp_drv); + + /* Initialize the (dummy) input device driver */ + static lv_indev_drv_t indev_drv; + lv_indev_drv_init(&indev_drv); + indev_drv.type = LV_INDEV_TYPE_POINTER; + indev_drv.read_cb = my_touchpad_read; + lv_indev_drv_register(&indev_drv); +#ifdef TFT_BL + pinMode(TFT_BL, OUTPUT); + digitalWrite(TFT_BL, HIGH); +#endif + + lcd.fillScreen(0x000000u); +} + +void initializeDisplay() { + ESP_LOGI(TAG, "Initializing display..."); + lcd.begin(); + lcd.fillScreen(0x000000u); + lcd.setTextSize(2); + //lcd.setBrightness(127); +} + +void initializeTouchScreen() { + ESP_LOGI(TAG, "Initializing touch screen..."); + touch_init(); +} + +void initializeLVGL() { + ESP_LOGI(TAG, "Initializing LVGL..."); + lv_init(); +} + +void initializeMesh() { board.begin(); if (!radio_init()) { halt(); } @@ -970,28 +973,42 @@ void setup() { // send out initial Advertisement to the mesh the_mesh.sendSelfAdvert(1200); // add slight delay +} - initializeDisplay(); +void setup() { + Serial.begin(115200); + + initializeDisplay(); delay(200); initializeLVGL(); initializeTouchScreen(); configureDisplay(); - createSemaphores(); - initializeUI(); + createTasks(); + initializeMesh(); + + vTaskResume(t_core1_core); + Serial.println("Setup completed"); } -void loop() { - the_mesh.loop(); - rtc_clock.tick(); -} +void core_task(void *pvParameters) { + vTaskSuspend(NULL); -// void loop() { -// vTaskDelete(NULL); -// } \ No newline at end of file + ESP_LOGI(TAG, "MeshCore: Task running on core %d", xPortGetCoreID()); + + while (1) { + the_mesh.loop(); + rtc_clock.tick(); + vTaskDelay(DELAY_CORE_TASK / portTICK_PERIOD_MS); + } +} + +void loop() { + vTaskDelete(NULL); +} \ No newline at end of file diff --git a/examples/simple_secure_chat_ui/task_clock.cpp b/examples/simple_secure_chat_ui/task_clock.cpp index fd87663a7..752a5147c 100644 --- a/examples/simple_secure_chat_ui/task_clock.cpp +++ b/examples/simple_secure_chat_ui/task_clock.cpp @@ -4,43 +4,22 @@ #include "uiDefines.h" #include "uiVars.h" +#define TAG "clock_task" + void clock_task(void *pvParameters) { vTaskSuspend(NULL); - ESP_LOGI("Clock manager: Task running on core %d", xPortGetCoreID()); + ESP_LOGI(TAG, "Clock manager: Task running on core %d", xPortGetCoreID()); - bool ntpResult = false; - uiManager->clearDateTime(); - while (!ntpResult) { - - myWiFi->ensureConnection(); - if (myWiFi->isConnected()) { - ntpResult = myClock->setTimeFromNTP(); - - if (!ntpResult) { - vTaskDelay(DELAY_NTP_TASK / portTICK_PERIOD_MS); - } else { - uiManager->updateInfo("", COLOR_WHITE); - } - } else { - ESP_LOGE("No internet connection"); - vTaskDelay(DELAY_WIFI_RECONNECT_TASK / portTICK_PERIOD_MS); - } - - } - - #ifdef USE_OPEN_WEATHER - vTaskResume(t_core1_openWeather); - #endif - + // TODO: sync clock while (1) { - uiManager->updateDateTime( - myClock->getTimeStruct() - ); - uiManager->updateValues(); + // uiManager->updateDateTime( + // myClock->getTimeStruct() + // ); + // uiManager->updateValues(); vTaskDelay(DELAY_CLOCK_TASK / portTICK_PERIOD_MS); } } \ No newline at end of file diff --git a/examples/simple_secure_chat_ui/task_lvgl.cpp b/examples/simple_secure_chat_ui/task_lvgl.cpp index 6e10ae689..d88b6cd38 100644 --- a/examples/simple_secure_chat_ui/task_lvgl.cpp +++ b/examples/simple_secure_chat_ui/task_lvgl.cpp @@ -4,11 +4,13 @@ #include "uiDefines.h" #include "uiVars.h" +#define TAG "lvgl_task" + void lvgl_task(void *pvParameters) { vTaskSuspend(NULL); - ESP_LOGI("UI manager: Task running on core %d", xPortGetCoreID()); + ESP_LOGI(TAG, "UI manager: Task running on core %d", xPortGetCoreID()); while (1) { lv_timer_handler(); diff --git a/examples/simple_secure_chat_ui/task_openWeather.cpp b/examples/simple_secure_chat_ui/task_openWeather.cpp deleted file mode 100644 index b2e7c2aff..000000000 --- a/examples/simple_secure_chat_ui/task_openWeather.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include - -#include "esp_log.h" -#include "uiDefines.h" - -#ifdef USE_OPEN_WEATHER -#include "uiVars.h" - -void openWeather_task(void *pvParameters) { - - vTaskSuspend(NULL); - - ESP_LOGI("openWeather manager: Task running on core %d", xPortGetCoreID()); - - int errors = 0; - - for (;;) { - myWiFi->ensureConnection(); - if (myWiFi->isConnected()) { - if (openWeather->fetchData()) { - vTaskDelay(DELAY_OPEN_WEATHER_TASK / portTICK_PERIOD_MS); - } else { - vTaskDelay(DELAY_OPEN_WEATHER_SHORT_TASK / portTICK_PERIOD_MS); - } - } else { - ESP_LOGE("No internet connection"); - vTaskDelay(DELAY_WIFI_RECONNECT_TASK / portTICK_PERIOD_MS); - } - } -} - -#endif \ No newline at end of file diff --git a/examples/simple_secure_chat_ui/uiManager.cpp b/examples/simple_secure_chat_ui/uiManager.cpp index b4558a0bd..7456da320 100644 --- a/examples/simple_secure_chat_ui/uiManager.cpp +++ b/examples/simple_secure_chat_ui/uiManager.cpp @@ -1,5 +1,6 @@ #include +#include "esp_log.h" #include "UI/ui.h" #include "uiDefines.h" #include "uiVars.h" @@ -16,6 +17,8 @@ const char *UIManager::months[12] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; #endif +#define TAG "UIManager" + UIManager::UIManager() { //myDebug->println(DEBUG_LEVEL_DEBUG, "[UIManager]"); @@ -35,34 +38,34 @@ void UIManager::format_datetime(char *buf, size_t size, const struct tm *timeinf } void UIManager::updateDateTime(const struct tm timeinfo) { - // // TODO: Add to settings "Date format" - // char date_str[50]; - // format_datetime(date_str, sizeof(date_str), &timeinfo); - // lv_label_set_text(ui_ValueDate, date_str); - - // // TODO: Add to settings "Hour format" - // strftime(tmp_buf, 50, "%H:%M", &timeinfo); // 24h format - // //strftime(tmp_buf, 50, "%I:%M %p", &timeinfo); // 12h format - // lv_label_set_text(ui_ValueTime, tmp_buf); - - // // TODO: Add to settings "dim at night" - // // TODO: Add to settings "dim hours" - // // TODO: Add to settings "dim percentage" - // if (timeinfo.tm_hour > 21 || timeinfo.tm_hour < 7) { - // setNightMode(true); - // } else { - // setNightMode(false); - // } + // TODO: Add to settings "Date format" + char date_str[50]; + format_datetime(date_str, sizeof(date_str), &timeinfo); + lv_label_set_text(ui_ValueDate, date_str); + + // TODO: Add to settings "Hour format" + strftime(tmp_buf, 50, "%H:%M", &timeinfo); // 24h format + //strftime(tmp_buf, 50, "%I:%M %p", &timeinfo); // 12h format + lv_label_set_text(ui_ValueTime, tmp_buf); + + // TODO: Add to settings "dim at night" + // TODO: Add to settings "dim hours" + // TODO: Add to settings "dim percentage" + if (timeinfo.tm_hour > 21 || timeinfo.tm_hour < 7) { + setNightMode(true); + } else { + setNightMode(false); + } } void UIManager::clearDateTime() { - // #if defined(LANG_EN) - // uiManager->updateInfo("Clock sync...", COLOR_WHITE); - // #elif defined(LANG_GR) - // uiManager->updateInfo("Συγχρονισμός ώρας...", COLOR_WHITE); - // #endif - // lv_label_set_text(ui_ValueDate, "--- --/--/----"); - // lv_label_set_text(ui_ValueTime, "--:--"); + #if defined(LANG_EN) + uiManager->updateInfo("Clock sync...", COLOR_WHITE); + #elif defined(LANG_GR) + uiManager->updateInfo("Συγχρονισμός ώρας...", COLOR_WHITE); + #endif + lv_label_set_text(ui_ValueDate, "--- --/--/----"); + lv_label_set_text(ui_ValueTime, "--:--"); } void UIManager::timestampToTime(time_t timestamp, char *buffer, size_t buffer_size) { @@ -104,54 +107,6 @@ int UIManager::windSpeedToBeaufort(float speed) { void UIManager::updateValues() { - #if defined(USE_OPEN_WEATHER) - if (openWeather->isDataUpdated()) { - myDebug->println(DEBUG_LEVEL_DEBUG, "Updating openWeather UI values"); - s_openWeatherData data = openWeather->getData(); - openWeather->setDataUpdated(false); - - sprintf(tmp_buf, "%0.1f °C", data.temperature[0]); - lv_label_set_text(ui_ValueTemperature, tmp_buf); - - sprintf(tmp_buf, "%0.1f °C", data.temperature[1]); - lv_label_set_text(ui_ValueFeelsLike, tmp_buf); - - timestampToTime(data.sun[0], time_str, sizeof(time_str)); - lv_label_set_text(ui_ValueSunrise, time_str); - - timestampToTime(data.sun[1], time_str, sizeof(time_str)); - lv_label_set_text(ui_ValueSunset, time_str); - - sprintf(tmp_buf, "%d %%", data.humidity); - lv_label_set_text(ui_ValueHumidity, tmp_buf); - - sprintf(tmp_buf, "%d hPa", data.pressure); - lv_label_set_text(ui_ValuePressure, tmp_buf); - - #if defined(LANG_EN) - sprintf(tmp_buf, "%0.1f m/s", data.windSpeed); - lv_label_set_text(ui_ValueWindSpeed, tmp_buf); - sprintf(tmp_buf, "Wind: %d Bf", windSpeedToBeaufort(data..windSpeed)); - lv_label_set_text(ui_Label2, tmp_buf); - - sprintf(tmp_buf, "Direction: %s", convertDegreesToDirection(data..windDirection)); - lv_label_set_text(ui_ValueWindDirection, tmp_buf); - - sprintf(tmp_buf, "Updated: %s", myClock->getTime()); - lv_label_set_text(ui_ValueLastUpdate, tmp_buf); - #elif defined(LANG_GR) - lv_label_set_text(ui_Label2, "Άνεμος"); - sprintf(tmp_buf, "%d Bf", windSpeedToBeaufort(data.windSpeed)); - lv_label_set_text(ui_ValueWindSpeed, tmp_buf); - - sprintf(tmp_buf, "Κατεύθυνση: %s", convertDegreesToDirection(data.windDirection)); - lv_label_set_text(ui_ValueWindDirection, tmp_buf); - - sprintf(tmp_buf, "Ενημερώθηκε: %s", myClock->getTime()); - updateInfo(tmp_buf, COLOR_WHITE); - #endif - } - #endif } void UIManager::updateInfo(const char *str, uint32_t color) { diff --git a/examples/simple_secure_chat_ui/uiTasks.cpp b/examples/simple_secure_chat_ui/uiTasks.cpp index 3f6230d53..7f85685be 100644 --- a/examples/simple_secure_chat_ui/uiTasks.cpp +++ b/examples/simple_secure_chat_ui/uiTasks.cpp @@ -1,14 +1,16 @@ #include + +#include "esp_log.h" #include "uiDefines.h" #include "uiTasks.h" #include "uiVars.h" // Tasks TaskHandle_t t_core0_lvgl; -TaskHandle_t t_core1_clock; -#ifdef USE_OPEN_WEATHER -TaskHandle_t t_core1_openWeather; -#endif +TaskHandle_t t_core1_clock; +TaskHandle_t t_core1_core; + +#define TAG "createTasks" void createTasks() { Serial.println("Creating Tasks..."); @@ -23,29 +25,26 @@ void createTasks() { 0); // Pin task to core 0 xTaskCreatePinnedToCore( - clock_task, // Task function. - "CLOCK_Manager", // Name of task. + core_task, // Task function. + "MeshCore", // Name of task. 10000, // Stack size of task NULL, // Parameter of the task 4, // Priority of the task - &t_core1_clock, // Task handle to keep track of created task - 1); // Pin task to core 0 + &t_core1_core, // Task handle to keep track of created task + 0); // Pin task to core 0 - #ifdef USE_OPEN_WEATHER xTaskCreatePinnedToCore( - openWeather_task, // Task function. - "OpenWeather_Manager", // Name of task. + clock_task, // Task function. + "CLOCK_Manager", // Name of task. 10000, // Stack size of task NULL, // Parameter of the task - 3, // Priority of the task - &t_core1_openWeather, // Task handle to keep track of created task - 1); // Pin task to core 0 - - #endif + 4, // Priority of the task + &t_core1_clock, // Task handle to keep track of created task + 1); // Pin task to core 1 - Serial.println("All tasks created\nStarting tasks..."); + ESP_LOGD(TAG, "All tasks created\nStarting tasks..."); vTaskResume(t_core0_lvgl); - vTaskResume(t_core1_clock); + vTaskResume(t_core1_clock); } diff --git a/include/openWeather.h b/include/openWeather.h deleted file mode 100644 index b6bc4f02c..000000000 --- a/include/openWeather.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef OPEN_WEATHER_h -#define OPEN_WEATHER_h - -#include -#include "uiDefines.h" - -#ifdef USE_OPEN_WEATHER - - #include - #include - #include - #include "user_setup.h" - - // Weather Image - #define IMG_WIDTH 200 - #define IMG_HEIGHT 200 - #define PNG_PIXELS_PER_LINE 2048 - - class OpenWeather { - private: - // functions - static int renderPNGToBuffer(PNGDRAW *pDraw); // static callback - int renderPNGToBufferImpl(PNGDRAW *pDraw); // normal method - void downloadImageToMemory(const char *url); - - // User setup - String town = USER_WeatherTown; - String myAPI = USER_WeatherAPI; - String units = USER_WeatherUnits; - - // vars - PNG png; - uint8_t *imageBuffer = nullptr; - uint16_t *rgb565_buffer = nullptr; - int bufferSize; - lv_img_dsc_t img_dsc; - - String openWeatherServer; - s_openWeatherData data; - String oldIconUrl; - - SemaphoreHandle_t semaphoreData; - bool dataUpdated; - String lastUpdate; - HTTPClient http; - char* tmp_buf; - public: - OpenWeather(); - // functions - void init(); - bool fetchData(); - bool isDataUpdated(); - void setDataUpdated(bool updated); - s_openWeatherData getData(); - bool decodePngToRgb565(uint8_t *png_data, int png_size); - }; - -#endif - -#endif \ No newline at end of file diff --git a/include/uiConfiguration.h b/include/uiConfiguration.h index 33e7a737b..217735c19 100644 --- a/include/uiConfiguration.h +++ b/include/uiConfiguration.h @@ -12,7 +12,3 @@ // Modules // ///////////// //#define SHOW_TOP_BAR - -// Language -//#define LANG_EN -#define LANG_GR \ No newline at end of file diff --git a/include/uiDefines.h b/include/uiDefines.h index f9eae202d..80e45195c 100644 --- a/include/uiDefines.h +++ b/include/uiDefines.h @@ -5,6 +5,7 @@ #define BUTTONS_ON_SCREEN 7 +#define DELAY_CORE_TASK 5 #define DELAY_LVGL_TASK 10 #define DELAY_MAIN_TASK 500 #define DELAY_CLOCK_TASK 1000 diff --git a/include/uiExternals.h b/include/uiExternals.h index 95f0f0d95..6e6508ad4 100644 --- a/include/uiExternals.h +++ b/include/uiExternals.h @@ -8,8 +8,6 @@ extern void createTasks(); extern TaskHandle_t t_core0_lvgl; extern TaskHandle_t t_core1_clock; -#ifdef USE_OPEN_WEATHER - extern TaskHandle_t t_core1_openWeather; -#endif +extern TaskHandle_t t_core1_core; #endif \ No newline at end of file diff --git a/include/uiTasks.h b/include/uiTasks.h index 98643b610..982a88995 100644 --- a/include/uiTasks.h +++ b/include/uiTasks.h @@ -6,9 +6,7 @@ #include "uiVars.h" void lvgl_task(void *pvParameters); -//void clock_task(void *pvParameters); -#ifdef USE_OPEN_WEATHER - void openWeather_task(void *pvParameters); -#endif +void clock_task(void *pvParameters); +void core_task(void *pvParameters); #endif \ No newline at end of file diff --git a/include/uiVars.h b/include/uiVars.h index cc8f992af..74a5e395b 100644 --- a/include/uiVars.h +++ b/include/uiVars.h @@ -2,25 +2,20 @@ #define VARS_h #include -#include "openWeather.h" #include "lvgl.h" +#include "uiManager.h" extern void createTasks(); extern TaskHandle_t t_core1_tft; extern TaskHandle_t t_core0_lvgl; -extern TaskHandle_t t_core1_clock; +extern TaskHandle_t t_core1_clock; +extern TaskHandle_t t_core1_core; extern SemaphoreHandle_t semaphoreData; extern UIManager *uiManager; -extern MyClock *myClock; -extern MyWiFi *myWiFi; -#ifdef USE_OPEN_WEATHER - extern OpenWeather *openWeather; - extern TaskHandle_t t_core1_openWeather; -#endif #ifdef USE_MAIN_TAB_VIEW extern lv_obj_t * ui_MainTabView; #endif diff --git a/include/user_setup.h.example b/include/user_setup.h.example deleted file mode 100644 index 546f53f94..000000000 --- a/include/user_setup.h.example +++ /dev/null @@ -1,20 +0,0 @@ -// Notes: -// Create a copy of this file and name it "user_setup.h" -// Setup your WiFi SSID and the password -// Select your timezone -// Write your town. You can find supported towns in Open Weather website -// Write your API KEY from Open Weather also take a look at configuration.h file for more settings. -// -// The file "user_setup.h" is in git ignore. Your data will stay local - -//#################### EDIT THIS ################### -// WiFi -#define USER_WiFiSSID "MyWiFiSSID" -#define USER_WiFiPassword "MyWiFiPassword" -// Clock -#define USER_TimeZone 2 -// Open Weather -#define USER_WeatherTown "Thessaloniki" -#define USER_WeatherAPI "000000000000000000000000000000" -#define USER_WeatherUnits "metric" -//#################### end of edits ################### diff --git a/lib/lvgl/lv_conf.h b/lib/lvgl/lv_conf.h index 8f9c5bc90..a447eaf4b 100644 --- a/lib/lvgl/lv_conf.h +++ b/lib/lvgl/lv_conf.h @@ -365,7 +365,7 @@ #define LV_FONT_MONTSERRAT_10 0 #define LV_FONT_MONTSERRAT_12 0 #define LV_FONT_MONTSERRAT_14 1 -#define LV_FONT_MONTSERRAT_16 1 +#define LV_FONT_MONTSERRAT_16 0 #define LV_FONT_MONTSERRAT_18 1 #define LV_FONT_MONTSERRAT_20 1 #define LV_FONT_MONTSERRAT_22 1 @@ -538,7 +538,7 @@ #define LV_USE_COLORWHEEL 0 -#define LV_USE_IMGBTN 0 +#define LV_USE_IMGBTN 1 #define LV_USE_KEYBOARD 1 diff --git a/src/UI/ui.c b/src/UI/ui.c index b46a0264e..37b5a7794 100644 --- a/src/UI/ui.c +++ b/src/UI/ui.c @@ -19,11 +19,41 @@ lv_obj_t * ui_ContactMessages; lv_obj_t * ui_TabPageChannels; lv_obj_t * ui_Channels; lv_obj_t * ui_ChannelMessages; -lv_obj_t * ui_TabPageSettings; void ui_event_AutoLight(lv_event_t * e); lv_obj_t * ui_AutoLight; lv_obj_t * ui____initial_actions0; +lv_obj_t * ui_DimOverlay; +lv_obj_t * ui_TabPageWeather; +lv_obj_t * ui_Container1; +lv_obj_t * ui_Label1; +lv_obj_t * ui_ValueTemperature; +lv_obj_t * ui_Panel1; +lv_obj_t * ui_Label3; +lv_obj_t * ui_ValueFeelsLike; +lv_obj_t * ui_Panel4; +lv_obj_t * ui_Label4; +lv_obj_t * ui_ValueSunrise; +lv_obj_t * ui_Label5; +lv_obj_t * ui_ValueSunset; +lv_obj_t * ui_Container2; +lv_obj_t * ui_Humidity; +lv_obj_t * ui_ValueHumidity; +lv_obj_t * ui_Panel3; +lv_obj_t * ui_Pressure; +lv_obj_t * ui_ValuePressure; +lv_obj_t * ui_Panel2; +lv_obj_t * ui_Label2; +lv_obj_t * ui_ValueWindSpeed; +lv_obj_t * ui_ValueWindDirection; +lv_obj_t * ui_Image1; +lv_obj_t * ui_ValueDate; +lv_obj_t * ui_ValueTime; +lv_obj_t * ui_ValueLastUpdate; +lv_obj_t * ui_TabPageSettings; +lv_obj_t * ui_DayLight; +lv_obj_t * ui____initial_actions0; + ///////////////////// TEST LVGL SETTINGS //////////////////// #if LV_COLOR_DEPTH != 16 #error "LV_COLOR_DEPTH should be 16bit to match SquareLine Studio's settings" @@ -32,18 +62,6 @@ lv_obj_t * ui____initial_actions0; #error "LV_COLOR_16_SWAP should be 0 to match SquareLine Studio's settings" #endif -///////////////////// ANIMATIONS //////////////////// - -///////////////////// FUNCTIONS //////////////////// -void ui_event_AutoLight(lv_event_t * e) -{ - lv_event_code_t event_code = lv_event_get_code(e); - lv_obj_t * target = lv_event_get_target(e); - if(event_code == LV_EVENT_CLICKED) { - //onDayLightPressed(e); - } -} - ///////////////////// SCREENS //////////////////// void ui_init(void) diff --git a/src/UI/ui.h b/src/UI/ui.h index b91d48379..f95cd60bd 100644 --- a/src/UI/ui.h +++ b/src/UI/ui.h @@ -28,6 +28,7 @@ extern "C" { // SCREEN: ui_Screen1 void ui_Screen1_screen_init(void); +void setNightMode(bool night); extern lv_obj_t * ui_Screen1; extern lv_obj_t * ui_TabView1; extern lv_obj_t * ui_TabPageContacts; @@ -42,10 +43,37 @@ extern lv_obj_t * ui_AutoLight; extern lv_obj_t * ui____initial_actions0; +extern lv_obj_t * ui_DimOverlay; +extern lv_obj_t * ui_TabPageWeather; +extern lv_obj_t * ui_Container1; +extern lv_obj_t * ui_Label1; +extern lv_obj_t * ui_ValueTemperature; +extern lv_obj_t * ui_Panel1; +extern lv_obj_t * ui_Label3; +extern lv_obj_t * ui_ValueFeelsLike; +extern lv_obj_t * ui_Panel4; +extern lv_obj_t * ui_Label4; +extern lv_obj_t * ui_ValueSunrise; +extern lv_obj_t * ui_Label5; +extern lv_obj_t * ui_ValueSunset; +extern lv_obj_t * ui_Container2; +extern lv_obj_t * ui_Humidity; +extern lv_obj_t * ui_ValueHumidity; +extern lv_obj_t * ui_Panel3; +extern lv_obj_t * ui_Pressure; +extern lv_obj_t * ui_ValuePressure; +extern lv_obj_t * ui_Panel2; +extern lv_obj_t * ui_Label2; +extern lv_obj_t * ui_ValueWindSpeed; +extern lv_obj_t * ui_ValueWindDirection; +extern lv_obj_t * ui_Image1; +extern lv_obj_t * ui_ValueDate; +extern lv_obj_t * ui_ValueTime; +extern lv_obj_t * ui_ValueLastUpdate; +extern lv_obj_t * ui_TabPageSettings; +extern lv_obj_t * ui_DayLight; - - - +extern void onDayLightPressed(bool pressed); void ui_init(void); diff --git a/src/UI/ui_Screen1.c b/src/UI/ui_Screen1.c index 9d0377536..4702474f5 100644 --- a/src/UI/ui_Screen1.c +++ b/src/UI/ui_Screen1.c @@ -5,6 +5,28 @@ #include "ui.h" +static void scroll_begin_event(lv_event_t* e) +{ + /*Disable the scroll animations. Triggered when a tab button is clicked */ + if (lv_event_get_code(e) == LV_EVENT_SCROLL_BEGIN) { + lv_anim_t* a = (lv_anim_t*)lv_event_get_param(e); + if (a) a->time = 0; + + } +} + +void event_handler(lv_event_t * e) +{ + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * target = lv_event_get_target(e); + + if(code == LV_EVENT_VALUE_CHANGED) { + if (target == ui_DayLight) { + onDayLightPressed(lv_obj_get_state(target) & LV_STATE_CHECKED); + } + } +} + void ui_Screen1_screen_init(void) { ui_Screen1 = lv_obj_create(NULL); @@ -13,6 +35,10 @@ void ui_Screen1_screen_init(void) lv_obj_set_style_bg_opa(ui_Screen1, 255, LV_PART_MAIN | LV_STATE_DEFAULT); ui_TabView1 = lv_tabview_create(ui_Screen1, LV_DIR_TOP, 50); + + lv_obj_add_event_cb(lv_tabview_get_content(ui_TabView1), scroll_begin_event,LV_EVENT_SCROLL_BEGIN, NULL); + lv_obj_clear_flag(lv_tabview_get_content(ui_TabView1), LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_width(ui_TabView1, 800); lv_obj_set_height(ui_TabView1, 480); lv_obj_set_align(ui_TabView1, LV_ALIGN_CENTER); @@ -30,6 +56,286 @@ void ui_Screen1_screen_init(void) lv_obj_set_style_text_font(lv_tabview_get_tab_btns(ui_TabView1), &lv_font_arial_18, LV_PART_ITEMS | LV_STATE_DEFAULT); + #if defined(LANG_EN) + ui_TabPageWeather = lv_tabview_add_tab(ui_TabView1, "Weather"); + #elif defined(LANG_GR) + ui_TabPageWeather = lv_tabview_add_tab(ui_TabView1, "Καιρός"); + #endif + + ui_Container1 = lv_obj_create(ui_TabPageWeather); + lv_obj_remove_style_all(ui_Container1); + lv_obj_set_width(ui_Container1, 200); + lv_obj_set_height(ui_Container1, 390); + lv_obj_set_x(ui_Container1, -284); + lv_obj_set_y(ui_Container1, 0); + lv_obj_set_align(ui_Container1, LV_ALIGN_CENTER); + lv_obj_set_flex_flow(ui_Container1, LV_FLEX_FLOW_COLUMN); + lv_obj_set_flex_align(ui_Container1, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); + lv_obj_clear_flag(ui_Container1, LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_SCROLLABLE); /// Flags + lv_obj_set_style_pad_row(ui_Container1, 15, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_pad_column(ui_Container1, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + + ui_Label1 = lv_label_create(ui_Container1); + lv_obj_set_width(ui_Label1, LV_SIZE_CONTENT); /// 1 + lv_obj_set_height(ui_Label1, LV_SIZE_CONTENT); /// 1 + lv_obj_set_align(ui_Label1, LV_ALIGN_CENTER); + #if defined(LANG_EN) + lv_label_set_text(ui_Label1, "Temperature"); + #elif defined(LANG_GR) + lv_label_set_text(ui_Label1, "Θερμοκρασία"); + #endif + lv_obj_set_style_text_color(ui_Label1, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_opa(ui_Label1, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_font(ui_Label1, &lv_font_arial_26, LV_PART_MAIN | LV_STATE_DEFAULT); + + ui_ValueTemperature = lv_label_create(ui_Container1); + lv_obj_set_width(ui_ValueTemperature, LV_SIZE_CONTENT); /// 1 + lv_obj_set_height(ui_ValueTemperature, LV_SIZE_CONTENT); /// 1 + lv_obj_set_align(ui_ValueTemperature, LV_ALIGN_CENTER); + lv_label_set_text(ui_ValueTemperature, "--.- °C"); + lv_obj_set_style_text_color(ui_ValueTemperature, lv_color_hex(0x17ABF7), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_opa(ui_ValueTemperature, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_font(ui_ValueTemperature, &lv_font_arial_48, LV_PART_MAIN | LV_STATE_DEFAULT); + + ui_Panel1 = lv_obj_create(ui_Container1); + lv_obj_set_height(ui_Panel1, 1); + lv_obj_set_width(ui_Panel1, lv_pct(90)); + lv_obj_set_x(ui_Panel1, 0); + lv_obj_set_y(ui_Panel1, -8); + lv_obj_set_align(ui_Panel1, LV_ALIGN_CENTER); + lv_obj_clear_flag(ui_Panel1, LV_OBJ_FLAG_SCROLLABLE); /// Flags + + ui_Label3 = lv_label_create(ui_Container1); + lv_obj_set_width(ui_Label3, LV_SIZE_CONTENT); /// 1 + lv_obj_set_height(ui_Label3, LV_SIZE_CONTENT); /// 1 + lv_obj_set_align(ui_Label3, LV_ALIGN_CENTER); + #if defined(LANG_EN) + lv_label_set_text(ui_Label3, "Feels like"); + #elif defined(LANG_GR) + lv_label_set_text(ui_Label3, "Αισθητή"); + #endif + lv_obj_set_style_text_color(ui_Label3, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_opa(ui_Label3, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_font(ui_Label3, &lv_font_arial_26, LV_PART_MAIN | LV_STATE_DEFAULT); + + ui_ValueFeelsLike = lv_label_create(ui_Container1); + lv_obj_set_width(ui_ValueFeelsLike, LV_SIZE_CONTENT); /// 1 + lv_obj_set_height(ui_ValueFeelsLike, LV_SIZE_CONTENT); /// 1 + lv_obj_set_x(ui_ValueFeelsLike, -2); + lv_obj_set_y(ui_ValueFeelsLike, 57); + lv_obj_set_align(ui_ValueFeelsLike, LV_ALIGN_CENTER); + lv_label_set_text(ui_ValueFeelsLike, "--.- °C"); + lv_obj_set_style_text_color(ui_ValueFeelsLike, lv_color_hex(0x17ABF7), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_opa(ui_ValueFeelsLike, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_font(ui_ValueFeelsLike, &lv_font_arial_48, LV_PART_MAIN | LV_STATE_DEFAULT); + + ui_Panel4 = lv_obj_create(ui_Container1); + lv_obj_set_height(ui_Panel4, 1); + lv_obj_set_width(ui_Panel4, lv_pct(90)); + lv_obj_set_x(ui_Panel4, 0); + lv_obj_set_y(ui_Panel4, -8); + lv_obj_set_align(ui_Panel4, LV_ALIGN_CENTER); + lv_obj_clear_flag(ui_Panel4, LV_OBJ_FLAG_SCROLLABLE); /// Flags + + ui_Label4 = lv_label_create(ui_Container1); + lv_obj_set_width(ui_Label4, LV_SIZE_CONTENT); /// 1 + lv_obj_set_height(ui_Label4, LV_SIZE_CONTENT); /// 1 + lv_obj_set_align(ui_Label4, LV_ALIGN_CENTER); + #if defined(LANG_EN) + lv_label_set_text(ui_Label4, "Sunrise"); + #elif defined(LANG_GR) + lv_label_set_text(ui_Label4, "Ανατολή"); + #endif + lv_obj_set_style_text_color(ui_Label4, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_opa(ui_Label4, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_font(ui_Label4, &lv_font_arial_24, LV_PART_MAIN | LV_STATE_DEFAULT); + + ui_ValueSunrise = lv_label_create(ui_Container1); + lv_obj_set_width(ui_ValueSunrise, LV_SIZE_CONTENT); /// 1 + lv_obj_set_height(ui_ValueSunrise, LV_SIZE_CONTENT); /// 1 + lv_obj_set_x(ui_ValueSunrise, 14); + lv_obj_set_y(ui_ValueSunrise, 205); + lv_obj_set_align(ui_ValueSunrise, LV_ALIGN_CENTER); + lv_label_set_text(ui_ValueSunrise, "--:--"); + lv_obj_set_style_text_color(ui_ValueSunrise, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_opa(ui_ValueSunrise, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_font(ui_ValueSunrise, &lv_font_arial_20, LV_PART_MAIN | LV_STATE_DEFAULT); + + ui_Label5 = lv_label_create(ui_Container1); + lv_obj_set_width(ui_Label5, LV_SIZE_CONTENT); /// 1 + lv_obj_set_height(ui_Label5, LV_SIZE_CONTENT); /// 1 + lv_obj_set_align(ui_Label5, LV_ALIGN_CENTER); + #if defined(LANG_EN) + lv_label_set_text(ui_Label5, "Sunset"); + #elif defined(LANG_GR) + lv_label_set_text(ui_Label5, "Δύση"); + #endif + lv_obj_set_style_text_color(ui_Label5, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_opa(ui_Label5, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_font(ui_Label5, &lv_font_arial_24, LV_PART_MAIN | LV_STATE_DEFAULT); + + ui_ValueSunset = lv_label_create(ui_Container1); + lv_obj_set_width(ui_ValueSunset, LV_SIZE_CONTENT); /// 1 + lv_obj_set_height(ui_ValueSunset, LV_SIZE_CONTENT); /// 1 + lv_obj_set_align(ui_ValueSunset, LV_ALIGN_CENTER); + lv_label_set_text(ui_ValueSunset, "--:--"); + lv_obj_set_style_text_color(ui_ValueSunset, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_opa(ui_ValueSunset, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_font(ui_ValueSunset, &lv_font_arial_20, LV_PART_MAIN | LV_STATE_DEFAULT); + + ui_Container2 = lv_obj_create(ui_TabPageWeather); + lv_obj_remove_style_all(ui_Container2); + lv_obj_set_width(ui_Container2, 200); + lv_obj_set_height(ui_Container2, 390); + lv_obj_set_x(ui_Container2, 280); + lv_obj_set_y(ui_Container2, 0); + lv_obj_set_align(ui_Container2, LV_ALIGN_CENTER); + lv_obj_set_flex_flow(ui_Container2, LV_FLEX_FLOW_COLUMN); + lv_obj_set_flex_align(ui_Container2, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); + lv_obj_clear_flag(ui_Container2, LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_SCROLLABLE); /// Flags + lv_obj_set_style_pad_row(ui_Container2, 15, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_pad_column(ui_Container2, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + + ui_Humidity = lv_label_create(ui_Container2); + lv_obj_set_width(ui_Humidity, LV_SIZE_CONTENT); /// 1 + lv_obj_set_height(ui_Humidity, LV_SIZE_CONTENT); /// 1 + lv_obj_set_align(ui_Humidity, LV_ALIGN_CENTER); + #if defined(LANG_EN) + lv_label_set_text(ui_Humidity, "Humidity"); + #elif defined(LANG_GR) + lv_label_set_text(ui_Humidity, "Υγρασία"); + #endif + lv_obj_set_style_text_color(ui_Humidity, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_opa(ui_Humidity, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_font(ui_Humidity, &lv_font_arial_26, LV_PART_MAIN | LV_STATE_DEFAULT); + + ui_ValueHumidity = lv_label_create(ui_Container2); + lv_obj_set_width(ui_ValueHumidity, LV_SIZE_CONTENT); /// 1 + lv_obj_set_height(ui_ValueHumidity, LV_SIZE_CONTENT); /// 1 + lv_obj_set_align(ui_ValueHumidity, LV_ALIGN_CENTER); + lv_label_set_text(ui_ValueHumidity, "--%"); + lv_obj_set_style_text_color(ui_ValueHumidity, lv_color_hex(0x17ABF7), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_opa(ui_ValueHumidity, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_font(ui_ValueHumidity, &lv_font_arial_48, LV_PART_MAIN | LV_STATE_DEFAULT); + + ui_Panel3 = lv_obj_create(ui_Container2); + lv_obj_set_height(ui_Panel3, 1); + lv_obj_set_width(ui_Panel3, lv_pct(90)); + lv_obj_set_align(ui_Panel3, LV_ALIGN_CENTER); + lv_obj_clear_flag(ui_Panel3, LV_OBJ_FLAG_SCROLLABLE); /// Flags + + ui_Pressure = lv_label_create(ui_Container2); + lv_obj_set_width(ui_Pressure, LV_SIZE_CONTENT); /// 1 + lv_obj_set_height(ui_Pressure, LV_SIZE_CONTENT); /// 1 + lv_obj_set_align(ui_Pressure, LV_ALIGN_CENTER); + #if defined(LANG_EN) + lv_label_set_text(ui_Pressure, "Pressure"); + #elif defined(LANG_GR) + lv_label_set_text(ui_Pressure, "Πίεση"); + #endif + lv_obj_set_style_text_color(ui_Pressure, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_opa(ui_Pressure, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_font(ui_Pressure, &lv_font_arial_26, LV_PART_MAIN | LV_STATE_DEFAULT); + + ui_ValuePressure = lv_label_create(ui_Container2); + lv_obj_set_width(ui_ValuePressure, LV_SIZE_CONTENT); /// 1 + lv_obj_set_height(ui_ValuePressure, LV_SIZE_CONTENT); /// 1 + lv_obj_set_align(ui_ValuePressure, LV_ALIGN_CENTER); + lv_label_set_text(ui_ValuePressure, "---- hpa"); + lv_obj_set_style_text_color(ui_ValuePressure, lv_color_hex(0x17ABF7), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_opa(ui_ValuePressure, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_font(ui_ValuePressure, &lv_font_arial_40, LV_PART_MAIN | LV_STATE_DEFAULT); + + ui_Panel2 = lv_obj_create(ui_Container2); + lv_obj_set_height(ui_Panel2, 1); + lv_obj_set_width(ui_Panel2, lv_pct(90)); + lv_obj_set_align(ui_Panel2, LV_ALIGN_CENTER); + lv_obj_clear_flag(ui_Panel2, LV_OBJ_FLAG_SCROLLABLE); /// Flags + + ui_Label2 = lv_label_create(ui_Container2); + lv_obj_set_width(ui_Label2, LV_SIZE_CONTENT); /// 1 + lv_obj_set_height(ui_Label2, LV_SIZE_CONTENT); /// 1 + lv_obj_set_align(ui_Label2, LV_ALIGN_CENTER); + + #if defined(LANG_EN) + lv_label_set_text(ui_Label2, "Wind"); + #elif defined(LANG_GR) + lv_label_set_text(ui_Label2, "Άνεμος"); + #endif + lv_obj_set_style_text_color(ui_Label2, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_opa(ui_Label2, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_font(ui_Label2, &lv_font_arial_26, LV_PART_MAIN | LV_STATE_DEFAULT); + + ui_ValueWindSpeed = lv_label_create(ui_Container2); + lv_obj_set_width(ui_ValueWindSpeed, LV_SIZE_CONTENT); /// 1 + lv_obj_set_height(ui_ValueWindSpeed, LV_SIZE_CONTENT); /// 1 + lv_obj_set_align(ui_ValueWindSpeed, LV_ALIGN_CENTER); + lv_label_set_text(ui_ValueWindSpeed, "-- m/s"); + lv_obj_set_style_text_color(ui_ValueWindSpeed, lv_color_hex(0x17ABF7), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_opa(ui_ValueWindSpeed, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_font(ui_ValueWindSpeed, &lv_font_arial_48, LV_PART_MAIN | LV_STATE_DEFAULT); + + ui_ValueWindDirection = lv_label_create(ui_Container2); + lv_obj_set_width(ui_ValueWindDirection, LV_SIZE_CONTENT); /// 1 + lv_obj_set_height(ui_ValueWindDirection, LV_SIZE_CONTENT); /// 1 + lv_obj_set_align(ui_ValueWindDirection, LV_ALIGN_CENTER); + #if defined(LANG_EN) + lv_label_set_text(ui_ValueWindDirection, "Direction: --"); + #elif defined(LANG_GR) + lv_label_set_text(ui_ValueWindDirection, "Κατεύθυνση: --"); + #endif + lv_obj_set_style_text_color(ui_ValueWindDirection, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_opa(ui_ValueWindDirection, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_font(ui_ValueWindDirection, &lv_font_arial_20, LV_PART_MAIN | LV_STATE_DEFAULT); + + ui_Image1 = lv_img_create(ui_TabPageWeather); + lv_obj_set_width(ui_Image1, LV_SIZE_CONTENT); /// 1 + lv_obj_set_height(ui_Image1, LV_SIZE_CONTENT); /// 1 + lv_obj_set_x(ui_Image1, 0); + lv_obj_set_y(ui_Image1, 14); + lv_obj_set_align(ui_Image1, LV_ALIGN_CENTER); + lv_obj_add_flag(ui_Image1, LV_OBJ_FLAG_ADV_HITTEST); /// Flags + lv_obj_clear_flag(ui_Image1, LV_OBJ_FLAG_SCROLLABLE); /// Flags + + ui_ValueDate = lv_label_create(ui_TabPageWeather); + lv_obj_set_width(ui_ValueDate, LV_SIZE_CONTENT); /// 1 + lv_obj_set_height(ui_ValueDate, LV_SIZE_CONTENT); /// 1 + lv_obj_set_x(ui_ValueDate, 0); + lv_obj_set_y(ui_ValueDate, -165); + lv_obj_set_align(ui_ValueDate, LV_ALIGN_CENTER); + lv_label_set_text(ui_ValueDate, "--- --/--/----"); + lv_obj_set_style_text_color(ui_ValueDate, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_opa(ui_ValueDate, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_font(ui_ValueDate, &lv_font_arial_40, LV_PART_MAIN | LV_STATE_DEFAULT); + + ui_ValueTime = lv_label_create(ui_TabPageWeather); + lv_obj_set_width(ui_ValueTime, LV_SIZE_CONTENT); /// 1 + lv_obj_set_height(ui_ValueTime, LV_SIZE_CONTENT); /// 1 + lv_obj_set_x(ui_ValueTime, 0); + lv_obj_set_y(ui_ValueTime, -100); + lv_obj_set_align(ui_ValueTime, LV_ALIGN_CENTER); + lv_label_set_text(ui_ValueTime, "--:--"); + lv_obj_set_style_text_color(ui_ValueTime, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_opa(ui_ValueTime, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_font(ui_ValueTime, &lv_font_arial_48, LV_PART_MAIN | LV_STATE_DEFAULT); + + ui_ValueLastUpdate = lv_label_create(ui_TabPageWeather); + lv_obj_set_width(ui_ValueLastUpdate, LV_SIZE_CONTENT); /// 559 + lv_obj_set_height(ui_ValueLastUpdate, LV_SIZE_CONTENT); /// 24 + lv_obj_set_x(ui_ValueLastUpdate, 0); + lv_obj_set_y(ui_ValueLastUpdate, 179); + lv_obj_set_align(ui_ValueLastUpdate, LV_ALIGN_CENTER); + #if defined(LANG_EN) + lv_label_set_text(ui_ValueLastUpdate, "Last update: --/--/----"); + #elif defined(LANG_GR) + lv_label_set_text(ui_ValueLastUpdate, "Ενημερώθηκε στις: --/--/----"); + #endif + lv_obj_set_style_text_color(ui_ValueLastUpdate, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_opa(ui_ValueLastUpdate, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_font(ui_ValueLastUpdate, &lv_font_arial_20, LV_PART_MAIN | LV_STATE_DEFAULT); + + + ui_TabPageContacts = lv_tabview_add_tab(ui_TabView1, "Contacts"); ui_Contacts = lv_list_create(ui_TabPageContacts); @@ -78,19 +384,158 @@ void ui_Screen1_screen_init(void) LV_FLEX_ALIGN_START); + + #if defined(LANG_EN) ui_TabPageSettings = lv_tabview_add_tab(ui_TabView1, "Settings"); + #elif defined(LANG_GR) + ui_TabPageSettings = lv_tabview_add_tab(ui_TabView1, "Ρυθμίσεις"); + #endif + + ui_DayLight = lv_checkbox_create(ui_TabPageSettings); + #if defined(LANG_EN) + lv_checkbox_set_text(ui_DayLight, "Day light (summer time)"); + #elif defined(LANG_GR) + lv_checkbox_set_text(ui_DayLight, "Θερινή ώρα"); + #endif + lv_obj_set_style_text_font(ui_DayLight, &lv_font_arial_20, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_width(ui_DayLight, LV_SIZE_CONTENT); /// 1 + lv_obj_set_height(ui_DayLight, LV_SIZE_CONTENT); /// 1 + lv_obj_set_x(ui_DayLight, -257); + lv_obj_set_y(ui_DayLight, -168); + lv_obj_set_align(ui_DayLight, LV_ALIGN_CENTER); + lv_obj_add_flag(ui_DayLight, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags + lv_obj_set_style_text_color(ui_DayLight, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_opa(ui_DayLight, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + + lv_obj_add_event_cb(ui_DayLight, event_handler, LV_EVENT_ALL, NULL); + lv_obj_add_state(ui_DayLight, LV_STATE_DEFAULT); - ui_AutoLight = lv_checkbox_create(ui_TabPageSettings); - lv_checkbox_set_text(ui_AutoLight, "Auto dim brightness"); - lv_obj_set_width(ui_AutoLight, LV_SIZE_CONTENT); /// 1 - lv_obj_set_height(ui_AutoLight, LV_SIZE_CONTENT); /// 1 - lv_obj_set_x(ui_AutoLight, -257); - lv_obj_set_y(ui_AutoLight, -168); - lv_obj_set_align(ui_AutoLight, LV_ALIGN_CENTER); - lv_obj_add_flag(ui_AutoLight, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags - lv_obj_set_style_text_color(ui_AutoLight, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_text_opa(ui_AutoLight, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + ui_DimOverlay = lv_obj_create(ui_Screen1); + lv_obj_remove_style_all(ui_DimOverlay); // no border/padding + lv_obj_set_size(ui_DimOverlay, LV_PCT(100), LV_PCT(100)); + lv_obj_set_align(ui_DimOverlay, LV_ALIGN_CENTER); - lv_obj_add_event_cb(ui_AutoLight, ui_event_AutoLight, LV_EVENT_ALL, NULL); + // black semi transparent background + lv_obj_set_style_bg_color(ui_DimOverlay, lv_color_hex(0x000000), 0); + lv_obj_set_style_bg_opa(ui_DimOverlay, 0, 0); // initially "off" + // Do not block touch/scroll + lv_obj_clear_flag(ui_DimOverlay, LV_OBJ_FLAG_CLICKABLE); + lv_obj_clear_flag(ui_DimOverlay, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_clear_flag(ui_DimOverlay, LV_OBJ_FLAG_SCROLL_CHAIN_HOR); + lv_obj_clear_flag(ui_DimOverlay, LV_OBJ_FLAG_SCROLL_CHAIN_VER); + + // always in front + lv_obj_move_foreground(ui_DimOverlay); + +} + +void setNightMode(bool night) { + + if (!ui_DimOverlay) return; + if (night) { + lv_obj_set_style_bg_opa(ui_DimOverlay, 192, 0); // 75% dark + } else { + lv_obj_set_style_bg_opa(ui_DimOverlay, 0, 0); // none + } } + +// void ui_Screen1_screen_init(void) +// { +// ui_Screen1 = lv_obj_create(NULL); +// lv_obj_clear_flag(ui_Screen1, LV_OBJ_FLAG_SCROLLABLE); /// Flags +// lv_obj_set_style_bg_color(ui_Screen1, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT); +// lv_obj_set_style_bg_opa(ui_Screen1, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + +// ui_TabView1 = lv_tabview_create(ui_Screen1, LV_DIR_TOP, 50); +// lv_obj_set_width(ui_TabView1, 800); +// lv_obj_set_height(ui_TabView1, 480); +// lv_obj_set_align(ui_TabView1, LV_ALIGN_CENTER); +// lv_obj_clear_flag(ui_TabView1, LV_OBJ_FLAG_SCROLLABLE); /// Flags +// lv_obj_set_style_bg_color(ui_TabView1, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT); +// lv_obj_set_style_bg_opa(ui_TabView1, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + +// lv_obj_set_style_bg_color(lv_tabview_get_tab_btns(ui_TabView1), lv_color_hex(0x424242), +// LV_PART_MAIN | LV_STATE_DEFAULT); +// lv_obj_set_style_bg_opa(lv_tabview_get_tab_btns(ui_TabView1), 255, LV_PART_MAIN | LV_STATE_DEFAULT); + +// lv_obj_set_style_text_color(lv_tabview_get_tab_btns(ui_TabView1), lv_color_hex(0xFFFFFF), +// LV_PART_ITEMS | LV_STATE_DEFAULT); +// lv_obj_set_style_text_opa(lv_tabview_get_tab_btns(ui_TabView1), 255, LV_PART_ITEMS | LV_STATE_DEFAULT); +// lv_obj_set_style_text_font(lv_tabview_get_tab_btns(ui_TabView1), &lv_font_arial_18, +// LV_PART_ITEMS | LV_STATE_DEFAULT); + +// ui_TabPageContacts = lv_tabview_add_tab(ui_TabView1, "Contacts"); + +// ui_Contacts = lv_list_create(ui_TabPageContacts); +// //lv_list_set_options(ui_Contacts, "Contact", LV_list_MODE_NORMAL); +// lv_obj_set_width(ui_Contacts, 246); +// lv_obj_set_height(ui_Contacts, 400); +// lv_obj_set_x(ui_Contacts, -262); +// lv_obj_set_y(ui_Contacts, 0); +// lv_obj_set_align(ui_Contacts, LV_ALIGN_CENTER); + +// ui_ContactMessages = lv_list_create(ui_TabPageContacts); +// //lv_list_set_options(ui_ContactMessages, "Contact", LV_list_MODE_NORMAL); +// lv_obj_set_width(ui_ContactMessages, 500); +// lv_obj_set_height(ui_ContactMessages, 400); +// lv_obj_set_x(ui_ContactMessages, 124); +// lv_obj_set_y(ui_ContactMessages, 0); +// lv_obj_set_align(ui_ContactMessages, LV_ALIGN_CENTER); +// lv_obj_set_style_bg_color(ui_ContactMessages, lv_color_hex(0), 0); + +// ui_TabPageChannels = lv_tabview_add_tab(ui_TabView1, "Channels"); + +// ui_Channels = lv_dropdown_create(ui_TabPageChannels); +// lv_dropdown_set_options(ui_Channels, "Public"); +// lv_obj_set_width(ui_Channels, 291); +// lv_obj_set_height(ui_Channels, LV_SIZE_CONTENT); /// 1 +// lv_obj_set_x(ui_Channels, -243); +// lv_obj_set_y(ui_Channels, -182); +// lv_obj_set_align(ui_Channels, LV_ALIGN_CENTER); +// lv_obj_add_flag(ui_Channels, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags + + + +// ui_ChannelMessages = lv_list_create(ui_TabPageChannels); +// //lv_list_set_options(ui_ChannelMessages, "Contact", LV_list_MODE_NORMAL); +// lv_obj_set_width(ui_ChannelMessages, 780); +// lv_obj_set_height(ui_ChannelMessages, 342); +// lv_obj_set_x(ui_ChannelMessages, 0); +// lv_obj_set_y(ui_ChannelMessages, 30); +// lv_obj_set_align(ui_ChannelMessages, LV_ALIGN_CENTER); +// lv_obj_set_flex_flow(ui_ChannelMessages, LV_FLEX_FLOW_COLUMN); +// lv_obj_set_style_pad_row(ui_ChannelMessages, 6, 0); +// lv_obj_set_style_pad_all(ui_ChannelMessages, 6, 0); +// lv_obj_set_flex_align(ui_ChannelMessages, +// LV_FLEX_ALIGN_START, +// LV_FLEX_ALIGN_START, +// LV_FLEX_ALIGN_START); + + +// ui_TabPageSettings = lv_tabview_add_tab(ui_TabView1, "Settings"); + +// ui_AutoLight = lv_checkbox_create(ui_TabPageSettings); +// lv_checkbox_set_text(ui_AutoLight, "Auto dim brightness"); +// lv_obj_set_width(ui_AutoLight, LV_SIZE_CONTENT); /// 1 +// lv_obj_set_height(ui_AutoLight, LV_SIZE_CONTENT); /// 1 +// lv_obj_set_x(ui_AutoLight, -257); +// lv_obj_set_y(ui_AutoLight, -168); +// lv_obj_set_align(ui_AutoLight, LV_ALIGN_CENTER); +// lv_obj_add_flag(ui_AutoLight, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags +// lv_obj_set_style_text_color(ui_AutoLight, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT); +// lv_obj_set_style_text_opa(ui_AutoLight, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + +// lv_obj_add_event_cb(ui_AutoLight, ui_event_AutoLight, LV_EVENT_ALL, NULL); + +// } + +// void setNightMode(bool night) { + +// if (!ui_DimOverlay) return; +// if (night) { +// lv_obj_set_style_bg_opa(ui_DimOverlay, 192, 0); // 75% dark +// } else { +// lv_obj_set_style_bg_opa(ui_DimOverlay, 0, 0); // none +// } +// } diff --git a/src/UI/ui_events.cpp b/src/UI/ui_events.cpp index f3f402f27..c2a7bb68d 100644 --- a/src/UI/ui_events.cpp +++ b/src/UI/ui_events.cpp @@ -5,7 +5,3 @@ #include "ui.h" -void onDayLightPressed(lv_event_t * e) -{ - // Your code here -} diff --git a/src/UI/ui_events.h b/src/UI/ui_events.h index 749b538da..4785f05db 100644 --- a/src/UI/ui_events.h +++ b/src/UI/ui_events.h @@ -10,8 +10,6 @@ extern "C" { #endif -void onDayLightPressed(lv_event_t * e); - #ifdef __cplusplus } /*extern "C"*/ #endif diff --git a/src/helpers/wifi/MyWiFi.h b/src/helpers/wifi/MyWiFi.h deleted file mode 100644 index b201b858a..000000000 --- a/src/helpers/wifi/MyWiFi.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef WIFI_h -#define WIFI_h - -#include -#include -#include "esp_wifi.h" -#include - -typedef struct s_espNow { - uint8_t type; - uint8_t id; - int16_t value; -} s_espNow; - -class MyWiFi { -private: - // functions - void notInitialized(); - - using OnDataSentCallback = void (*)(const uint8_t *mac_addr, esp_now_send_status_t status); - using OnDataRecvCallback = void (*)(const uint8_t *mac_addr, const uint8_t *incomingData, int len); - - //Vars - uint8_t WiFiChannel; - bool initDone; - - esp_now_peer_info_t peerInfo; - s_espNow espNowPacket; - - SemaphoreHandle_t semaphoreData; - - char *tmp_buf; - char *savedSSID; - char *savedPassword; -public: - MyWiFi(); - // functions - void init(wifi_mode_t mode, char *ssid, char *password); - void stop(); - bool initESPNow(int channel, bool encrypted, OnDataSentCallback onSent, OnDataRecvCallback onRecv); - void addEspNowPeer(uint8_t address[6]); - esp_err_t sendEspNow(const uint8_t *peer_addr, uint8_t type, uint8_t id, uint16_t value); - void connect(); - void disconnect(); - void ensureConnection(); - bool isConnected(); - wl_status_t getStatus(); - uint8_t getChannel(); -}; - -#endif \ No newline at end of file diff --git a/src/helpers/wifi/myWiFi.cpp b/src/helpers/wifi/myWiFi.cpp deleted file mode 100644 index 5f96fd243..000000000 --- a/src/helpers/wifi/myWiFi.cpp +++ /dev/null @@ -1,191 +0,0 @@ -#include -#include - -#include "esp_log.h" -#include "MyWiFi.h" - -MyWiFi::MyWiFi() { - ESP_LOGD("[WiFi]"); - - initDone = false; - tmp_buf = (char*)malloc(128); - - semaphoreData = xSemaphoreCreateMutex(); - xSemaphoreGive(semaphoreData); -} - -void MyWiFi::init(wifi_mode_t mode, char *ssid, char *password) { - ESP_LOGD("Initializing WiFi"); - - savedSSID = (char*)malloc(strlen(ssid) + 1); - strcpy(savedSSID, ssid); - - savedPassword = (char*)malloc(strlen(password) + 1); - strcpy(savedPassword, password); - - ESP_LOGD("SSID: '%s', password:'%s'", savedSSID, savedPassword); - - WiFi.mode(mode); - ESP_LOGI("MAC Address: %s", WiFi.macAddress()); - initDone = true; -} - -void MyWiFi::stop() { - if (!initDone) { - notInitialized(); - return; - } - disconnect(); - initDone = false; - free(savedSSID); - free(savedPassword); -} - -void MyWiFi::notInitialized() { - ESP_LOGE("WiFi not initialized"); -} - -void MyWiFi::connect() { - ESP_LOGI("WiFi disconnected, reconnecting..."); - - if (!initDone) { - notInitialized(); - return; - } - - xSemaphoreTake(semaphoreData, portMAX_DELAY); - WiFi.disconnect(); - WiFi.begin(savedSSID, savedPassword); - unsigned long startAttemptTime = millis(); - - while (WiFi.status() != WL_CONNECTED && millis() - startAttemptTime < 10000) { - delay(500); - } - - wifi_ap_record_t ap_info; - if (esp_wifi_sta_get_ap_info(&ap_info) == ESP_OK) { - ESP_LOGD("WiFi connected"); - WiFiChannel = ap_info.primary; - ESP_LOGD("WiFi channel: %d", WiFiChannel); - } else { - WiFiChannel = 0; - ESP_LOGD("Not connected to any WiFi network."); - } - xSemaphoreGive(semaphoreData); -} - -void MyWiFi::ensureConnection() { - if (!initDone) { - notInitialized(); - return; - } - if (!isConnected()) { - connect(); - } -} - -bool MyWiFi::isConnected() { - if (!initDone) { - notInitialized(); - return false; - } - bool ret; - xSemaphoreTake(semaphoreData, portMAX_DELAY); - ret = WiFi.status() == WL_CONNECTED; - xSemaphoreGive(semaphoreData); - return ret; -} - -void MyWiFi::disconnect() { - ESP_LOGD("WiFi disconnecting..."); - if (!initDone) { - notInitialized(); - return; - } - xSemaphoreTake(semaphoreData, portMAX_DELAY); - WiFi.disconnect(); - xSemaphoreGive(semaphoreData); -} - -wl_status_t MyWiFi::getStatus() { - if (!initDone) { - notInitialized(); - return WL_DISCONNECTED; - } - wl_status_t ret; - xSemaphoreTake(semaphoreData, portMAX_DELAY); - ret = WiFi.status(); - xSemaphoreGive(semaphoreData); - return ret; -} - -uint8_t MyWiFi::getChannel() { - if (!initDone) { - notInitialized(); - return 0; - } - uint8_t ret; - xSemaphoreTake(semaphoreData, portMAX_DELAY); - ret = WiFiChannel; - xSemaphoreGive(semaphoreData); - return ret; -} - -//////////// -// ESPNow // -//////////// -void MyWiFi::addEspNowPeer(uint8_t address[6]) { - ESP_LOGD("Adding ESPNow peer"); - memcpy(peerInfo.peer_addr, address, 6); - if (esp_now_add_peer(&peerInfo) != ESP_OK) { - ESP_LOGE("Failed to add peer"); - } else { - ESP_LOGD("ESPNow peer added"); - } -} - -bool MyWiFi::initESPNow(int channel, bool encrypted, OnDataSentCallback onSent, OnDataRecvCallback onRecv) { - - ESP_LOGI("Initializing ESP-NOW..."); - - if (onRecv == nullptr) { - ESP_LOGE("register_recv_cb is null"); - return false; - } - - WiFi.mode(WIFI_STA); - - ESP_LOGI("MAC Address: %s", WiFi.macAddress()); - - // Init ESP-NOW - if (esp_now_init() != ESP_OK) { - ESP_LOGE("Error initializing ESP-NOW"); - return false; - } else { - ESP_LOGD("Initializing ESP-NOW ok"); - } - - // preper register peer - peerInfo.channel = channel; - peerInfo.encrypt = encrypted; - peerInfo.ifidx = WIFI_IF_STA; - - // Once ESPNow is successfully Init, we will register for Send CB to - // get the status of Trasnmitted packet - if (onSent != nullptr) { - esp_now_register_send_cb(onSent); - } - - // Register for a callback function that will be called when data is received - esp_now_register_recv_cb(onRecv); - - return true; -} - -esp_err_t MyWiFi::sendEspNow(const uint8_t *peer_addr, uint8_t type, uint8_t id, uint16_t value) { - espNowPacket.type = type; - espNowPacket.id = id; - espNowPacket.value = value; - return esp_now_send(peer_addr, (uint8_t *) &espNowPacket, sizeof(s_espNow)); -} - diff --git a/variants/elecrow_espnow/platformio.ini b/variants/elecrow_espnow/platformio.ini index 5e95874ab..ede9766b9 100644 --- a/variants/elecrow_espnow/platformio.ini +++ b/variants/elecrow_espnow/platformio.ini @@ -27,7 +27,7 @@ build_flags = -D LV_CONF_PATH=lv_conf.h -D ELECROW_DISPLAY_50 -D CLIENT_WITHOUT_LORA - -D USE_OPEN_WEATHER + -D LANG_GR -D ADVERT_NAME='"Elecrow Terminal"' -D MAX_CONTACTS=350 -D MAX_GROUP_CHANNELS=8 @@ -35,12 +35,12 @@ build_flags = -D BOARD_HAS_PSRAM=1 build_src_filter = ${Elecrow_ESPNOW.build_src_filter} +<../examples/simple_secure_chat_ui/*.cpp> - + + + lib_deps = ${esp32_base.lib_deps} adafruit/Adafruit SSD1306 @ ^2.5.15 + fbiego/ESP32Time@^2.0.6 lvgl/lvgl@8.3.11 lovyan03/LovyanGFX@^1.1.16 bitbank2/PNGdec@^1.1.6