Fix ESP32 firmware size in PlatformIO.
Error: The program size (1564865 bytes) is greater than maximum allowed (1310720 bytes)
Most ESP32 boards ship with a 1.3 MB (1310720 bytes) application partition, unless a custom partition table is used. So if your firmware size is bigger than that, it won't compile.
Solution:
Change platformio.ini to use a partition layout with a 2 MB app slot.
.partitions = partitions.csv
Create partitions.csv in your project root:
Option A - "huge app"
Option B - "no OTA"
See [[Understanding ESP32 partition tables]] for more information.
Or have a look at those examples.