Zum Inhalt springen

Fusion/Entwicklung/en

Aus WetterCube Wiki
Dies ist die englische Fassung. Zur deutschen Fassung

Repository layout

File / folder Content
CMakeLists.txt, main/ ESP-IDF project; main/main.cpp is the entry point (app_main(): start NVS, then starten() from src/app/app.cpp); src/platform/ is the small compatibility layer for the former Arduino names
sdkconfig.defaults, sdkconfig.defaults.esp32s3, sdkconfig.defaults.esp32p4 common and chip-specific settings (P4 draft, not tried on the board yet)
partitions.csv, partitions_p4.csv partition tables (S3: 16 MB flash, 2 × almost 8 MB OTA slots; P4: 32 MB, 2 × 10 MB)
conf/lv_conf.h LVGL configuration (project copy)
src/board/, src/hardware/, src/display/ board layer (board.h; board/s3/ RGB panel, I²C, IO expander, SD over SPI; board/p4/ MIPI-DSI, PWM brightness, SDMMC), shared GT911 touch driver and LVGL glue
src/app/ navigation, data (data_*.cpp), UI (ui_*.cpp), web UI, update (ota.cpp), network task (app.cpp)
src/ui/ PicoPixel export of the UI (LVGL 8, 1024×600)
tools/ deploy_ui.sh, icons_code.py, wetter_icons.py, anim_pack.py, flash_usb.py, notfall_snap.py
assets/ logo, roadmap graphic, teaser, icons (icons/weather/: weather icons for the display; icons/meteocons/: sensor icons as PNG)
docs/ GitHub Pages: web installer, version.json, manifest.json, firmware/*.bin
CHANGELOG.md / CHANGELOG.en.md changes (bilingual)

Building

Install ESP-IDF 5.5.x (git clone --branch v5.5.5 --recursive https://github.com/espressif/esp-idf.git ~/esp/esp-idf-v5.5.5 && cd ~/esp/esp-idf-v5.5.5 && ./install.sh esp32s3,esp32p4), then:

bash build.sh                       # build (target esp32s3; the first time the component manager downloads LVGL, ArduinoJson and mdns)
bash build.sh flash /dev/cu.xxx     # build and flash (port from ls /dev/cu.*)
bash build.sh recovery              # build the recovery app (recovery/build/recovery.bin), before flashing
bash build.sh clean                 # after changes to sdkconfig.defaults*
PCLK=40 bash build.sh               # pixel clock in MHz (S3: default 30 = 33 frames/s; at 15 MHz = 16 Hz the panel visibly flickers, clocks that are too high give stripes when WiFi, web interface and display need the PSRAM at the same time)
TARGET=esp32p4 bash build.sh        # other target

Important settings on the S3 (sdkconfig.defaults.esp32s3): flash and PSRAM 120 MHz, code in PSRAM, LCD_RGB_ISR_IRAM_SAFE (the picture keeps running during flash writes), 64 KB data cache, TLS buffers in PSRAM, Wi-Fi and LWIP buffers in internal RAM (in PSRAM they steal bandwidth from the display and cause stripes), Wi-Fi code without IRAM optimisation (saves about 15 to 20 KB). In CMakeLists.txt: -DLODEPNG_NO_COMPILE_ALLOCATORS (PNG decoding in PSRAM).

Recovery app (recovery/)

A project of its own in pure ESP-IDF (no Arduino): display, touch and the LVGL port come from src/ (with recovery/shim/Arduino.h for delay() and millis(); the main firmware has src/platform/Arduino.h for that), the UI is built in code in recovery/main/ui.cpp. It runs from the factory partition (1.5 MB, the app is about 0.6 MB) and uses the same partition table (../partitions.csv).

Development tools: bash build.sh recovery -DNOTFALL_SNAPSHOT=1 prints every screen at half size as text on the serial port (python3 tools/notfall_snap.py PORT /tmp/nf 60 --reset turns it into PNGs) and accepts keys as characters (1 firmware, 2 complete, 3 only reset, 4 normal, k/a/b source, j/n yes/no, z back); with -DNOTFALL_DEMO=1 it also shows all screens with sample data. The rollback can be checked with TESTHANG=1 TESTVERSION=9.9.9-test bash build.sh (builds a deliberately hanging firmware; afterwards run bash build.sh without the variables).

Pure ESP-IDF (since v0.6.0)

Arduino-ESP32 is removed. The application keeps using the familiar names, which src/platform/ maps onto ESP-IDF: WiFi → esp_wifi (on the P4 via esp_wifi_remote), HTTPClient → esp_http_client with the certificate bundle, WebServer → esp_http_server, DNSServer → an own DNS responder for the captive portal, Preferences → nvs_flash (same types), ESPmDNS → mdns, Update → esp_ota_*, String → an own class on std::string, time → SNTP; ArduinoJson stays (plain C++ library).

Memory (ESP32-S3)

Internal RAM (about 320 KB usable): variables, heap (Wi-Fi), stacks, LVGL draw buffer (20 lines), RGB bounce buffer, 64 KB cache; about 65 KB free after start. PSRAM (8 MB): framebuffer (1.2 MB), program code, LVGL pool (192 KB), TLS buffers, map image, large downloads (about 3 MB free after start). Flash (16 MB): program, images, fonts, settings. The warning map needs about 3 MB contiguous in PSRAM while decoding; the old map is therefore freed first.

UI with PicoPixel

Export from PicoPixel to src/ui/, then run ./tools/deploy_ui.sh (puts in the weather icons from assets/icons/weather/ (Meteocons, even if PicoPixel still holds the old images), renames image files to .inc, adjusts images.c, disables the screen fade, fixes color prefix and special characters, and checks that all objects wired in the code still exist). The fonts only contain ASCII and ° Ä Ö Ü ß ä ö ü; bereinigeText() replaces other characters.

Releases and update path

The firmware files in docs/firmware/ and the releases are created by the maintainer from one build (bootloader, partition table, boot_app0.bin and firmware come from the same state). Please send pull requests without changes to docs/firmware/.

Devices fetch version.json via raw.githubusercontent.com and the firmware from GitHub Pages; a device only offers higher versions.

Contributing, licence and credits

The source code is licensed under the Apache License 2.0 (LICENSE, NOTICE), texts and images under CC BY-NC 4.0. The name and logos of "WetterCube" are not licensed. Pull requests and issues are welcome; contributions are accepted under the Apache License 2.0. Note: src/ui/ is a PicoPixel export; make small UI changes in the code (src/app/ui_*.cpp) instead. The free weather interface of Open-Meteo is meant for non-commercial use only.

Weather and sensor icons by Meteocons (Bas Milius, MIT), control icons from the Flat Color Icons by Icons8 (MIT / Good Boy License), font Montserrat (SIL OFL 1.1), see CREDITS.md. Third-party resources keep their own licences.