"""Partition tables a board file can ask for with `smart_display: partitions:` (firmware 0.2.79). ESPHome's own table for 4 MB of flash keeps 448 KB for NVS and gives the two update slots 1,792 KB each. The screen's preferences take a few KB of NVS (ESP-IDF's own two-slot example keeps 16 KB), and the Elecrow CrowPanel 7.0" needs the room: its firmware is the Guition's, which does not fit 1,792 KB. The tables live here, as text, because a board file over GitHub cannot carry a file of its own; __init__.py hands the chosen one to ESPHome as the build's partitions.csv. A table never changes once a screen is flashed with it: an update over Wi-Fi writes into the other slot of the table the screen has, and only a USB install lays the flash out anew. """ # 4 MB as two update slots of 0x1F0000 bytes, the largest 64 KB-aligned pair that fits, and 64 KB of NVS at the end; # otadata and phy_init where ESPHome puts them. Offsets are explicit so the table is the same on every build. TABLES = { '4mb_wide_slots': """\ # ESP Screens: 4 MB ESP32-S3 with two update slots of 1,984 KB (components/smart_display/partitions.py). # Name, Type, SubType, Offset, Size otadata, data, ota, 0x9000, 0x2000 phy_init, data, phy, 0xB000, 0x1000 app0, app, ota_0, 0x10000, 0x1F0000 app1, app, ota_1, 0x200000, 0x1F0000 nvs, data, nvs, 0x3F0000, 0x10000 """, }