├── weather_13 ├── src │ ├── readme.txt │ ├── ui │ │ ├── Behaviour │ │ │ ├── GUI_Events.c │ │ │ └── GUI_Animations.c │ │ ├── filelist.txt │ │ ├── CMakeLists.txt │ │ ├── GUI.c │ │ ├── GUI_Themes.c │ │ ├── ui_theme_manager.h │ │ ├── GUI_Themes.h │ │ ├── ui_helpers.h │ │ ├── Content │ │ │ └── assets │ │ │ │ └── images │ │ │ │ ├── upload_humi_479a980bbd324940bbd291ab8d342bd8_png.c │ │ │ │ ├── upload_fan_f58335df51f940da8686fe1402df28e2_png.c │ │ │ │ └── upload_temp_a6542b73daec4eaaac6a3d9b6729be03_png.c │ │ ├── ui_helpers.c │ │ ├── GUI_Variables.c │ │ └── GUI.h │ ├── e1002_display.h │ ├── main.cpp │ ├── e1002_display.cpp │ ├── weather_view.cpp │ └── weather.cpp ├── .gitignore ├── include │ ├── weather_view.h │ ├── driver.h │ └── weather.h ├── .vscode │ ├── extensions.json │ └── settings.json ├── partitions_custom.csv ├── test │ └── README ├── lib │ └── README ├── platformio.ini └── boards │ └── reterminal.json ├── weather_7 ├── src │ ├── readme.txt │ ├── ui │ │ ├── Behaviour │ │ │ ├── GUI_Events.c │ │ │ └── GUI_Animations.c │ │ ├── filelist.txt │ │ ├── CMakeLists.txt │ │ ├── GUI.c │ │ ├── GUI_Themes.c │ │ ├── ui_theme_manager.h │ │ ├── GUI_Themes.h │ │ ├── ui_helpers.h │ │ ├── ui_helpers.c │ │ ├── GUI_Variables.c │ │ ├── Content │ │ │ └── assets │ │ │ │ └── images │ │ │ │ └── upload_small_weather_2_31a67822608c43f695415b4825c28313_png.c │ │ └── GUI.h │ ├── e1002_display.h │ ├── main.cpp │ ├── e1002_display.cpp │ ├── weather_view.cpp │ └── weather.cpp ├── .gitignore ├── include │ ├── weather_view.h │ ├── driver.h │ └── weather.h ├── .vscode │ ├── extensions.json │ └── settings.json ├── partitions_custom.csv ├── test │ └── README ├── lib │ └── README ├── platformio.ini └── boards │ └── reterminal.json ├── Seeed Weather epaper 1.slvp ├── Seeed Weather epaper 2.slvp ├── README.md ├── .vscode └── settings.json └── LICENSE /weather_13/src/readme.txt: -------------------------------------------------------------------------------- 1 | For information on installing libraries, see: http://www.arduino.cc/en/Guide/Libraries 2 | -------------------------------------------------------------------------------- /weather_7/src/readme.txt: -------------------------------------------------------------------------------- 1 | For information on installing libraries, see: http://www.arduino.cc/en/Guide/Libraries 2 | -------------------------------------------------------------------------------- /Seeed Weather epaper 1.slvp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seeed-Projects/E1002_SquareLine_Vision_Demo/main/Seeed Weather epaper 1.slvp -------------------------------------------------------------------------------- /Seeed Weather epaper 2.slvp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seeed-Projects/E1002_SquareLine_Vision_Demo/main/Seeed Weather epaper 2.slvp -------------------------------------------------------------------------------- /weather_13/.gitignore: -------------------------------------------------------------------------------- 1 | .pio 2 | .vscode/.browse.c_cpp.db* 3 | .vscode/c_cpp_properties.json 4 | .vscode/launch.json 5 | .vscode/ipch 6 | -------------------------------------------------------------------------------- /weather_7/.gitignore: -------------------------------------------------------------------------------- 1 | .pio 2 | .vscode/.browse.c_cpp.db* 3 | .vscode/c_cpp_properties.json 4 | .vscode/launch.json 5 | .vscode/ipch 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # E1002_SquareLine_Vision_Demo 2 | Here are the .slvp files for importing SquareLine Vision as well as the example programs for Platformio. 3 | -------------------------------------------------------------------------------- /weather_13/src/ui/Behaviour/GUI_Events.c: -------------------------------------------------------------------------------- 1 | #include "../GUI.h" 2 | 3 | #ifdef GUI_EXTERNAL_CUSTOM_CALLBACK_FUNCTION_FILE 4 | #include GUI_EXTERNAL_CUSTOM_CALLBACK_FUNCTION_FILE 5 | #endif 6 | 7 | 8 | -------------------------------------------------------------------------------- /weather_7/src/ui/Behaviour/GUI_Events.c: -------------------------------------------------------------------------------- 1 | #include "../GUI.h" 2 | 3 | #ifdef GUI_EXTERNAL_CUSTOM_CALLBACK_FUNCTION_FILE 4 | #include GUI_EXTERNAL_CUSTOM_CALLBACK_FUNCTION_FILE 5 | #endif 6 | 7 | 8 | -------------------------------------------------------------------------------- /weather_13/include/weather_view.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "weather.h" 4 | 5 | // Update LVGL widgets with the latest weather information. 6 | void GUI_update_weather_screen(const WeatherData &data); 7 | -------------------------------------------------------------------------------- /weather_7/include/weather_view.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "weather.h" 4 | 5 | // Update LVGL widgets with the latest weather information. 6 | void GUI_update_weather_screen(const WeatherData &data); 7 | -------------------------------------------------------------------------------- /weather_13/include/driver.h: -------------------------------------------------------------------------------- 1 | // #define BOARD_SCREEN_COMBO 520 // reTerminal E1001 (UC8179) 2 | #define BOARD_SCREEN_COMBO 521 // reTerminal E1002 (ED2208) 3 | 4 | // #define BOARD_SCREEN_COMBO 502 // 7.3 inch six-color ePaper Screen(ED2208) 5 | // #define USE_XIAO_EPAPER_DISPLAY_BOARD_EE04 -------------------------------------------------------------------------------- /weather_7/include/driver.h: -------------------------------------------------------------------------------- 1 | // #define BOARD_SCREEN_COMBO 520 // reTerminal E1001 (UC8179) 2 | #define BOARD_SCREEN_COMBO 521 // reTerminal E1002 (ED2208) 3 | 4 | // #define BOARD_SCREEN_COMBO 502 // 7.3 inch six-color ePaper Screen(ED2208) 5 | // #define USE_XIAO_EPAPER_DISPLAY_BOARD_EE04 -------------------------------------------------------------------------------- /weather_7/.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // See http://go.microsoft.com/fwlink/?LinkId=827846 3 | // for the documentation about the extensions.json format 4 | "recommendations": [ 5 | "platformio.platformio-ide" 6 | ], 7 | "unwantedRecommendations": [ 8 | "ms-vscode.cpptools-extension-pack" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /weather_13/.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // See http://go.microsoft.com/fwlink/?LinkId=827846 3 | // for the documentation about the extensions.json format 4 | "recommendations": [ 5 | "platformio.platformio-ide" 6 | ], 7 | "unwantedRecommendations": [ 8 | "ms-vscode.cpptools-extension-pack" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /weather_13/src/ui/filelist.txt: -------------------------------------------------------------------------------- 1 | Behaviour/GUI_Animations.c 2 | Behaviour/GUI_Events.c 3 | Content/assets/fonts/big_number_1.c 4 | Content/assets/fonts/header_1.c 5 | Content/assets/fonts/label_1.c 6 | Content/assets/fonts/small_titla_1.c 7 | Content/assets/fonts/title_1.c 8 | Content/assets/styles/GUI_GlobalStyles.c 9 | Content/screens/main_screen.c 10 | GUI.c 11 | GUI_Themes.c 12 | GUI_Variables.c 13 | ui_helpers.c 14 | ui_theme_manager.c 15 | -------------------------------------------------------------------------------- /weather_7/partitions_custom.csv: -------------------------------------------------------------------------------- 1 | # Custom Partition Table for 32MB Flash 2 | # Name, Type, SubType, Offset, Size, Flags 3 | nvs, data, nvs, , 500K, 4 | otadata, data, ota, , 0x2000, 5 | phy_init, data, phy, , 0x1000, 6 | app0, app, ota_0, , 12M, 7 | app1, app, ota_1, , 12M, 8 | spiffs, data, spiffs, , 6144K, 9 | coredump, data, coredump, , 64K, -------------------------------------------------------------------------------- /weather_7/src/ui/filelist.txt: -------------------------------------------------------------------------------- 1 | Behaviour/GUI_Animations.c 2 | Behaviour/GUI_Events.c 3 | Content/assets/fonts/display_1.c 4 | Content/assets/fonts/header_1.c 5 | Content/assets/fonts/label_1.c 6 | Content/assets/fonts/number_1.c 7 | Content/assets/fonts/subtitle_1.c 8 | Content/assets/fonts/title_1.c 9 | Content/assets/styles/GUI_GlobalStyles.c 10 | Content/screens/cont.c 11 | GUI.c 12 | GUI_Themes.c 13 | GUI_Variables.c 14 | ui_helpers.c 15 | ui_theme_manager.c 16 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "MicroPython.executeButton": [ 3 | { 4 | "text": "▶", 5 | "tooltip": "Run", 6 | "alignment": "left", 7 | "command": "extension.executeFile", 8 | "priority": 3.5 9 | } 10 | ], 11 | "MicroPython.syncButton": [ 12 | { 13 | "text": "$(sync)", 14 | "tooltip": "sync", 15 | "alignment": "left", 16 | "command": "extension.execute", 17 | "priority": 4 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /weather_13/partitions_custom.csv: -------------------------------------------------------------------------------- 1 | # Custom Partition Table for 32MB Flash 2 | # Name, Type, SubType, Offset, Size, Flags 3 | nvs, data, nvs, , 500K, 4 | otadata, data, ota, , 0x2000, 5 | phy_init, data, phy, , 0x1000, 6 | app0, app, ota_0, , 12M, 7 | app1, app, ota_1, , 12M, 8 | spiffs, data, spiffs, , 6144K, 9 | coredump, data, coredump, , 64K, -------------------------------------------------------------------------------- /weather_7/src/e1002_display.h: -------------------------------------------------------------------------------- 1 | #ifndef LVGL_DISPLAY_H 2 | #define LVGL_DISPLAY_H 3 | 4 | #include 5 | 6 | typedef struct { 7 | EPaper *epd; 8 | uint32_t flush_scheduled_time; 9 | bool flush_scheduled; 10 | } e1002_driver_t; 11 | 12 | void e1002_display_init(e1002_driver_t *drv); 13 | 14 | void e1002_display_refresh(e1002_driver_t *drv); 15 | 16 | void e1002_display_schedule_refresh(e1002_driver_t *drv); 17 | 18 | bool e1002_display_should_refresh(e1002_driver_t *drv); 19 | 20 | #endif -------------------------------------------------------------------------------- /weather_13/src/e1002_display.h: -------------------------------------------------------------------------------- 1 | #ifndef LVGL_DISPLAY_H 2 | #define LVGL_DISPLAY_H 3 | 4 | #include 5 | 6 | typedef struct { 7 | EPaper *epd; 8 | uint32_t flush_scheduled_time; 9 | bool flush_scheduled; 10 | } e1002_driver_t; 11 | 12 | void e1002_display_init(e1002_driver_t *drv); 13 | 14 | void e1002_display_refresh(e1002_driver_t *drv); 15 | 16 | void e1002_display_schedule_refresh(e1002_driver_t *drv); 17 | 18 | bool e1002_display_should_refresh(e1002_driver_t *drv); 19 | 20 | #endif -------------------------------------------------------------------------------- /weather_13/src/ui/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | SET( SOURCES 2 | Behaviour/GUI_Animations.c 3 | Behaviour/GUI_Events.c 4 | Content/assets/fonts/big_number_1.c 5 | Content/assets/fonts/header_1.c 6 | Content/assets/fonts/label_1.c 7 | Content/assets/fonts/small_titla_1.c 8 | Content/assets/fonts/title_1.c 9 | Content/assets/styles/GUI_GlobalStyles.c 10 | Content/screens/main_screen.c 11 | GUI.c 12 | GUI_Themes.c 13 | GUI_Variables.c 14 | ui_helpers.c 15 | ui_theme_manager.c 16 | ) 17 | 18 | add_library( GUI ${SOURCES} ) 19 | 20 | -------------------------------------------------------------------------------- /weather_13/test/README: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for PlatformIO Test Runner and project tests. 3 | 4 | Unit Testing is a software testing method by which individual units of 5 | source code, sets of one or more MCU program modules together with associated 6 | control data, usage procedures, and operating procedures, are tested to 7 | determine whether they are fit for use. Unit testing finds problems early 8 | in the development cycle. 9 | 10 | More information about PlatformIO Unit Testing: 11 | - https://docs.platformio.org/en/latest/advanced/unit-testing/index.html 12 | -------------------------------------------------------------------------------- /weather_7/test/README: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for PlatformIO Test Runner and project tests. 3 | 4 | Unit Testing is a software testing method by which individual units of 5 | source code, sets of one or more MCU program modules together with associated 6 | control data, usage procedures, and operating procedures, are tested to 7 | determine whether they are fit for use. Unit testing finds problems early 8 | in the development cycle. 9 | 10 | More information about PlatformIO Unit Testing: 11 | - https://docs.platformio.org/en/latest/advanced/unit-testing/index.html 12 | -------------------------------------------------------------------------------- /weather_7/src/ui/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | SET( SOURCES 2 | Behaviour/GUI_Animations.c 3 | Behaviour/GUI_Events.c 4 | Content/assets/fonts/display_1.c 5 | Content/assets/fonts/header_1.c 6 | Content/assets/fonts/label_1.c 7 | Content/assets/fonts/number_1.c 8 | Content/assets/fonts/subtitle_1.c 9 | Content/assets/fonts/title_1.c 10 | Content/assets/styles/GUI_GlobalStyles.c 11 | Content/screens/cont.c 12 | GUI.c 13 | GUI_Themes.c 14 | GUI_Variables.c 15 | ui_helpers.c 16 | ui_theme_manager.c 17 | ) 18 | 19 | add_library( GUI ${SOURCES} ) 20 | 21 | -------------------------------------------------------------------------------- /weather_7/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.associations": { 3 | "tft_espi_esp32_c3.c": "cpp" 4 | }, 5 | "cmake.sourceDirectory": "D:/Seeed_code/E1002/weather_squareline(2)/weather_7/src/ui", 6 | "MicroPython.executeButton": [ 7 | { 8 | "text": "▶", 9 | "tooltip": "Run", 10 | "alignment": "left", 11 | "command": "extension.executeFile", 12 | "priority": 3.5 13 | } 14 | ], 15 | "MicroPython.syncButton": [ 16 | { 17 | "text": "$(sync)", 18 | "tooltip": "sync", 19 | "alignment": "left", 20 | "command": "extension.execute", 21 | "priority": 4 22 | } 23 | ] 24 | } -------------------------------------------------------------------------------- /weather_13/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.associations": { 3 | "tft_espi_esp32_c3.c": "cpp" 4 | }, 5 | "MicroPython.executeButton": [ 6 | { 7 | "text": "▶", 8 | "tooltip": "Run", 9 | "alignment": "left", 10 | "command": "extension.executeFile", 11 | "priority": 3.5 12 | } 13 | ], 14 | "MicroPython.syncButton": [ 15 | { 16 | "text": "$(sync)", 17 | "tooltip": "sync", 18 | "alignment": "left", 19 | "command": "extension.execute", 20 | "priority": 4 21 | } 22 | ], 23 | "cmake.sourceDirectory": "D:/Seeed_code/E1002/weather_squareline(2)/weather_13/src/ui" 24 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 Seeed-Projects 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /weather_13/lib/README: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for project specific (private) libraries. 3 | PlatformIO will compile them to static libraries and link into the executable file. 4 | 5 | The source code of each library should be placed in a separate directory 6 | ("lib/your_library_name/[Code]"). 7 | 8 | For example, see the structure of the following example libraries `Foo` and `Bar`: 9 | 10 | |--lib 11 | | | 12 | | |--Bar 13 | | | |--docs 14 | | | |--examples 15 | | | |--src 16 | | | |- Bar.c 17 | | | |- Bar.h 18 | | | |- library.json (optional. for custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html 19 | | | 20 | | |--Foo 21 | | | |- Foo.c 22 | | | |- Foo.h 23 | | | 24 | | |- README --> THIS FILE 25 | | 26 | |- platformio.ini 27 | |--src 28 | |- main.c 29 | 30 | Example contents of `src/main.c` using Foo and Bar: 31 | ``` 32 | #include 33 | #include 34 | 35 | int main (void) 36 | { 37 | ... 38 | } 39 | 40 | ``` 41 | 42 | The PlatformIO Library Dependency Finder will find automatically dependent 43 | libraries by scanning project source files. 44 | 45 | More information about PlatformIO Library Dependency Finder 46 | - https://docs.platformio.org/page/librarymanager/ldf.html 47 | -------------------------------------------------------------------------------- /weather_7/lib/README: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for project specific (private) libraries. 3 | PlatformIO will compile them to static libraries and link into the executable file. 4 | 5 | The source code of each library should be placed in a separate directory 6 | ("lib/your_library_name/[Code]"). 7 | 8 | For example, see the structure of the following example libraries `Foo` and `Bar`: 9 | 10 | |--lib 11 | | | 12 | | |--Bar 13 | | | |--docs 14 | | | |--examples 15 | | | |--src 16 | | | |- Bar.c 17 | | | |- Bar.h 18 | | | |- library.json (optional. for custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html 19 | | | 20 | | |--Foo 21 | | | |- Foo.c 22 | | | |- Foo.h 23 | | | 24 | | |- README --> THIS FILE 25 | | 26 | |- platformio.ini 27 | |--src 28 | |- main.c 29 | 30 | Example contents of `src/main.c` using Foo and Bar: 31 | ``` 32 | #include 33 | #include 34 | 35 | int main (void) 36 | { 37 | ... 38 | } 39 | 40 | ``` 41 | 42 | The PlatformIO Library Dependency Finder will find automatically dependent 43 | libraries by scanning project source files. 44 | 45 | More information about PlatformIO Library Dependency Finder 46 | - https://docs.platformio.org/page/librarymanager/ldf.html 47 | -------------------------------------------------------------------------------- /weather_7/platformio.ini: -------------------------------------------------------------------------------- 1 | ; PlatformIO Project Configuration File 2 | ; 3 | ; Build options: build flags, source filter 4 | ; Upload options: custom upload port, speed and extra flags 5 | ; Library options: dependencies, extra library storages 6 | ; Advanced options: extra scripting 7 | ; 8 | ; Please visit documentation for the other options and examples 9 | ; https://docs.platformio.org/page/projectconf.html 10 | 11 | [platformio] 12 | default_envs = seeed_xiao_esp32s3 13 | 14 | [env:seeed_xiao_esp32c3] 15 | platform = espressif32 16 | board = seeed_xiao_esp32c3 17 | framework = arduino 18 | build_flags = 19 | -I $PROJECT_DIR/include 20 | 21 | monitor_speed = 115200 22 | 23 | 24 | [env:seeed_xiao_esp32s3] 25 | platform = espressif32 26 | board = seeed_xiao_esp32s3 27 | framework = arduino 28 | build_flags = 29 | -I $PROJECT_DIR/include 30 | -D ARDUINO_USB_MODE=1 31 | -D ARDUINO_USB_CDC_ON_BOOT=1 32 | 33 | lib_ldf_mode = deep 34 | lib_deps = 35 | https://github.com/Bodmer/U8g2_for_TFT_eSPI.git 36 | https://github.com/Seeed-Studio/Seeed_GFX.git 37 | https://github.com/lvgl/lvgl#c033a98afddd65aaafeebea625382a94020fe4a7 38 | https://github.com/bblanchon/ArduinoJson.git 39 | https://github.com/adafruit/Adafruit_SHT4X.git#76a06edfa280a699da1c2f311bdeccb0bd5cee92 40 | 41 | monitor_speed = 115200 -------------------------------------------------------------------------------- /weather_13/platformio.ini: -------------------------------------------------------------------------------- 1 | ; PlatformIO Project Configuration File 2 | ; 3 | ; Build options: build flags, source filter 4 | ; Upload options: custom upload port, speed and extra flags 5 | ; Library options: dependencies, extra library storages 6 | ; Advanced options: extra scripting 7 | ; 8 | ; Please visit documentation for the other options and examples 9 | ; https://docs.platformio.org/page/projectconf.html 10 | 11 | [platformio] 12 | default_envs = seeed_xiao_esp32s3 13 | 14 | [env:seeed_xiao_esp32c3] 15 | platform = espressif32 16 | board = seeed_xiao_esp32c3 17 | framework = arduino 18 | build_flags = 19 | -I $PROJECT_DIR/include 20 | 21 | monitor_speed = 115200 22 | 23 | 24 | [env:seeed_xiao_esp32s3] 25 | platform = espressif32 26 | board = seeed_xiao_esp32s3 27 | framework = arduino 28 | build_flags = 29 | -I $PROJECT_DIR/include 30 | -D ARDUINO_USB_MODE=1 31 | -D ARDUINO_USB_CDC_ON_BOOT=1 32 | 33 | lib_ldf_mode = deep 34 | lib_deps = 35 | https://github.com/Bodmer/U8g2_for_TFT_eSPI.git 36 | https://github.com/Seeed-Studio/Seeed_GFX.git 37 | https://github.com/lvgl/lvgl#c033a98afddd65aaafeebea625382a94020fe4a7 38 | https://github.com/bblanchon/ArduinoJson.git 39 | https://github.com/adafruit/Adafruit_SHT4X.git#76a06edfa280a699da1c2f311bdeccb0bd5cee92 40 | 41 | monitor_speed = 115200 -------------------------------------------------------------------------------- /weather_7/boards/reterminal.json: -------------------------------------------------------------------------------- 1 | { 2 | "build": { 3 | "arduino": { 4 | "ldscript": "esp32s3_out.ld", 5 | "partitions": "partitions_custom.csv", 6 | "memory_type": "qio_opi" 7 | }, 8 | "core": "esp32", 9 | "extra_flags": [ 10 | "-DBOARD_HAS_PSRAM", 11 | "-DARDUINO_USB_CDC_ON_BOOT=0", 12 | "-DARDUINO_USB_MODE=1", 13 | "-DARDUINO_RUNNING_CORE=1", 14 | "-DARDUINO_EVENT_RUNNING_CORE=1" 15 | ], 16 | "f_cpu": "240000000L", 17 | "f_flash": "80000000L", 18 | "f_boot": "120000000L", 19 | "boot": "qio", 20 | "flash_mode": "qio", 21 | "psram_type": "opi", 22 | "hwids": [["0x1A86", "0x7523"]], 23 | "mcu": "esp32s3", 24 | "variant": "esp32s3" 25 | }, 26 | "connectivity": ["wifi"], 27 | "debug": { 28 | "default_tool": "esp-builtin", 29 | "onboard_tools": ["esp-builtin"], 30 | "openocd_target": "esp32s3.cfg" 31 | }, 32 | "frameworks": ["arduino"], 33 | "name": "Seeed Studio SenseCraft reTerminal", 34 | "upload": { 35 | "flash_size": "32MB", 36 | "maximum_ram_size": 327680, 37 | "maximum_size": 4194304, 38 | "require_upload_port": false, 39 | "use_1200bps_touch": true, 40 | "wait_for_upload_port": false, 41 | "speed": 921600 42 | }, 43 | "url": "https://www.seeedstudio.com/", 44 | "vendor": "Seeed Studio" 45 | } -------------------------------------------------------------------------------- /weather_13/boards/reterminal.json: -------------------------------------------------------------------------------- 1 | { 2 | "build": { 3 | "arduino": { 4 | "ldscript": "esp32s3_out.ld", 5 | "partitions": "partitions_custom.csv", 6 | "memory_type": "qio_opi" 7 | }, 8 | "core": "esp32", 9 | "extra_flags": [ 10 | "-DBOARD_HAS_PSRAM", 11 | "-DARDUINO_USB_CDC_ON_BOOT=0", 12 | "-DARDUINO_USB_MODE=1", 13 | "-DARDUINO_RUNNING_CORE=1", 14 | "-DARDUINO_EVENT_RUNNING_CORE=1" 15 | ], 16 | "f_cpu": "240000000L", 17 | "f_flash": "80000000L", 18 | "f_boot": "120000000L", 19 | "boot": "qio", 20 | "flash_mode": "qio", 21 | "psram_type": "opi", 22 | "hwids": [["0x1A86", "0x7523"]], 23 | "mcu": "esp32s3", 24 | "variant": "esp32s3" 25 | }, 26 | "connectivity": ["wifi"], 27 | "debug": { 28 | "default_tool": "esp-builtin", 29 | "onboard_tools": ["esp-builtin"], 30 | "openocd_target": "esp32s3.cfg" 31 | }, 32 | "frameworks": ["arduino"], 33 | "name": "Seeed Studio SenseCraft reTerminal", 34 | "upload": { 35 | "flash_size": "32MB", 36 | "maximum_ram_size": 327680, 37 | "maximum_size": 4194304, 38 | "require_upload_port": false, 39 | "use_1200bps_touch": true, 40 | "wait_for_upload_port": false, 41 | "speed": 921600 42 | }, 43 | "url": "https://www.seeedstudio.com/", 44 | "vendor": "Seeed Studio" 45 | } -------------------------------------------------------------------------------- /weather_7/src/ui/GUI.c: -------------------------------------------------------------------------------- 1 | #include "GUI.h" 2 | 3 | 4 | 5 | void GUI_load () { 6 | GUI_initFramework(); 7 | GUI_initHAL(); 8 | GUI_loadContent(); 9 | } 10 | 11 | 12 | void GUI_init () { 13 | GUI_loadContent(); 14 | } 15 | 16 | 17 | void GUI_refresh () { 18 | lv_timer_handler(); 19 | //... 20 | } 21 | 22 | 23 | void GUI_initHAL () { 24 | //... 25 | } 26 | 27 | 28 | void GUI_initFramework () { 29 | lv_init(); 30 | } 31 | 32 | 33 | void GUI_loadContent () { 34 | GUI_initContent(); 35 | GUI_loadFirstScreen(); 36 | } 37 | 38 | 39 | void GUI_initContent () { 40 | GUI_initTheme(); 41 | GUI_initGlobalStyles(); 42 | GUI_initScreens(); 43 | GUI_initAnimations(); 44 | } 45 | 46 | 47 | void GUI_initTheme () { 48 | lv_display_t* Display = lv_display_get_default(); 49 | lv_theme_t* Theme = lv_theme_simple_init( Display ); 50 | lv_display_set_theme( Display, Theme ); 51 | } 52 | 53 | 54 | void GUI_initScreens () { 55 | GUI_initScreenContents(); 56 | } 57 | 58 | 59 | void GUI_loadFirstScreen () { 60 | lv_screen_load( GUI_Screen__cont ); 61 | } 62 | 63 | 64 | void GUI_initScreenContents () { 65 | GUI_initScreen__cont(); 66 | } 67 | 68 | 69 | void GUI_initScreenTexts () { 70 | GUI_initScreenTexts__cont(); 71 | } 72 | void GUI_initScreenStyles () { 73 | GUI_initScreenStyles__cont(); 74 | } 75 | -------------------------------------------------------------------------------- /weather_7/src/ui/Behaviour/GUI_Animations.c: -------------------------------------------------------------------------------- 1 | #include "../GUI.h" 2 | 3 | 4 | 5 | static void GUI_createTimelinePhase (lv_anim_timeline_t* timeline, uint32_t start_time, lv_anim_t* animation, lv_obj_t* object, lv_anim_custom_exec_cb_t animator, int32_t startvalue, int32_t endvalue, uint32_t duration, lv_anim_path_cb_t animpath, bool early_apply) { 6 | lv_anim_init( animation ); 7 | lv_anim_set_var( animation, object ); 8 | lv_anim_set_early_apply( animation, early_apply ); 9 | lv_anim_set_custom_exec_cb( animation, animator ); 10 | lv_anim_set_values( animation, startvalue, endvalue ); 11 | lv_anim_set_duration( animation, duration ); 12 | lv_anim_set_path_cb( animation, animpath ); 13 | lv_anim_timeline_add( timeline, start_time, animation ); 14 | } 15 | 16 | 17 | static void GUI_animatorCallback__Set_X (lv_anim_t * var, int32_t v) { 18 | lv_obj_set_x( var->var, v ); 19 | } 20 | 21 | 22 | static void GUI_animatorCallback__Set_Y (lv_anim_t * var, int32_t v) { 23 | lv_obj_set_y( var->var, v ); 24 | } 25 | 26 | 27 | static void GUI_animatorCallback__Set_WIDTH (lv_anim_t * var, int32_t v) { 28 | lv_obj_set_width( var->var, v ); 29 | } 30 | 31 | 32 | static void GUI_animatorCallback__Set_HEIGHT (lv_anim_t * var, int32_t v) { 33 | lv_obj_set_height( var->var, v ); 34 | } 35 | 36 | 37 | void GUI_initAnimations () { 38 | 39 | } 40 | 41 | 42 | -------------------------------------------------------------------------------- /weather_13/src/ui/Behaviour/GUI_Animations.c: -------------------------------------------------------------------------------- 1 | #include "../GUI.h" 2 | 3 | 4 | 5 | static void GUI_createTimelinePhase (lv_anim_timeline_t* timeline, uint32_t start_time, lv_anim_t* animation, lv_obj_t* object, lv_anim_custom_exec_cb_t animator, int32_t startvalue, int32_t endvalue, uint32_t duration, lv_anim_path_cb_t animpath, bool early_apply) { 6 | lv_anim_init( animation ); 7 | lv_anim_set_var( animation, object ); 8 | lv_anim_set_early_apply( animation, early_apply ); 9 | lv_anim_set_custom_exec_cb( animation, animator ); 10 | lv_anim_set_values( animation, startvalue, endvalue ); 11 | lv_anim_set_duration( animation, duration ); 12 | lv_anim_set_path_cb( animation, animpath ); 13 | lv_anim_timeline_add( timeline, start_time, animation ); 14 | } 15 | 16 | 17 | static void GUI_animatorCallback__Set_X (lv_anim_t * var, int32_t v) { 18 | lv_obj_set_x( var->var, v ); 19 | } 20 | 21 | 22 | static void GUI_animatorCallback__Set_Y (lv_anim_t * var, int32_t v) { 23 | lv_obj_set_y( var->var, v ); 24 | } 25 | 26 | 27 | static void GUI_animatorCallback__Set_WIDTH (lv_anim_t * var, int32_t v) { 28 | lv_obj_set_width( var->var, v ); 29 | } 30 | 31 | 32 | static void GUI_animatorCallback__Set_HEIGHT (lv_anim_t * var, int32_t v) { 33 | lv_obj_set_height( var->var, v ); 34 | } 35 | 36 | 37 | void GUI_initAnimations () { 38 | 39 | } 40 | 41 | 42 | -------------------------------------------------------------------------------- /weather_13/src/ui/GUI.c: -------------------------------------------------------------------------------- 1 | #include "GUI.h" 2 | 3 | 4 | 5 | void GUI_load () { 6 | GUI_initFramework(); 7 | GUI_initHAL(); 8 | GUI_loadContent(); 9 | } 10 | 11 | 12 | void GUI_init () { 13 | GUI_loadContent(); 14 | } 15 | 16 | 17 | void GUI_refresh () { 18 | lv_timer_handler(); 19 | //... 20 | } 21 | 22 | 23 | void GUI_initHAL () { 24 | //... 25 | } 26 | 27 | 28 | void GUI_initFramework () { 29 | lv_init(); 30 | } 31 | 32 | 33 | void GUI_loadContent () { 34 | GUI_initContent(); 35 | GUI_loadFirstScreen(); 36 | } 37 | 38 | 39 | void GUI_initContent () { 40 | GUI_initTheme(); 41 | GUI_initGlobalStyles(); 42 | GUI_initScreens(); 43 | GUI_initAnimations(); 44 | } 45 | 46 | 47 | void GUI_initTheme () { 48 | lv_display_t* Display = lv_display_get_default(); 49 | lv_theme_t* Theme = lv_theme_simple_init( Display ); 50 | lv_display_set_theme( Display, Theme ); 51 | } 52 | 53 | 54 | void GUI_initScreens () { 55 | GUI_initScreenContents(); 56 | } 57 | 58 | 59 | void GUI_loadFirstScreen () { 60 | lv_screen_load( GUI_Screen__main_screen ); 61 | } 62 | 63 | 64 | void GUI_initScreenContents () { 65 | GUI_initScreen__main_screen(); 66 | } 67 | 68 | 69 | void GUI_initScreenTexts () { 70 | GUI_initScreenTexts__main_screen(); 71 | } 72 | void GUI_initScreenStyles () { 73 | GUI_initScreenStyles__main_screen(); 74 | } 75 | -------------------------------------------------------------------------------- /weather_13/include/weather.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | struct HourItem 6 | { 7 | uint32_t ts = 0; 8 | float temp = NAN; 9 | int weatherId = 0; 10 | String main; 11 | String desc; 12 | String icon; 13 | float windSpeed = 0; 14 | float windGust = 0; 15 | }; 16 | 17 | struct DayItem 18 | { 19 | uint32_t ts = 0; 20 | float day = NAN; 21 | float min = NAN; 22 | float max = NAN; 23 | int weatherId = 0; 24 | String main; 25 | String desc; 26 | String icon; 27 | }; 28 | 29 | struct AlertItem 30 | { 31 | String event; 32 | String sender; 33 | String description; 34 | uint32_t start = 0; 35 | uint32_t end = 0; 36 | String severity; 37 | }; 38 | 39 | struct WeatherData 40 | { 41 | String cityName; 42 | int timezoneOffset = 0; 43 | uint32_t dt = 0; 44 | float temp = NAN; 45 | float feelsLike = NAN; 46 | int humidity = 0; 47 | float windSpeed = 0; 48 | float windGust = 0; 49 | int windDeg = 0; 50 | int weatherId = 0; 51 | String main; 52 | String desc; 53 | String icon; 54 | HourItem hourly[4]; 55 | DayItem daily[3]; 56 | bool hasAlert = false; 57 | AlertItem alert; 58 | int aqi = 0; 59 | String aqiLabel = "Unknown"; 60 | float indoorTemp = NAN; 61 | int indoorHumidity = -1; 62 | }; 63 | 64 | struct WeatherRequest 65 | { 66 | String apiKey; 67 | String units = "metric"; 68 | String lang = "en"; 69 | bool useCity = true; 70 | String city = ""; 71 | String lat = ""; 72 | String lon = ""; 73 | }; 74 | 75 | // Fetch weather, forecast and AQI data. Returns true on success. 76 | bool fetchWeather(const WeatherRequest &request, WeatherData &out); 77 | -------------------------------------------------------------------------------- /weather_7/include/weather.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | struct HourItem 6 | { 7 | uint32_t ts = 0; 8 | float temp = NAN; 9 | int weatherId = 0; 10 | String main; 11 | String desc; 12 | String icon; 13 | float windSpeed = 0; 14 | float windGust = 0; 15 | }; 16 | 17 | struct DayItem 18 | { 19 | uint32_t ts = 0; 20 | float day = NAN; 21 | float min = NAN; 22 | float max = NAN; 23 | int weatherId = 0; 24 | String main; 25 | String desc; 26 | String icon; 27 | }; 28 | 29 | struct AlertItem 30 | { 31 | String event; 32 | String sender; 33 | String description; 34 | uint32_t start = 0; 35 | uint32_t end = 0; 36 | String severity; 37 | }; 38 | 39 | struct WeatherData 40 | { 41 | String cityName; 42 | int timezoneOffset = 0; 43 | uint32_t dt = 0; 44 | float temp = NAN; 45 | float feelsLike = NAN; 46 | int humidity = 0; 47 | float windSpeed = 0; 48 | float windGust = 0; 49 | int windDeg = 0; 50 | int weatherId = 0; 51 | String main; 52 | String desc; 53 | String icon; 54 | HourItem hourly[4]; 55 | DayItem daily[3]; 56 | bool hasAlert = false; 57 | AlertItem alert; 58 | int aqi = 0; 59 | String aqiLabel = "Unknown"; 60 | float indoorTemp = NAN; 61 | int indoorHumidity = -1; 62 | }; 63 | 64 | struct WeatherRequest 65 | { 66 | String apiKey; 67 | String units = "metric"; 68 | String lang = "en"; 69 | bool useCity = true; 70 | String city = ""; 71 | String lat = ""; 72 | String lon = ""; 73 | }; 74 | 75 | // Fetch weather, forecast and AQI data. Returns true on success. 76 | bool fetchWeather(const WeatherRequest &request, WeatherData &out); 77 | -------------------------------------------------------------------------------- /weather_13/src/ui/GUI_Themes.c: -------------------------------------------------------------------------------- 1 | #include "GUI.h" 2 | 3 | 4 | 5 | const ui_theme_variable_t _ui_theme_bg_color_white[1] = {0xDDDDDD}; 6 | const ui_style_variable_t _ui_theme_bg_opa_white[1] = {255}; 7 | const ui_style_variable_t _ui_theme_grad_color_white[1] = {0x000000}; 8 | const ui_style_variable_t _ui_theme_grad_opa_white[1] = {0}; 9 | const ui_style_variable_t _ui_theme_grad_dir_white[1] = {LV_GRAD_DIR_NONE}; 10 | const ui_style_variable_t _ui_theme_main_stop_white[1] = {0}; 11 | const ui_style_variable_t _ui_theme_grad_stop_white[1] = {0}; 12 | 13 | const ui_theme_variable_t _ui_theme_bg_color_green[1] = {0x4AAA16}; 14 | const ui_style_variable_t _ui_theme_bg_opa_green[1] = {255}; 15 | const ui_style_variable_t _ui_theme_grad_color_green[1] = {0x000000}; 16 | const ui_style_variable_t _ui_theme_grad_opa_green[1] = {0}; 17 | const ui_style_variable_t _ui_theme_grad_dir_green[1] = {LV_GRAD_DIR_NONE}; 18 | const ui_style_variable_t _ui_theme_main_stop_green[1] = {0}; 19 | const ui_style_variable_t _ui_theme_grad_stop_green[1] = {0}; 20 | 21 | const ui_theme_variable_t _ui_theme_bg_color_yellow[1] = {0xE6E600}; 22 | const ui_style_variable_t _ui_theme_bg_opa_yellow[1] = {255}; 23 | const ui_style_variable_t _ui_theme_grad_color_yellow[1] = {0x000000}; 24 | const ui_style_variable_t _ui_theme_grad_opa_yellow[1] = {0}; 25 | const ui_style_variable_t _ui_theme_grad_dir_yellow[1] = {LV_GRAD_DIR_NONE}; 26 | const ui_style_variable_t _ui_theme_main_stop_yellow[1] = {0}; 27 | const ui_style_variable_t _ui_theme_grad_stop_yellow[1] = {0}; 28 | 29 | const ui_theme_variable_t _ui_theme_bg_color_black[1] = {0x0D0C0F}; 30 | const ui_style_variable_t _ui_theme_bg_opa_black[1] = {255}; 31 | const ui_style_variable_t _ui_theme_grad_color_black[1] = {0x000000}; 32 | const ui_style_variable_t _ui_theme_grad_opa_black[1] = {0}; 33 | const ui_style_variable_t _ui_theme_grad_dir_black[1] = {LV_GRAD_DIR_NONE}; 34 | const ui_style_variable_t _ui_theme_main_stop_black[1] = {0}; 35 | const ui_style_variable_t _ui_theme_grad_stop_black[1] = {0}; 36 | 37 | const ui_theme_variable_t _ui_theme_bg_color_red[1] = {0x7E2822}; 38 | const ui_style_variable_t _ui_theme_bg_opa_red[1] = {255}; 39 | const ui_style_variable_t _ui_theme_grad_color_red[1] = {0x000000}; 40 | const ui_style_variable_t _ui_theme_grad_opa_red[1] = {0}; 41 | const ui_style_variable_t _ui_theme_grad_dir_red[1] = {LV_GRAD_DIR_NONE}; 42 | const ui_style_variable_t _ui_theme_main_stop_red[1] = {0}; 43 | const ui_style_variable_t _ui_theme_grad_stop_red[1] = {0}; 44 | 45 | const ui_theme_variable_t _ui_theme_bg_color_blue[1] = {0x2461B7}; 46 | const ui_style_variable_t _ui_theme_bg_opa_blue[1] = {255}; 47 | const ui_style_variable_t _ui_theme_grad_color_blue[1] = {0x000000}; 48 | const ui_style_variable_t _ui_theme_grad_opa_blue[1] = {0}; 49 | const ui_style_variable_t _ui_theme_grad_dir_blue[1] = {LV_GRAD_DIR_NONE}; 50 | const ui_style_variable_t _ui_theme_main_stop_blue[1] = {0}; 51 | const ui_style_variable_t _ui_theme_grad_stop_blue[1] = {0}; 52 | 53 | uint8_t ui_theme_idx = UI_THEME_DEFAULT; 54 | 55 | 56 | void ui_theme_set(uint8_t theme_idx) { 57 | ui_theme_idx = theme_idx; 58 | _ui_theme_set_variable_styles(UI_VARIABLE_STYLES_MODE_FOLLOW); 59 | } 60 | -------------------------------------------------------------------------------- /weather_7/src/ui/GUI_Themes.c: -------------------------------------------------------------------------------- 1 | #include "GUI.h" 2 | 3 | 4 | 5 | const ui_theme_variable_t _ui_theme_bg_color_white[1] = {0xDDDDDD}; 6 | const ui_style_variable_t _ui_theme_bg_opa_white[1] = {255}; 7 | const ui_style_variable_t _ui_theme_grad_color_white[1] = {0x000000}; 8 | const ui_style_variable_t _ui_theme_grad_opa_white[1] = {0}; 9 | const ui_style_variable_t _ui_theme_grad_dir_white[1] = {LV_GRAD_DIR_NONE}; 10 | const ui_style_variable_t _ui_theme_main_stop_white[1] = {0}; 11 | const ui_style_variable_t _ui_theme_grad_stop_white[1] = {0}; 12 | 13 | const ui_theme_variable_t _ui_theme_bg_color_green[1] = {0x4AAA16}; 14 | const ui_style_variable_t _ui_theme_bg_opa_green[1] = {255}; 15 | const ui_style_variable_t _ui_theme_grad_color_green[1] = {0x000000}; 16 | const ui_style_variable_t _ui_theme_grad_opa_green[1] = {0}; 17 | const ui_style_variable_t _ui_theme_grad_dir_green[1] = {LV_GRAD_DIR_NONE}; 18 | const ui_style_variable_t _ui_theme_main_stop_green[1] = {0}; 19 | const ui_style_variable_t _ui_theme_grad_stop_green[1] = {0}; 20 | 21 | const ui_theme_variable_t _ui_theme_bg_color_yellow[1] = {0xE6E600}; 22 | const ui_style_variable_t _ui_theme_bg_opa_yellow[1] = {255}; 23 | const ui_style_variable_t _ui_theme_grad_color_yellow[1] = {0x000000}; 24 | const ui_style_variable_t _ui_theme_grad_opa_yellow[1] = {0}; 25 | const ui_style_variable_t _ui_theme_grad_dir_yellow[1] = {LV_GRAD_DIR_NONE}; 26 | const ui_style_variable_t _ui_theme_main_stop_yellow[1] = {0}; 27 | const ui_style_variable_t _ui_theme_grad_stop_yellow[1] = {0}; 28 | 29 | const ui_theme_variable_t _ui_theme_bg_color_black[1] = {0x0D0C0F}; 30 | const ui_style_variable_t _ui_theme_bg_opa_black[1] = {255}; 31 | const ui_style_variable_t _ui_theme_grad_color_black[1] = {0x000000}; 32 | const ui_style_variable_t _ui_theme_grad_opa_black[1] = {0}; 33 | const ui_style_variable_t _ui_theme_grad_dir_black[1] = {LV_GRAD_DIR_NONE}; 34 | const ui_style_variable_t _ui_theme_main_stop_black[1] = {0}; 35 | const ui_style_variable_t _ui_theme_grad_stop_black[1] = {0}; 36 | 37 | const ui_theme_variable_t _ui_theme_bg_color_red[1] = {0x7E2822}; 38 | const ui_style_variable_t _ui_theme_bg_opa_red[1] = {255}; 39 | const ui_style_variable_t _ui_theme_grad_color_red[1] = {0x000000}; 40 | const ui_style_variable_t _ui_theme_grad_opa_red[1] = {0}; 41 | const ui_style_variable_t _ui_theme_grad_dir_red[1] = {LV_GRAD_DIR_NONE}; 42 | const ui_style_variable_t _ui_theme_main_stop_red[1] = {0}; 43 | const ui_style_variable_t _ui_theme_grad_stop_red[1] = {0}; 44 | 45 | const ui_theme_variable_t _ui_theme_bg_color_blue[1] = {0x2461B7}; 46 | const ui_style_variable_t _ui_theme_bg_opa_blue[1] = {255}; 47 | const ui_style_variable_t _ui_theme_grad_color_blue[1] = {0x000000}; 48 | const ui_style_variable_t _ui_theme_grad_opa_blue[1] = {0}; 49 | const ui_style_variable_t _ui_theme_grad_dir_blue[1] = {LV_GRAD_DIR_NONE}; 50 | const ui_style_variable_t _ui_theme_main_stop_blue[1] = {0}; 51 | const ui_style_variable_t _ui_theme_grad_stop_blue[1] = {0}; 52 | 53 | uint8_t ui_theme_idx = UI_THEME_DEFAULT; 54 | 55 | 56 | void ui_theme_set(uint8_t theme_idx) { 57 | ui_theme_idx = theme_idx; 58 | _ui_theme_set_variable_styles(UI_VARIABLE_STYLES_MODE_FOLLOW); 59 | } 60 | -------------------------------------------------------------------------------- /weather_7/src/ui/ui_theme_manager.h: -------------------------------------------------------------------------------- 1 | // This file was generated by SquareLine Studio 2 | // SquareLine Studio version: SquareLine Studio 1.4.3+ 3 | 4 | #ifndef _UI_THEME_MANAGER_H 5 | #define _UI_THEME_MANAGER_H 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | #define UI_THEME_ACTIVE 1 12 | 13 | /*#ifndef LV_SQUARELINE_THEME__IMPLICIT_GARBAGE_COLLECTOR 14 | #ifndef LV_SQUARELINE_THEME__EXPLICIT_GARBAGE_COLLECTOR_PERIOD //for slow hardware, tells how frequently the style-properties inside this style should be garbage-collected (recommended value: 10..100, 0:never) 15 | #define LV_SQUARELINE_THEME__EXPLICIT_GARBAGE_COLLECTOR_PERIOD 100 //a sensible default value that already gives good results on slow hardware, can be overridden from outside 16 | #endif 17 | #endif*/ 18 | 19 | 20 | enum { UI_VARIABLE_STYLES_MODE_INIT = 1, UI_VARIABLE_STYLES_MODE_FOLLOW = 0 }; 21 | 22 | 23 | typedef int64_t ui_style_variable_t; 24 | typedef ui_style_variable_t ui_theme_variable_t; //A 'theme' variable array is an array of 'style' variables for corresponding themes. 25 | 26 | typedef struct { 27 | lv_obj_t * object_p; 28 | lv_style_selector_t selector; 29 | lv_style_prop_t property; 30 | /*#ifdef LV_SQUARELINE_THEME__OBJECT_VALIDITY_CACHE //for slow hardware, adding this and setting to 5..10 in lv_conf.h might make it faster (less lv_obj_is_valid calls) 31 | uint16_t validcheck_counter; //used for garbage collection (finding empty slots) not to call lv_obj_is_valid() every time 32 | #endif*/ 33 | void * next_p; 34 | } _ui_local_style_property_setting_t; 35 | 36 | typedef struct { 37 | bool is_themeable; //scalar or vector? 38 | ui_style_variable_t * style_variable_p; 39 | ui_style_variable_t * previous_pointer; 40 | ui_style_variable_t previous_value; 41 | uint32_t style_property_setting_count; 42 | _ui_local_style_property_setting_t * style_property_settings; 43 | /*#ifdef LV_SQUARELINE_THEME__EXPLICIT_GARBAGE_COLLECTOR_PERIOD 44 | uint16_t garbage_collector_couter; 45 | #endif*/ 46 | } _ui_local_style_t; 47 | 48 | 49 | extern _ui_local_style_t * _ui_local_styles; 50 | extern uint32_t _ui_local_style_count; 51 | 52 | 53 | void ui_object_set_local_style_property 54 | (lv_obj_t* object_p, lv_style_selector_t selector, lv_style_prop_t property, ui_style_variable_t value ); 55 | 56 | void ui_object_set_themeable_style_property 57 | (lv_obj_t* object_p, lv_style_selector_t selector, lv_style_prop_t property, const ui_theme_variable_t* theme_variable_p); 58 | 59 | void _ui_theme_set_variable_styles (uint8_t mode); 60 | 61 | lv_style_value_t _ui_style_value_convert (lv_style_prop_t property, ui_style_variable_t value); 62 | ui_style_variable_t ui_get_theme_value (const ui_theme_variable_t *var); 63 | 64 | _ui_local_style_t * _ui_local_style_create (const ui_style_variable_t * style_variable_p, bool is_themeable); 65 | 66 | _ui_local_style_property_setting_t * _ui_local_style_property_setting_create 67 | (_ui_local_style_t * local_style, lv_obj_t * object_p, lv_style_selector_t selector, lv_style_prop_t property); 68 | 69 | 70 | #ifdef __cplusplus 71 | } /*extern "C"*/ 72 | #endif 73 | 74 | #endif 75 | 76 | -------------------------------------------------------------------------------- /weather_13/src/ui/ui_theme_manager.h: -------------------------------------------------------------------------------- 1 | // This file was generated by SquareLine Studio 2 | // SquareLine Studio version: SquareLine Studio 1.4.3+ 3 | 4 | #ifndef _UI_THEME_MANAGER_H 5 | #define _UI_THEME_MANAGER_H 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | #define UI_THEME_ACTIVE 1 12 | 13 | /*#ifndef LV_SQUARELINE_THEME__IMPLICIT_GARBAGE_COLLECTOR 14 | #ifndef LV_SQUARELINE_THEME__EXPLICIT_GARBAGE_COLLECTOR_PERIOD //for slow hardware, tells how frequently the style-properties inside this style should be garbage-collected (recommended value: 10..100, 0:never) 15 | #define LV_SQUARELINE_THEME__EXPLICIT_GARBAGE_COLLECTOR_PERIOD 100 //a sensible default value that already gives good results on slow hardware, can be overridden from outside 16 | #endif 17 | #endif*/ 18 | 19 | 20 | enum { UI_VARIABLE_STYLES_MODE_INIT = 1, UI_VARIABLE_STYLES_MODE_FOLLOW = 0 }; 21 | 22 | 23 | typedef int64_t ui_style_variable_t; 24 | typedef ui_style_variable_t ui_theme_variable_t; //A 'theme' variable array is an array of 'style' variables for corresponding themes. 25 | 26 | typedef struct { 27 | lv_obj_t * object_p; 28 | lv_style_selector_t selector; 29 | lv_style_prop_t property; 30 | /*#ifdef LV_SQUARELINE_THEME__OBJECT_VALIDITY_CACHE //for slow hardware, adding this and setting to 5..10 in lv_conf.h might make it faster (less lv_obj_is_valid calls) 31 | uint16_t validcheck_counter; //used for garbage collection (finding empty slots) not to call lv_obj_is_valid() every time 32 | #endif*/ 33 | void * next_p; 34 | } _ui_local_style_property_setting_t; 35 | 36 | typedef struct { 37 | bool is_themeable; //scalar or vector? 38 | ui_style_variable_t * style_variable_p; 39 | ui_style_variable_t * previous_pointer; 40 | ui_style_variable_t previous_value; 41 | uint32_t style_property_setting_count; 42 | _ui_local_style_property_setting_t * style_property_settings; 43 | /*#ifdef LV_SQUARELINE_THEME__EXPLICIT_GARBAGE_COLLECTOR_PERIOD 44 | uint16_t garbage_collector_couter; 45 | #endif*/ 46 | } _ui_local_style_t; 47 | 48 | 49 | extern _ui_local_style_t * _ui_local_styles; 50 | extern uint32_t _ui_local_style_count; 51 | 52 | 53 | void ui_object_set_local_style_property 54 | (lv_obj_t* object_p, lv_style_selector_t selector, lv_style_prop_t property, ui_style_variable_t value ); 55 | 56 | void ui_object_set_themeable_style_property 57 | (lv_obj_t* object_p, lv_style_selector_t selector, lv_style_prop_t property, const ui_theme_variable_t* theme_variable_p); 58 | 59 | void _ui_theme_set_variable_styles (uint8_t mode); 60 | 61 | lv_style_value_t _ui_style_value_convert (lv_style_prop_t property, ui_style_variable_t value); 62 | ui_style_variable_t ui_get_theme_value (const ui_theme_variable_t *var); 63 | 64 | _ui_local_style_t * _ui_local_style_create (const ui_style_variable_t * style_variable_p, bool is_themeable); 65 | 66 | _ui_local_style_property_setting_t * _ui_local_style_property_setting_create 67 | (_ui_local_style_t * local_style, lv_obj_t * object_p, lv_style_selector_t selector, lv_style_prop_t property); 68 | 69 | 70 | #ifdef __cplusplus 71 | } /*extern "C"*/ 72 | #endif 73 | 74 | #endif 75 | 76 | -------------------------------------------------------------------------------- /weather_13/src/ui/GUI_Themes.h: -------------------------------------------------------------------------------- 1 | #ifndef _UI_THEMES_H 2 | #define _UI_THEMES_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | 9 | #define UI_THEME_COLOR_WHITE 0 10 | #define UI_THEME_COLOR_GREEN 1 11 | #define UI_THEME_COLOR_YELLOW 2 12 | #define UI_THEME_COLOR_BLACK 3 13 | #define UI_THEME_COLOR_RED 4 14 | #define UI_THEME_COLOR_BLUE 5 15 | 16 | #define UI_THEME_DEFAULT 0 17 | 18 | // Declarations for gradient style 'White' 19 | extern const ui_theme_variable_t _ui_theme_bg_color_white[1]; 20 | extern const ui_style_variable_t _ui_theme_bg_opa_white[1]; 21 | extern const ui_style_variable_t _ui_theme_grad_color_white[1]; 22 | extern const ui_style_variable_t _ui_theme_grad_opa_white[1]; 23 | extern const ui_style_variable_t _ui_theme_grad_dir_white[1]; 24 | extern const ui_style_variable_t _ui_theme_main_stop_white[1]; 25 | extern const ui_style_variable_t _ui_theme_grad_stop_white[1]; 26 | 27 | // Declarations for gradient style 'Green' 28 | extern const ui_theme_variable_t _ui_theme_bg_color_green[1]; 29 | extern const ui_style_variable_t _ui_theme_bg_opa_green[1]; 30 | extern const ui_style_variable_t _ui_theme_grad_color_green[1]; 31 | extern const ui_style_variable_t _ui_theme_grad_opa_green[1]; 32 | extern const ui_style_variable_t _ui_theme_grad_dir_green[1]; 33 | extern const ui_style_variable_t _ui_theme_main_stop_green[1]; 34 | extern const ui_style_variable_t _ui_theme_grad_stop_green[1]; 35 | 36 | // Declarations for gradient style 'Yellow' 37 | extern const ui_theme_variable_t _ui_theme_bg_color_yellow[1]; 38 | extern const ui_style_variable_t _ui_theme_bg_opa_yellow[1]; 39 | extern const ui_style_variable_t _ui_theme_grad_color_yellow[1]; 40 | extern const ui_style_variable_t _ui_theme_grad_opa_yellow[1]; 41 | extern const ui_style_variable_t _ui_theme_grad_dir_yellow[1]; 42 | extern const ui_style_variable_t _ui_theme_main_stop_yellow[1]; 43 | extern const ui_style_variable_t _ui_theme_grad_stop_yellow[1]; 44 | 45 | // Declarations for gradient style 'Black' 46 | extern const ui_theme_variable_t _ui_theme_bg_color_black[1]; 47 | extern const ui_style_variable_t _ui_theme_bg_opa_black[1]; 48 | extern const ui_style_variable_t _ui_theme_grad_color_black[1]; 49 | extern const ui_style_variable_t _ui_theme_grad_opa_black[1]; 50 | extern const ui_style_variable_t _ui_theme_grad_dir_black[1]; 51 | extern const ui_style_variable_t _ui_theme_main_stop_black[1]; 52 | extern const ui_style_variable_t _ui_theme_grad_stop_black[1]; 53 | 54 | // Declarations for gradient style 'Red' 55 | extern const ui_theme_variable_t _ui_theme_bg_color_red[1]; 56 | extern const ui_style_variable_t _ui_theme_bg_opa_red[1]; 57 | extern const ui_style_variable_t _ui_theme_grad_color_red[1]; 58 | extern const ui_style_variable_t _ui_theme_grad_opa_red[1]; 59 | extern const ui_style_variable_t _ui_theme_grad_dir_red[1]; 60 | extern const ui_style_variable_t _ui_theme_main_stop_red[1]; 61 | extern const ui_style_variable_t _ui_theme_grad_stop_red[1]; 62 | 63 | // Declarations for gradient style 'Blue' 64 | extern const ui_theme_variable_t _ui_theme_bg_color_blue[1]; 65 | extern const ui_style_variable_t _ui_theme_bg_opa_blue[1]; 66 | extern const ui_style_variable_t _ui_theme_grad_color_blue[1]; 67 | extern const ui_style_variable_t _ui_theme_grad_opa_blue[1]; 68 | extern const ui_style_variable_t _ui_theme_grad_dir_blue[1]; 69 | extern const ui_style_variable_t _ui_theme_main_stop_blue[1]; 70 | extern const ui_style_variable_t _ui_theme_grad_stop_blue[1]; 71 | 72 | extern uint8_t ui_theme_idx; 73 | 74 | void ui_theme_set(uint8_t theme_idx); 75 | 76 | 77 | #ifdef __cplusplus 78 | } //extern "C" 79 | #endif 80 | 81 | #endif //_UI_THEMES_H 82 | 83 | -------------------------------------------------------------------------------- /weather_7/src/ui/GUI_Themes.h: -------------------------------------------------------------------------------- 1 | #ifndef _UI_THEMES_H 2 | #define _UI_THEMES_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | 9 | #define UI_THEME_COLOR_WHITE 0 10 | #define UI_THEME_COLOR_GREEN 1 11 | #define UI_THEME_COLOR_YELLOW 2 12 | #define UI_THEME_COLOR_BLACK 3 13 | #define UI_THEME_COLOR_RED 4 14 | #define UI_THEME_COLOR_BLUE 5 15 | 16 | #define UI_THEME_DEFAULT 0 17 | 18 | // Declarations for gradient style 'White' 19 | extern const ui_theme_variable_t _ui_theme_bg_color_white[1]; 20 | extern const ui_style_variable_t _ui_theme_bg_opa_white[1]; 21 | extern const ui_style_variable_t _ui_theme_grad_color_white[1]; 22 | extern const ui_style_variable_t _ui_theme_grad_opa_white[1]; 23 | extern const ui_style_variable_t _ui_theme_grad_dir_white[1]; 24 | extern const ui_style_variable_t _ui_theme_main_stop_white[1]; 25 | extern const ui_style_variable_t _ui_theme_grad_stop_white[1]; 26 | 27 | // Declarations for gradient style 'Green' 28 | extern const ui_theme_variable_t _ui_theme_bg_color_green[1]; 29 | extern const ui_style_variable_t _ui_theme_bg_opa_green[1]; 30 | extern const ui_style_variable_t _ui_theme_grad_color_green[1]; 31 | extern const ui_style_variable_t _ui_theme_grad_opa_green[1]; 32 | extern const ui_style_variable_t _ui_theme_grad_dir_green[1]; 33 | extern const ui_style_variable_t _ui_theme_main_stop_green[1]; 34 | extern const ui_style_variable_t _ui_theme_grad_stop_green[1]; 35 | 36 | // Declarations for gradient style 'Yellow' 37 | extern const ui_theme_variable_t _ui_theme_bg_color_yellow[1]; 38 | extern const ui_style_variable_t _ui_theme_bg_opa_yellow[1]; 39 | extern const ui_style_variable_t _ui_theme_grad_color_yellow[1]; 40 | extern const ui_style_variable_t _ui_theme_grad_opa_yellow[1]; 41 | extern const ui_style_variable_t _ui_theme_grad_dir_yellow[1]; 42 | extern const ui_style_variable_t _ui_theme_main_stop_yellow[1]; 43 | extern const ui_style_variable_t _ui_theme_grad_stop_yellow[1]; 44 | 45 | // Declarations for gradient style 'Black' 46 | extern const ui_theme_variable_t _ui_theme_bg_color_black[1]; 47 | extern const ui_style_variable_t _ui_theme_bg_opa_black[1]; 48 | extern const ui_style_variable_t _ui_theme_grad_color_black[1]; 49 | extern const ui_style_variable_t _ui_theme_grad_opa_black[1]; 50 | extern const ui_style_variable_t _ui_theme_grad_dir_black[1]; 51 | extern const ui_style_variable_t _ui_theme_main_stop_black[1]; 52 | extern const ui_style_variable_t _ui_theme_grad_stop_black[1]; 53 | 54 | // Declarations for gradient style 'Red' 55 | extern const ui_theme_variable_t _ui_theme_bg_color_red[1]; 56 | extern const ui_style_variable_t _ui_theme_bg_opa_red[1]; 57 | extern const ui_style_variable_t _ui_theme_grad_color_red[1]; 58 | extern const ui_style_variable_t _ui_theme_grad_opa_red[1]; 59 | extern const ui_style_variable_t _ui_theme_grad_dir_red[1]; 60 | extern const ui_style_variable_t _ui_theme_main_stop_red[1]; 61 | extern const ui_style_variable_t _ui_theme_grad_stop_red[1]; 62 | 63 | // Declarations for gradient style 'Blue' 64 | extern const ui_theme_variable_t _ui_theme_bg_color_blue[1]; 65 | extern const ui_style_variable_t _ui_theme_bg_opa_blue[1]; 66 | extern const ui_style_variable_t _ui_theme_grad_color_blue[1]; 67 | extern const ui_style_variable_t _ui_theme_grad_opa_blue[1]; 68 | extern const ui_style_variable_t _ui_theme_grad_dir_blue[1]; 69 | extern const ui_style_variable_t _ui_theme_main_stop_blue[1]; 70 | extern const ui_style_variable_t _ui_theme_grad_stop_blue[1]; 71 | 72 | extern uint8_t ui_theme_idx; 73 | 74 | void ui_theme_set(uint8_t theme_idx); 75 | 76 | 77 | #ifdef __cplusplus 78 | } //extern "C" 79 | #endif 80 | 81 | #endif //_UI_THEMES_H 82 | 83 | -------------------------------------------------------------------------------- /weather_13/src/ui/ui_helpers.h: -------------------------------------------------------------------------------- 1 | // This file was generated by SquareLine Studio 2 | // SquareLine Studio version: SquareLine Studio 1.5.1 3 | // LVGL version: 9.2.2 4 | // Project name: SquareLine_Project 5 | 6 | #ifndef _SQUARELINE_PROJECT_UI_HELPERS_H 7 | #define _SQUARELINE_PROJECT_UI_HELPERS_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" 11 | { 12 | #endif 13 | 14 | #include "GUI.h" 15 | 16 | #define _UI_TEMPORARY_STRING_BUFFER_SIZE 32 17 | #define _UI_BAR_PROPERTY_VALUE 0 18 | #define _UI_BAR_PROPERTY_VALUE_WITH_ANIM 1 19 | void _ui_bar_set_property(lv_obj_t *target, int id, int val); 20 | 21 | #define _UI_BASIC_PROPERTY_POSITION_X 0 22 | #define _UI_BASIC_PROPERTY_POSITION_Y 1 23 | #define _UI_BASIC_PROPERTY_WIDTH 2 24 | #define _UI_BASIC_PROPERTY_HEIGHT 3 25 | void _ui_basic_set_property(lv_obj_t *target, int id, int val); 26 | 27 | #define _UI_DROPDOWN_PROPERTY_SELECTED 0 28 | void _ui_dropdown_set_property(lv_obj_t *target, int id, int val); 29 | 30 | #define _UI_IMAGE_PROPERTY_IMAGE 0 31 | void _ui_image_set_property(lv_obj_t *target, int id, uint8_t *val); 32 | 33 | #define _UI_LABEL_PROPERTY_TEXT 0 34 | void _ui_label_set_property(lv_obj_t *target, int id, const char *val); 35 | 36 | #define _UI_ROLLER_PROPERTY_SELECTED 0 37 | #define _UI_ROLLER_PROPERTY_SELECTED_WITH_ANIM 1 38 | void _ui_roller_set_property(lv_obj_t *target, int id, int val); 39 | 40 | #define _UI_SLIDER_PROPERTY_VALUE 0 41 | #define _UI_SLIDER_PROPERTY_VALUE_WITH_ANIM 1 42 | void _ui_slider_set_property(lv_obj_t *target, int id, int val); 43 | 44 | void _ui_screen_change(lv_obj_t **target, lv_screen_load_anim_t fademode, int spd, int delay, 45 | void (*target_init)(void)); 46 | 47 | void _ui_screen_delete(lv_obj_t **target); 48 | 49 | void _ui_arc_increment(lv_obj_t *target, int val); 50 | 51 | void _ui_bar_increment(lv_obj_t *target, int val, int anm); 52 | 53 | void _ui_slider_increment(lv_obj_t *target, int val, int anm); 54 | 55 | void _ui_keyboard_set_target(lv_obj_t *keyboard, lv_obj_t *textarea); 56 | 57 | #define _UI_MODIFY_FLAG_ADD 0 58 | #define _UI_MODIFY_FLAG_REMOVE 1 59 | #define _UI_MODIFY_FLAG_TOGGLE 2 60 | void _ui_flag_modify(lv_obj_t *target, int32_t flag, int value); 61 | 62 | #define _UI_MODIFY_STATE_ADD 0 63 | #define _UI_MODIFY_STATE_REMOVE 1 64 | #define _UI_MODIFY_STATE_TOGGLE 2 65 | void _ui_state_modify(lv_obj_t *target, int32_t state, int value); 66 | 67 | #define UI_MOVE_CURSOR_UP 0 68 | #define UI_MOVE_CURSOR_RIGHT 1 69 | #define UI_MOVE_CURSOR_DOWN 2 70 | #define UI_MOVE_CURSOR_LEFT 3 71 | void _ui_textarea_move_cursor(lv_obj_t *target, int val); 72 | 73 | void scr_unloaded_delete_cb(lv_event_t *e); 74 | 75 | void _ui_opacity_set(lv_obj_t *target, int val); 76 | 77 | /** Describes an animation*/ 78 | typedef struct _ui_anim_user_data_t 79 | { 80 | lv_obj_t *target; 81 | lv_image_dsc_t **imgset; 82 | int32_t imgset_size; 83 | int32_t val; 84 | } ui_anim_user_data_t; 85 | void _ui_anim_callback_free_user_data(lv_anim_t *a); 86 | 87 | void _ui_anim_callback_set_x(lv_anim_t *a, int32_t v); 88 | 89 | void _ui_anim_callback_set_y(lv_anim_t *a, int32_t v); 90 | 91 | void _ui_anim_callback_set_width(lv_anim_t *a, int32_t v); 92 | 93 | void _ui_anim_callback_set_height(lv_anim_t *a, int32_t v); 94 | 95 | void _ui_anim_callback_set_opacity(lv_anim_t *a, int32_t v); 96 | 97 | void _ui_anim_callback_set_image_zoom(lv_anim_t *a, int32_t v); 98 | 99 | void _ui_anim_callback_set_image_angle(lv_anim_t *a, int32_t v); 100 | 101 | void _ui_anim_callback_set_image_frame(lv_anim_t *a, int32_t v); 102 | 103 | int32_t _ui_anim_callback_get_x(lv_anim_t *a); 104 | 105 | int32_t _ui_anim_callback_get_y(lv_anim_t *a); 106 | 107 | int32_t _ui_anim_callback_get_width(lv_anim_t *a); 108 | 109 | int32_t _ui_anim_callback_get_height(lv_anim_t *a); 110 | 111 | int32_t _ui_anim_callback_get_opacity(lv_anim_t *a); 112 | 113 | int32_t _ui_anim_callback_get_image_zoom(lv_anim_t *a); 114 | 115 | int32_t _ui_anim_callback_get_image_angle(lv_anim_t *a); 116 | 117 | int32_t _ui_anim_callback_get_image_frame(lv_anim_t *a); 118 | 119 | void _ui_arc_set_text_value(lv_obj_t *trg, lv_obj_t *src, const char *prefix, const char *postfix); 120 | 121 | void _ui_slider_set_text_value(lv_obj_t *trg, lv_obj_t *src, const char *prefix, const char *postfix); 122 | 123 | void _ui_checked_set_text_value(lv_obj_t *trg, lv_obj_t *src, const char *txt_on, const char *txt_off); 124 | 125 | void _ui_spinbox_step(lv_obj_t *target, int val); 126 | 127 | void _ui_switch_theme(int val); 128 | 129 | #ifdef __cplusplus 130 | } /*extern "C"*/ 131 | #endif 132 | 133 | #endif 134 | -------------------------------------------------------------------------------- /weather_7/src/ui/ui_helpers.h: -------------------------------------------------------------------------------- 1 | // This file was generated by SquareLine Studio 2 | // SquareLine Studio version: SquareLine Studio 1.5.1 3 | // LVGL version: 9.2.2 4 | // Project name: SquareLine_Project 5 | 6 | #ifndef _SQUARELINE_PROJECT_UI_HELPERS_H 7 | #define _SQUARELINE_PROJECT_UI_HELPERS_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" 11 | { 12 | #endif 13 | 14 | #include "GUI.h" 15 | 16 | #define _UI_TEMPORARY_STRING_BUFFER_SIZE 32 17 | #define _UI_BAR_PROPERTY_VALUE 0 18 | #define _UI_BAR_PROPERTY_VALUE_WITH_ANIM 1 19 | void _ui_bar_set_property(lv_obj_t *target, int id, int val); 20 | 21 | #define _UI_BASIC_PROPERTY_POSITION_X 0 22 | #define _UI_BASIC_PROPERTY_POSITION_Y 1 23 | #define _UI_BASIC_PROPERTY_WIDTH 2 24 | #define _UI_BASIC_PROPERTY_HEIGHT 3 25 | void _ui_basic_set_property(lv_obj_t *target, int id, int val); 26 | 27 | #define _UI_DROPDOWN_PROPERTY_SELECTED 0 28 | void _ui_dropdown_set_property(lv_obj_t *target, int id, int val); 29 | 30 | #define _UI_IMAGE_PROPERTY_IMAGE 0 31 | void _ui_image_set_property(lv_obj_t *target, int id, uint8_t *val); 32 | 33 | #define _UI_LABEL_PROPERTY_TEXT 0 34 | void _ui_label_set_property(lv_obj_t *target, int id, const char *val); 35 | 36 | #define _UI_ROLLER_PROPERTY_SELECTED 0 37 | #define _UI_ROLLER_PROPERTY_SELECTED_WITH_ANIM 1 38 | void _ui_roller_set_property(lv_obj_t *target, int id, int val); 39 | 40 | #define _UI_SLIDER_PROPERTY_VALUE 0 41 | #define _UI_SLIDER_PROPERTY_VALUE_WITH_ANIM 1 42 | void _ui_slider_set_property(lv_obj_t *target, int id, int val); 43 | 44 | void _ui_screen_change(lv_obj_t **target, lv_screen_load_anim_t fademode, int spd, int delay, 45 | void (*target_init)(void)); 46 | 47 | void _ui_screen_delete(lv_obj_t **target); 48 | 49 | void _ui_arc_increment(lv_obj_t *target, int val); 50 | 51 | void _ui_bar_increment(lv_obj_t *target, int val, int anm); 52 | 53 | void _ui_slider_increment(lv_obj_t *target, int val, int anm); 54 | 55 | void _ui_keyboard_set_target(lv_obj_t *keyboard, lv_obj_t *textarea); 56 | 57 | #define _UI_MODIFY_FLAG_ADD 0 58 | #define _UI_MODIFY_FLAG_REMOVE 1 59 | #define _UI_MODIFY_FLAG_TOGGLE 2 60 | void _ui_flag_modify(lv_obj_t *target, int32_t flag, int value); 61 | 62 | #define _UI_MODIFY_STATE_ADD 0 63 | #define _UI_MODIFY_STATE_REMOVE 1 64 | #define _UI_MODIFY_STATE_TOGGLE 2 65 | void _ui_state_modify(lv_obj_t *target, int32_t state, int value); 66 | 67 | #define UI_MOVE_CURSOR_UP 0 68 | #define UI_MOVE_CURSOR_RIGHT 1 69 | #define UI_MOVE_CURSOR_DOWN 2 70 | #define UI_MOVE_CURSOR_LEFT 3 71 | void _ui_textarea_move_cursor(lv_obj_t *target, int val); 72 | 73 | void scr_unloaded_delete_cb(lv_event_t *e); 74 | 75 | void _ui_opacity_set(lv_obj_t *target, int val); 76 | 77 | /** Describes an animation*/ 78 | typedef struct _ui_anim_user_data_t 79 | { 80 | lv_obj_t *target; 81 | lv_image_dsc_t **imgset; 82 | int32_t imgset_size; 83 | int32_t val; 84 | } ui_anim_user_data_t; 85 | void _ui_anim_callback_free_user_data(lv_anim_t *a); 86 | 87 | void _ui_anim_callback_set_x(lv_anim_t *a, int32_t v); 88 | 89 | void _ui_anim_callback_set_y(lv_anim_t *a, int32_t v); 90 | 91 | void _ui_anim_callback_set_width(lv_anim_t *a, int32_t v); 92 | 93 | void _ui_anim_callback_set_height(lv_anim_t *a, int32_t v); 94 | 95 | void _ui_anim_callback_set_opacity(lv_anim_t *a, int32_t v); 96 | 97 | void _ui_anim_callback_set_image_zoom(lv_anim_t *a, int32_t v); 98 | 99 | void _ui_anim_callback_set_image_angle(lv_anim_t *a, int32_t v); 100 | 101 | void _ui_anim_callback_set_image_frame(lv_anim_t *a, int32_t v); 102 | 103 | int32_t _ui_anim_callback_get_x(lv_anim_t *a); 104 | 105 | int32_t _ui_anim_callback_get_y(lv_anim_t *a); 106 | 107 | int32_t _ui_anim_callback_get_width(lv_anim_t *a); 108 | 109 | int32_t _ui_anim_callback_get_height(lv_anim_t *a); 110 | 111 | int32_t _ui_anim_callback_get_opacity(lv_anim_t *a); 112 | 113 | int32_t _ui_anim_callback_get_image_zoom(lv_anim_t *a); 114 | 115 | int32_t _ui_anim_callback_get_image_angle(lv_anim_t *a); 116 | 117 | int32_t _ui_anim_callback_get_image_frame(lv_anim_t *a); 118 | 119 | void _ui_arc_set_text_value(lv_obj_t *trg, lv_obj_t *src, const char *prefix, const char *postfix); 120 | 121 | void _ui_slider_set_text_value(lv_obj_t *trg, lv_obj_t *src, const char *prefix, const char *postfix); 122 | 123 | void _ui_checked_set_text_value(lv_obj_t *trg, lv_obj_t *src, const char *txt_on, const char *txt_off); 124 | 125 | void _ui_spinbox_step(lv_obj_t *target, int val); 126 | 127 | void _ui_switch_theme(int val); 128 | 129 | #ifdef __cplusplus 130 | } /*extern "C"*/ 131 | #endif 132 | 133 | #endif 134 | -------------------------------------------------------------------------------- /weather_13/src/ui/Content/assets/images/upload_humi_479a980bbd324940bbd291ab8d342bd8_png.c: -------------------------------------------------------------------------------- 1 | #ifdef __has_include 2 | #if __has_include("lvgl.h") 3 | #ifndef LV_LVGL_H_INCLUDE_SIMPLE 4 | #define LV_LVGL_H_INCLUDE_SIMPLE 5 | #endif 6 | #endif 7 | #endif 8 | 9 | #if defined(LV_LVGL_H_INCLUDE_SIMPLE) 10 | #include "lvgl.h" 11 | #else 12 | #include "lvgl/lvgl.h" 13 | #endif 14 | 15 | 16 | #ifndef LV_ATTRIBUTE_MEM_ALIGN 17 | #define LV_ATTRIBUTE_MEM_ALIGN 18 | #endif 19 | 20 | #ifndef LV_ATTRIBUTE_IMAGE_UPLOAD_HUMI_479A980BBD324940BBD291AB8D342BD8_PNG 21 | #define LV_ATTRIBUTE_IMAGE_UPLOAD_HUMI_479A980BBD324940BBD291AB8D342BD8_PNG 22 | #endif 23 | 24 | const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMAGE_UPLOAD_HUMI_479A980BBD324940BBD291AB8D342BD8_PNG uint8_t upload_humi_479a980bbd324940bbd291ab8d342bd8_png_map[] = { 25 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x1b, 0xff, 0xff, 0xff, 0xd1, 0xff, 0xff, 0xff, 0x8e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 26 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xb3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 27 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x6c, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe9, 0xff, 0xff, 0xff, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 28 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x24, 0xff, 0xff, 0xff, 0xf5, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xa3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 29 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xaf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0x42, 0x00, 0x00, 0x00, 0x00, 30 | 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x48, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, 0xff, 0xff, 0xff, 0x09, 31 | 0xff, 0xff, 0xff, 0x01, 0xff, 0xff, 0xff, 0xc5, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x65, 32 | 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xd0, 33 | 0xff, 0xff, 0xff, 0x9c, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf1, 34 | 0xff, 0xff, 0xff, 0xde, 0xff, 0xff, 0xff, 0xf7, 0xff, 0xff, 0xff, 0x45, 0xff, 0xff, 0xff, 0xbe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xed, 35 | 0xff, 0xff, 0xff, 0xe9, 0xff, 0xff, 0xff, 0xf4, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x72, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xed, 36 | 0xff, 0xff, 0xff, 0xbe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x4d, 0xff, 0xff, 0xff, 0x0f, 0xff, 0xff, 0xff, 0xda, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 37 | 0xff, 0xff, 0xff, 0x61, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdc, 0xff, 0xff, 0xff, 0x1e, 0xff, 0xff, 0xff, 0x09, 0xff, 0xff, 0xff, 0x60, 0xff, 0xff, 0xff, 0xb0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe6, 38 | 0xff, 0xff, 0xff, 0x08, 0xff, 0xff, 0xff, 0xc6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe2, 0xff, 0xff, 0xff, 0x60, 0xff, 0xff, 0xff, 0x19, 0xff, 0xff, 0xff, 0x67, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6e, 39 | 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x1b, 0xff, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0x76, 0x00, 0x00, 0x00, 0x00, 40 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x04, 0xff, 0xff, 0xff, 0x59, 0xff, 0xff, 0xff, 0xab, 0xff, 0xff, 0xff, 0xe4, 0xff, 0xff, 0xff, 0xd3, 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 41 | }; 42 | 43 | const lv_image_dsc_t upload_humi_479a980bbd324940bbd291ab8d342bd8_png = { 44 | .header.cf = LV_COLOR_FORMAT_ARGB8888, 45 | .header.magic = LV_IMAGE_HEADER_MAGIC, 46 | .header.w = 11, 47 | .header.h = 16, 48 | .data_size = 176 * 4, 49 | .data = upload_humi_479a980bbd324940bbd291ab8d342bd8_png_map, 50 | }; 51 | -------------------------------------------------------------------------------- /weather_7/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "Adafruit_SHT4x.h" 6 | 7 | #include "e1002_display.h" 8 | #include "ui/GUI.h" 9 | 10 | #include 11 | 12 | #include "weather.h" 13 | #include "weather_view.h" 14 | 15 | e1002_driver_t e1002_driver; 16 | Adafruit_SHT4x sht4 = Adafruit_SHT4x(); 17 | // ==================== configuration ==================== 18 | const char *WIFI_SSID = "*********"; 19 | const char *WIFI_PASSWORD = "*********"; 20 | const char *OW_API_KEY = "******************"; // OpenWeather API Key 21 | 22 | const char *UNITS = "metric"; 23 | const char *LANG = "zh_cn"; 24 | 25 | const uint32_t WEATHER_REFRESH_INTERVAL_MIN = 60; // Weather API call interval 26 | const uint32_t INDOOR_REFRESH_INTERVAL_MIN = 10; // Indoor sensor/UI refresh interval 27 | const uint32_t WEATHER_REFRESH_INTERVAL_MS = WEATHER_REFRESH_INTERVAL_MIN * 60UL * 1000UL; 28 | const uint32_t INDOOR_REFRESH_INTERVAL_MS = INDOOR_REFRESH_INTERVAL_MIN * 60UL * 1000UL; 29 | 30 | // ✅ 方式1:城市名 31 | String CITY = "Shenzhen,CN"; // 推荐带国家码避免同名冲突 32 | 33 | // ✅ 方式2:经纬度 34 | const char *LAT = "40.7128"; 35 | const char *LON = "-74.0060"; 36 | 37 | // 开关:true = 使用城市名;false = 使用经纬度 38 | bool USE_CITY_MODE = true; 39 | 40 | typedef struct { 41 | float temperature; 42 | float humidity; 43 | } SHT40_DATA; 44 | 45 | WeatherRequest g_weatherRequest; 46 | WeatherData g_weatherData; 47 | bool g_weatherValid = false; 48 | uint32_t g_lastWeatherFetchMs = 0; 49 | uint32_t g_lastIndoorUpdateMs = 0; 50 | 51 | SHT40_DATA sht40_read() 52 | { 53 | sensors_event_t humidity, temp; 54 | sht4.getEvent(&humidity, &temp); 55 | SHT40_DATA d; 56 | d.temperature = temp.temperature; 57 | d.humidity = humidity.relative_humidity; 58 | return d; 59 | } 60 | 61 | // ==================== 主函数 ==================== 62 | void setup() 63 | { 64 | Serial1.begin(115200, SERIAL_8N1, 44, 43); 65 | e1002_display_init(&e1002_driver); 66 | GUI_init(); 67 | Wire.setPins(19, 20); 68 | sht4.begin(); 69 | 70 | WiFi.begin(WIFI_SSID, WIFI_PASSWORD); 71 | Serial1.print("Connecting to WiFi..."); 72 | while (WiFi.status() != WL_CONNECTED) 73 | { 74 | delay(500); 75 | Serial1.print("."); 76 | } 77 | Serial1.println(" Connected!"); 78 | Serial1.println("IP address: " + WiFi.localIP().toString()); 79 | 80 | g_weatherRequest.apiKey = OW_API_KEY; 81 | g_weatherRequest.units = UNITS; 82 | g_weatherRequest.lang = LANG; 83 | g_weatherRequest.useCity = USE_CITY_MODE; 84 | if (USE_CITY_MODE) 85 | { 86 | g_weatherRequest.city = CITY; 87 | } 88 | else 89 | { 90 | g_weatherRequest.lat = LAT; 91 | g_weatherRequest.lon = LON; 92 | } 93 | 94 | if (fetchWeather(g_weatherRequest, g_weatherData)) 95 | { 96 | Serial1.println("=== CITY/TZ ==="); 97 | Serial1.printf("city=%s tzOffset=%d(s)\n", g_weatherData.cityName.c_str(), g_weatherData.timezoneOffset); 98 | 99 | Serial1.println("=== CURRENT ==="); 100 | Serial1.printf("temp=%.1f feels=%.1f hum=%d%% wind=%.1f gust=%.1f deg=%d\n", 101 | g_weatherData.temp, g_weatherData.feelsLike, g_weatherData.humidity, 102 | g_weatherData.windSpeed, g_weatherData.windGust, g_weatherData.windDeg); 103 | Serial1.printf("weather: %d %s / %s icon=%s\n", 104 | g_weatherData.weatherId, g_weatherData.main.c_str(), g_weatherData.desc.c_str(), g_weatherData.icon.c_str()); 105 | 106 | Serial1.println("=== HOURLY (next 4 x 3h) ==="); 107 | for (int i = 0; i < 4; i++) 108 | { 109 | Serial1.printf("[%d] t=%.1f wind=%.1f gust=%.1f id=%d %s icon=%s\n", 110 | g_weatherData.hourly[i].ts, g_weatherData.hourly[i].temp, g_weatherData.hourly[i].windSpeed, 111 | g_weatherData.hourly[i].windGust, g_weatherData.hourly[i].weatherId, 112 | g_weatherData.hourly[i].main.c_str(), g_weatherData.hourly[i].icon.c_str()); 113 | } 114 | 115 | Serial1.println("=== DAILY (next 3, aggregated) ==="); 116 | for (int i = 0; i < 3; i++) 117 | { 118 | Serial1.printf("[%d] day=%.1f min=%.1f max=%.1f id=%d %s icon=%s\n", 119 | g_weatherData.daily[i].ts, g_weatherData.daily[i].day, g_weatherData.daily[i].min, g_weatherData.daily[i].max, 120 | g_weatherData.daily[i].weatherId, g_weatherData.daily[i].main.c_str(), g_weatherData.daily[i].icon.c_str()); 121 | } 122 | 123 | Serial1.println("=== AQI ==="); 124 | Serial1.printf("AQI=%d (%s)\n", g_weatherData.aqi, g_weatherData.aqiLabel.c_str()); 125 | 126 | Serial1.println("Alerts: not available on 2.5"); 127 | 128 | SHT40_DATA indoor = sht40_read(); 129 | g_weatherData.indoorTemp = indoor.temperature; 130 | g_weatherData.indoorHumidity = static_cast(roundf(indoor.humidity)); 131 | 132 | GUI_update_weather_screen(g_weatherData); 133 | g_weatherValid = true; 134 | g_lastWeatherFetchMs = millis(); 135 | g_lastIndoorUpdateMs = g_lastWeatherFetchMs; 136 | } 137 | else 138 | { 139 | Serial1.println("Fetch weather failed."); 140 | } 141 | } 142 | 143 | void loop() 144 | { 145 | lv_timer_handler(); // Drive LVGL internal timers 146 | delay(50); // Reduce CPU usage since frequent updates aren't needed 147 | 148 | const uint32_t now = millis(); 149 | 150 | if (!g_weatherValid || (now - g_lastWeatherFetchMs) >= WEATHER_REFRESH_INTERVAL_MS) 151 | { 152 | WeatherData latest; 153 | if (fetchWeather(g_weatherRequest, latest)) 154 | { 155 | // Preserve latest indoor readings 156 | latest.indoorTemp = g_weatherData.indoorTemp; 157 | latest.indoorHumidity = g_weatherData.indoorHumidity; 158 | 159 | g_weatherData = latest; 160 | g_weatherValid = true; 161 | g_lastWeatherFetchMs = now; 162 | GUI_update_weather_screen(g_weatherData); 163 | } 164 | } 165 | 166 | if ((now - g_lastIndoorUpdateMs) >= INDOOR_REFRESH_INTERVAL_MS) 167 | { 168 | SHT40_DATA indoor = sht40_read(); 169 | if (g_weatherValid) 170 | { 171 | g_weatherData.indoorTemp = indoor.temperature; 172 | g_weatherData.indoorHumidity = static_cast(roundf(indoor.humidity)); 173 | GUI_update_weather_screen(g_weatherData); 174 | } 175 | g_lastIndoorUpdateMs = now; 176 | } 177 | 178 | // Check if display refresh is needed 179 | if (e1002_display_should_refresh(&e1002_driver)) 180 | { 181 | Serial1.println("Refreshing e-paper display..."); 182 | e1002_display_refresh(&e1002_driver); 183 | Serial1.println("Display refresh complete"); 184 | } 185 | } 186 | -------------------------------------------------------------------------------- /weather_13/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "Adafruit_SHT4x.h" 6 | 7 | #include "e1002_display.h" 8 | #include "ui/GUI.h" 9 | 10 | #include 11 | 12 | #include "weather.h" 13 | #include "weather_view.h" 14 | 15 | e1002_driver_t e1002_driver; 16 | Adafruit_SHT4x sht4 = Adafruit_SHT4x(); 17 | // ==================== 配置 ==================== 18 | const char *WIFI_SSID = "*************"; 19 | const char *WIFI_PASSWORD = "*************"; 20 | const char *OW_API_KEY = "**************************"; // OpenWeather API Key 21 | 22 | const char *UNITS = "metric"; 23 | const char *LANG = "zh_cn"; 24 | 25 | const uint32_t WEATHER_REFRESH_INTERVAL_MIN = 60; // Weather API call interval 26 | const uint32_t INDOOR_REFRESH_INTERVAL_MIN = 10; // Indoor sensor/UI refresh interval 27 | const uint32_t WEATHER_REFRESH_INTERVAL_MS = WEATHER_REFRESH_INTERVAL_MIN * 60UL * 1000UL; 28 | const uint32_t INDOOR_REFRESH_INTERVAL_MS = INDOOR_REFRESH_INTERVAL_MIN * 60UL * 1000UL; 29 | 30 | // ✅ 方式1:城市名 31 | String CITY = "Shenzhen,CN"; // 推荐带国家码避免同名冲突 32 | 33 | // ✅ 方式2:经纬度 34 | const char *LAT = "40.7128"; 35 | const char *LON = "-74.0060"; 36 | 37 | // 开关:true = 使用城市名;false = 使用经纬度 38 | bool USE_CITY_MODE = true; 39 | 40 | typedef struct { 41 | float temperature; 42 | float humidity; 43 | } SHT40_DATA; 44 | 45 | WeatherRequest g_weatherRequest; 46 | WeatherData g_weatherData; 47 | bool g_weatherValid = false; 48 | uint32_t g_lastWeatherFetchMs = 0; 49 | uint32_t g_lastIndoorUpdateMs = 0; 50 | 51 | SHT40_DATA sht40_read() 52 | { 53 | sensors_event_t humidity, temp; 54 | sht4.getEvent(&humidity, &temp); 55 | SHT40_DATA d; 56 | d.temperature = temp.temperature; 57 | d.humidity = humidity.relative_humidity; 58 | return d; 59 | } 60 | 61 | // ==================== 主函数 ==================== 62 | void setup() 63 | { 64 | Serial1.begin(115200, SERIAL_8N1, 44, 43); 65 | e1002_display_init(&e1002_driver); 66 | GUI_init(); 67 | Wire.setPins(19, 20); 68 | sht4.begin(); 69 | 70 | WiFi.begin(WIFI_SSID, WIFI_PASSWORD); 71 | Serial1.print("Connecting to WiFi..."); 72 | while (WiFi.status() != WL_CONNECTED) 73 | { 74 | delay(500); 75 | Serial1.print("."); 76 | } 77 | Serial1.println(" Connected!"); 78 | Serial1.println("IP address: " + WiFi.localIP().toString()); 79 | 80 | g_weatherRequest.apiKey = OW_API_KEY; 81 | g_weatherRequest.units = UNITS; 82 | g_weatherRequest.lang = LANG; 83 | g_weatherRequest.useCity = USE_CITY_MODE; 84 | if (USE_CITY_MODE) 85 | { 86 | g_weatherRequest.city = CITY; 87 | } 88 | else 89 | { 90 | g_weatherRequest.lat = LAT; 91 | g_weatherRequest.lon = LON; 92 | } 93 | 94 | if (fetchWeather(g_weatherRequest, g_weatherData)) 95 | { 96 | Serial1.println("=== CITY/TZ ==="); 97 | Serial1.printf("city=%s tzOffset=%d(s)\n", g_weatherData.cityName.c_str(), g_weatherData.timezoneOffset); 98 | 99 | Serial1.println("=== CURRENT ==="); 100 | Serial1.printf("temp=%.1f feels=%.1f hum=%d%% wind=%.1f gust=%.1f deg=%d\n", 101 | g_weatherData.temp, g_weatherData.feelsLike, g_weatherData.humidity, 102 | g_weatherData.windSpeed, g_weatherData.windGust, g_weatherData.windDeg); 103 | Serial1.printf("weather: %d %s / %s icon=%s\n", 104 | g_weatherData.weatherId, g_weatherData.main.c_str(), g_weatherData.desc.c_str(), g_weatherData.icon.c_str()); 105 | 106 | Serial1.println("=== HOURLY (next 4 x 3h) ==="); 107 | for (int i = 0; i < 4; i++) 108 | { 109 | Serial1.printf("[%d] t=%.1f wind=%.1f gust=%.1f id=%d %s icon=%s\n", 110 | g_weatherData.hourly[i].ts, g_weatherData.hourly[i].temp, g_weatherData.hourly[i].windSpeed, 111 | g_weatherData.hourly[i].windGust, g_weatherData.hourly[i].weatherId, 112 | g_weatherData.hourly[i].main.c_str(), g_weatherData.hourly[i].icon.c_str()); 113 | } 114 | 115 | Serial1.println("=== DAILY (next 3, aggregated) ==="); 116 | for (int i = 0; i < 3; i++) 117 | { 118 | Serial1.printf("[%d] day=%.1f min=%.1f max=%.1f id=%d %s icon=%s\n", 119 | g_weatherData.daily[i].ts, g_weatherData.daily[i].day, g_weatherData.daily[i].min, g_weatherData.daily[i].max, 120 | g_weatherData.daily[i].weatherId, g_weatherData.daily[i].main.c_str(), g_weatherData.daily[i].icon.c_str()); 121 | } 122 | 123 | Serial1.println("=== AQI ==="); 124 | Serial1.printf("AQI=%d (%s)\n", g_weatherData.aqi, g_weatherData.aqiLabel.c_str()); 125 | 126 | Serial1.println("Alerts: not available on 2.5"); 127 | 128 | SHT40_DATA indoor = sht40_read(); 129 | g_weatherData.indoorTemp = indoor.temperature; 130 | g_weatherData.indoorHumidity = static_cast(roundf(indoor.humidity)); 131 | 132 | GUI_update_weather_screen(g_weatherData); 133 | g_weatherValid = true; 134 | g_lastWeatherFetchMs = millis(); 135 | g_lastIndoorUpdateMs = g_lastWeatherFetchMs; 136 | } 137 | else 138 | { 139 | Serial1.println("Fetch weather failed."); 140 | } 141 | } 142 | 143 | void loop() 144 | { 145 | lv_timer_handler(); // Drive LVGL internal timers 146 | delay(50); // Reduce CPU usage since frequent updates aren't needed 147 | 148 | const uint32_t now = millis(); 149 | 150 | if (!g_weatherValid || (now - g_lastWeatherFetchMs) >= WEATHER_REFRESH_INTERVAL_MS) 151 | { 152 | WeatherData latest; 153 | if (fetchWeather(g_weatherRequest, latest)) 154 | { 155 | // Preserve latest indoor readings 156 | latest.indoorTemp = g_weatherData.indoorTemp; 157 | latest.indoorHumidity = g_weatherData.indoorHumidity; 158 | 159 | g_weatherData = latest; 160 | g_weatherValid = true; 161 | g_lastWeatherFetchMs = now; 162 | GUI_update_weather_screen(g_weatherData); 163 | } 164 | } 165 | 166 | if ((now - g_lastIndoorUpdateMs) >= INDOOR_REFRESH_INTERVAL_MS) 167 | { 168 | SHT40_DATA indoor = sht40_read(); 169 | if (g_weatherValid) 170 | { 171 | g_weatherData.indoorTemp = indoor.temperature; 172 | g_weatherData.indoorHumidity = static_cast(roundf(indoor.humidity)); 173 | GUI_update_weather_screen(g_weatherData); 174 | } 175 | g_lastIndoorUpdateMs = now; 176 | } 177 | 178 | // Check if display refresh is needed 179 | if (e1002_display_should_refresh(&e1002_driver)) 180 | { 181 | Serial1.println("Refreshing e-paper display..."); 182 | e1002_display_refresh(&e1002_driver); 183 | Serial1.println("Display refresh complete"); 184 | } 185 | } 186 | -------------------------------------------------------------------------------- /weather_13/src/ui/Content/assets/images/upload_fan_f58335df51f940da8686fe1402df28e2_png.c: -------------------------------------------------------------------------------- 1 | #ifdef __has_include 2 | #if __has_include("lvgl.h") 3 | #ifndef LV_LVGL_H_INCLUDE_SIMPLE 4 | #define LV_LVGL_H_INCLUDE_SIMPLE 5 | #endif 6 | #endif 7 | #endif 8 | 9 | #if defined(LV_LVGL_H_INCLUDE_SIMPLE) 10 | #include "lvgl.h" 11 | #else 12 | #include "lvgl/lvgl.h" 13 | #endif 14 | 15 | 16 | #ifndef LV_ATTRIBUTE_MEM_ALIGN 17 | #define LV_ATTRIBUTE_MEM_ALIGN 18 | #endif 19 | 20 | #ifndef LV_ATTRIBUTE_IMAGE_UPLOAD_FAN_F58335DF51F940DA8686FE1402DF28E2_PNG 21 | #define LV_ATTRIBUTE_IMAGE_UPLOAD_FAN_F58335DF51F940DA8686FE1402DF28E2_PNG 22 | #endif 23 | 24 | const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMAGE_UPLOAD_FAN_F58335DF51F940DA8686FE1402DF28E2_PNG uint8_t upload_fan_f58335df51f940da8686fe1402df28e2_png_map[] = { 25 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x65, 0xff, 0xff, 0xff, 0xc5, 0xff, 0xff, 0xff, 0xe7, 0xff, 0xff, 0xff, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 26 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x98, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 27 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x59, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 28 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xb6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 29 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xcf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x2d, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 30 | 0xff, 0xff, 0xff, 0x01, 0xff, 0xff, 0xff, 0x05, 0xff, 0xff, 0xff, 0x04, 0xff, 0xff, 0xff, 0x04, 0xff, 0xff, 0xff, 0x04, 0xff, 0xff, 0xff, 0xbd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xc9, 0xff, 0xff, 0xff, 0xd2, 0xff, 0xff, 0xff, 0xc8, 0xff, 0xff, 0xff, 0x89, 0xff, 0xff, 0xff, 0x17, 0x00, 0x00, 0x00, 0x00, 31 | 0xff, 0xff, 0xff, 0xb5, 0xff, 0xff, 0xff, 0xd5, 0xff, 0xff, 0xff, 0xd5, 0xff, 0xff, 0xff, 0xd5, 0xff, 0xff, 0xff, 0xd5, 0xff, 0xff, 0xff, 0xee, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xd7, 0xff, 0xff, 0xff, 0x20, 32 | 0xff, 0xff, 0xff, 0xdb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0x74, 0xff, 0xff, 0xff, 0x3c, 0xff, 0xff, 0xff, 0xe9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xb6, 33 | 0xff, 0xff, 0xff, 0x85, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0x42, 0xff, 0xff, 0xff, 0x05, 0xff, 0xff, 0xff, 0xda, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 34 | 0xff, 0xff, 0xff, 0x12, 0xff, 0xff, 0xff, 0xd0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf1, 0xff, 0xff, 0xff, 0xe1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 35 | 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x19, 0xff, 0xff, 0xff, 0xa4, 0xff, 0xff, 0xff, 0xf1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xfb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xff, 0xff, 0xff, 0x4f, 0xff, 0xff, 0xff, 0x36, 0xff, 0xff, 0xff, 0x36, 0xff, 0xff, 0xff, 0x36, 0xff, 0xff, 0xff, 0x31, 36 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x1d, 0xff, 0xff, 0xff, 0x35, 0xff, 0xff, 0xff, 0x26, 0xff, 0xff, 0xff, 0xcd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 37 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xc9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 38 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xca, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xd4, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 39 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xce, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 40 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xbc, 0xff, 0xff, 0xff, 0xed, 0xff, 0xff, 0xff, 0xd2, 0xff, 0xff, 0xff, 0x4b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 41 | }; 42 | 43 | const lv_image_dsc_t upload_fan_f58335df51f940da8686fe1402df28e2_png = { 44 | .header.cf = LV_COLOR_FORMAT_ARGB8888, 45 | .header.magic = LV_IMAGE_HEADER_MAGIC, 46 | .header.w = 16, 47 | .header.h = 16, 48 | .data_size = 256 * 4, 49 | .data = upload_fan_f58335df51f940da8686fe1402df28e2_png_map, 50 | }; 51 | -------------------------------------------------------------------------------- /weather_13/src/ui/Content/assets/images/upload_temp_a6542b73daec4eaaac6a3d9b6729be03_png.c: -------------------------------------------------------------------------------- 1 | #ifdef __has_include 2 | #if __has_include("lvgl.h") 3 | #ifndef LV_LVGL_H_INCLUDE_SIMPLE 4 | #define LV_LVGL_H_INCLUDE_SIMPLE 5 | #endif 6 | #endif 7 | #endif 8 | 9 | #if defined(LV_LVGL_H_INCLUDE_SIMPLE) 10 | #include "lvgl.h" 11 | #else 12 | #include "lvgl/lvgl.h" 13 | #endif 14 | 15 | 16 | #ifndef LV_ATTRIBUTE_MEM_ALIGN 17 | #define LV_ATTRIBUTE_MEM_ALIGN 18 | #endif 19 | 20 | #ifndef LV_ATTRIBUTE_IMAGE_UPLOAD_TEMP_A6542B73DAEC4EAAAC6A3D9B6729BE03_PNG 21 | #define LV_ATTRIBUTE_IMAGE_UPLOAD_TEMP_A6542B73DAEC4EAAAC6A3D9B6729BE03_PNG 22 | #endif 23 | 24 | const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMAGE_UPLOAD_TEMP_A6542B73DAEC4EAAAC6A3D9B6729BE03_PNG uint8_t upload_temp_a6542b73daec4eaaac6a3d9b6729be03_png_map[] = { 25 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x46, 0xff, 0xff, 0xff, 0x92, 0xff, 0xff, 0xff, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x1e, 0xff, 0xff, 0xff, 0xaa, 0xff, 0xff, 0xff, 0xad, 0xff, 0xff, 0xff, 0xad, 0xff, 0xff, 0xff, 0xad, 0xff, 0xff, 0xff, 0xae, 0xff, 0xff, 0xff, 0x53, 0x00, 0x00, 0x00, 0x00, 26 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x79, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcc, 0xff, 0xff, 0xff, 0x6d, 0xff, 0xff, 0xff, 0x43, 0xff, 0xff, 0xff, 0x23, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 27 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xa9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6b, 0xff, 0xff, 0xff, 0x1b, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, 0xf4, 0xff, 0xff, 0xff, 0x7e, 0xff, 0xff, 0xff, 0xcb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7a, 0x00, 0x00, 0x00, 0x00, 28 | 0xff, 0xff, 0xff, 0x3b, 0xff, 0xff, 0xff, 0x6c, 0xff, 0xff, 0xff, 0x9d, 0xff, 0xff, 0xff, 0xf1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdc, 0xff, 0xff, 0xff, 0xbd, 0xff, 0xff, 0xff, 0x4e, 0xff, 0xff, 0xff, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe7, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x91, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7a, 0x00, 0x00, 0x00, 0x00, 29 | 0xff, 0xff, 0xff, 0x8e, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x93, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x2c, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe8, 0xff, 0xff, 0xff, 0x01, 0xff, 0xff, 0xff, 0x98, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7a, 0x00, 0x00, 0x00, 0x00, 30 | 0xff, 0xff, 0xff, 0x0d, 0xff, 0xff, 0xff, 0xd2, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xd6, 0xff, 0xff, 0xff, 0x02, 0xff, 0xff, 0xff, 0x5d, 0xff, 0xff, 0xff, 0xc1, 0xff, 0xff, 0xff, 0x3b, 0xff, 0xff, 0xff, 0x21, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe8, 0xff, 0xff, 0xff, 0x01, 0xff, 0xff, 0xff, 0x98, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7a, 0x00, 0x00, 0x00, 0x00, 31 | 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x53, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xa1, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xe8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6b, 0xff, 0xff, 0xff, 0x1b, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe8, 0xff, 0xff, 0xff, 0x01, 0xff, 0xff, 0xff, 0x98, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7a, 0x00, 0x00, 0x00, 0x00, 32 | 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xad, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc3, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x95, 0xff, 0xff, 0xff, 0xf6, 0xff, 0xff, 0xff, 0x53, 0xff, 0xff, 0xff, 0x16, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe8, 0xff, 0xff, 0xff, 0x01, 0xff, 0xff, 0xff, 0x98, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x73, 0x00, 0x00, 0x00, 0x00, 33 | 0xff, 0xff, 0xff, 0x6a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, 0x5d, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x1f, 0xff, 0xff, 0xff, 0x01, 0xff, 0xff, 0xff, 0x65, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xea, 0xff, 0xff, 0xff, 0x01, 0xff, 0xff, 0xff, 0x9c, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xba, 0xff, 0xff, 0xff, 0x0a, 34 | 0xff, 0xff, 0xff, 0x75, 0xff, 0xff, 0xff, 0xb9, 0xff, 0xff, 0xff, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xa2, 0xff, 0xff, 0xff, 0x12, 0xff, 0xff, 0xff, 0x16, 0xff, 0xff, 0xff, 0xf1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xd8, 0xff, 0xff, 0xff, 0x01, 0xff, 0xff, 0xff, 0x84, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7a, 35 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x0c, 0xff, 0xff, 0xff, 0xbd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x17, 0xff, 0xff, 0xff, 0x63, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x09, 0xff, 0xff, 0xff, 0xb8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xd7, 36 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x84, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe7, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x85, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xca, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x6e, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 37 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x59, 0xff, 0xff, 0xff, 0xd0, 0xff, 0xff, 0xff, 0x35, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x6e, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xff, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xb5, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xd9, 38 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x0e, 0xff, 0xff, 0xff, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x22, 0xff, 0xff, 0xff, 0xf5, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe2, 0xff, 0xff, 0xff, 0x92, 0xff, 0xff, 0xff, 0xba, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7e, 39 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x6a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xbc, 0xff, 0xff, 0xff, 0x0e, 40 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x48, 0xff, 0xff, 0xff, 0xbd, 0xff, 0xff, 0xff, 0xe8, 0xff, 0xff, 0xff, 0xd8, 0xff, 0xff, 0xff, 0x7a, 0xff, 0xff, 0xff, 0x08, 0x00, 0x00, 0x00, 0x00, 41 | }; 42 | 43 | const lv_image_dsc_t upload_temp_a6542b73daec4eaaac6a3d9b6729be03_png = { 44 | .header.cf = LV_COLOR_FORMAT_ARGB8888, 45 | .header.magic = LV_IMAGE_HEADER_MAGIC, 46 | .header.w = 16, 47 | .header.h = 16, 48 | .data_size = 256 * 4, 49 | .data = upload_temp_a6542b73daec4eaaac6a3d9b6729be03_png_map, 50 | }; 51 | -------------------------------------------------------------------------------- /weather_7/src/e1002_display.cpp: -------------------------------------------------------------------------------- 1 | #include "e1002_display.h" 2 | 3 | #include 4 | #include 5 | 6 | /*Set to your screen resolution and rotation*/ 7 | #define TFT_HOR_RES 800 8 | #define TFT_VER_RES 480 9 | 10 | #define EPAPER_BLACK_UINT 0x000000 11 | #define EPAPER_WHITE_UINT 0xFFFFFF 12 | #define EPAPER_RED_UINT 0xFF0000 13 | #define EPAPER_GREEN_UINT 0x00FF00 14 | #define EPAPER_BLUE_UINT 0x0000FF 15 | #define EPAPER_YELLOW_UINT 0xFFFF00 16 | 17 | /*LVGL draw into this buffer, 1/10 screen size usually works well. The size is in bytes*/ 18 | #define DRAW_BUF_SIZE (TFT_HOR_RES * TFT_VER_RES / 10 * (LV_COLOR_DEPTH / 8)) 19 | static uint8_t draw_buf[DRAW_BUF_SIZE]; 20 | 21 | EPaper epaper; 22 | 23 | #if LV_USE_LOG != 0 24 | void arduino_print( lv_log_level_t level, const char * buf ) 25 | { 26 | LV_UNUSED(level); 27 | Serial.println(buf); 28 | Serial.flush(); 29 | } 30 | #endif 31 | 32 | // Convert RGB888 color to 6-color e-paper index 33 | static uint8_t rgb888_to_epaper_6color(uint8_t r, uint8_t g, uint8_t b) 34 | { 35 | // White: High brightness 36 | if (r > 200 && g > 200 && b > 200) { 37 | return TFT_WHITE; // 0x0 38 | } 39 | 40 | // Black: Low brightness 41 | if (r < 50 && g < 50 && b < 50) { 42 | return TFT_BLACK; // 0xF 43 | } 44 | 45 | // Red: Red component dominates 46 | if (r > g && r > b && r > 100) { 47 | return TFT_RED; // 0x6 48 | } 49 | 50 | // Green: Green component dominates 51 | if (g > r && g > b && g > 100) { 52 | return TFT_GREEN; // 0x2 53 | } 54 | 55 | // Blue: Blue component dominates 56 | if (b > r && b > g && b > 100) { 57 | return TFT_BLUE; // 0xD 58 | } 59 | 60 | // Yellow: High red+green, low blue 61 | if (r > 100 && g > 100 && b < 100) { 62 | return TFT_YELLOW; // 0xB 63 | } 64 | 65 | // Gray area determination 66 | uint8_t avg = (r + g + b) / 3; 67 | if (avg > 128) { 68 | return TFT_WHITE; // Light gray -> White 69 | } else { 70 | return TFT_BLACK; // Dark gray -> Black 71 | } 72 | } 73 | 74 | /* LVGL calls it when a rendered image needs to copied to the display*/ 75 | static void e1002_disp_flush( lv_display_t *disp, const lv_area_t *area, uint8_t * px_map) 76 | { 77 | e1002_driver_t *drv = (e1002_driver_t *)lv_display_get_driver_data(disp); 78 | EPaper *epd = drv->epd; 79 | int32_t w = lv_area_get_width(area); 80 | int32_t h = lv_area_get_height(area); 81 | 82 | for (int y = 0; y < h; y++) { 83 | for (int x = 0; x < w; x++) { 84 | lv_color_t lv_color = ((lv_color_t*)px_map)[y * w + x]; 85 | uint8_t r = lv_color.red; 86 | uint8_t g = lv_color.green; 87 | uint8_t b = lv_color.blue; 88 | uint32_t color_hex = (r << 16) | (g << 8) | b; 89 | 90 | uint8_t epaper_clr_index; 91 | 92 | // --- 新增的智能处理逻辑 --- 93 | // 检查这个像素是否已经是我们支持的6种基本色之一 94 | // 如果是,直接使用,不做任何转换。这可以完美保留您抖动过的背景。 95 | switch(color_hex) { 96 | case EPAPER_BLACK_UINT: 97 | epaper_clr_index = TFT_BLACK; 98 | break; 99 | case EPAPER_WHITE_UINT: 100 | epaper_clr_index = TFT_WHITE; 101 | break; 102 | case EPAPER_RED_UINT: 103 | epaper_clr_index = TFT_RED; 104 | break; 105 | case EPAPER_GREEN_UINT: 106 | epaper_clr_index = TFT_GREEN; 107 | break; 108 | case EPAPER_BLUE_UINT: 109 | epaper_clr_index = TFT_BLUE; 110 | break; 111 | case EPAPER_YELLOW_UINT: 112 | epaper_clr_index = TFT_YELLOW; 113 | break; 114 | default: 115 | // 如果不是6种基本色之一,我们假设它是文字的抗锯齿像素 116 | // 这时再调用颜色转换函数,将其强制转换为最接近的纯色 117 | epaper_clr_index = rgb888_to_epaper_6color(r, g, b); 118 | break; 119 | } 120 | // --- 逻辑结束 --- 121 | 122 | epd->drawPixel(area->x1 + x, area->y1 + y, epaper_clr_index); 123 | } 124 | } 125 | 126 | if (lv_display_flush_is_last(disp)) { 127 | drv->flush_scheduled = true; 128 | drv->flush_scheduled_time = millis(); 129 | } 130 | 131 | /*Call it to tell LVGL you are ready*/ 132 | lv_display_flush_ready(disp); 133 | } 134 | 135 | /*Read the touchpad*/ 136 | static void device_touchpad_read( lv_indev_t * indev, lv_indev_data_t * data ) 137 | { 138 | } 139 | 140 | /*use Arduinos millis() as tick source*/ 141 | static uint32_t get_arduino_tick(void) 142 | { 143 | return millis(); 144 | } 145 | 146 | static void resolution_changed_event_cb(lv_event_t * e) 147 | { 148 | lv_display_t *disp = (lv_display_t *)lv_event_get_target(e); 149 | e1002_driver_t *drv = (e1002_driver_t *)lv_display_get_driver_data(disp); 150 | EPaper *epd = drv->epd; 151 | int32_t hor_res = lv_display_get_horizontal_resolution(disp); 152 | int32_t ver_res = lv_display_get_vertical_resolution(disp); 153 | lv_display_rotation_t rot = lv_display_get_rotation(disp); 154 | 155 | /* handle rotation */ 156 | switch(rot) { 157 | case LV_DISPLAY_ROTATION_0: 158 | epd->setRotation(0); /* Portrait orientation */ 159 | break; 160 | case LV_DISPLAY_ROTATION_90: 161 | epd->setRotation(1); /* Landscape orientation */ 162 | break; 163 | case LV_DISPLAY_ROTATION_180: 164 | epd->setRotation(2); /* Portrait orientation, flipped */ 165 | break; 166 | case LV_DISPLAY_ROTATION_270: 167 | epd->setRotation(3); /* Landscape orientation, flipped */ 168 | break; 169 | } 170 | } 171 | 172 | void e1002_display_init(e1002_driver_t *drv) 173 | { 174 | drv->epd = &epaper; 175 | drv->flush_scheduled = false; 176 | drv->flush_scheduled_time = 0; 177 | 178 | drv->epd->begin(); 179 | 180 | lv_init(); 181 | 182 | /*Set a tick source so that LVGL will know how much time elapsed. */ 183 | lv_tick_set_cb(get_arduino_tick); 184 | 185 | /* register print function for debugging */ 186 | #if LV_USE_LOG != 0 187 | lv_log_register_print_cb( arduino_print ); 188 | #endif 189 | 190 | lv_display_t *disp; 191 | 192 | /*Else create a display yourself*/ 193 | disp = lv_display_create(TFT_HOR_RES, TFT_VER_RES); 194 | lv_display_set_driver_data(disp, (void *)drv); 195 | lv_display_set_flush_cb(disp, e1002_disp_flush); 196 | //lv_display_add_event_cb(disp, resolution_changed_event_cb, LV_EVENT_RESOLUTION_CHANGED, NULL); 197 | lv_display_set_buffers(disp, draw_buf, NULL, sizeof(draw_buf), LV_DISPLAY_RENDER_MODE_PARTIAL); 198 | 199 | /*Initialize the (dummy) input device driver*/ 200 | // lv_indev_t * indev = lv_indev_create(); 201 | // lv_indev_set_type(indev, LV_INDEV_TYPE_POINTER); /*Touchpad should have POINTER type*/ 202 | // lv_indev_set_read_cb(indev, device_touchpad_read); 203 | 204 | } 205 | 206 | void e1002_display_refresh(e1002_driver_t *drv) 207 | { 208 | drv->epd->update(); 209 | drv->flush_scheduled = false; 210 | } 211 | 212 | void e1002_display_schedule_refresh(e1002_driver_t *drv) 213 | { 214 | drv->flush_scheduled = true; 215 | drv->flush_scheduled_time = millis(); 216 | } 217 | 218 | bool e1002_display_should_refresh(e1002_driver_t *drv) 219 | { 220 | return drv->flush_scheduled && (millis() - drv->flush_scheduled_time > 100); 221 | } 222 | -------------------------------------------------------------------------------- /weather_13/src/e1002_display.cpp: -------------------------------------------------------------------------------- 1 | #include "e1002_display.h" 2 | 3 | #include 4 | #include 5 | 6 | /*Set to your screen resolution and rotation*/ 7 | #define TFT_HOR_RES 800 8 | #define TFT_VER_RES 480 9 | 10 | #define EPAPER_BLACK_UINT 0x000000 11 | #define EPAPER_WHITE_UINT 0xFFFFFF 12 | #define EPAPER_RED_UINT 0xFF0000 13 | #define EPAPER_GREEN_UINT 0x00FF00 14 | #define EPAPER_BLUE_UINT 0x0000FF 15 | #define EPAPER_YELLOW_UINT 0xFFFF00 16 | 17 | /*LVGL draw into this buffer, 1/10 screen size usually works well. The size is in bytes*/ 18 | #define DRAW_BUF_SIZE (TFT_HOR_RES * TFT_VER_RES / 10 * (LV_COLOR_DEPTH / 8)) 19 | static uint8_t draw_buf[DRAW_BUF_SIZE]; 20 | 21 | EPaper epaper; 22 | 23 | #if LV_USE_LOG != 0 24 | void arduino_print( lv_log_level_t level, const char * buf ) 25 | { 26 | LV_UNUSED(level); 27 | Serial.println(buf); 28 | Serial.flush(); 29 | } 30 | #endif 31 | 32 | // Convert RGB888 color to 6-color e-paper index 33 | static uint8_t rgb888_to_epaper_6color(uint8_t r, uint8_t g, uint8_t b) 34 | { 35 | // White: High brightness 36 | if (r > 200 && g > 200 && b > 200) { 37 | return TFT_WHITE; // 0x0 38 | } 39 | 40 | // Black: Low brightness 41 | if (r < 50 && g < 50 && b < 50) { 42 | return TFT_BLACK; // 0xF 43 | } 44 | 45 | // Red: Red component dominates 46 | if (r > g && r > b && r > 100) { 47 | return TFT_RED; // 0x6 48 | } 49 | 50 | // Green: Green component dominates 51 | if (g > r && g > b && g > 100) { 52 | return TFT_GREEN; // 0x2 53 | } 54 | 55 | // Blue: Blue component dominates 56 | if (b > r && b > g && b > 100) { 57 | return TFT_BLUE; // 0xD 58 | } 59 | 60 | // Yellow: High red+green, low blue 61 | if (r > 100 && g > 100 && b < 100) { 62 | return TFT_YELLOW; // 0xB 63 | } 64 | 65 | // Gray area determination 66 | uint8_t avg = (r + g + b) / 3; 67 | if (avg > 128) { 68 | return TFT_WHITE; // Light gray -> White 69 | } else { 70 | return TFT_BLACK; // Dark gray -> Black 71 | } 72 | } 73 | 74 | /* LVGL calls it when a rendered image needs to copied to the display*/ 75 | static void e1002_disp_flush( lv_display_t *disp, const lv_area_t *area, uint8_t * px_map) 76 | { 77 | e1002_driver_t *drv = (e1002_driver_t *)lv_display_get_driver_data(disp); 78 | EPaper *epd = drv->epd; 79 | int32_t w = lv_area_get_width(area); 80 | int32_t h = lv_area_get_height(area); 81 | 82 | for (int y = 0; y < h; y++) { 83 | for (int x = 0; x < w; x++) { 84 | lv_color_t lv_color = ((lv_color_t*)px_map)[y * w + x]; 85 | uint8_t r = lv_color.red; 86 | uint8_t g = lv_color.green; 87 | uint8_t b = lv_color.blue; 88 | uint32_t color_hex = (r << 16) | (g << 8) | b; 89 | 90 | uint8_t epaper_clr_index; 91 | 92 | // --- 新增的智能处理逻辑 --- 93 | // 检查这个像素是否已经是我们支持的6种基本色之一 94 | // 如果是,直接使用,不做任何转换。这可以完美保留您抖动过的背景。 95 | switch(color_hex) { 96 | case EPAPER_BLACK_UINT: 97 | epaper_clr_index = TFT_BLACK; 98 | break; 99 | case EPAPER_WHITE_UINT: 100 | epaper_clr_index = TFT_WHITE; 101 | break; 102 | case EPAPER_RED_UINT: 103 | epaper_clr_index = TFT_RED; 104 | break; 105 | case EPAPER_GREEN_UINT: 106 | epaper_clr_index = TFT_GREEN; 107 | break; 108 | case EPAPER_BLUE_UINT: 109 | epaper_clr_index = TFT_BLUE; 110 | break; 111 | case EPAPER_YELLOW_UINT: 112 | epaper_clr_index = TFT_YELLOW; 113 | break; 114 | default: 115 | // 如果不是6种基本色之一,我们假设它是文字的抗锯齿像素 116 | // 这时再调用颜色转换函数,将其强制转换为最接近的纯色 117 | epaper_clr_index = rgb888_to_epaper_6color(r, g, b); 118 | break; 119 | } 120 | // --- 逻辑结束 --- 121 | 122 | epd->drawPixel(area->x1 + x, area->y1 + y, epaper_clr_index); 123 | } 124 | } 125 | 126 | if (lv_display_flush_is_last(disp)) { 127 | drv->flush_scheduled = true; 128 | drv->flush_scheduled_time = millis(); 129 | } 130 | 131 | /*Call it to tell LVGL you are ready*/ 132 | lv_display_flush_ready(disp); 133 | } 134 | 135 | /*Read the touchpad*/ 136 | static void device_touchpad_read( lv_indev_t * indev, lv_indev_data_t * data ) 137 | { 138 | } 139 | 140 | /*use Arduinos millis() as tick source*/ 141 | static uint32_t get_arduino_tick(void) 142 | { 143 | return millis(); 144 | } 145 | 146 | static void resolution_changed_event_cb(lv_event_t * e) 147 | { 148 | lv_display_t *disp = (lv_display_t *)lv_event_get_target(e); 149 | e1002_driver_t *drv = (e1002_driver_t *)lv_display_get_driver_data(disp); 150 | EPaper *epd = drv->epd; 151 | int32_t hor_res = lv_display_get_horizontal_resolution(disp); 152 | int32_t ver_res = lv_display_get_vertical_resolution(disp); 153 | lv_display_rotation_t rot = lv_display_get_rotation(disp); 154 | 155 | /* handle rotation */ 156 | switch(rot) { 157 | case LV_DISPLAY_ROTATION_0: 158 | epd->setRotation(0); /* Portrait orientation */ 159 | break; 160 | case LV_DISPLAY_ROTATION_90: 161 | epd->setRotation(1); /* Landscape orientation */ 162 | break; 163 | case LV_DISPLAY_ROTATION_180: 164 | epd->setRotation(2); /* Portrait orientation, flipped */ 165 | break; 166 | case LV_DISPLAY_ROTATION_270: 167 | epd->setRotation(3); /* Landscape orientation, flipped */ 168 | break; 169 | } 170 | } 171 | 172 | void e1002_display_init(e1002_driver_t *drv) 173 | { 174 | drv->epd = &epaper; 175 | drv->flush_scheduled = false; 176 | drv->flush_scheduled_time = 0; 177 | 178 | drv->epd->begin(); 179 | 180 | lv_init(); 181 | 182 | /*Set a tick source so that LVGL will know how much time elapsed. */ 183 | lv_tick_set_cb(get_arduino_tick); 184 | 185 | /* register print function for debugging */ 186 | #if LV_USE_LOG != 0 187 | lv_log_register_print_cb( arduino_print ); 188 | #endif 189 | 190 | lv_display_t *disp; 191 | 192 | /*Else create a display yourself*/ 193 | disp = lv_display_create(TFT_HOR_RES, TFT_VER_RES); 194 | lv_display_set_driver_data(disp, (void *)drv); 195 | lv_display_set_flush_cb(disp, e1002_disp_flush); 196 | //lv_display_add_event_cb(disp, resolution_changed_event_cb, LV_EVENT_RESOLUTION_CHANGED, NULL); 197 | lv_display_set_buffers(disp, draw_buf, NULL, sizeof(draw_buf), LV_DISPLAY_RENDER_MODE_PARTIAL); 198 | 199 | /*Initialize the (dummy) input device driver*/ 200 | // lv_indev_t * indev = lv_indev_create(); 201 | // lv_indev_set_type(indev, LV_INDEV_TYPE_POINTER); /*Touchpad should have POINTER type*/ 202 | // lv_indev_set_read_cb(indev, device_touchpad_read); 203 | 204 | } 205 | 206 | void e1002_display_refresh(e1002_driver_t *drv) 207 | { 208 | drv->epd->update(); 209 | drv->flush_scheduled = false; 210 | } 211 | 212 | void e1002_display_schedule_refresh(e1002_driver_t *drv) 213 | { 214 | drv->flush_scheduled = true; 215 | drv->flush_scheduled_time = millis(); 216 | } 217 | 218 | bool e1002_display_should_refresh(e1002_driver_t *drv) 219 | { 220 | return drv->flush_scheduled && (millis() - drv->flush_scheduled_time > 100); 221 | } 222 | -------------------------------------------------------------------------------- /weather_7/src/weather_view.cpp: -------------------------------------------------------------------------------- 1 | #include "weather_view.h" 2 | 3 | #include "ui/GUI.h" 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | namespace 10 | { 11 | String formatTemperature(float value) 12 | { 13 | if (isnan(value)) 14 | return "--"; 15 | int rounded = static_cast(roundf(value)); 16 | return String(rounded) + "°"; 17 | } 18 | 19 | String formatHumidity(int value) 20 | { 21 | if (value < 0) 22 | return "--"; 23 | return String(value) + "%"; 24 | } 25 | 26 | String formatWind(float speedMs) 27 | { 28 | if (isnan(speedMs)) 29 | return "--"; 30 | float kmh = speedMs * 3.6f; 31 | int rounded = static_cast(roundf(kmh)); 32 | return String(rounded); 33 | } 34 | 35 | String formatHour(uint32_t ts, int tzOffset) 36 | { 37 | if (ts == 0) 38 | return "--"; 39 | time_t t = static_cast(ts) + tzOffset; 40 | struct tm tmv; 41 | gmtime_r(&t, &tmv); 42 | char buf[6]; 43 | snprintf(buf, sizeof(buf), "%02d:%02d", tmv.tm_hour, tmv.tm_min); 44 | return String(buf); 45 | } 46 | 47 | String formatWeekday(uint32_t ts, int tzOffset) 48 | { 49 | if (ts == 0) 50 | return "--"; 51 | static const char *kWeekdays[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; 52 | time_t t = static_cast(ts) + tzOffset; 53 | struct tm tmv; 54 | gmtime_r(&t, &tmv); 55 | int idx = tmv.tm_wday; 56 | if (idx < 0 || idx > 6) 57 | return "--"; 58 | return String(kWeekdays[idx]); 59 | } 60 | 61 | String formatDateLine(uint32_t ts, int tzOffset) 62 | { 63 | if (ts == 0) 64 | return "--"; 65 | time_t t = static_cast(ts) + tzOffset; 66 | struct tm tmv; 67 | gmtime_r(&t, &tmv); 68 | char buf[16]; 69 | // Match original layout: DD.MM.YYYY 70 | snprintf(buf, sizeof(buf), "%02d.%02d.%04d", tmv.tm_mday, tmv.tm_mon + 1, tmv.tm_year + 1900); 71 | return String(buf); 72 | } 73 | 74 | String formatDailyTemp(const DayItem &day) 75 | { 76 | if (isnan(day.min) && isnan(day.max) && isnan(day.day)) 77 | return "--"; 78 | 79 | if (!isnan(day.min) && !isnan(day.max)) 80 | { 81 | int minVal = static_cast(roundf(day.min)); 82 | int maxVal = static_cast(roundf(day.max)); 83 | // return String(maxVal) + "°/" + String(minVal) + "°"; 84 | return String(maxVal) + "°"; 85 | } 86 | 87 | if (!isnan(day.day)) 88 | { 89 | int dayVal = static_cast(roundf(day.day)); 90 | return String(dayVal) + "°"; 91 | } 92 | 93 | return "--"; 94 | } 95 | 96 | String fallbackText(const String &value, const char *fallback = "--") 97 | { 98 | return value.length() > 0 ? value : String(fallback); 99 | } 100 | 101 | int aqiPercentFromLevel(int aqi) 102 | { 103 | switch (aqi) 104 | { 105 | case 1: return 100; 106 | case 2: return 80; 107 | case 3: return 60; 108 | case 4: return 40; 109 | case 5: return 20; 110 | default: return 0; 111 | } 112 | } 113 | 114 | } // namespace 115 | 116 | void GUI_update_weather_screen(const WeatherData &data) 117 | { 118 | // Current status 119 | lv_label_set_text(GUI_Label__cont__current_status_text_lbl, 120 | fallbackText(data.main, "Loading...").c_str()); 121 | 122 | // Main temperature and location/date 123 | lv_label_set_text(GUI_Label__cont__main_display_temp_lbl, formatTemperature(data.temp).c_str()); 124 | 125 | String titleLine = formatDateLine(data.dt, data.timezoneOffset); 126 | titleLine += "\n"; 127 | titleLine += fallbackText(data.cityName, "Unknown"); 128 | lv_label_set_text(GUI_Label__cont__main_display_title_lbl, titleLine.c_str()); 129 | 130 | // Details section 131 | lv_label_set_text(GUI_Label__cont__details_feels_like_value_lbl, 132 | formatTemperature(data.feelsLike).c_str()); 133 | lv_label_set_text(GUI_Label__cont__details_humidity_value_lbl, 134 | formatHumidity(data.humidity).c_str()); 135 | lv_label_set_text(GUI_Label__cont__details_wind_speed_lbl, 136 | formatWind(data.windSpeed).c_str()); 137 | 138 | // Hourly forecast 139 | lv_obj_t *const hourlyTimeLabels[4] = { 140 | GUI_Label__cont__hourly_forecast_item_1_time_lbl, 141 | GUI_Label__cont__hourly_forecast_item_2_time_lbl, 142 | GUI_Label__cont__hourly_forecast_item_3_time_lbl, 143 | GUI_Label__cont__hourly_forecast_item_4_time_lbl, 144 | }; 145 | lv_obj_t *const hourlyTempLabels[4] = { 146 | GUI_Label__cont__hourly_forecast_item_1_temp_lbl, 147 | GUI_Label__cont__hourly_forecast_item_2_temp_lbl, 148 | GUI_Label__cont__hourly_forecast_item_3_temp_lbl, 149 | GUI_Label__cont__hourly_forecast_item_4_temp_lbl, 150 | }; 151 | 152 | for (int i = 0; i < 4; ++i) 153 | { 154 | const HourItem &item = data.hourly[i]; 155 | lv_label_set_text(hourlyTimeLabels[i], formatHour(item.ts, data.timezoneOffset).c_str()); 156 | lv_label_set_text(hourlyTempLabels[i], formatTemperature(item.temp).c_str()); 157 | } 158 | 159 | // Daily forecast 160 | lv_obj_t *const dailyDayLabels[3] = { 161 | GUI_Label__cont__daily_forecast_monday_item_day_lbl, 162 | GUI_Label__cont__daily_forecast_tuesday_item_day_lbl, 163 | GUI_Label__cont__daily_forecast_wednesday_item_day_lbl, 164 | }; 165 | lv_obj_t *const dailyTempLabels[3] = { 166 | GUI_Label__cont__daily_forecast_monday_item_temp_lbl, 167 | GUI_Label__cont__daily_forecast_tuesday_item_temp_lbl, 168 | GUI_Label__cont__daily_forecast_wednesday_item_temp_lbl, 169 | }; 170 | lv_obj_t *const dailyStatusLabels[3] = { 171 | GUI_Label__cont__daily_forecast_monday_item_status_lbl, 172 | GUI_Label__cont__daily_forecast_tuesday_item_status_lbl, 173 | GUI_Label__cont__daily_forecast_wednesday_item_status_lbl, 174 | }; 175 | 176 | for (int i = 0; i < 3; ++i) 177 | { 178 | const DayItem &item = data.daily[i]; 179 | lv_label_set_text(dailyDayLabels[i], formatWeekday(item.ts, data.timezoneOffset).c_str()); 180 | lv_label_set_text(dailyTempLabels[i], formatDailyTemp(item).c_str()); 181 | lv_label_set_text(dailyStatusLabels[i], fallbackText(item.main).c_str()); 182 | } 183 | 184 | // AQI & indoor stats (using outdoor data as placeholder if indoor not available) 185 | const int aqiPercent = aqiPercentFromLevel(data.aqi); 186 | if (aqiPercent > 0) 187 | { 188 | String aqiPercentText = String(aqiPercent) + "%"; 189 | lv_label_set_text(GUI_Label__cont__indoor_stats_air_quality_value_lbl, aqiPercentText.c_str()); 190 | } 191 | else 192 | { 193 | lv_label_set_text(GUI_Label__cont__indoor_stats_air_quality_value_lbl, "--"); 194 | } 195 | lv_slider_set_value(GUI_Slider__cont__indoor_stats_air_quality_slider, aqiPercent, LV_ANIM_OFF); 196 | 197 | lv_label_set_text(GUI_Label__cont__indoor_stats_air_quality_gap_value_lbl, 198 | fallbackText(data.aqiLabel, "--").c_str()); 199 | 200 | lv_label_set_text(GUI_Label__cont__indoor_stats_temp_value_lbl, 201 | isnan(data.indoorTemp) ? "--" : formatTemperature(data.indoorTemp).c_str()); 202 | lv_label_set_text(GUI_Label__cont__indoor_stats_humidity_value_lbl, 203 | data.indoorHumidity >= 0 ? formatHumidity(data.indoorHumidity).c_str() : "--"); 204 | 205 | // Alert message 206 | if (data.hasAlert) 207 | { 208 | lv_label_set_text(GUI_Label__cont__alert_message_lbl, 209 | fallbackText(data.alert.description, "Weather alert").c_str()); 210 | } 211 | else 212 | { 213 | lv_label_set_text(GUI_Label__cont__alert_message_lbl, "No severe alerts."); 214 | } 215 | } 216 | -------------------------------------------------------------------------------- /weather_13/src/weather_view.cpp: -------------------------------------------------------------------------------- 1 | #include "weather_view.h" 2 | 3 | #include "ui/GUI.h" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | namespace 11 | { 12 | String formatTemperature(float value) 13 | { 14 | if (isnan(value)) 15 | return "--"; 16 | int rounded = static_cast(roundf(value)); 17 | return String(rounded) + "°"; 18 | } 19 | 20 | String formatHumidity(int value) 21 | { 22 | if (value < 0) 23 | return "--"; 24 | return String(value) + "%"; 25 | } 26 | 27 | String formatWindKmH(float speedMs) 28 | { 29 | if (isnan(speedMs)) 30 | return "--"; 31 | float kmh = speedMs * 3.6f; 32 | int rounded = static_cast(roundf(kmh)); 33 | return String(rounded); 34 | } 35 | 36 | String formatHour(uint32_t ts, int tzOffset) 37 | { 38 | if (ts == 0) 39 | return "--"; 40 | time_t t = static_cast(ts) + tzOffset; 41 | struct tm tmv; 42 | gmtime_r(&t, &tmv); 43 | char buf[6]; 44 | snprintf(buf, sizeof(buf), "%02d:%02d", tmv.tm_hour, tmv.tm_min); 45 | return String(buf); 46 | } 47 | 48 | String formatWeekdayShort(uint32_t ts, int tzOffset) 49 | { 50 | if (ts == 0) 51 | return "--"; 52 | static const char *kWeekdays[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; 53 | time_t t = static_cast(ts) + tzOffset; 54 | struct tm tmv; 55 | gmtime_r(&t, &tmv); 56 | int idx = tmv.tm_wday; 57 | if (idx < 0 || idx > 6) 58 | return "--"; 59 | return String(kWeekdays[idx]); 60 | } 61 | 62 | String formatWeekdayLong(uint32_t ts, int tzOffset) 63 | { 64 | if (ts == 0) 65 | return "--"; 66 | static const char *kWeekdays[] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}; 67 | time_t t = static_cast(ts) + tzOffset; 68 | struct tm tmv; 69 | gmtime_r(&t, &tmv); 70 | int idx = tmv.tm_wday; 71 | if (idx < 0 || idx > 6) 72 | return "--"; 73 | return String(kWeekdays[idx]); 74 | } 75 | 76 | String formatDateLine(uint32_t ts, int tzOffset) 77 | { 78 | if (ts == 0) 79 | return "--"; 80 | time_t t = static_cast(ts) + tzOffset; 81 | struct tm tmv; 82 | gmtime_r(&t, &tmv); 83 | char buf[16]; 84 | // Match original layout: DD.MM.YYYY 85 | snprintf(buf, sizeof(buf), "%02d.%02d.%04d", tmv.tm_mday, tmv.tm_mon + 1, tmv.tm_year + 1900); 86 | return String(buf); 87 | } 88 | 89 | String formatDailyTemp(const DayItem &day) 90 | { 91 | if (isnan(day.min) && isnan(day.max) && isnan(day.day)) 92 | return "--"; 93 | 94 | float base = !isnan(day.day) ? day.day : day.max; 95 | if (isnan(base)) 96 | base = day.min; 97 | if (isnan(base)) 98 | return "--"; 99 | return formatTemperature(base); 100 | } 101 | 102 | String formatTempRange(float minVal, float maxVal) 103 | { 104 | if (isnan(minVal) || isnan(maxVal)) 105 | return "--"; 106 | if (maxVal < minVal) 107 | std::swap(minVal, maxVal); 108 | int minRounded = static_cast(roundf(minVal)); 109 | int maxRounded = static_cast(roundf(maxVal)); 110 | return String(minRounded) + "° - " + String(maxRounded) + "°"; 111 | } 112 | 113 | String fallbackText(const String &value, const char *fallback = "--") 114 | { 115 | return value.length() > 0 ? value : String(fallback); 116 | } 117 | 118 | int aqiPercentFromLevel(int aqi) 119 | { 120 | switch (aqi) 121 | { 122 | case 1: return 100; 123 | case 2: return 80; 124 | case 3: return 60; 125 | case 4: return 40; 126 | case 5: return 20; 127 | default: return 0; 128 | } 129 | } 130 | 131 | int percentFromRange(float value, float minValue, float maxValue) 132 | { 133 | if (isnan(value) || maxValue <= minValue) 134 | return 0; 135 | float norm = (value - minValue) / (maxValue - minValue); 136 | int percent = static_cast(roundf(norm * 100.0f)); 137 | if (percent < 0) 138 | percent = 0; 139 | if (percent > 100) 140 | percent = 100; 141 | return percent; 142 | } 143 | 144 | int clampPercent(int value) 145 | { 146 | if (value < 0) 147 | return 0; 148 | if (value > 100) 149 | return 100; 150 | return value; 151 | } 152 | 153 | } // namespace 154 | 155 | void GUI_update_weather_screen(const WeatherData &data) 156 | { 157 | // Current status and headline 158 | lv_label_set_text(GUI_Label__main_screen__forecast_current_status_lbl, 159 | fallbackText(data.main, "Loading...").c_str()); 160 | 161 | lv_label_set_text(GUI_Label__main_screen__current_day_city_lbl, 162 | fallbackText(data.cityName, "--").c_str()); 163 | lv_label_set_text(GUI_Label__main_screen__current_day_date_lbl, 164 | formatDateLine(data.dt, data.timezoneOffset).c_str()); 165 | lv_label_set_text(GUI_Label__main_screen__current_day_weekday_lbl, 166 | formatWeekdayLong(data.dt, data.timezoneOffset).c_str()); 167 | lv_label_set_text(GUI_Label__main_screen__current_day_temp_lbl, 168 | formatTemperature(data.temp).c_str()); 169 | lv_label_set_text(GUI_Label__main_screen__current_day_status_lbl, 170 | fallbackText(data.main).c_str()); 171 | 172 | // Hourly forecast 173 | lv_obj_t *const hourlyTimeLabels[4] = { 174 | GUI_Label__main_screen__forecast_hourly_item_1_time_lbl, 175 | GUI_Label__main_screen__forecast_hourly_item_2_time_lbl, 176 | GUI_Label__main_screen__forecast_hourly_item_3_time_lbl, 177 | GUI_Label__main_screen__forecast_hourly_item_4_time_lbl, 178 | }; 179 | lv_obj_t *const hourlyTempLabels[4] = { 180 | GUI_Label__main_screen__forecast_hourly_item_1_temp_lbl, 181 | GUI_Label__main_screen__forecast_hourly_item_2_temp_lbl, 182 | GUI_Label__main_screen__forecast_hourly_item_3_temp_lbl, 183 | GUI_Label__main_screen__forecast_hourly_item_4_temp_lbl, 184 | }; 185 | 186 | for (int i = 0; i < 4; ++i) 187 | { 188 | const HourItem &item = data.hourly[i]; 189 | lv_label_set_text(hourlyTimeLabels[i], formatHour(item.ts, data.timezoneOffset).c_str()); 190 | lv_label_set_text(hourlyTempLabels[i], formatTemperature(item.temp).c_str()); 191 | } 192 | 193 | // Daily forecast 194 | lv_obj_t *const dailyDayLabels[3] = { 195 | GUI_Label__main_screen__forecast_daily_item_1_day_lbl, 196 | GUI_Label__main_screen__forecast_daily_item_2_day_lbl, 197 | GUI_Label__main_screen__forecast_daily_item_3_day_lbl, 198 | }; 199 | lv_obj_t *const dailyTempLabels[3] = { 200 | GUI_Label__main_screen__forecast_daily_item_1_temp_lbl, 201 | GUI_Label__main_screen__forecast_daily_item_2_temp_lbl, 202 | GUI_Label__main_screen__forecast_daily_item_3_temp_lbl, 203 | }; 204 | 205 | for (int i = 0; i < 3; ++i) 206 | { 207 | const DayItem &item = data.daily[i]; 208 | lv_label_set_text(dailyDayLabels[i], formatWeekdayShort(item.ts, data.timezoneOffset).c_str()); 209 | lv_label_set_text(dailyTempLabels[i], formatDailyTemp(item).c_str()); 210 | } 211 | 212 | // Outdoor summary 213 | lv_label_set_text(GUI_Label__main_screen__details_outdoor_humidity_value_lbl, 214 | formatHumidity(data.humidity).c_str()); 215 | // String humidityRange = "--"; 216 | // if (!isnan(data.daily[0].min) && !isnan(data.daily[0].max)) 217 | // humidityRange = formatTempRange(data.daily[0].min, data.daily[0].max); 218 | // lv_label_set_text(GUI_Label__main_screen__details_outdoor_humidity_range_lbl, humidityRange.c_str()); 219 | 220 | lv_label_set_text(GUI_Label__main_screen__details_outdoor_wind_value_lbl, 221 | formatWindKmH(data.windSpeed).c_str()); 222 | lv_label_set_text(GUI_Label__main_screen__details_outdoor_wind_unit_lbl, "km/h"); 223 | 224 | // Indoor stats 225 | lv_label_set_text(GUI_Label__main_screen__details_indoor_temp_value_lbl, 226 | formatTemperature(data.indoorTemp).c_str()); 227 | 228 | const int aqiPercent = aqiPercentFromLevel(data.aqi); 229 | const int indoorTempPercent = percentFromRange(data.indoorTemp, 0.0f, 35.0f); 230 | const int indoorHumidityPercent = data.indoorHumidity >= 0 ? clampPercent(data.indoorHumidity) : 0; 231 | 232 | lv_bar_set_value(GUI_Bar__main_screen__details_indoor_temp_indicator_bar, indoorTempPercent, LV_ANIM_OFF); 233 | lv_bar_set_value(GUI_Bar__main_screen__details_indoor_humidity_indicator_bar, indoorHumidityPercent, LV_ANIM_OFF); 234 | lv_bar_set_value(GUI_Bar__main_screen__details_indoor_fan_indicator_bar, aqiPercent, LV_ANIM_OFF); 235 | 236 | lv_label_set_text(GUI_Label__main_screen__details_indoor_air_quality_title_lbl, "Air Quality"); 237 | String aqiText = fallbackText(data.aqiLabel, ""); 238 | if (aqiPercent > 0) 239 | { 240 | if (aqiText.length() > 0) 241 | aqiText += " · "; 242 | aqiText += String(aqiPercent) + "%"; 243 | } 244 | if (aqiText.length() == 0) 245 | aqiText = "--"; 246 | lv_label_set_text(GUI_Label__main_screen__details_indoor_air_quality_value_lbl, aqiText.c_str()); 247 | 248 | // Alert message 249 | if (data.hasAlert) 250 | { 251 | lv_label_set_text(GUI_Label__main_screen__alert_title_lbl, 252 | fallbackText(data.alert.event, "Weather alert").c_str()); 253 | lv_label_set_text(GUI_Label__main_screen__alert_details_lbl, 254 | fallbackText(data.alert.description, "Details unavailable").c_str()); 255 | } 256 | else 257 | { 258 | lv_label_set_text(GUI_Label__main_screen__alert_title_lbl, "No alerts"); 259 | lv_label_set_text(GUI_Label__main_screen__alert_details_lbl, "No severe alerts."); 260 | } 261 | } 262 | -------------------------------------------------------------------------------- /weather_13/src/ui/ui_helpers.c: -------------------------------------------------------------------------------- 1 | // This file was generated by SquareLine Studio 2 | // SquareLine Studio version: SquareLine Studio 1.5.1 3 | // LVGL version: 9.2.2 4 | // Project name: SquareLine_Project 5 | 6 | #include "ui_helpers.h" 7 | 8 | void _ui_bar_set_property(lv_obj_t * target, int id, int val) 9 | { 10 | if(id == _UI_BAR_PROPERTY_VALUE_WITH_ANIM) lv_bar_set_value(target, val, LV_ANIM_ON); 11 | if(id == _UI_BAR_PROPERTY_VALUE) lv_bar_set_value(target, val, LV_ANIM_OFF); 12 | } 13 | 14 | void _ui_basic_set_property(lv_obj_t * target, int id, int val) 15 | { 16 | if(id == _UI_BASIC_PROPERTY_POSITION_X) lv_obj_set_x(target, val); 17 | if(id == _UI_BASIC_PROPERTY_POSITION_Y) lv_obj_set_y(target, val); 18 | if(id == _UI_BASIC_PROPERTY_WIDTH) lv_obj_set_width(target, val); 19 | if(id == _UI_BASIC_PROPERTY_HEIGHT) lv_obj_set_height(target, val); 20 | } 21 | 22 | 23 | void _ui_dropdown_set_property(lv_obj_t * target, int id, int val) 24 | { 25 | if(id == _UI_DROPDOWN_PROPERTY_SELECTED) lv_dropdown_set_selected(target, val); 26 | } 27 | 28 | void _ui_image_set_property(lv_obj_t * target, int id, uint8_t * val) 29 | { 30 | if(id == _UI_IMAGE_PROPERTY_IMAGE) lv_image_set_src(target, val); 31 | } 32 | 33 | void _ui_label_set_property(lv_obj_t * target, int id, const char * val) 34 | { 35 | if(id == _UI_LABEL_PROPERTY_TEXT) lv_label_set_text(target, val); 36 | } 37 | 38 | 39 | void _ui_roller_set_property(lv_obj_t * target, int id, int val) 40 | { 41 | if(id == _UI_ROLLER_PROPERTY_SELECTED_WITH_ANIM) lv_roller_set_selected(target, val, LV_ANIM_ON); 42 | if(id == _UI_ROLLER_PROPERTY_SELECTED) lv_roller_set_selected(target, val, LV_ANIM_OFF); 43 | } 44 | 45 | void _ui_slider_set_property(lv_obj_t * target, int id, int val) 46 | { 47 | if(id == _UI_SLIDER_PROPERTY_VALUE_WITH_ANIM) lv_slider_set_value(target, val, LV_ANIM_ON); 48 | if(id == _UI_SLIDER_PROPERTY_VALUE) lv_slider_set_value(target, val, LV_ANIM_OFF); 49 | } 50 | 51 | 52 | void _ui_screen_change(lv_obj_t ** target, lv_screen_load_anim_t fademode, int spd, int delay, 53 | void (*target_init)(void)) 54 | { 55 | if(*target == NULL) 56 | target_init(); 57 | lv_screen_load_anim(*target, fademode, spd, delay, false); 58 | } 59 | 60 | void _ui_screen_delete(lv_obj_t ** target) 61 | { 62 | if(*target == NULL) { 63 | lv_obj_delete(*target); 64 | target = NULL; 65 | } 66 | } 67 | 68 | void _ui_arc_increment(lv_obj_t * target, int val) 69 | { 70 | int old = lv_arc_get_value(target); 71 | lv_arc_set_value(target, old + val); 72 | lv_obj_send_event(target, LV_EVENT_VALUE_CHANGED, 0); 73 | } 74 | 75 | void _ui_bar_increment(lv_obj_t * target, int val, int anm) 76 | { 77 | int old = lv_bar_get_value(target); 78 | lv_bar_set_value(target, old + val, anm); 79 | } 80 | 81 | void _ui_slider_increment(lv_obj_t * target, int val, int anm) 82 | { 83 | int old = lv_slider_get_value(target); 84 | lv_slider_set_value(target, old + val, anm); 85 | lv_obj_send_event(target, LV_EVENT_VALUE_CHANGED, 0); 86 | } 87 | 88 | void _ui_keyboard_set_target(lv_obj_t * keyboard, lv_obj_t * textarea) 89 | { 90 | lv_keyboard_set_textarea(keyboard, textarea); 91 | } 92 | 93 | void _ui_flag_modify(lv_obj_t * target, int32_t flag, int value) 94 | { 95 | if(value == _UI_MODIFY_FLAG_TOGGLE) { 96 | if(lv_obj_has_flag(target, flag)) lv_obj_remove_flag(target, flag); 97 | else lv_obj_add_flag(target, flag); 98 | } 99 | else if(value == _UI_MODIFY_FLAG_ADD) lv_obj_add_flag(target, flag); 100 | else lv_obj_remove_flag(target, flag); 101 | } 102 | void _ui_state_modify(lv_obj_t * target, int32_t state, int value) 103 | { 104 | if(value == _UI_MODIFY_STATE_TOGGLE) { 105 | if(lv_obj_has_state(target, state)) lv_obj_remove_state(target, state); 106 | else lv_obj_add_state(target, state); 107 | } 108 | else if(value == _UI_MODIFY_STATE_ADD) lv_obj_add_state(target, state); 109 | else lv_obj_remove_state(target, state); 110 | } 111 | 112 | 113 | void _ui_textarea_move_cursor(lv_obj_t * target, int val) 114 | 115 | { 116 | 117 | if(val == UI_MOVE_CURSOR_UP) lv_textarea_cursor_up(target); 118 | if(val == UI_MOVE_CURSOR_RIGHT) lv_textarea_cursor_right(target); 119 | if(val == UI_MOVE_CURSOR_DOWN) lv_textarea_cursor_down(target); 120 | if(val == UI_MOVE_CURSOR_LEFT) lv_textarea_cursor_left(target); 121 | lv_obj_add_state(target, LV_STATE_FOCUSED); 122 | } 123 | 124 | void scr_unloaded_delete_cb(lv_event_t * e) 125 | { 126 | 127 | lv_obj_t ** var = lv_event_get_user_data(e); 128 | lv_obj_delete(*var); 129 | (*var) = NULL; 130 | 131 | } 132 | 133 | void _ui_opacity_set(lv_obj_t * target, int val) 134 | { 135 | lv_obj_set_style_opa(target, val, 0); 136 | } 137 | 138 | void _ui_anim_callback_free_user_data(lv_anim_t * a) 139 | { 140 | lv_free(a->user_data); 141 | a->user_data = NULL; 142 | } 143 | 144 | void _ui_anim_callback_set_x(lv_anim_t * a, int32_t v) 145 | 146 | { 147 | 148 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 149 | lv_obj_set_x(usr->target, v); 150 | 151 | } 152 | 153 | 154 | void _ui_anim_callback_set_y(lv_anim_t * a, int32_t v) 155 | 156 | { 157 | 158 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 159 | lv_obj_set_y(usr->target, v); 160 | 161 | } 162 | 163 | 164 | void _ui_anim_callback_set_width(lv_anim_t * a, int32_t v) 165 | 166 | { 167 | 168 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 169 | lv_obj_set_width(usr->target, v); 170 | 171 | } 172 | 173 | 174 | void _ui_anim_callback_set_height(lv_anim_t * a, int32_t v) 175 | 176 | { 177 | 178 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 179 | lv_obj_set_height(usr->target, v); 180 | 181 | } 182 | 183 | 184 | void _ui_anim_callback_set_opacity(lv_anim_t * a, int32_t v) 185 | 186 | { 187 | 188 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 189 | lv_obj_set_style_opa(usr->target, v, 0); 190 | 191 | } 192 | 193 | 194 | void _ui_anim_callback_set_image_zoom(lv_anim_t * a, int32_t v) 195 | 196 | { 197 | 198 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 199 | lv_image_set_scale(usr->target, v); 200 | 201 | } 202 | 203 | 204 | void _ui_anim_callback_set_image_angle(lv_anim_t * a, int32_t v) 205 | 206 | { 207 | 208 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 209 | lv_image_set_rotation(usr->target, v); 210 | 211 | } 212 | 213 | 214 | void _ui_anim_callback_set_image_frame(lv_anim_t * a, int32_t v) 215 | 216 | { 217 | 218 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 219 | usr->val = v; 220 | 221 | if(v < 0) v = 0; 222 | if(v >= usr->imgset_size) v = usr->imgset_size - 1; 223 | lv_image_set_src(usr->target, usr->imgset[v]); 224 | } 225 | 226 | int32_t _ui_anim_callback_get_x(lv_anim_t * a) 227 | 228 | { 229 | 230 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 231 | return lv_obj_get_x_aligned(usr->target); 232 | 233 | } 234 | 235 | 236 | int32_t _ui_anim_callback_get_y(lv_anim_t * a) 237 | 238 | { 239 | 240 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 241 | return lv_obj_get_y_aligned(usr->target); 242 | 243 | } 244 | 245 | 246 | int32_t _ui_anim_callback_get_width(lv_anim_t * a) 247 | 248 | { 249 | 250 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 251 | return lv_obj_get_width(usr->target); 252 | 253 | } 254 | 255 | 256 | int32_t _ui_anim_callback_get_height(lv_anim_t * a) 257 | 258 | { 259 | 260 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 261 | return lv_obj_get_height(usr->target); 262 | 263 | } 264 | 265 | 266 | int32_t _ui_anim_callback_get_opacity(lv_anim_t * a) 267 | 268 | { 269 | 270 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 271 | return lv_obj_get_style_opa(usr->target, 0); 272 | 273 | } 274 | 275 | int32_t _ui_anim_callback_get_image_zoom(lv_anim_t * a) 276 | 277 | { 278 | 279 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 280 | return lv_image_get_scale(usr->target); 281 | 282 | } 283 | 284 | int32_t _ui_anim_callback_get_image_angle(lv_anim_t * a) 285 | 286 | { 287 | 288 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 289 | return lv_image_get_rotation(usr->target); 290 | 291 | } 292 | 293 | int32_t _ui_anim_callback_get_image_frame(lv_anim_t * a) 294 | 295 | { 296 | 297 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 298 | return usr->val; 299 | 300 | } 301 | 302 | void _ui_arc_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * prefix, const char * postfix) 303 | { 304 | char buf[_UI_TEMPORARY_STRING_BUFFER_SIZE]; 305 | 306 | lv_snprintf(buf, sizeof(buf), "%s%d%s", prefix, (int)lv_arc_get_value(src), postfix); 307 | 308 | lv_label_set_text(trg, buf); 309 | } 310 | 311 | void _ui_slider_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * prefix, const char * postfix) 312 | { 313 | char buf[_UI_TEMPORARY_STRING_BUFFER_SIZE]; 314 | 315 | lv_snprintf(buf, sizeof(buf), "%s%d%s", prefix, (int)lv_slider_get_value(src), postfix); 316 | 317 | lv_label_set_text(trg, buf); 318 | } 319 | void _ui_checked_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * txt_on, const char * txt_off) 320 | { 321 | if(lv_obj_has_state(src, LV_STATE_CHECKED)) lv_label_set_text(trg, txt_on); 322 | else lv_label_set_text(trg, txt_off); 323 | } 324 | 325 | 326 | void _ui_spinbox_step(lv_obj_t * target, int val) 327 | 328 | { 329 | 330 | if(val > 0) lv_spinbox_increment(target); 331 | 332 | else lv_spinbox_decrement(target); 333 | 334 | 335 | lv_obj_send_event(target, LV_EVENT_VALUE_CHANGED, 0); 336 | } 337 | 338 | void _ui_switch_theme(int val) 339 | 340 | { 341 | 342 | #ifdef UI_THEME_ACTIVE 343 | ui_theme_set(val); 344 | #endif 345 | } 346 | 347 | 348 | -------------------------------------------------------------------------------- /weather_7/src/ui/ui_helpers.c: -------------------------------------------------------------------------------- 1 | // This file was generated by SquareLine Studio 2 | // SquareLine Studio version: SquareLine Studio 1.5.1 3 | // LVGL version: 9.2.2 4 | // Project name: SquareLine_Project 5 | 6 | #include "ui_helpers.h" 7 | 8 | void _ui_bar_set_property(lv_obj_t * target, int id, int val) 9 | { 10 | if(id == _UI_BAR_PROPERTY_VALUE_WITH_ANIM) lv_bar_set_value(target, val, LV_ANIM_ON); 11 | if(id == _UI_BAR_PROPERTY_VALUE) lv_bar_set_value(target, val, LV_ANIM_OFF); 12 | } 13 | 14 | void _ui_basic_set_property(lv_obj_t * target, int id, int val) 15 | { 16 | if(id == _UI_BASIC_PROPERTY_POSITION_X) lv_obj_set_x(target, val); 17 | if(id == _UI_BASIC_PROPERTY_POSITION_Y) lv_obj_set_y(target, val); 18 | if(id == _UI_BASIC_PROPERTY_WIDTH) lv_obj_set_width(target, val); 19 | if(id == _UI_BASIC_PROPERTY_HEIGHT) lv_obj_set_height(target, val); 20 | } 21 | 22 | 23 | void _ui_dropdown_set_property(lv_obj_t * target, int id, int val) 24 | { 25 | if(id == _UI_DROPDOWN_PROPERTY_SELECTED) lv_dropdown_set_selected(target, val); 26 | } 27 | 28 | void _ui_image_set_property(lv_obj_t * target, int id, uint8_t * val) 29 | { 30 | if(id == _UI_IMAGE_PROPERTY_IMAGE) lv_image_set_src(target, val); 31 | } 32 | 33 | void _ui_label_set_property(lv_obj_t * target, int id, const char * val) 34 | { 35 | if(id == _UI_LABEL_PROPERTY_TEXT) lv_label_set_text(target, val); 36 | } 37 | 38 | 39 | void _ui_roller_set_property(lv_obj_t * target, int id, int val) 40 | { 41 | if(id == _UI_ROLLER_PROPERTY_SELECTED_WITH_ANIM) lv_roller_set_selected(target, val, LV_ANIM_ON); 42 | if(id == _UI_ROLLER_PROPERTY_SELECTED) lv_roller_set_selected(target, val, LV_ANIM_OFF); 43 | } 44 | 45 | void _ui_slider_set_property(lv_obj_t * target, int id, int val) 46 | { 47 | if(id == _UI_SLIDER_PROPERTY_VALUE_WITH_ANIM) lv_slider_set_value(target, val, LV_ANIM_ON); 48 | if(id == _UI_SLIDER_PROPERTY_VALUE) lv_slider_set_value(target, val, LV_ANIM_OFF); 49 | } 50 | 51 | 52 | void _ui_screen_change(lv_obj_t ** target, lv_screen_load_anim_t fademode, int spd, int delay, 53 | void (*target_init)(void)) 54 | { 55 | if(*target == NULL) 56 | target_init(); 57 | lv_screen_load_anim(*target, fademode, spd, delay, false); 58 | } 59 | 60 | void _ui_screen_delete(lv_obj_t ** target) 61 | { 62 | if(*target == NULL) { 63 | lv_obj_delete(*target); 64 | target = NULL; 65 | } 66 | } 67 | 68 | void _ui_arc_increment(lv_obj_t * target, int val) 69 | { 70 | int old = lv_arc_get_value(target); 71 | lv_arc_set_value(target, old + val); 72 | lv_obj_send_event(target, LV_EVENT_VALUE_CHANGED, 0); 73 | } 74 | 75 | void _ui_bar_increment(lv_obj_t * target, int val, int anm) 76 | { 77 | int old = lv_bar_get_value(target); 78 | lv_bar_set_value(target, old + val, anm); 79 | } 80 | 81 | void _ui_slider_increment(lv_obj_t * target, int val, int anm) 82 | { 83 | int old = lv_slider_get_value(target); 84 | lv_slider_set_value(target, old + val, anm); 85 | lv_obj_send_event(target, LV_EVENT_VALUE_CHANGED, 0); 86 | } 87 | 88 | void _ui_keyboard_set_target(lv_obj_t * keyboard, lv_obj_t * textarea) 89 | { 90 | lv_keyboard_set_textarea(keyboard, textarea); 91 | } 92 | 93 | void _ui_flag_modify(lv_obj_t * target, int32_t flag, int value) 94 | { 95 | if(value == _UI_MODIFY_FLAG_TOGGLE) { 96 | if(lv_obj_has_flag(target, flag)) lv_obj_remove_flag(target, flag); 97 | else lv_obj_add_flag(target, flag); 98 | } 99 | else if(value == _UI_MODIFY_FLAG_ADD) lv_obj_add_flag(target, flag); 100 | else lv_obj_remove_flag(target, flag); 101 | } 102 | void _ui_state_modify(lv_obj_t * target, int32_t state, int value) 103 | { 104 | if(value == _UI_MODIFY_STATE_TOGGLE) { 105 | if(lv_obj_has_state(target, state)) lv_obj_remove_state(target, state); 106 | else lv_obj_add_state(target, state); 107 | } 108 | else if(value == _UI_MODIFY_STATE_ADD) lv_obj_add_state(target, state); 109 | else lv_obj_remove_state(target, state); 110 | } 111 | 112 | 113 | void _ui_textarea_move_cursor(lv_obj_t * target, int val) 114 | 115 | { 116 | 117 | if(val == UI_MOVE_CURSOR_UP) lv_textarea_cursor_up(target); 118 | if(val == UI_MOVE_CURSOR_RIGHT) lv_textarea_cursor_right(target); 119 | if(val == UI_MOVE_CURSOR_DOWN) lv_textarea_cursor_down(target); 120 | if(val == UI_MOVE_CURSOR_LEFT) lv_textarea_cursor_left(target); 121 | lv_obj_add_state(target, LV_STATE_FOCUSED); 122 | } 123 | 124 | void scr_unloaded_delete_cb(lv_event_t * e) 125 | { 126 | 127 | lv_obj_t ** var = lv_event_get_user_data(e); 128 | lv_obj_delete(*var); 129 | (*var) = NULL; 130 | 131 | } 132 | 133 | void _ui_opacity_set(lv_obj_t * target, int val) 134 | { 135 | lv_obj_set_style_opa(target, val, 0); 136 | } 137 | 138 | void _ui_anim_callback_free_user_data(lv_anim_t * a) 139 | { 140 | lv_free(a->user_data); 141 | a->user_data = NULL; 142 | } 143 | 144 | void _ui_anim_callback_set_x(lv_anim_t * a, int32_t v) 145 | 146 | { 147 | 148 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 149 | lv_obj_set_x(usr->target, v); 150 | 151 | } 152 | 153 | 154 | void _ui_anim_callback_set_y(lv_anim_t * a, int32_t v) 155 | 156 | { 157 | 158 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 159 | lv_obj_set_y(usr->target, v); 160 | 161 | } 162 | 163 | 164 | void _ui_anim_callback_set_width(lv_anim_t * a, int32_t v) 165 | 166 | { 167 | 168 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 169 | lv_obj_set_width(usr->target, v); 170 | 171 | } 172 | 173 | 174 | void _ui_anim_callback_set_height(lv_anim_t * a, int32_t v) 175 | 176 | { 177 | 178 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 179 | lv_obj_set_height(usr->target, v); 180 | 181 | } 182 | 183 | 184 | void _ui_anim_callback_set_opacity(lv_anim_t * a, int32_t v) 185 | 186 | { 187 | 188 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 189 | lv_obj_set_style_opa(usr->target, v, 0); 190 | 191 | } 192 | 193 | 194 | void _ui_anim_callback_set_image_zoom(lv_anim_t * a, int32_t v) 195 | 196 | { 197 | 198 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 199 | lv_image_set_scale(usr->target, v); 200 | 201 | } 202 | 203 | 204 | void _ui_anim_callback_set_image_angle(lv_anim_t * a, int32_t v) 205 | 206 | { 207 | 208 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 209 | lv_image_set_rotation(usr->target, v); 210 | 211 | } 212 | 213 | 214 | void _ui_anim_callback_set_image_frame(lv_anim_t * a, int32_t v) 215 | 216 | { 217 | 218 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 219 | usr->val = v; 220 | 221 | if(v < 0) v = 0; 222 | if(v >= usr->imgset_size) v = usr->imgset_size - 1; 223 | lv_image_set_src(usr->target, usr->imgset[v]); 224 | } 225 | 226 | int32_t _ui_anim_callback_get_x(lv_anim_t * a) 227 | 228 | { 229 | 230 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 231 | return lv_obj_get_x_aligned(usr->target); 232 | 233 | } 234 | 235 | 236 | int32_t _ui_anim_callback_get_y(lv_anim_t * a) 237 | 238 | { 239 | 240 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 241 | return lv_obj_get_y_aligned(usr->target); 242 | 243 | } 244 | 245 | 246 | int32_t _ui_anim_callback_get_width(lv_anim_t * a) 247 | 248 | { 249 | 250 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 251 | return lv_obj_get_width(usr->target); 252 | 253 | } 254 | 255 | 256 | int32_t _ui_anim_callback_get_height(lv_anim_t * a) 257 | 258 | { 259 | 260 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 261 | return lv_obj_get_height(usr->target); 262 | 263 | } 264 | 265 | 266 | int32_t _ui_anim_callback_get_opacity(lv_anim_t * a) 267 | 268 | { 269 | 270 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 271 | return lv_obj_get_style_opa(usr->target, 0); 272 | 273 | } 274 | 275 | int32_t _ui_anim_callback_get_image_zoom(lv_anim_t * a) 276 | 277 | { 278 | 279 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 280 | return lv_image_get_scale(usr->target); 281 | 282 | } 283 | 284 | int32_t _ui_anim_callback_get_image_angle(lv_anim_t * a) 285 | 286 | { 287 | 288 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 289 | return lv_image_get_rotation(usr->target); 290 | 291 | } 292 | 293 | int32_t _ui_anim_callback_get_image_frame(lv_anim_t * a) 294 | 295 | { 296 | 297 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 298 | return usr->val; 299 | 300 | } 301 | 302 | void _ui_arc_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * prefix, const char * postfix) 303 | { 304 | char buf[_UI_TEMPORARY_STRING_BUFFER_SIZE]; 305 | 306 | lv_snprintf(buf, sizeof(buf), "%s%d%s", prefix, (int)lv_arc_get_value(src), postfix); 307 | 308 | lv_label_set_text(trg, buf); 309 | } 310 | 311 | void _ui_slider_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * prefix, const char * postfix) 312 | { 313 | char buf[_UI_TEMPORARY_STRING_BUFFER_SIZE]; 314 | 315 | lv_snprintf(buf, sizeof(buf), "%s%d%s", prefix, (int)lv_slider_get_value(src), postfix); 316 | 317 | lv_label_set_text(trg, buf); 318 | } 319 | void _ui_checked_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * txt_on, const char * txt_off) 320 | { 321 | if(lv_obj_has_state(src, LV_STATE_CHECKED)) lv_label_set_text(trg, txt_on); 322 | else lv_label_set_text(trg, txt_off); 323 | } 324 | 325 | 326 | void _ui_spinbox_step(lv_obj_t * target, int val) 327 | 328 | { 329 | 330 | if(val > 0) lv_spinbox_increment(target); 331 | 332 | else lv_spinbox_decrement(target); 333 | 334 | 335 | lv_obj_send_event(target, LV_EVENT_VALUE_CHANGED, 0); 336 | } 337 | 338 | void _ui_switch_theme(int val) 339 | 340 | { 341 | 342 | #ifdef UI_THEME_ACTIVE 343 | ui_theme_set(val); 344 | #endif 345 | } 346 | 347 | 348 | -------------------------------------------------------------------------------- /weather_7/src/ui/GUI_Variables.c: -------------------------------------------------------------------------------- 1 | #include "GUI.h" 2 | 3 | 4 | 5 | lv_obj_t* GUI_Screen__cont; 6 | lv_obj_t* GUI_Image__cont__background_img; 7 | lv_obj_t* GUI_Container__cont__current_status_cont; 8 | lv_obj_t* GUI_Image__cont__current_status_icon_img; 9 | lv_obj_t* GUI_Label__cont__current_status_text_lbl; 10 | lv_obj_t* GUI_Container__cont__hourly_forecast_cont; 11 | lv_obj_t* GUI_Container__cont__hourly_forecast_title_cont; 12 | lv_obj_t* GUI_Label__cont__hourly_forecast_title_lbl; 13 | lv_obj_t* GUI_Container__cont__hourly_forecast_items_cont; 14 | lv_obj_t* GUI_Container__cont__hourly_forecast_item_1_cont; 15 | lv_obj_t* GUI_Label__cont__hourly_forecast_item_1_time_lbl; 16 | lv_obj_t* GUI_Image__cont__hourly_forecast_item_1_icon_img; 17 | lv_obj_t* GUI_Label__cont__hourly_forecast_item_1_temp_lbl; 18 | lv_obj_t* GUI_Container__cont__hourly_forecast_item_2_cont; 19 | lv_obj_t* GUI_Label__cont__hourly_forecast_item_2_time_lbl; 20 | lv_obj_t* GUI_Image__cont__hourly_forecast_item_2_icon_img; 21 | lv_obj_t* GUI_Label__cont__hourly_forecast_item_2_temp_lbl; 22 | lv_obj_t* GUI_Container__cont__hourly_forecast_item_3_cont; 23 | lv_obj_t* GUI_Label__cont__hourly_forecast_item_3_time_lbl; 24 | lv_obj_t* GUI_Image__cont__hourly_forecast_item_3_icon_img; 25 | lv_obj_t* GUI_Label__cont__hourly_forecast_item_3_temp_lbl; 26 | lv_obj_t* GUI_Container__cont__hourly_forecast_item_4_cont; 27 | lv_obj_t* GUI_Label__cont__hourly_forecast_item_4_time_lbl; 28 | lv_obj_t* GUI_Image__cont__hourly_forecast_item_4_icon_img; 29 | lv_obj_t* GUI_Label__cont__hourly_forecast_item_4_temp_lbl; 30 | lv_obj_t* GUI_Container__cont__daily_forecast_cont; 31 | lv_obj_t* GUI_Container__cont__daily_forecast_title_cont; 32 | lv_obj_t* GUI_Label__cont__daily_forecast_title_lbl; 33 | lv_obj_t* GUI_Container__cont__daily_forecast_items_cont; 34 | lv_obj_t* GUI_Container__cont__daily_forecast_monday_item_cont; 35 | lv_obj_t* GUI_Panel__cont__daily_forecast_monday_item_data_panel; 36 | lv_obj_t* GUI_Label__cont__daily_forecast_monday_item_day_lbl; 37 | lv_obj_t* GUI_Label__cont__daily_forecast_monday_item_temp_lbl; 38 | lv_obj_t* GUI_Label__cont__daily_forecast_monday_item_status_lbl; 39 | lv_obj_t* GUI_Container__cont__daily_forecast_tuesday_item_cont; 40 | lv_obj_t* GUI_Panel__cont__daily_forecast_tuesday_item_data_panel; 41 | lv_obj_t* GUI_Label__cont__daily_forecast_tuesday_item_day_lbl; 42 | lv_obj_t* GUI_Label__cont__daily_forecast_tuesday_item_temp_lbl; 43 | lv_obj_t* GUI_Label__cont__daily_forecast_tuesday_item_status_lbl; 44 | lv_obj_t* GUI_Container__cont__daily_forecast_wednesday_item_cont; 45 | lv_obj_t* GUI_Panel__cont__daily_forecast_wednesday_item_data_panel; 46 | lv_obj_t* GUI_Label__cont__daily_forecast_wednesday_item_day_lbl; 47 | lv_obj_t* GUI_Label__cont__daily_forecast_wednesday_item_temp_lbl; 48 | lv_obj_t* GUI_Label__cont__daily_forecast_wednesday_item_status_lbl; 49 | lv_obj_t* GUI_Container__cont__main_display_cont; 50 | lv_obj_t* GUI_Label__cont__main_display_temp_lbl; 51 | lv_obj_t* GUI_Image__cont__main_display_icon_img; 52 | lv_obj_t* GUI_Container__cont__main_display_spacer_cont; 53 | lv_obj_t* GUI_Label__cont__main_display_title_lbl; 54 | lv_obj_t* GUI_Container__cont__details_cont; 55 | lv_obj_t* GUI_Container__cont__details_feels_like_cont; 56 | lv_obj_t* GUI_Label__cont__details_feels_like_title_lbl; 57 | lv_obj_t* GUI_Label__cont__details_feels_like_value_lbl; 58 | lv_obj_t* GUI_Panel__cont__details_separator_1_panel; 59 | lv_obj_t* GUI_Container__cont__details_humidity_cont; 60 | lv_obj_t* GUI_Label__cont__details_humidity_title_lbl; 61 | lv_obj_t* GUI_Label__cont__details_humidity_value_lbl; 62 | lv_obj_t* GUI_Panel__cont__details_separator_2_panel; 63 | lv_obj_t* GUI_Container__cont__details_wind_cont; 64 | lv_obj_t* GUI_Label__cont__details_wind_title_lbl; 65 | lv_obj_t* GUI_Container__cont__details_wind_value_cont; 66 | lv_obj_t* GUI_Label__cont__details_wind_speed_lbl; 67 | lv_obj_t* GUI_Label__cont__details_wind_unit_lbl; 68 | lv_obj_t* GUI_Container__cont__indoor_stats_cont; 69 | lv_obj_t* GUI_Container__cont__indoor_stats_primary_cont; 70 | lv_obj_t* GUI_Container__cont__indoor_stats_temp_cont; 71 | lv_obj_t* GUI_Label__cont__indoor_stats_temp_title_lbl; 72 | lv_obj_t* GUI_Label__cont__indoor_stats_temp_value_lbl; 73 | lv_obj_t* GUI_Container__cont__indoor_stats_humidity_cont; 74 | lv_obj_t* GUI_Label__cont__indoor_stats_humidity_title_lbl; 75 | lv_obj_t* GUI_Label__cont__indoor_stats_humidity_value_lbl; 76 | lv_obj_t* GUI_Container__cont__indoor_stats_air_quality_cont; 77 | lv_obj_t* GUI_Container__cont__indoor_stats_air_quality_display_cont; 78 | lv_obj_t* GUI_Panel__cont__indoor_stats_air_quality_title_panel; 79 | lv_obj_t* GUI_Label__cont__indoor_stats_air_quality_title_lbl; 80 | lv_obj_t* GUI_Panel__cont__indoor_stats_air_quality_value_panel; 81 | lv_obj_t* GUI_Label__cont__indoor_stats_air_quality_value_lbl; 82 | lv_obj_t* GUI_Container__cont__indoor_stats_air_quality_details_cont; 83 | lv_obj_t* GUI_Container__cont__indoor_stats_air_quality_header_cont; 84 | lv_obj_t* GUI_Label__cont__indoor_stats_air_quality_gap_title_lbl; 85 | lv_obj_t* GUI_Label__cont__indoor_stats_air_quality_gap_value_lbl; 86 | lv_obj_t* GUI_Container__cont__indoor_stats_air_quality_slider_area_cont; 87 | lv_obj_t* GUI_Container__cont__indoor_stats_air_quality_range_lbl_cont; 88 | lv_obj_t* GUI_Label__cont__indoor_stats_air_quality_low_lbl; 89 | lv_obj_t* GUI_Label__cont__indoor_stats_air_quality_medium_lbl; 90 | lv_obj_t* GUI_Label__cont__indoor_stats_air_quality_high_lbl; 91 | lv_obj_t* GUI_Slider__cont__indoor_stats_air_quality_slider; 92 | lv_obj_t* GUI_Container__cont__alert_cont; 93 | lv_obj_t* GUI_Image__cont__alert_icon_img; 94 | lv_obj_t* GUI_Container__cont__alert_text_cont; 95 | lv_obj_t* GUI_Label__cont__alert_title_lbl; 96 | lv_obj_t* GUI_Label__cont__alert_message_lbl; 97 | 98 | 99 | lv_style_t GUI_Style__class_8rQJj2WR7KS5BW__; 100 | lv_style_t GUI_Style__class_kL3MCphSm1zdhB__; 101 | lv_style_t GUI_Style__class_OWp7o3fr8u7nZG__; 102 | lv_style_t GUI_Style__class_E4wegkc5VJFKsz__; 103 | lv_style_t GUI_Style__class_RGR5O50FZk8MjD__; 104 | lv_style_t GUI_Style__class_NHMYIepongiLxJ__; 105 | lv_style_t GUI_Style__class_bnXaTUcRtszjic__; 106 | lv_style_t GUI_Style__class_e1RJqKV5YEtyLL__; 107 | lv_style_t GUI_Style__class_z1zvszPSytj7GK__; 108 | lv_style_t GUI_Style__class_SqnJ2yTfN70m5F__; 109 | lv_style_t GUI_Style__class_Sl2id12bl9NQMv__; 110 | lv_style_t GUI_Style__class_Yoie1JkY7ut7dR__; 111 | lv_style_t GUI_Style__class_9V6WvrW17HbJD1__; 112 | lv_style_t GUI_Style__class_uctqe13XSbRVrf__; 113 | lv_style_t GUI_Style__class_CrXq0J1lzKaWzo__; 114 | lv_style_t GUI_Style__class_yL6megXhm9GYb7__; 115 | lv_style_t GUI_Style__class_4FP9fwNC3Jfkoc__; 116 | lv_style_t GUI_Style__class_wWU5ITomt2XhrC__; 117 | lv_style_t GUI_Style__class_N6QjKxi1tUPVcv__; 118 | lv_style_t GUI_Style__class_OKWBnOvOGtNUNv__; 119 | lv_style_t GUI_Style__class_WhQHp8mtjRM1Z6__; 120 | lv_style_t GUI_Style__class_6Zqyl1PAzGby72__; 121 | lv_style_t GUI_Style__class_P20EIfA3luXdY3__; 122 | lv_style_t GUI_Style__class_mGTxkagT6y6pNF__; 123 | lv_style_t GUI_Style__class_QtBH9YSEMkGaW1__; 124 | lv_style_t GUI_Style__class_wlkSJFhc3canUg__; 125 | lv_style_t GUI_Style__class_E4t2gqcHR8MbAP__; 126 | lv_style_t GUI_Style__class_XwvnqhCeV2aoM1__; 127 | lv_style_t GUI_Style__class_1w85YzMTP9d5q4__; 128 | lv_style_t GUI_Style__class_j3PIJOujL57xFq__; 129 | lv_style_t GUI_Style__class_DaDvAetiVI0Sy4__; 130 | lv_style_t GUI_Style__class_sI3TdUhM0WS1Zb__; 131 | lv_style_t GUI_Style__class_f9uFiY7jL0YFTZ__; 132 | lv_style_t GUI_Style__class_tpmJOiEkbfWCQ5__; 133 | lv_style_t GUI_Style__class_NqL7LHebj5jnE1__; 134 | lv_style_t GUI_Style__class_MNThGQl2quXcmK__; 135 | lv_style_t GUI_Style__class_l2KF3gLqvrvgNA__; 136 | lv_style_t GUI_Style__class_S38iEdXYHp1zFH__; 137 | lv_style_t GUI_Style__class_l05DXbHrWKpOYP__; 138 | lv_style_t GUI_Style__class_dlCXVJg3k6UwKj__; 139 | lv_style_t GUI_Style__class_UthKrP17uaRpGr__; 140 | lv_style_t GUI_Style__class_7TxYpcbJKqrqzb__; 141 | lv_style_t GUI_Style__class_fMZLS649q9lJQi__; 142 | lv_style_t GUI_Style__class_Jw5auITeCyGC1B__; 143 | lv_style_t GUI_Style__class_3kssyjEdbcCLSh__; 144 | lv_style_t GUI_Style__class_JC5FT5PPZmgeAd__; 145 | lv_style_t GUI_Style__class_z6I6jhPHmAziTD__; 146 | lv_style_t GUI_Style__class_u3dHPTQfScNGqf__; 147 | lv_style_t GUI_Style__class_Kv9aIdJXPzd4E0__; 148 | lv_style_t GUI_Style__class_d6oNFVfxUQNLTp__; 149 | lv_style_t GUI_Style__class_330bxbZF7kZsG8__; 150 | lv_style_t GUI_Style__class_aB5O6v8av05RG3__; 151 | lv_style_t GUI_Style__class_3gzB3jg0wffHq2__; 152 | lv_style_t GUI_Style__class_2dmVS6KVV9M8t4__; 153 | lv_style_t GUI_Style__class_Pjj7UmgHuETrFH__; 154 | lv_style_t GUI_Style__class_lWoRmnbHxdxX1R__; 155 | lv_style_t GUI_Style__class_NYOlN6CAjXN9ct__; 156 | lv_style_t GUI_Style__class_gV4odhky0u7lrc__; 157 | lv_style_t GUI_Style__class_lVmv26isUUbrTV__; 158 | lv_style_t GUI_Style__class_Kq3Mw0nOQ4bmih__; 159 | lv_style_t GUI_Style__class_xxhbZyQuM4W5a0__; 160 | lv_style_t GUI_Style__class_rORFbD8iFMPP1h__; 161 | lv_style_t GUI_Style__class_z5KKKSCX8HvB2b__; 162 | lv_style_t GUI_Style__class_AYPupaF3KarTJN__; 163 | lv_style_t GUI_Style__class_S3sy9bpI49A3HI__; 164 | lv_style_t GUI_Style__class_2hdOb8fjSaLxHS__; 165 | lv_style_t GUI_Style__class_Q3FYyHHZdNIPFL__; 166 | lv_style_t GUI_Style__class_4CH5toICFW9I39__; 167 | lv_style_t GUI_Style__class_FOyhSAD3uzjelO__; 168 | lv_style_t GUI_Style__class_HhXjRiqCm3yqaP__; 169 | lv_style_t GUI_Style__class_jFHXUVfU7O2fDs__; 170 | lv_style_t GUI_Style__class_EpPa3IwZL2z8XC__; 171 | lv_style_t GUI_Style__class_omL70ju4I8KjJb__; 172 | lv_style_t GUI_Style__class_C9LNZClr6DQlR7__; 173 | lv_style_t GUI_Style__class_i4iutar91dNdNN__; 174 | lv_style_t GUI_Style__class_ExbBIkHP328YgN__; 175 | lv_style_t GUI_Style__class_i5pavOZ9Sk9FhX__; 176 | lv_style_t GUI_Style__class_kTo6PU445jhsJh__; 177 | lv_style_t GUI_Style__class_YICAG2c7DumoUx__; 178 | lv_style_t GUI_Style__class_L7ACd19ZSOmkfm__; 179 | lv_style_t GUI_Style__class_cnRipu8Qpup4cw__; 180 | lv_style_t GUI_Style__class_Jlp2zZ20kBQEty__; 181 | lv_style_t GUI_Style__class_0gni4cQw4iYD9n__; 182 | lv_style_t GUI_Style__class_kozKKjL0gOY0dw__; 183 | 184 | -------------------------------------------------------------------------------- /weather_13/src/ui/GUI_Variables.c: -------------------------------------------------------------------------------- 1 | #include "GUI.h" 2 | 3 | 4 | 5 | lv_obj_t* GUI_Screen__main_screen; 6 | lv_obj_t* GUI_Container__main_screen__layout_cont; 7 | lv_obj_t* GUI_Container__main_screen__forecast_column_cont; 8 | lv_obj_t* GUI_Panel__main_screen__forecast_current_panel; 9 | lv_obj_t* GUI_Label__main_screen__forecast_current_status_lbl; 10 | lv_obj_t* GUI_Image__main_screen__forecast_current_icon_img; 11 | lv_obj_t* GUI_Panel__main_screen__forecast_separator_1_panel; 12 | lv_obj_t* GUI_Panel__main_screen__forecast_hourly_panel; 13 | lv_obj_t* GUI_Container__main_screen__forecast_hourly_title_cont; 14 | lv_obj_t* GUI_Label__main_screen__forecast_hourly_title_lbl; 15 | lv_obj_t* GUI_Container__main_screen__forecast_hourly_items_cont; 16 | lv_obj_t* GUI_Container__main_screen__forecast_hourly_item_1_cont; 17 | lv_obj_t* GUI_Label__main_screen__forecast_hourly_item_1_time_lbl; 18 | lv_obj_t* GUI_Image__main_screen__forecast_hourly_item_1_icon_img; 19 | lv_obj_t* GUI_Label__main_screen__forecast_hourly_item_1_temp_lbl; 20 | lv_obj_t* GUI_Container__main_screen__forecast_hourly_item_2_cont; 21 | lv_obj_t* GUI_Label__main_screen__forecast_hourly_item_2_time_lbl; 22 | lv_obj_t* GUI_Image__main_screen__forecast_hourly_item_2_icon_img; 23 | lv_obj_t* GUI_Label__main_screen__forecast_hourly_item_2_temp_lbl; 24 | lv_obj_t* GUI_Container__main_screen__forecast_hourly_item_3_cont; 25 | lv_obj_t* GUI_Label__main_screen__forecast_hourly_item_3_time_lbl; 26 | lv_obj_t* GUI_Image__main_screen__forecast_hourly_item_3_icon_img; 27 | lv_obj_t* GUI_Label__main_screen__forecast_hourly_item_3_temp_lbl; 28 | lv_obj_t* GUI_Container__main_screen__forecast_hourly_item_4_cont; 29 | lv_obj_t* GUI_Label__main_screen__forecast_hourly_item_4_time_lbl; 30 | lv_obj_t* GUI_Image__main_screen__forecast_hourly_item_4_icon_img; 31 | lv_obj_t* GUI_Label__main_screen__forecast_hourly_item_4_temp_lbl; 32 | lv_obj_t* GUI_Panel__main_screen__forecast_separator_2_panel; 33 | lv_obj_t* GUI_Panel__main_screen__forecast_daily_panel; 34 | lv_obj_t* GUI_Container__main_screen__forecast_daily_title_cont; 35 | lv_obj_t* GUI_Label__main_screen__forecast_daily_title_lbl; 36 | lv_obj_t* GUI_Container__main_screen__forecast_daily_items_cont; 37 | lv_obj_t* GUI_Container__main_screen__forecast_daily_item_1_cont; 38 | lv_obj_t* GUI_Label__main_screen__forecast_daily_item_1_day_lbl; 39 | lv_obj_t* GUI_Label__main_screen__forecast_daily_item_1_temp_lbl; 40 | lv_obj_t* GUI_Panel__main_screen__forecast_daily_separator_1_panel; 41 | lv_obj_t* GUI_Container__main_screen__forecast_daily_item_2_cont; 42 | lv_obj_t* GUI_Label__main_screen__forecast_daily_item_2_day_lbl; 43 | lv_obj_t* GUI_Label__main_screen__forecast_daily_item_2_temp_lbl; 44 | lv_obj_t* GUI_Panel__main_screen__forecast_daily_separator_2_panel; 45 | lv_obj_t* GUI_Container__main_screen__forecast_daily_item_3_cont; 46 | lv_obj_t* GUI_Label__main_screen__forecast_daily_item_3_day_lbl; 47 | lv_obj_t* GUI_Label__main_screen__forecast_daily_item_3_temp_lbl; 48 | lv_obj_t* GUI_Panel__main_screen__current_day_panel; 49 | lv_obj_t* GUI_Label__main_screen__current_day_city_lbl; 50 | lv_obj_t* GUI_Label__main_screen__current_day_date_lbl; 51 | lv_obj_t* GUI_Label__main_screen__current_day_weekday_lbl; 52 | lv_obj_t* GUI_Label__main_screen__current_day_temp_lbl; 53 | lv_obj_t* GUI_Panel__main_screen__current_day_status_wrapper_panel; 54 | lv_obj_t* GUI_Label__main_screen__current_day_status_lbl; 55 | lv_obj_t* GUI_Container__main_screen__details_column_cont; 56 | lv_obj_t* GUI_Panel__main_screen__details_outdoor_panel; 57 | lv_obj_t* GUI_Container__main_screen__details_outdoor_humidity_cont; 58 | lv_obj_t* GUI_Label__main_screen__details_outdoor_humidity_title_lbl; 59 | lv_obj_t* GUI_Label__main_screen__details_outdoor_humidity_value_lbl; 60 | lv_obj_t* GUI_Label__main_screen__details_outdoor_humidity_range_lbl; 61 | lv_obj_t* GUI_Container__main_screen__details_outdoor_wind_cont; 62 | lv_obj_t* GUI_Label__main_screen__details_outdoor_wind_title_lbl; 63 | lv_obj_t* GUI_Label__main_screen__details_outdoor_wind_value_lbl; 64 | lv_obj_t* GUI_Label__main_screen__details_outdoor_wind_unit_lbl; 65 | lv_obj_t* GUI_Panel__main_screen__details_separator_panel; 66 | lv_obj_t* GUI_Panel__main_screen__details_indoor_panel; 67 | lv_obj_t* GUI_Container__main_screen__details_indoor_display_cont; 68 | lv_obj_t* GUI_Container__main_screen__details_indoor_data_cont; 69 | lv_obj_t* GUI_Container__main_screen__details_indoor_title_cont; 70 | lv_obj_t* GUI_Label__main_screen__details_indoor_title_lbl; 71 | lv_obj_t* GUI_Container__main_screen__details_indoor_metrics_cont; 72 | lv_obj_t* GUI_Label__main_screen__details_indoor_temp_value_lbl; 73 | lv_obj_t* GUI_Label__main_screen__details_indoor_air_quality_title_lbl; 74 | lv_obj_t* GUI_Panel__main_screen__details_indoor_air_quality_separator_panel; 75 | lv_obj_t* GUI_Label__main_screen__details_indoor_air_quality_value_lbl; 76 | lv_obj_t* GUI_Image__main_screen__details_indoor_room_img; 77 | lv_obj_t* GUI_Container__main_screen__details_indoor_controls_cont; 78 | lv_obj_t* GUI_Container__main_screen__details_indoor_temp_control_cont; 79 | lv_obj_t* GUI_Image__main_screen__details_indoor_temp_icon_img; 80 | lv_obj_t* GUI_Bar__main_screen__details_indoor_temp_indicator_bar; 81 | lv_obj_t* GUI_Container__main_screen__details_indoor_humidity_control_cont; 82 | lv_obj_t* GUI_Image__main_screen__details_indoor_humidity_icon_img; 83 | lv_obj_t* GUI_Bar__main_screen__details_indoor_humidity_indicator_bar; 84 | lv_obj_t* GUI_Container__main_screen__details_indoor_fan_control_cont; 85 | lv_obj_t* GUI_Image__main_screen__details_indoor_fan_icon_img; 86 | lv_obj_t* GUI_Bar__main_screen__details_indoor_fan_indicator_bar; 87 | lv_obj_t* GUI_Panel__main_screen__alert_banner_panel; 88 | lv_obj_t* GUI_Image__main_screen__alert_icon_img; 89 | lv_obj_t* GUI_Container__main_screen__alert_text_cont; 90 | lv_obj_t* GUI_Label__main_screen__alert_title_lbl; 91 | lv_obj_t* GUI_Label__main_screen__alert_details_lbl; 92 | 93 | 94 | lv_style_t GUI_Style__class_rLwCgGpiuHaI5t__; 95 | lv_style_t GUI_Style__class_30q1uUBE4V7tEw__; 96 | lv_style_t GUI_Style__class_4dBfZy3cC8dwt1__; 97 | lv_style_t GUI_Style__class_d67KdfOh0xYgra__; 98 | lv_style_t GUI_Style__class_efvJHE3IVkk8cp__; 99 | lv_style_t GUI_Style__class_O62xyeqWplfGyC__; 100 | lv_style_t GUI_Style__class_Ts8CMzC0OygGMy__; 101 | lv_style_t GUI_Style__class_pXhAlK5D7SJRVC__; 102 | lv_style_t GUI_Style__class_zVq5RtUETsvwOF__; 103 | lv_style_t GUI_Style__class_dJWzWjB2kDFTuO__; 104 | lv_style_t GUI_Style__class_WCBZDgY2t6PmLE__; 105 | lv_style_t GUI_Style__class_TKcq1KUXp4WFil__; 106 | lv_style_t GUI_Style__class_XebdxV5kmVe4DX__; 107 | lv_style_t GUI_Style__class_COz6FozwVvaqNe__; 108 | lv_style_t GUI_Style__class_30gh17XfxCvFQy__; 109 | lv_style_t GUI_Style__class_CkLFSgPtf6Bl0N__; 110 | lv_style_t GUI_Style__class_MmlHHAG8DlXwM7__; 111 | lv_style_t GUI_Style__class_Zk1yuQLgxLzKb2__; 112 | lv_style_t GUI_Style__class_RaQFqoyffnhcrh__; 113 | lv_style_t GUI_Style__class_lKs8xCagJV4AW9__; 114 | lv_style_t GUI_Style__class_jl3LjjzbYQVlsj__; 115 | lv_style_t GUI_Style__class_9bUt7PyXQDnufp__; 116 | lv_style_t GUI_Style__class_bUBrVDK2XXg27v__; 117 | lv_style_t GUI_Style__class_abpsloLXKTBXIw__; 118 | lv_style_t GUI_Style__class_pS5LfAKHz1U1w8__; 119 | lv_style_t GUI_Style__class_qzLjyJvIzcRKvx__; 120 | lv_style_t GUI_Style__class_UpVFH1pAorlgkM__; 121 | lv_style_t GUI_Style__class_JazfWqxFROS2ut__; 122 | lv_style_t GUI_Style__class_zvtRN4uOLIt5y7__; 123 | lv_style_t GUI_Style__class_PVbJEEenkxqdEX__; 124 | lv_style_t GUI_Style__class_K1LjYJMIZwKYwX__; 125 | lv_style_t GUI_Style__class_oX5Q6RH4Nh59QY__; 126 | lv_style_t GUI_Style__class_Mr1NLF2gCtBbZ3__; 127 | lv_style_t GUI_Style__class_TgKiKSYv9T45GL__; 128 | lv_style_t GUI_Style__class_14T0GZGasUtdQz__; 129 | lv_style_t GUI_Style__class_qlKBHC1b3neUJs__; 130 | lv_style_t GUI_Style__class_K0hCcfgu1eLcCJ__Light_Panel; 131 | lv_style_t GUI_Style__class_JLnOH13L9xFOxA__; 132 | lv_style_t GUI_Style__class_YBAk3AT2jXGwju__; 133 | lv_style_t GUI_Style__class_RG35kwvmHdRq5V__; 134 | lv_style_t GUI_Style__class_PVJ556qdocL6mb__; 135 | lv_style_t GUI_Style__class_z0k4lDZdSbClTN__; 136 | lv_style_t GUI_Style__class_Qrxz25380oNljV__; 137 | lv_style_t GUI_Style__class_B3ho2rNB4rNaDW__; 138 | lv_style_t GUI_Style__class_sGqngSUzbyIPox__; 139 | lv_style_t GUI_Style__class_TAi4FT1aO41nlI__; 140 | lv_style_t GUI_Style__class_hEcwNv6F6wZAxH__; 141 | lv_style_t GUI_Style__class_Cv0JPabmyPw8eB__; 142 | lv_style_t GUI_Style__class_7oxN5VBtl0eoDO__; 143 | lv_style_t GUI_Style__class_pR7cwMnOLj77Co__; 144 | lv_style_t GUI_Style__class_pXXsoewqlUF912__; 145 | lv_style_t GUI_Style__class_9Sa5zoIIvnTiSd__; 146 | lv_style_t GUI_Style__class_nsmjYpWbtgmLWN__; 147 | lv_style_t GUI_Style__class_oUye0Q5y6pK8kM__; 148 | lv_style_t GUI_Style__class_NbBK7LANXxBxwp__; 149 | lv_style_t GUI_Style__class_tAXKNidGSVQjcH__; 150 | lv_style_t GUI_Style__class_c7N70YnXjXDaFa__; 151 | lv_style_t GUI_Style__class_ayOWyuftyHeHRr__; 152 | lv_style_t GUI_Style__class_xpoiNhi6AftotQ__; 153 | lv_style_t GUI_Style__class_8LHElSnO6Hux2d__; 154 | lv_style_t GUI_Style__class_JEUvdihGK3D2T2__; 155 | lv_style_t GUI_Style__class_xZ1DYGsn078O2f__; 156 | lv_style_t GUI_Style__class_LQMfXcQ7GloRPo__; 157 | lv_style_t GUI_Style__class_GZPVvrC6KUJYs3__; 158 | lv_style_t GUI_Style__class_MATAkwvgfjxcHp__; 159 | lv_style_t GUI_Style__class_ImN60rH27aiXIx__; 160 | lv_style_t GUI_Style__class_5g3yUcjLvpNIwP__; 161 | lv_style_t GUI_Style__class_ixeuHuB9l2UC2a__; 162 | lv_style_t GUI_Style__class_yb5DuJX0oTMbae__; 163 | lv_style_t GUI_Style__class_UuzaOplsX0JN4w__; 164 | lv_style_t GUI_Style__class_ShZuRMufwv3M1V__; 165 | lv_style_t GUI_Style__class_0OiSTq0GXV09iF__; 166 | lv_style_t GUI_Style__class_qxKfqFKUMlnbQg__; 167 | lv_style_t GUI_Style__class_mGMwQDCVAfRmXv__; 168 | lv_style_t GUI_Style__class_agK5hlOaxQuyi6__; 169 | lv_style_t GUI_Style__class_elqZRytK812bkq__; 170 | lv_style_t GUI_Style__class_eu9eLToI0iUK3c__; 171 | lv_style_t GUI_Style__class_id18G0qqvrE58I__; 172 | lv_style_t GUI_Style__class_J9prjMDYKgRk5E__; 173 | lv_style_t GUI_Style__class_EHTydUqAI35xzG__; 174 | lv_style_t GUI_Style__class_HVI4YSNhbbBijJ__; 175 | lv_style_t GUI_Style__class_Mvbw7wohXoI3rF__; 176 | 177 | -------------------------------------------------------------------------------- /weather_13/src/weather.cpp: -------------------------------------------------------------------------------- 1 | #include "weather.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | namespace 13 | { 14 | String aqiLabelFrom(int aqi) 15 | { 16 | switch (aqi) 17 | { 18 | case 1: return "Good"; 19 | case 2: return "Fair"; 20 | case 3: return "Moderate"; 21 | case 4: return "Poor"; 22 | case 5: return "Very Poor"; 23 | default: return "Unknown"; 24 | } 25 | } 26 | 27 | String urlEncode(const String &s) 28 | { 29 | String o; 30 | o.reserve(s.length() * 3); 31 | for (size_t i = 0; i < s.length(); ++i) 32 | { 33 | char c = s[i]; 34 | if (c == ' ') 35 | o += "%20"; 36 | else 37 | o += c; 38 | } 39 | return o; 40 | } 41 | 42 | String weatherByCityUrl(const WeatherRequest &req) 43 | { 44 | return String("https://api.openweathermap.org/data/2.5/weather") + 45 | "?q=" + urlEncode(req.city) + 46 | "&units=" + req.units + 47 | "&lang=" + req.lang + 48 | "&appid=" + req.apiKey; 49 | } 50 | 51 | String weatherByCoordUrl(const WeatherRequest &req, const String &lat, const String &lon) 52 | { 53 | return String("https://api.openweathermap.org/data/2.5/weather") + 54 | "?lat=" + lat + "&lon=" + lon + 55 | "&units=" + req.units + "&lang=" + req.lang + 56 | "&appid=" + req.apiKey; 57 | } 58 | 59 | String forecastByCoordUrl(const WeatherRequest &req, float lat, float lon) 60 | { 61 | return String("https://api.openweathermap.org/data/2.5/forecast") + 62 | "?lat=" + String(lat, 6) + "&lon=" + String(lon, 6) + 63 | "&units=" + req.units + "&lang=" + req.lang + 64 | "&appid=" + req.apiKey; 65 | } 66 | 67 | String airByCoordUrl(const WeatherRequest &req, float lat, float lon) 68 | { 69 | return String("https://api.openweathermap.org/data/2.5/air_pollution") + 70 | "?lat=" + String(lat, 6) + "&lon=" + String(lon, 6) + 71 | "&appid=" + req.apiKey; 72 | } 73 | 74 | bool httpGetJson(const String &url, DynamicJsonDocument &doc) 75 | { 76 | HTTPClient http; 77 | WiFiClientSecure client; 78 | client.setInsecure(); 79 | http.begin(client, url); 80 | int code = http.GET(); 81 | String body = http.getString(); 82 | if (code != HTTP_CODE_OK) 83 | { 84 | Serial1.printf("HTTP GET %s -> %d\n", url.c_str(), code); 85 | Serial1.println(body); 86 | http.end(); 87 | return false; 88 | } 89 | DeserializationError err = deserializeJson(doc, body); 90 | http.end(); 91 | if (err) 92 | { 93 | Serial1.printf("JSON parse error: %s\n", err.c_str()); 94 | return false; 95 | } 96 | return true; 97 | } 98 | 99 | struct Ymd 100 | { 101 | int y; 102 | int m; 103 | int d; 104 | }; 105 | 106 | Ymd ymdFromTs(int64_t tsUtc, int tzOffset) 107 | { 108 | time_t t = tsUtc + tzOffset; 109 | struct tm tmv; 110 | gmtime_r(&t, &tmv); 111 | return {tmv.tm_year + 1900, tmv.tm_mon + 1, tmv.tm_mday}; 112 | } 113 | 114 | int secondsOfDay(int64_t tsUtc, int tzOffset) 115 | { 116 | time_t t = tsUtc + tzOffset; 117 | struct tm tmv; 118 | gmtime_r(&t, &tmv); 119 | return tmv.tm_hour * 3600 + tmv.tm_min * 60 + tmv.tm_sec; 120 | } 121 | 122 | void aggregateNext3Days(const DynamicJsonDocument &fcDoc, WeatherData &out) 123 | { 124 | out.cityName = (const char *)(fcDoc["city"]["name"] | ""); 125 | out.timezoneOffset = fcDoc["city"]["timezone"] | 0; 126 | JsonArrayConst list = fcDoc["list"].as(); 127 | if (list.isNull() || list.size() == 0) 128 | return; 129 | 130 | struct DayAgg 131 | { 132 | bool inited = false; 133 | uint32_t anyTs = 0; 134 | float minT = 1e9; 135 | float maxT = -1e9; 136 | int bestDelta = INT_MAX; 137 | float dayT = NAN; 138 | int wid = 0; 139 | String main; 140 | String desc; 141 | String icon; 142 | }; 143 | 144 | std::map agg; 145 | for (JsonVariantConst itVar : list) 146 | { 147 | JsonObjectConst it = itVar.as(); 148 | int64_t ts = it["dt"] | 0; 149 | float tt = it["main"]["temp"] | NAN; 150 | int wid = it["weather"][0]["id"] | 0; 151 | String main = (const char *)(it["weather"][0]["main"] | ""); 152 | String desc = (const char *)(it["weather"][0]["description"] | ""); 153 | String icon = (const char *)(it["weather"][0]["icon"] | ""); 154 | 155 | Ymd ymd = ymdFromTs(ts, out.timezoneOffset); 156 | char keyBuf[16]; 157 | snprintf(keyBuf, sizeof(keyBuf), "%04d-%02d-%02d", ymd.y, ymd.m, ymd.d); 158 | String key(keyBuf); 159 | DayAgg &d = agg[key]; 160 | if (!d.inited) 161 | { 162 | d.inited = true; 163 | d.anyTs = ts; 164 | } 165 | if (!isnan(tt)) 166 | { 167 | if (tt < d.minT) 168 | d.minT = tt; 169 | if (tt > d.maxT) 170 | d.maxT = tt; 171 | } 172 | int delta = abs(secondsOfDay(ts, out.timezoneOffset) - 12 * 3600); 173 | if (delta < d.bestDelta) 174 | { 175 | d.bestDelta = delta; 176 | d.dayT = tt; 177 | d.wid = wid; 178 | d.main = main; 179 | d.desc = desc; 180 | d.icon = icon; 181 | } 182 | } 183 | 184 | std::vector> days; 185 | for (auto &kv : agg) 186 | days.push_back(kv); 187 | std::sort(days.begin(), days.end(), 188 | [](const std::pair &a, const std::pair &b) { 189 | return a.first.compareTo(b.first) < 0; 190 | }); 191 | 192 | int idx = 0; 193 | for (auto &kv : days) 194 | { 195 | if (idx >= 3) 196 | break; 197 | DayAgg &d = kv.second; 198 | out.daily[idx].ts = d.anyTs; 199 | out.daily[idx].day = d.dayT; 200 | out.daily[idx].min = d.minT; 201 | out.daily[idx].max = d.maxT; 202 | out.daily[idx].weatherId = d.wid; 203 | out.daily[idx].main = d.main; 204 | out.daily[idx].desc = d.desc; 205 | out.daily[idx].icon = d.icon; 206 | idx++; 207 | } 208 | } 209 | 210 | } // namespace 211 | 212 | bool fetchWeather(const WeatherRequest &request, WeatherData &out) 213 | { 214 | if (request.apiKey.isEmpty()) 215 | { 216 | Serial1.println("Weather API key is empty."); 217 | return false; 218 | } 219 | 220 | WeatherData data; 221 | float lat = 0; 222 | float lon = 0; 223 | 224 | if (request.useCity) 225 | { 226 | if (request.city.isEmpty()) 227 | { 228 | Serial1.println("City name not provided."); 229 | return false; 230 | } 231 | 232 | DynamicJsonDocument doc(24 * 1024); 233 | if (!httpGetJson(weatherByCityUrl(request), doc)) 234 | return false; 235 | 236 | data.cityName = (const char *)(doc["name"] | request.city.c_str()); 237 | lat = doc["coord"]["lat"] | 0.0; 238 | lon = doc["coord"]["lon"] | 0.0; 239 | 240 | data.dt = doc["dt"] | 0; 241 | data.temp = doc["main"]["temp"] | NAN; 242 | data.feelsLike = doc["main"]["feels_like"] | NAN; 243 | data.humidity = doc["main"]["humidity"] | 0; 244 | data.windSpeed = doc["wind"]["speed"] | 0.0; 245 | data.windDeg = doc["wind"]["deg"] | 0; 246 | data.windGust = doc["wind"]["gust"] | 0.0; 247 | JsonObject w0 = doc["weather"][0].as(); 248 | data.weatherId = w0["id"] | 0; 249 | data.main = (const char *)(w0["main"] | ""); 250 | data.desc = (const char *)(w0["description"] | ""); 251 | data.icon = (const char *)(w0["icon"] | ""); 252 | } 253 | else 254 | { 255 | if (request.lat.isEmpty() || request.lon.isEmpty()) 256 | { 257 | Serial1.println("Latitude/Longitude not provided."); 258 | return false; 259 | } 260 | 261 | lat = request.lat.toFloat(); 262 | lon = request.lon.toFloat(); 263 | 264 | DynamicJsonDocument doc(16 * 1024); 265 | if (!httpGetJson(weatherByCoordUrl(request, request.lat, request.lon), doc)) 266 | return false; 267 | 268 | data.cityName = (const char *)(doc["name"] | ""); 269 | data.dt = doc["dt"] | 0; 270 | data.temp = doc["main"]["temp"] | NAN; 271 | data.feelsLike = doc["main"]["feels_like"] | NAN; 272 | data.humidity = doc["main"]["humidity"] | 0; 273 | data.windSpeed = doc["wind"]["speed"] | 0.0; 274 | data.windDeg = doc["wind"]["deg"] | 0; 275 | data.windGust = doc["wind"]["gust"] | 0.0; 276 | JsonObject w0 = doc["weather"][0].as(); 277 | data.weatherId = w0["id"] | 0; 278 | data.main = (const char *)(w0["main"] | ""); 279 | data.desc = (const char *)(w0["description"] | ""); 280 | data.icon = (const char *)(w0["icon"] | ""); 281 | } 282 | 283 | { 284 | DynamicJsonDocument doc(96 * 1024); 285 | if (!httpGetJson(forecastByCoordUrl(request, lat, lon), doc)) 286 | return false; 287 | 288 | data.cityName = (const char *)(doc["city"]["name"] | data.cityName.c_str()); 289 | data.timezoneOffset = doc["city"]["timezone"] | 0; 290 | 291 | JsonArray list = doc["list"].as(); 292 | for (int i = 0; i < 4 && i < (int)list.size(); ++i) 293 | { 294 | JsonObject it = list[i].as(); 295 | data.hourly[i].ts = it["dt"] | 0; 296 | data.hourly[i].temp = it["main"]["temp"] | NAN; 297 | data.hourly[i].windSpeed = it["wind"]["speed"] | 0.0; 298 | data.hourly[i].windGust = it["wind"]["gust"] | 0.0; 299 | JsonObject ww = it["weather"][0]; 300 | data.hourly[i].weatherId = ww["id"] | 0; 301 | data.hourly[i].main = (const char *)(ww["main"] | ""); 302 | data.hourly[i].desc = (const char *)(ww["description"] | ""); 303 | data.hourly[i].icon = (const char *)(ww["icon"] | ""); 304 | } 305 | 306 | aggregateNext3Days(doc, data); 307 | } 308 | 309 | { 310 | DynamicJsonDocument doc(8 * 1024); 311 | if (httpGetJson(airByCoordUrl(request, lat, lon), doc)) 312 | { 313 | int aqi = doc["list"][0]["main"]["aqi"] | 0; 314 | data.aqi = aqi; 315 | data.aqiLabel = aqiLabelFrom(aqi); 316 | } 317 | else 318 | { 319 | data.aqi = 0; 320 | data.aqiLabel = "Unknown"; 321 | } 322 | } 323 | 324 | data.hasAlert = false; 325 | out = data; 326 | return true; 327 | } 328 | -------------------------------------------------------------------------------- /weather_7/src/weather.cpp: -------------------------------------------------------------------------------- 1 | #include "weather.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | namespace 13 | { 14 | String aqiLabelFrom(int aqi) 15 | { 16 | switch (aqi) 17 | { 18 | case 1: return "Good"; 19 | case 2: return "Fair"; 20 | case 3: return "Moderate"; 21 | case 4: return "Poor"; 22 | case 5: return "Very Poor"; 23 | default: return "Unknown"; 24 | } 25 | } 26 | 27 | String urlEncode(const String &s) 28 | { 29 | String o; 30 | o.reserve(s.length() * 3); 31 | for (size_t i = 0; i < s.length(); ++i) 32 | { 33 | char c = s[i]; 34 | if (c == ' ') 35 | o += "%20"; 36 | else 37 | o += c; 38 | } 39 | return o; 40 | } 41 | 42 | String weatherByCityUrl(const WeatherRequest &req) 43 | { 44 | return String("https://api.openweathermap.org/data/2.5/weather") + 45 | "?q=" + urlEncode(req.city) + 46 | "&units=" + req.units + 47 | "&lang=" + req.lang + 48 | "&appid=" + req.apiKey; 49 | } 50 | 51 | String weatherByCoordUrl(const WeatherRequest &req, const String &lat, const String &lon) 52 | { 53 | return String("https://api.openweathermap.org/data/2.5/weather") + 54 | "?lat=" + lat + "&lon=" + lon + 55 | "&units=" + req.units + "&lang=" + req.lang + 56 | "&appid=" + req.apiKey; 57 | } 58 | 59 | String forecastByCoordUrl(const WeatherRequest &req, float lat, float lon) 60 | { 61 | return String("https://api.openweathermap.org/data/2.5/forecast") + 62 | "?lat=" + String(lat, 6) + "&lon=" + String(lon, 6) + 63 | "&units=" + req.units + "&lang=" + req.lang + 64 | "&appid=" + req.apiKey; 65 | } 66 | 67 | String airByCoordUrl(const WeatherRequest &req, float lat, float lon) 68 | { 69 | return String("https://api.openweathermap.org/data/2.5/air_pollution") + 70 | "?lat=" + String(lat, 6) + "&lon=" + String(lon, 6) + 71 | "&appid=" + req.apiKey; 72 | } 73 | 74 | bool httpGetJson(const String &url, DynamicJsonDocument &doc) 75 | { 76 | HTTPClient http; 77 | WiFiClientSecure client; 78 | client.setInsecure(); 79 | http.begin(client, url); 80 | int code = http.GET(); 81 | String body = http.getString(); 82 | if (code != HTTP_CODE_OK) 83 | { 84 | Serial1.printf("HTTP GET %s -> %d\n", url.c_str(), code); 85 | Serial1.println(body); 86 | http.end(); 87 | return false; 88 | } 89 | DeserializationError err = deserializeJson(doc, body); 90 | http.end(); 91 | if (err) 92 | { 93 | Serial1.printf("JSON parse error: %s\n", err.c_str()); 94 | return false; 95 | } 96 | return true; 97 | } 98 | 99 | struct Ymd 100 | { 101 | int y; 102 | int m; 103 | int d; 104 | }; 105 | 106 | Ymd ymdFromTs(int64_t tsUtc, int tzOffset) 107 | { 108 | time_t t = tsUtc + tzOffset; 109 | struct tm tmv; 110 | gmtime_r(&t, &tmv); 111 | return {tmv.tm_year + 1900, tmv.tm_mon + 1, tmv.tm_mday}; 112 | } 113 | 114 | int secondsOfDay(int64_t tsUtc, int tzOffset) 115 | { 116 | time_t t = tsUtc + tzOffset; 117 | struct tm tmv; 118 | gmtime_r(&t, &tmv); 119 | return tmv.tm_hour * 3600 + tmv.tm_min * 60 + tmv.tm_sec; 120 | } 121 | 122 | void aggregateNext3Days(const DynamicJsonDocument &fcDoc, WeatherData &out) 123 | { 124 | out.cityName = (const char *)(fcDoc["city"]["name"] | ""); 125 | out.timezoneOffset = fcDoc["city"]["timezone"] | 0; 126 | JsonArrayConst list = fcDoc["list"].as(); 127 | if (list.isNull() || list.size() == 0) 128 | return; 129 | 130 | struct DayAgg 131 | { 132 | bool inited = false; 133 | uint32_t anyTs = 0; 134 | float minT = 1e9; 135 | float maxT = -1e9; 136 | int bestDelta = INT_MAX; 137 | float dayT = NAN; 138 | int wid = 0; 139 | String main; 140 | String desc; 141 | String icon; 142 | }; 143 | 144 | std::map agg; 145 | for (JsonVariantConst itVar : list) 146 | { 147 | JsonObjectConst it = itVar.as(); 148 | int64_t ts = it["dt"] | 0; 149 | float tt = it["main"]["temp"] | NAN; 150 | int wid = it["weather"][0]["id"] | 0; 151 | String main = (const char *)(it["weather"][0]["main"] | ""); 152 | String desc = (const char *)(it["weather"][0]["description"] | ""); 153 | String icon = (const char *)(it["weather"][0]["icon"] | ""); 154 | 155 | Ymd ymd = ymdFromTs(ts, out.timezoneOffset); 156 | char keyBuf[16]; 157 | snprintf(keyBuf, sizeof(keyBuf), "%04d-%02d-%02d", ymd.y, ymd.m, ymd.d); 158 | String key(keyBuf); 159 | DayAgg &d = agg[key]; 160 | if (!d.inited) 161 | { 162 | d.inited = true; 163 | d.anyTs = ts; 164 | } 165 | if (!isnan(tt)) 166 | { 167 | if (tt < d.minT) 168 | d.minT = tt; 169 | if (tt > d.maxT) 170 | d.maxT = tt; 171 | } 172 | int delta = abs(secondsOfDay(ts, out.timezoneOffset) - 12 * 3600); 173 | if (delta < d.bestDelta) 174 | { 175 | d.bestDelta = delta; 176 | d.dayT = tt; 177 | d.wid = wid; 178 | d.main = main; 179 | d.desc = desc; 180 | d.icon = icon; 181 | } 182 | } 183 | 184 | std::vector> days; 185 | for (auto &kv : agg) 186 | days.push_back(kv); 187 | std::sort(days.begin(), days.end(), 188 | [](const std::pair &a, const std::pair &b) { 189 | return a.first.compareTo(b.first) < 0; 190 | }); 191 | 192 | int idx = 0; 193 | for (auto &kv : days) 194 | { 195 | if (idx >= 3) 196 | break; 197 | DayAgg &d = kv.second; 198 | out.daily[idx].ts = d.anyTs; 199 | out.daily[idx].day = d.dayT; 200 | out.daily[idx].min = d.minT; 201 | out.daily[idx].max = d.maxT; 202 | out.daily[idx].weatherId = d.wid; 203 | out.daily[idx].main = d.main; 204 | out.daily[idx].desc = d.desc; 205 | out.daily[idx].icon = d.icon; 206 | idx++; 207 | } 208 | } 209 | 210 | } // namespace 211 | 212 | bool fetchWeather(const WeatherRequest &request, WeatherData &out) 213 | { 214 | if (request.apiKey.isEmpty()) 215 | { 216 | Serial1.println("Weather API key is empty."); 217 | return false; 218 | } 219 | 220 | WeatherData data; 221 | float lat = 0; 222 | float lon = 0; 223 | 224 | if (request.useCity) 225 | { 226 | if (request.city.isEmpty()) 227 | { 228 | Serial1.println("City name not provided."); 229 | return false; 230 | } 231 | 232 | DynamicJsonDocument doc(24 * 1024); 233 | if (!httpGetJson(weatherByCityUrl(request), doc)) 234 | return false; 235 | 236 | data.cityName = (const char *)(doc["name"] | request.city.c_str()); 237 | lat = doc["coord"]["lat"] | 0.0; 238 | lon = doc["coord"]["lon"] | 0.0; 239 | 240 | data.dt = doc["dt"] | 0; 241 | data.temp = doc["main"]["temp"] | NAN; 242 | data.feelsLike = doc["main"]["feels_like"] | NAN; 243 | data.humidity = doc["main"]["humidity"] | 0; 244 | data.windSpeed = doc["wind"]["speed"] | 0.0; 245 | data.windDeg = doc["wind"]["deg"] | 0; 246 | data.windGust = doc["wind"]["gust"] | 0.0; 247 | JsonObject w0 = doc["weather"][0].as(); 248 | data.weatherId = w0["id"] | 0; 249 | data.main = (const char *)(w0["main"] | ""); 250 | data.desc = (const char *)(w0["description"] | ""); 251 | data.icon = (const char *)(w0["icon"] | ""); 252 | } 253 | else 254 | { 255 | if (request.lat.isEmpty() || request.lon.isEmpty()) 256 | { 257 | Serial1.println("Latitude/Longitude not provided."); 258 | return false; 259 | } 260 | 261 | lat = request.lat.toFloat(); 262 | lon = request.lon.toFloat(); 263 | 264 | DynamicJsonDocument doc(16 * 1024); 265 | if (!httpGetJson(weatherByCoordUrl(request, request.lat, request.lon), doc)) 266 | return false; 267 | 268 | data.cityName = (const char *)(doc["name"] | ""); 269 | data.dt = doc["dt"] | 0; 270 | data.temp = doc["main"]["temp"] | NAN; 271 | data.feelsLike = doc["main"]["feels_like"] | NAN; 272 | data.humidity = doc["main"]["humidity"] | 0; 273 | data.windSpeed = doc["wind"]["speed"] | 0.0; 274 | data.windDeg = doc["wind"]["deg"] | 0; 275 | data.windGust = doc["wind"]["gust"] | 0.0; 276 | JsonObject w0 = doc["weather"][0].as(); 277 | data.weatherId = w0["id"] | 0; 278 | data.main = (const char *)(w0["main"] | ""); 279 | data.desc = (const char *)(w0["description"] | ""); 280 | data.icon = (const char *)(w0["icon"] | ""); 281 | } 282 | 283 | { 284 | DynamicJsonDocument doc(96 * 1024); 285 | if (!httpGetJson(forecastByCoordUrl(request, lat, lon), doc)) 286 | return false; 287 | 288 | data.cityName = (const char *)(doc["city"]["name"] | data.cityName.c_str()); 289 | data.timezoneOffset = doc["city"]["timezone"] | 0; 290 | 291 | JsonArray list = doc["list"].as(); 292 | for (int i = 0; i < 4 && i < (int)list.size(); ++i) 293 | { 294 | JsonObject it = list[i].as(); 295 | data.hourly[i].ts = it["dt"] | 0; 296 | data.hourly[i].temp = it["main"]["temp"] | NAN; 297 | data.hourly[i].windSpeed = it["wind"]["speed"] | 0.0; 298 | data.hourly[i].windGust = it["wind"]["gust"] | 0.0; 299 | JsonObject ww = it["weather"][0]; 300 | data.hourly[i].weatherId = ww["id"] | 0; 301 | data.hourly[i].main = (const char *)(ww["main"] | ""); 302 | data.hourly[i].desc = (const char *)(ww["description"] | ""); 303 | data.hourly[i].icon = (const char *)(ww["icon"] | ""); 304 | } 305 | 306 | aggregateNext3Days(doc, data); 307 | } 308 | 309 | { 310 | DynamicJsonDocument doc(8 * 1024); 311 | if (httpGetJson(airByCoordUrl(request, lat, lon), doc)) 312 | { 313 | int aqi = doc["list"][0]["main"]["aqi"] | 0; 314 | data.aqi = aqi; 315 | data.aqiLabel = aqiLabelFrom(aqi); 316 | } 317 | else 318 | { 319 | data.aqi = 0; 320 | data.aqiLabel = "Unknown"; 321 | } 322 | } 323 | 324 | data.hasAlert = false; 325 | out = data; 326 | return true; 327 | } 328 | -------------------------------------------------------------------------------- /weather_7/src/ui/Content/assets/images/upload_small_weather_2_31a67822608c43f695415b4825c28313_png.c: -------------------------------------------------------------------------------- 1 | #ifdef __has_include 2 | #if __has_include("lvgl.h") 3 | #ifndef LV_LVGL_H_INCLUDE_SIMPLE 4 | #define LV_LVGL_H_INCLUDE_SIMPLE 5 | #endif 6 | #endif 7 | #endif 8 | 9 | #if defined(LV_LVGL_H_INCLUDE_SIMPLE) 10 | #include "lvgl.h" 11 | #else 12 | #include "lvgl/lvgl.h" 13 | #endif 14 | 15 | 16 | #ifndef LV_ATTRIBUTE_MEM_ALIGN 17 | #define LV_ATTRIBUTE_MEM_ALIGN 18 | #endif 19 | 20 | #ifndef LV_ATTRIBUTE_IMAGE_UPLOAD_SMALL_WEATHER_2_31A67822608C43F695415B4825C28313_PNG 21 | #define LV_ATTRIBUTE_IMAGE_UPLOAD_SMALL_WEATHER_2_31A67822608C43F695415B4825C28313_PNG 22 | #endif 23 | 24 | const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMAGE_UPLOAD_SMALL_WEATHER_2_31A67822608C43F695415B4825C28313_PNG uint8_t upload_small_weather_2_31a67822608c43f695415b4825c28313_png_map[] = { 25 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x2b, 0x00, 0xff, 0xff, 0x9d, 0x00, 0xff, 0xff, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 26 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x59, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0x4a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 27 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x03, 0x00, 0xff, 0xff, 0x91, 0x00, 0xff, 0xff, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x5b, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 28 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x04, 0x00, 0xff, 0xff, 0xb1, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x13, 0x00, 0xff, 0xff, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x59, 0x00, 0xff, 0xff, 0x8e, 0x00, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0x00, 29 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x16, 0x00, 0xff, 0xff, 0xbb, 0x00, 0xff, 0xff, 0x54, 0x00, 0xff, 0xff, 0x27, 0x00, 0xff, 0xff, 0x79, 0x00, 0xff, 0xff, 0x9a, 0x00, 0xff, 0xff, 0x83, 0x00, 0xff, 0xff, 0x70, 0x00, 0xff, 0xff, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x4c, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xde, 0x00, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 30 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x78, 0x00, 0xff, 0xff, 0xe5, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xe4, 0x00, 0xff, 0xff, 0x5d, 0x00, 0xff, 0xff, 0x6b, 0x00, 0xff, 0xff, 0xa8, 0x00, 0xff, 0xff, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 31 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xd4, 0xd4, 0x06, 0xab, 0xec, 0xec, 0xcb, 0x59, 0xf5, 0xf5, 0xf8, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xfe, 0x00, 0xff, 0xff, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 32 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe6, 0xe6, 0xe6, 0x47, 0xe5, 0xe5, 0xe5, 0x81, 0xe4, 0xe6, 0xe6, 0xbf, 0xdf, 0xe6, 0xe6, 0xf9, 0xc6, 0xe8, 0xe8, 0xfd, 0xb9, 0xea, 0xea, 0xfe, 0x58, 0xf5, 0xf5, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xd5, 0x00, 0xff, 0xff, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 33 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdf, 0xdf, 0xdf, 0x10, 0xe5, 0xe5, 0xe5, 0x9a, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xd8, 0xe7, 0xe7, 0xfe, 0xb9, 0xea, 0xea, 0xfe, 0x58, 0xf5, 0xf5, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x06, 0x00, 0x00, 0x00, 0x00, 34 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x03, 0xe6, 0xe6, 0xe6, 0xa1, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xd8, 0xe6, 0xe6, 0xfe, 0xb7, 0xea, 0xea, 0xfe, 0x58, 0xf5, 0xf5, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xa8, 0x00, 0xff, 0xff, 0xa9, 0x00, 0xff, 0xff, 0xd2, 0x00, 0xff, 0xff, 0xb6, 35 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe6, 0xe6, 0xe6, 0x28, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe4, 0xe5, 0xe5, 0xff, 0xd6, 0xe7, 0xe7, 0xfe, 0xa2, 0xed, 0xed, 0xfc, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xfd, 0x00, 0xff, 0xff, 0x6e, 0x00, 0xff, 0xff, 0x84, 0x00, 0xff, 0xff, 0xc1, 0x00, 0xff, 0xff, 0x99, 36 | 0x00, 0x00, 0x00, 0x00, 0xe7, 0xe7, 0xe7, 0x20, 0xe5, 0xe5, 0xe5, 0xbc, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe4, 0xe5, 0xe5, 0xff, 0xd8, 0xe6, 0xe6, 0xff, 0xc6, 0xe8, 0xe8, 0xff, 0xd5, 0xe7, 0xe7, 0xff, 0xcf, 0xe7, 0xe7, 0xff, 0xb4, 0xea, 0xea, 0xec, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 37 | 0xe4, 0xe4, 0xe4, 0x13, 0xe5, 0xe5, 0xe5, 0xd4, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe4, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xdd, 0xe6, 0xe6, 0xdf, 0xd2, 0xe8, 0xe8, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 38 | 0xe6, 0xe6, 0xe6, 0x96, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xde, 0xdf, 0xdf, 0xdf, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 39 | 0xe4, 0xe4, 0xe4, 0xdd, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0x6a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 40 | 0xe6, 0xe6, 0xe6, 0xdc, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0x9f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 41 | 0xe4, 0xe4, 0xe4, 0xa2, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe6, 0xe6, 0xe6, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 42 | 0xe8, 0xe8, 0xe8, 0x21, 0xe6, 0xe6, 0xe6, 0xf0, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xec, 0xe7, 0xe7, 0xe7, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 43 | 0x00, 0x00, 0x00, 0x00, 0xe7, 0xe7, 0xe7, 0x49, 0xe5, 0xe5, 0xe5, 0xe8, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xec, 0xe7, 0xe7, 0xe7, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 44 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe4, 0xe4, 0xe4, 0x2f, 0xe5, 0xe5, 0xe5, 0xa8, 0xe4, 0xe4, 0xe4, 0xd3, 0xe5, 0xe5, 0xe5, 0xe9, 0xe6, 0xe6, 0xe6, 0xf0, 0xe5, 0xe5, 0xe5, 0xf1, 0xe5, 0xe5, 0xe5, 0xf2, 0xe5, 0xe5, 0xe5, 0xf1, 0xe5, 0xe5, 0xe5, 0xef, 0xe5, 0xe5, 0xe5, 0xf2, 0xe5, 0xe5, 0xe5, 0xf3, 0xe5, 0xe5, 0xe5, 0xf1, 0xe5, 0xe5, 0xe5, 0xe7, 0xe5, 0xe5, 0xe5, 0xd6, 0xe5, 0xe5, 0xe5, 0xb7, 0xe5, 0xe5, 0xe5, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 45 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xea, 0xea, 0xea, 0x0c, 0xe3, 0xe3, 0xe3, 0x1b, 0xe6, 0xe6, 0xe6, 0x3d, 0xe5, 0xe5, 0xe5, 0x44, 0xe6, 0xe6, 0xe6, 0x48, 0xe5, 0xe5, 0xe5, 0x4d, 0xe6, 0xe6, 0xe6, 0x48, 0xe4, 0xe4, 0xe4, 0x43, 0xe5, 0xe5, 0xe5, 0x4e, 0xe6, 0xe6, 0xe6, 0x51, 0xe6, 0xe6, 0xe6, 0x48, 0xe4, 0xe4, 0xe4, 0x2f, 0xe4, 0xe4, 0xe4, 0x1c, 0xe1, 0xe1, 0xe1, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 46 | }; 47 | 48 | const lv_image_dsc_t upload_small_weather_2_31a67822608c43f695415b4825c28313_png = { 49 | .header.cf = LV_COLOR_FORMAT_ARGB8888, 50 | .header.magic = LV_IMAGE_HEADER_MAGIC, 51 | .header.w = 22, 52 | .header.h = 21, 53 | .data_size = 462 * 4, 54 | .data = upload_small_weather_2_31a67822608c43f695415b4825c28313_png_map, 55 | }; 56 | -------------------------------------------------------------------------------- /weather_7/src/ui/GUI.h: -------------------------------------------------------------------------------- 1 | #ifndef _GUI_HEADER_INCLUDED 2 | #define _GUI_HEADER_INCLUDED 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | 9 | #if defined __has_include 10 | #if __has_include("lvgl.h") 11 | #include "lvgl.h" 12 | #elif __has_include("lvgl/lvgl.h") 13 | #include "lvgl/lvgl.h" 14 | #else 15 | #include "lvgl.h" 16 | #endif 17 | #else 18 | #include "lvgl.h" 19 | #endif 20 | #include "ui_helpers.h" 21 | 22 | #include "ui_theme_manager.h" 23 | 24 | #include "GUI_Themes.h" 25 | 26 | extern lv_obj_t* GUI_Screen__cont; 27 | extern lv_obj_t* GUI_Image__cont__background_img; 28 | extern lv_obj_t* GUI_Container__cont__current_status_cont; 29 | extern lv_obj_t* GUI_Image__cont__current_status_icon_img; 30 | LV_FONT_DECLARE( header_1 ); 31 | extern lv_obj_t* GUI_Label__cont__current_status_text_lbl; 32 | extern lv_obj_t* GUI_Container__cont__hourly_forecast_cont; 33 | extern lv_obj_t* GUI_Container__cont__hourly_forecast_title_cont; 34 | LV_FONT_DECLARE( title_1 ); 35 | extern lv_obj_t* GUI_Label__cont__hourly_forecast_title_lbl; 36 | extern lv_obj_t* GUI_Container__cont__hourly_forecast_items_cont; 37 | extern lv_obj_t* GUI_Container__cont__hourly_forecast_item_1_cont; 38 | LV_FONT_DECLARE( label_1 ); 39 | extern lv_obj_t* GUI_Label__cont__hourly_forecast_item_1_time_lbl; 40 | extern lv_obj_t* GUI_Image__cont__hourly_forecast_item_1_icon_img; 41 | extern lv_obj_t* GUI_Label__cont__hourly_forecast_item_1_temp_lbl; 42 | extern lv_obj_t* GUI_Container__cont__hourly_forecast_item_2_cont; 43 | extern lv_obj_t* GUI_Label__cont__hourly_forecast_item_2_time_lbl; 44 | extern lv_obj_t* GUI_Image__cont__hourly_forecast_item_2_icon_img; 45 | extern lv_obj_t* GUI_Label__cont__hourly_forecast_item_2_temp_lbl; 46 | extern lv_obj_t* GUI_Container__cont__hourly_forecast_item_3_cont; 47 | extern lv_obj_t* GUI_Label__cont__hourly_forecast_item_3_time_lbl; 48 | extern lv_obj_t* GUI_Image__cont__hourly_forecast_item_3_icon_img; 49 | extern lv_obj_t* GUI_Label__cont__hourly_forecast_item_3_temp_lbl; 50 | extern lv_obj_t* GUI_Container__cont__hourly_forecast_item_4_cont; 51 | extern lv_obj_t* GUI_Label__cont__hourly_forecast_item_4_time_lbl; 52 | extern lv_obj_t* GUI_Image__cont__hourly_forecast_item_4_icon_img; 53 | extern lv_obj_t* GUI_Label__cont__hourly_forecast_item_4_temp_lbl; 54 | extern lv_obj_t* GUI_Container__cont__daily_forecast_cont; 55 | extern lv_obj_t* GUI_Container__cont__daily_forecast_title_cont; 56 | extern lv_obj_t* GUI_Label__cont__daily_forecast_title_lbl; 57 | extern lv_obj_t* GUI_Container__cont__daily_forecast_items_cont; 58 | extern lv_obj_t* GUI_Container__cont__daily_forecast_monday_item_cont; 59 | extern lv_obj_t* GUI_Panel__cont__daily_forecast_monday_item_data_panel; 60 | LV_FONT_DECLARE( subtitle_1 ); 61 | extern lv_obj_t* GUI_Label__cont__daily_forecast_monday_item_day_lbl; 62 | extern lv_obj_t* GUI_Label__cont__daily_forecast_monday_item_temp_lbl; 63 | extern lv_obj_t* GUI_Label__cont__daily_forecast_monday_item_status_lbl; 64 | extern lv_obj_t* GUI_Container__cont__daily_forecast_tuesday_item_cont; 65 | extern lv_obj_t* GUI_Panel__cont__daily_forecast_tuesday_item_data_panel; 66 | extern lv_obj_t* GUI_Label__cont__daily_forecast_tuesday_item_day_lbl; 67 | extern lv_obj_t* GUI_Label__cont__daily_forecast_tuesday_item_temp_lbl; 68 | extern lv_obj_t* GUI_Label__cont__daily_forecast_tuesday_item_status_lbl; 69 | extern lv_obj_t* GUI_Container__cont__daily_forecast_wednesday_item_cont; 70 | extern lv_obj_t* GUI_Panel__cont__daily_forecast_wednesday_item_data_panel; 71 | extern lv_obj_t* GUI_Label__cont__daily_forecast_wednesday_item_day_lbl; 72 | extern lv_obj_t* GUI_Label__cont__daily_forecast_wednesday_item_temp_lbl; 73 | extern lv_obj_t* GUI_Label__cont__daily_forecast_wednesday_item_status_lbl; 74 | extern lv_obj_t* GUI_Container__cont__main_display_cont; 75 | LV_FONT_DECLARE( display_1 ); 76 | extern lv_obj_t* GUI_Label__cont__main_display_temp_lbl; 77 | extern lv_obj_t* GUI_Image__cont__main_display_icon_img; 78 | extern lv_obj_t* GUI_Container__cont__main_display_spacer_cont; 79 | extern lv_obj_t* GUI_Label__cont__main_display_title_lbl; 80 | extern lv_obj_t* GUI_Container__cont__details_cont; 81 | extern lv_obj_t* GUI_Container__cont__details_feels_like_cont; 82 | extern lv_obj_t* GUI_Label__cont__details_feels_like_title_lbl; 83 | extern lv_obj_t* GUI_Label__cont__details_feels_like_value_lbl; 84 | extern lv_obj_t* GUI_Panel__cont__details_separator_1_panel; 85 | extern lv_obj_t* GUI_Container__cont__details_humidity_cont; 86 | extern lv_obj_t* GUI_Label__cont__details_humidity_title_lbl; 87 | extern lv_obj_t* GUI_Label__cont__details_humidity_value_lbl; 88 | extern lv_obj_t* GUI_Panel__cont__details_separator_2_panel; 89 | extern lv_obj_t* GUI_Container__cont__details_wind_cont; 90 | extern lv_obj_t* GUI_Label__cont__details_wind_title_lbl; 91 | extern lv_obj_t* GUI_Container__cont__details_wind_value_cont; 92 | extern lv_obj_t* GUI_Label__cont__details_wind_speed_lbl; 93 | extern lv_obj_t* GUI_Label__cont__details_wind_unit_lbl; 94 | extern lv_obj_t* GUI_Container__cont__indoor_stats_cont; 95 | extern lv_obj_t* GUI_Container__cont__indoor_stats_primary_cont; 96 | extern lv_obj_t* GUI_Container__cont__indoor_stats_temp_cont; 97 | extern lv_obj_t* GUI_Label__cont__indoor_stats_temp_title_lbl; 98 | LV_FONT_DECLARE( number_1 ); 99 | extern lv_obj_t* GUI_Label__cont__indoor_stats_temp_value_lbl; 100 | extern lv_obj_t* GUI_Container__cont__indoor_stats_humidity_cont; 101 | extern lv_obj_t* GUI_Label__cont__indoor_stats_humidity_title_lbl; 102 | extern lv_obj_t* GUI_Label__cont__indoor_stats_humidity_value_lbl; 103 | extern lv_obj_t* GUI_Container__cont__indoor_stats_air_quality_cont; 104 | extern lv_obj_t* GUI_Container__cont__indoor_stats_air_quality_display_cont; 105 | extern lv_obj_t* GUI_Panel__cont__indoor_stats_air_quality_title_panel; 106 | extern lv_obj_t* GUI_Label__cont__indoor_stats_air_quality_title_lbl; 107 | extern lv_obj_t* GUI_Panel__cont__indoor_stats_air_quality_value_panel; 108 | extern lv_obj_t* GUI_Label__cont__indoor_stats_air_quality_value_lbl; 109 | extern lv_obj_t* GUI_Container__cont__indoor_stats_air_quality_details_cont; 110 | extern lv_obj_t* GUI_Container__cont__indoor_stats_air_quality_header_cont; 111 | extern lv_obj_t* GUI_Label__cont__indoor_stats_air_quality_gap_title_lbl; 112 | extern lv_obj_t* GUI_Label__cont__indoor_stats_air_quality_gap_value_lbl; 113 | extern lv_obj_t* GUI_Container__cont__indoor_stats_air_quality_slider_area_cont; 114 | extern lv_obj_t* GUI_Container__cont__indoor_stats_air_quality_range_lbl_cont; 115 | extern lv_obj_t* GUI_Label__cont__indoor_stats_air_quality_low_lbl; 116 | extern lv_obj_t* GUI_Label__cont__indoor_stats_air_quality_medium_lbl; 117 | extern lv_obj_t* GUI_Label__cont__indoor_stats_air_quality_high_lbl; 118 | extern lv_obj_t* GUI_Slider__cont__indoor_stats_air_quality_slider; 119 | extern lv_obj_t* GUI_Container__cont__alert_cont; 120 | extern lv_obj_t* GUI_Image__cont__alert_icon_img; 121 | extern lv_obj_t* GUI_Container__cont__alert_text_cont; 122 | extern lv_obj_t* GUI_Label__cont__alert_title_lbl; 123 | extern lv_obj_t* GUI_Label__cont__alert_message_lbl; 124 | 125 | 126 | // Screen-specific function declarations 127 | void GUI_initScreen__cont (); 128 | void GUI_initScreenTexts__cont (); 129 | void GUI_initScreenStyles__cont (); 130 | 131 | extern lv_style_t GUI_Style__class_8rQJj2WR7KS5BW__; 132 | extern lv_style_t GUI_Style__class_kL3MCphSm1zdhB__; 133 | extern lv_style_t GUI_Style__class_OWp7o3fr8u7nZG__; 134 | extern lv_style_t GUI_Style__class_E4wegkc5VJFKsz__; 135 | extern lv_style_t GUI_Style__class_RGR5O50FZk8MjD__; 136 | extern lv_style_t GUI_Style__class_NHMYIepongiLxJ__; 137 | extern lv_style_t GUI_Style__class_bnXaTUcRtszjic__; 138 | extern lv_style_t GUI_Style__class_e1RJqKV5YEtyLL__; 139 | extern lv_style_t GUI_Style__class_z1zvszPSytj7GK__; 140 | extern lv_style_t GUI_Style__class_SqnJ2yTfN70m5F__; 141 | extern lv_style_t GUI_Style__class_Sl2id12bl9NQMv__; 142 | extern lv_style_t GUI_Style__class_Yoie1JkY7ut7dR__; 143 | extern lv_style_t GUI_Style__class_9V6WvrW17HbJD1__; 144 | extern lv_style_t GUI_Style__class_uctqe13XSbRVrf__; 145 | extern lv_style_t GUI_Style__class_CrXq0J1lzKaWzo__; 146 | extern lv_style_t GUI_Style__class_yL6megXhm9GYb7__; 147 | extern lv_style_t GUI_Style__class_4FP9fwNC3Jfkoc__; 148 | extern lv_style_t GUI_Style__class_wWU5ITomt2XhrC__; 149 | extern lv_style_t GUI_Style__class_N6QjKxi1tUPVcv__; 150 | extern lv_style_t GUI_Style__class_OKWBnOvOGtNUNv__; 151 | extern lv_style_t GUI_Style__class_WhQHp8mtjRM1Z6__; 152 | extern lv_style_t GUI_Style__class_6Zqyl1PAzGby72__; 153 | extern lv_style_t GUI_Style__class_P20EIfA3luXdY3__; 154 | extern lv_style_t GUI_Style__class_mGTxkagT6y6pNF__; 155 | extern lv_style_t GUI_Style__class_QtBH9YSEMkGaW1__; 156 | extern lv_style_t GUI_Style__class_wlkSJFhc3canUg__; 157 | extern lv_style_t GUI_Style__class_E4t2gqcHR8MbAP__; 158 | extern lv_style_t GUI_Style__class_XwvnqhCeV2aoM1__; 159 | extern lv_style_t GUI_Style__class_1w85YzMTP9d5q4__; 160 | extern lv_style_t GUI_Style__class_j3PIJOujL57xFq__; 161 | extern lv_style_t GUI_Style__class_DaDvAetiVI0Sy4__; 162 | extern lv_style_t GUI_Style__class_sI3TdUhM0WS1Zb__; 163 | extern lv_style_t GUI_Style__class_f9uFiY7jL0YFTZ__; 164 | extern lv_style_t GUI_Style__class_tpmJOiEkbfWCQ5__; 165 | extern lv_style_t GUI_Style__class_NqL7LHebj5jnE1__; 166 | extern lv_style_t GUI_Style__class_MNThGQl2quXcmK__; 167 | extern lv_style_t GUI_Style__class_l2KF3gLqvrvgNA__; 168 | extern lv_style_t GUI_Style__class_S38iEdXYHp1zFH__; 169 | extern lv_style_t GUI_Style__class_l05DXbHrWKpOYP__; 170 | extern lv_style_t GUI_Style__class_dlCXVJg3k6UwKj__; 171 | extern lv_style_t GUI_Style__class_UthKrP17uaRpGr__; 172 | extern lv_style_t GUI_Style__class_7TxYpcbJKqrqzb__; 173 | extern lv_style_t GUI_Style__class_fMZLS649q9lJQi__; 174 | extern lv_style_t GUI_Style__class_Jw5auITeCyGC1B__; 175 | extern lv_style_t GUI_Style__class_3kssyjEdbcCLSh__; 176 | extern lv_style_t GUI_Style__class_JC5FT5PPZmgeAd__; 177 | extern lv_style_t GUI_Style__class_z6I6jhPHmAziTD__; 178 | extern lv_style_t GUI_Style__class_u3dHPTQfScNGqf__; 179 | extern lv_style_t GUI_Style__class_Kv9aIdJXPzd4E0__; 180 | extern lv_style_t GUI_Style__class_d6oNFVfxUQNLTp__; 181 | extern lv_style_t GUI_Style__class_330bxbZF7kZsG8__; 182 | extern lv_style_t GUI_Style__class_aB5O6v8av05RG3__; 183 | extern lv_style_t GUI_Style__class_3gzB3jg0wffHq2__; 184 | extern lv_style_t GUI_Style__class_2dmVS6KVV9M8t4__; 185 | extern lv_style_t GUI_Style__class_Pjj7UmgHuETrFH__; 186 | extern lv_style_t GUI_Style__class_lWoRmnbHxdxX1R__; 187 | extern lv_style_t GUI_Style__class_NYOlN6CAjXN9ct__; 188 | extern lv_style_t GUI_Style__class_gV4odhky0u7lrc__; 189 | extern lv_style_t GUI_Style__class_lVmv26isUUbrTV__; 190 | extern lv_style_t GUI_Style__class_Kq3Mw0nOQ4bmih__; 191 | extern lv_style_t GUI_Style__class_xxhbZyQuM4W5a0__; 192 | extern lv_style_t GUI_Style__class_rORFbD8iFMPP1h__; 193 | extern lv_style_t GUI_Style__class_z5KKKSCX8HvB2b__; 194 | extern lv_style_t GUI_Style__class_AYPupaF3KarTJN__; 195 | extern lv_style_t GUI_Style__class_S3sy9bpI49A3HI__; 196 | extern lv_style_t GUI_Style__class_2hdOb8fjSaLxHS__; 197 | extern lv_style_t GUI_Style__class_Q3FYyHHZdNIPFL__; 198 | extern lv_style_t GUI_Style__class_4CH5toICFW9I39__; 199 | extern lv_style_t GUI_Style__class_FOyhSAD3uzjelO__; 200 | extern lv_style_t GUI_Style__class_HhXjRiqCm3yqaP__; 201 | extern lv_style_t GUI_Style__class_jFHXUVfU7O2fDs__; 202 | extern lv_style_t GUI_Style__class_EpPa3IwZL2z8XC__; 203 | extern lv_style_t GUI_Style__class_omL70ju4I8KjJb__; 204 | extern lv_style_t GUI_Style__class_C9LNZClr6DQlR7__; 205 | extern lv_style_t GUI_Style__class_i4iutar91dNdNN__; 206 | extern lv_style_t GUI_Style__class_ExbBIkHP328YgN__; 207 | extern lv_style_t GUI_Style__class_i5pavOZ9Sk9FhX__; 208 | extern lv_style_t GUI_Style__class_kTo6PU445jhsJh__; 209 | extern lv_style_t GUI_Style__class_YICAG2c7DumoUx__; 210 | extern lv_style_t GUI_Style__class_L7ACd19ZSOmkfm__; 211 | extern lv_style_t GUI_Style__class_cnRipu8Qpup4cw__; 212 | extern lv_style_t GUI_Style__class_Jlp2zZ20kBQEty__; 213 | extern lv_style_t GUI_Style__class_0gni4cQw4iYD9n__; 214 | extern lv_style_t GUI_Style__class_kozKKjL0gOY0dw__; 215 | 216 | 217 | void GUI_load (); 218 | 219 | void GUI_init (); 220 | 221 | void GUI_refresh (); 222 | 223 | 224 | void GUI_initHAL (); 225 | void HAL_init (); 226 | 227 | void GUI_initFramework (); 228 | 229 | void GUI_loadContent (); 230 | 231 | 232 | void GUI_initContent (); 233 | 234 | 235 | void GUI_initTheme (); 236 | 237 | 238 | void GUI_initScreens (); 239 | 240 | 241 | void GUI_loadFirstScreen (); 242 | 243 | 244 | void GUI_initScreenContents (); 245 | 246 | void GUI_initScreenTexts (); 247 | 248 | void GUI_initScreenStyles (); 249 | 250 | 251 | void GUI_initGlobalStyles (); 252 | 253 | 254 | void GUI_initAnimations (); 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | #ifdef __cplusplus 263 | } //extern "C" 264 | #endif 265 | 266 | #endif //_GUI_HEADER_INCLUDED 267 | 268 | LV_IMG_DECLARE( upload_small_weather_2_31a67822608c43f695415b4825c28313_png ); 269 | LV_IMG_DECLARE( upload_alert2_9e8b60d4068c4bac9c241b5b1cb5c158_png ); 270 | LV_IMG_DECLARE( upload_cloud_39745fd7aedb4c2aa29e768a41291e4d_png ); 271 | LV_IMG_DECLARE( upload_bg5_88ea15d971da48d8ad0a42f710ed7d4e_png ); 272 | -------------------------------------------------------------------------------- /weather_13/src/ui/GUI.h: -------------------------------------------------------------------------------- 1 | #ifndef _GUI_HEADER_INCLUDED 2 | #define _GUI_HEADER_INCLUDED 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | 9 | #if defined __has_include 10 | #if __has_include("lvgl.h") 11 | #include "lvgl.h" 12 | #elif __has_include("lvgl/lvgl.h") 13 | #include "lvgl/lvgl.h" 14 | #else 15 | #include "lvgl.h" 16 | #endif 17 | #else 18 | #include "lvgl.h" 19 | #endif 20 | #include "ui_helpers.h" 21 | 22 | #include "ui_theme_manager.h" 23 | 24 | #include "GUI_Themes.h" 25 | 26 | extern lv_obj_t* GUI_Screen__main_screen; 27 | extern lv_obj_t* GUI_Container__main_screen__layout_cont; 28 | extern lv_obj_t* GUI_Container__main_screen__forecast_column_cont; 29 | extern lv_obj_t* GUI_Panel__main_screen__forecast_current_panel; 30 | LV_FONT_DECLARE( title_1 ); 31 | extern lv_obj_t* GUI_Label__main_screen__forecast_current_status_lbl; 32 | extern lv_obj_t* GUI_Image__main_screen__forecast_current_icon_img; 33 | extern lv_obj_t* GUI_Panel__main_screen__forecast_separator_1_panel; 34 | extern lv_obj_t* GUI_Panel__main_screen__forecast_hourly_panel; 35 | extern lv_obj_t* GUI_Container__main_screen__forecast_hourly_title_cont; 36 | LV_FONT_DECLARE( header_1 ); 37 | extern lv_obj_t* GUI_Label__main_screen__forecast_hourly_title_lbl; 38 | extern lv_obj_t* GUI_Container__main_screen__forecast_hourly_items_cont; 39 | extern lv_obj_t* GUI_Container__main_screen__forecast_hourly_item_1_cont; 40 | LV_FONT_DECLARE( label_1 ); 41 | extern lv_obj_t* GUI_Label__main_screen__forecast_hourly_item_1_time_lbl; 42 | extern lv_obj_t* GUI_Image__main_screen__forecast_hourly_item_1_icon_img; 43 | extern lv_obj_t* GUI_Label__main_screen__forecast_hourly_item_1_temp_lbl; 44 | extern lv_obj_t* GUI_Container__main_screen__forecast_hourly_item_2_cont; 45 | extern lv_obj_t* GUI_Label__main_screen__forecast_hourly_item_2_time_lbl; 46 | extern lv_obj_t* GUI_Image__main_screen__forecast_hourly_item_2_icon_img; 47 | extern lv_obj_t* GUI_Label__main_screen__forecast_hourly_item_2_temp_lbl; 48 | extern lv_obj_t* GUI_Container__main_screen__forecast_hourly_item_3_cont; 49 | extern lv_obj_t* GUI_Label__main_screen__forecast_hourly_item_3_time_lbl; 50 | extern lv_obj_t* GUI_Image__main_screen__forecast_hourly_item_3_icon_img; 51 | extern lv_obj_t* GUI_Label__main_screen__forecast_hourly_item_3_temp_lbl; 52 | extern lv_obj_t* GUI_Container__main_screen__forecast_hourly_item_4_cont; 53 | extern lv_obj_t* GUI_Label__main_screen__forecast_hourly_item_4_time_lbl; 54 | extern lv_obj_t* GUI_Image__main_screen__forecast_hourly_item_4_icon_img; 55 | extern lv_obj_t* GUI_Label__main_screen__forecast_hourly_item_4_temp_lbl; 56 | extern lv_obj_t* GUI_Panel__main_screen__forecast_separator_2_panel; 57 | extern lv_obj_t* GUI_Panel__main_screen__forecast_daily_panel; 58 | extern lv_obj_t* GUI_Container__main_screen__forecast_daily_title_cont; 59 | extern lv_obj_t* GUI_Label__main_screen__forecast_daily_title_lbl; 60 | extern lv_obj_t* GUI_Container__main_screen__forecast_daily_items_cont; 61 | extern lv_obj_t* GUI_Container__main_screen__forecast_daily_item_1_cont; 62 | extern lv_obj_t* GUI_Label__main_screen__forecast_daily_item_1_day_lbl; 63 | LV_FONT_DECLARE( small_titla_1 ); 64 | extern lv_obj_t* GUI_Label__main_screen__forecast_daily_item_1_temp_lbl; 65 | extern lv_obj_t* GUI_Panel__main_screen__forecast_daily_separator_1_panel; 66 | extern lv_obj_t* GUI_Container__main_screen__forecast_daily_item_2_cont; 67 | extern lv_obj_t* GUI_Label__main_screen__forecast_daily_item_2_day_lbl; 68 | extern lv_obj_t* GUI_Label__main_screen__forecast_daily_item_2_temp_lbl; 69 | extern lv_obj_t* GUI_Panel__main_screen__forecast_daily_separator_2_panel; 70 | extern lv_obj_t* GUI_Container__main_screen__forecast_daily_item_3_cont; 71 | extern lv_obj_t* GUI_Label__main_screen__forecast_daily_item_3_day_lbl; 72 | extern lv_obj_t* GUI_Label__main_screen__forecast_daily_item_3_temp_lbl; 73 | extern lv_obj_t* GUI_Panel__main_screen__current_day_panel; 74 | extern lv_obj_t* GUI_Label__main_screen__current_day_city_lbl; 75 | extern lv_obj_t* GUI_Label__main_screen__current_day_date_lbl; 76 | extern lv_obj_t* GUI_Label__main_screen__current_day_weekday_lbl; 77 | LV_FONT_DECLARE( big_number_1 ); 78 | extern lv_obj_t* GUI_Label__main_screen__current_day_temp_lbl; 79 | extern lv_obj_t* GUI_Panel__main_screen__current_day_status_wrapper_panel; 80 | extern lv_obj_t* GUI_Label__main_screen__current_day_status_lbl; 81 | extern lv_obj_t* GUI_Container__main_screen__details_column_cont; 82 | extern lv_obj_t* GUI_Panel__main_screen__details_outdoor_panel; 83 | extern lv_obj_t* GUI_Container__main_screen__details_outdoor_humidity_cont; 84 | extern lv_obj_t* GUI_Label__main_screen__details_outdoor_humidity_title_lbl; 85 | extern lv_obj_t* GUI_Label__main_screen__details_outdoor_humidity_value_lbl; 86 | extern lv_obj_t* GUI_Label__main_screen__details_outdoor_humidity_range_lbl; 87 | extern lv_obj_t* GUI_Container__main_screen__details_outdoor_wind_cont; 88 | extern lv_obj_t* GUI_Label__main_screen__details_outdoor_wind_title_lbl; 89 | extern lv_obj_t* GUI_Label__main_screen__details_outdoor_wind_value_lbl; 90 | extern lv_obj_t* GUI_Label__main_screen__details_outdoor_wind_unit_lbl; 91 | extern lv_obj_t* GUI_Panel__main_screen__details_separator_panel; 92 | extern lv_obj_t* GUI_Panel__main_screen__details_indoor_panel; 93 | extern lv_obj_t* GUI_Container__main_screen__details_indoor_display_cont; 94 | extern lv_obj_t* GUI_Container__main_screen__details_indoor_data_cont; 95 | extern lv_obj_t* GUI_Container__main_screen__details_indoor_title_cont; 96 | extern lv_obj_t* GUI_Label__main_screen__details_indoor_title_lbl; 97 | extern lv_obj_t* GUI_Container__main_screen__details_indoor_metrics_cont; 98 | extern lv_obj_t* GUI_Label__main_screen__details_indoor_temp_value_lbl; 99 | extern lv_obj_t* GUI_Label__main_screen__details_indoor_air_quality_title_lbl; 100 | extern lv_obj_t* GUI_Panel__main_screen__details_indoor_air_quality_separator_panel; 101 | extern lv_obj_t* GUI_Label__main_screen__details_indoor_air_quality_value_lbl; 102 | extern lv_obj_t* GUI_Image__main_screen__details_indoor_room_img; 103 | extern lv_obj_t* GUI_Container__main_screen__details_indoor_controls_cont; 104 | extern lv_obj_t* GUI_Container__main_screen__details_indoor_temp_control_cont; 105 | extern lv_obj_t* GUI_Image__main_screen__details_indoor_temp_icon_img; 106 | extern lv_obj_t* GUI_Bar__main_screen__details_indoor_temp_indicator_bar; 107 | extern lv_obj_t* GUI_Container__main_screen__details_indoor_humidity_control_cont; 108 | extern lv_obj_t* GUI_Image__main_screen__details_indoor_humidity_icon_img; 109 | extern lv_obj_t* GUI_Bar__main_screen__details_indoor_humidity_indicator_bar; 110 | extern lv_obj_t* GUI_Container__main_screen__details_indoor_fan_control_cont; 111 | extern lv_obj_t* GUI_Image__main_screen__details_indoor_fan_icon_img; 112 | extern lv_obj_t* GUI_Bar__main_screen__details_indoor_fan_indicator_bar; 113 | extern lv_obj_t* GUI_Panel__main_screen__alert_banner_panel; 114 | extern lv_obj_t* GUI_Image__main_screen__alert_icon_img; 115 | extern lv_obj_t* GUI_Container__main_screen__alert_text_cont; 116 | extern lv_obj_t* GUI_Label__main_screen__alert_title_lbl; 117 | extern lv_obj_t* GUI_Label__main_screen__alert_details_lbl; 118 | 119 | 120 | // Screen-specific function declarations 121 | void GUI_initScreen__main_screen (); 122 | void GUI_initScreenTexts__main_screen (); 123 | void GUI_initScreenStyles__main_screen (); 124 | 125 | extern lv_style_t GUI_Style__class_rLwCgGpiuHaI5t__; 126 | extern lv_style_t GUI_Style__class_30q1uUBE4V7tEw__; 127 | extern lv_style_t GUI_Style__class_4dBfZy3cC8dwt1__; 128 | extern lv_style_t GUI_Style__class_d67KdfOh0xYgra__; 129 | extern lv_style_t GUI_Style__class_efvJHE3IVkk8cp__; 130 | extern lv_style_t GUI_Style__class_O62xyeqWplfGyC__; 131 | extern lv_style_t GUI_Style__class_Ts8CMzC0OygGMy__; 132 | extern lv_style_t GUI_Style__class_pXhAlK5D7SJRVC__; 133 | extern lv_style_t GUI_Style__class_zVq5RtUETsvwOF__; 134 | extern lv_style_t GUI_Style__class_dJWzWjB2kDFTuO__; 135 | extern lv_style_t GUI_Style__class_WCBZDgY2t6PmLE__; 136 | extern lv_style_t GUI_Style__class_TKcq1KUXp4WFil__; 137 | extern lv_style_t GUI_Style__class_XebdxV5kmVe4DX__; 138 | extern lv_style_t GUI_Style__class_COz6FozwVvaqNe__; 139 | extern lv_style_t GUI_Style__class_30gh17XfxCvFQy__; 140 | extern lv_style_t GUI_Style__class_CkLFSgPtf6Bl0N__; 141 | extern lv_style_t GUI_Style__class_MmlHHAG8DlXwM7__; 142 | extern lv_style_t GUI_Style__class_Zk1yuQLgxLzKb2__; 143 | extern lv_style_t GUI_Style__class_RaQFqoyffnhcrh__; 144 | extern lv_style_t GUI_Style__class_lKs8xCagJV4AW9__; 145 | extern lv_style_t GUI_Style__class_jl3LjjzbYQVlsj__; 146 | extern lv_style_t GUI_Style__class_9bUt7PyXQDnufp__; 147 | extern lv_style_t GUI_Style__class_bUBrVDK2XXg27v__; 148 | extern lv_style_t GUI_Style__class_abpsloLXKTBXIw__; 149 | extern lv_style_t GUI_Style__class_pS5LfAKHz1U1w8__; 150 | extern lv_style_t GUI_Style__class_qzLjyJvIzcRKvx__; 151 | extern lv_style_t GUI_Style__class_UpVFH1pAorlgkM__; 152 | extern lv_style_t GUI_Style__class_JazfWqxFROS2ut__; 153 | extern lv_style_t GUI_Style__class_zvtRN4uOLIt5y7__; 154 | extern lv_style_t GUI_Style__class_PVbJEEenkxqdEX__; 155 | extern lv_style_t GUI_Style__class_K1LjYJMIZwKYwX__; 156 | extern lv_style_t GUI_Style__class_oX5Q6RH4Nh59QY__; 157 | extern lv_style_t GUI_Style__class_Mr1NLF2gCtBbZ3__; 158 | extern lv_style_t GUI_Style__class_TgKiKSYv9T45GL__; 159 | extern lv_style_t GUI_Style__class_14T0GZGasUtdQz__; 160 | extern lv_style_t GUI_Style__class_qlKBHC1b3neUJs__; 161 | extern lv_style_t GUI_Style__class_K0hCcfgu1eLcCJ__Light_Panel; 162 | extern lv_style_t GUI_Style__class_JLnOH13L9xFOxA__; 163 | extern lv_style_t GUI_Style__class_YBAk3AT2jXGwju__; 164 | extern lv_style_t GUI_Style__class_RG35kwvmHdRq5V__; 165 | extern lv_style_t GUI_Style__class_PVJ556qdocL6mb__; 166 | extern lv_style_t GUI_Style__class_z0k4lDZdSbClTN__; 167 | extern lv_style_t GUI_Style__class_Qrxz25380oNljV__; 168 | extern lv_style_t GUI_Style__class_B3ho2rNB4rNaDW__; 169 | extern lv_style_t GUI_Style__class_sGqngSUzbyIPox__; 170 | extern lv_style_t GUI_Style__class_TAi4FT1aO41nlI__; 171 | extern lv_style_t GUI_Style__class_hEcwNv6F6wZAxH__; 172 | extern lv_style_t GUI_Style__class_Cv0JPabmyPw8eB__; 173 | extern lv_style_t GUI_Style__class_7oxN5VBtl0eoDO__; 174 | extern lv_style_t GUI_Style__class_pR7cwMnOLj77Co__; 175 | extern lv_style_t GUI_Style__class_pXXsoewqlUF912__; 176 | extern lv_style_t GUI_Style__class_9Sa5zoIIvnTiSd__; 177 | extern lv_style_t GUI_Style__class_nsmjYpWbtgmLWN__; 178 | extern lv_style_t GUI_Style__class_oUye0Q5y6pK8kM__; 179 | extern lv_style_t GUI_Style__class_NbBK7LANXxBxwp__; 180 | extern lv_style_t GUI_Style__class_tAXKNidGSVQjcH__; 181 | extern lv_style_t GUI_Style__class_c7N70YnXjXDaFa__; 182 | extern lv_style_t GUI_Style__class_ayOWyuftyHeHRr__; 183 | extern lv_style_t GUI_Style__class_xpoiNhi6AftotQ__; 184 | extern lv_style_t GUI_Style__class_8LHElSnO6Hux2d__; 185 | extern lv_style_t GUI_Style__class_JEUvdihGK3D2T2__; 186 | extern lv_style_t GUI_Style__class_xZ1DYGsn078O2f__; 187 | extern lv_style_t GUI_Style__class_LQMfXcQ7GloRPo__; 188 | extern lv_style_t GUI_Style__class_GZPVvrC6KUJYs3__; 189 | extern lv_style_t GUI_Style__class_MATAkwvgfjxcHp__; 190 | extern lv_style_t GUI_Style__class_ImN60rH27aiXIx__; 191 | extern lv_style_t GUI_Style__class_5g3yUcjLvpNIwP__; 192 | extern lv_style_t GUI_Style__class_ixeuHuB9l2UC2a__; 193 | extern lv_style_t GUI_Style__class_yb5DuJX0oTMbae__; 194 | extern lv_style_t GUI_Style__class_UuzaOplsX0JN4w__; 195 | extern lv_style_t GUI_Style__class_ShZuRMufwv3M1V__; 196 | extern lv_style_t GUI_Style__class_0OiSTq0GXV09iF__; 197 | extern lv_style_t GUI_Style__class_qxKfqFKUMlnbQg__; 198 | extern lv_style_t GUI_Style__class_mGMwQDCVAfRmXv__; 199 | extern lv_style_t GUI_Style__class_agK5hlOaxQuyi6__; 200 | extern lv_style_t GUI_Style__class_elqZRytK812bkq__; 201 | extern lv_style_t GUI_Style__class_eu9eLToI0iUK3c__; 202 | extern lv_style_t GUI_Style__class_id18G0qqvrE58I__; 203 | extern lv_style_t GUI_Style__class_J9prjMDYKgRk5E__; 204 | extern lv_style_t GUI_Style__class_EHTydUqAI35xzG__; 205 | extern lv_style_t GUI_Style__class_HVI4YSNhbbBijJ__; 206 | extern lv_style_t GUI_Style__class_Mvbw7wohXoI3rF__; 207 | 208 | 209 | void GUI_load (); 210 | 211 | void GUI_init (); 212 | 213 | void GUI_refresh (); 214 | 215 | 216 | void GUI_initHAL (); 217 | void HAL_init (); 218 | 219 | void GUI_initFramework (); 220 | 221 | void GUI_loadContent (); 222 | 223 | 224 | void GUI_initContent (); 225 | 226 | 227 | void GUI_initTheme (); 228 | 229 | 230 | void GUI_initScreens (); 231 | 232 | 233 | void GUI_loadFirstScreen (); 234 | 235 | 236 | void GUI_initScreenContents (); 237 | 238 | void GUI_initScreenTexts (); 239 | 240 | void GUI_initScreenStyles (); 241 | 242 | 243 | void GUI_initGlobalStyles (); 244 | 245 | 246 | void GUI_initAnimations (); 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | #ifdef __cplusplus 255 | } //extern "C" 256 | #endif 257 | 258 | #endif //_GUI_HEADER_INCLUDED 259 | 260 | LV_IMG_DECLARE( upload_small_weather_087205a4d421466ea34264aed5676a0a_png ); 261 | LV_IMG_DECLARE( upload_temp_a6542b73daec4eaaac6a3d9b6729be03_png ); 262 | LV_IMG_DECLARE( upload_cloud_e0a1a1b786a74673a80ec34e91c7a0c5_png ); 263 | LV_IMG_DECLARE( upload_fan_f58335df51f940da8686fe1402df28e2_png ); 264 | LV_IMG_DECLARE( upload_humi_479a980bbd324940bbd291ab8d342bd8_png ); 265 | LV_IMG_DECLARE( upload_alert2_a6a5f34213dd46e39f825314c3cfcb02_png ); 266 | LV_IMG_DECLARE( upload_room3_cdef742273434532bf16968433bf89ca_png ); 267 | --------------------------------------------------------------------------------