ImageReader library is not compile

Hello Community

i tried to run the Adafruit image Reader library and run the one example which read the image from the sd card I am using [Adafruit TFT FeatherWing - 3.5" 480x320 Touchscreen for Feathers] but every I got this error

.pio\libdeps\PlanetExpress\Adafruit SPIFlash\src\esp32\Adafruit_FlashTransport_ESP32.cpp: In member function 'SPIFlash_Device_t* Adafruit_FlashTransport_ESP32::getFlashDevice()':
.pio\libdeps\PlanetExpress\Adafruit SPIFlash\src\esp32\Adafruit_FlashTransport_ESP32.cpp:54:3: error: 'esp_flash_t' was not declared in this scope
   esp_flash_t const *flash = _partition->flash_chip;
   ^
Indexing .pio\build\PlanetExpress\liba48\libSdFat - Adafruit Fork.a
.pio\libdeps\PlanetExpress\Adafruit SPIFlash\src\esp32\Adafruit_FlashTransport_ESP32.cpp:55:36: error: 'flash' was not declared in this scope
   _flash_device.manufacturer_id = (flash->chip_id >> 16);
                                    ^
Indexing .pio\build\PlanetExpress\lib041\libAutoConnect.a
Compiling .pio\build\PlanetExpress\lib6a0\Adafruit ImageReader Library\Adafruit_ImageReader.cpp.o
* [.pio\build\PlanetExpress\lib1be\Adafruit SPIFlash\esp32\Adafruit_FlashTransport_ESP32.cpp.o] Error 1

Can anybody find the any solution for the error, I am trying a different method but it does not work.

What is your full platformio.ini?

platform = espressif32
board = esp32dev
framework = arduino
; Custom Serial Monitor port
; monitor_port = /dev/cu.usbserial-1410
; Custom Serial Monitor speed (baud rate)

monitor_speed = 115200
monitor_filters = esp32_exception_decoder
src_filter =
                ; Add During Compilation
        +<./>
        +<../src/PlanetExpress/System_Manager.cpp>
        +<../src/PlanetExpress/main.cpp>
                ; Remove During Compilation
        -<../src/Discovery/System_Manager.cpp>
        -<../src/Discovery/main.cpp>
build_flags =
        '-DVERSION="3.4.1"'
         -DCORE_DEBUG_LEVEL=3
         -DAC_DEBUG
         -I include/PlanetExpress
          
extra_scripts = pre:extra_script.py
lib_ignore = SD
lib_deps =    
        https://github.com/knolleary/pubsubclient
        https://github.com/arduino-libraries/NTPClient
        https://github.com/Hieromon/AutoConnect@^1.2.2
        https://github.com/Hieromon/PageBuilder
        https://github.com/bblanchon/ArduinoJson
        https://github.com/adafruit/Adafruit_Sensor
        https://github.com/adafruit/DHT-sensor-library
        https://github.com/ERROPiX/ESP32_AnalogWrite.git
        https://github.com/sparkfun/SparkFun_SX1509_Arduino_Library.git
        https://github.com/4-20ma/i2c_adc_ads7828.git
        https://github.com/adafruit/Adafruit_BME680.git
           
        https://github.com/adafruit/Adafruit-GFX-Library.git
        https://github.com/adafruit/SdFat.git
        https://github.com/adafruit/Adafruit_SPIFlash.git
        https://github.com/adafruit/Adafruit_ImageReader.git

I’ve edited your post so the platformio.ini file is displayed properly, i.e. I have formatted it as code and removed the duplicate line feeds. Please do it yourself the next time.

So according to Overview | Adafruit 3.5" 480x320 TFT FeatherWing | Adafruit Learning System that Feather shield has

  • If you have the 3.5" TFT Featherwing, run the Adafruit HX8357->touchpaint_featherwing demo

A HX8357 display controler, and so I think you want to try the Adafruit_HX8357_Library/[…]/graphicstest_featherwing.ino demo as src\main.cpp.

Indeed, when I try this code with the platformio.ini

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
lib_ignore = SD
lib_deps =    
        https://github.com/adafruit/Adafruit-GFX-Library.git
        https://github.com/adafruit/SdFat.git
        https://github.com/adafruit/Adafruit_SPIFlash.git
        https://github.com/adafruit/Adafruit_ImageReader.git
        https://github.com/adafruit/Adafruit_HX8357_Library.git
        adafruit/Adafruit EPD @ ^4.4.2
        adafruit/Adafruit BusIO @ 1.9.3
        Wire

I receive the same compilation error.

.pio\libdeps\esp32dev\Adafruit SPIFlash\src\esp32\Adafruit_FlashTransport_ESP32.cpp: In member function 'SPIFlash_Device_t* Adafruit_FlashTransport_ESP32::getFlashDevice()':
.pio\libdeps\esp32dev\Adafruit SPIFlash\src\esp32\Adafruit_FlashTransport_ESP32.cpp:54:3: error: 'esp_flash_t' was not declared in this scope
   esp_flash_t const *flash = _partition->flash_chip;
   ^
.pio\libdeps\esp32dev\Adafruit SPIFlash\src\esp32\Adafruit_FlashTransport_ESP32.cpp:55:36: error: 'flash' was not declared in this scope
   _flash_device.manufacturer_id = (flash->chip_id >> 16);
                                    ^
*** [.pio\build\esp32dev\lib898\Adafruit SPIFlash\esp32\Adafruit_FlashTransport_ESP32.cpp.o] Error 1

This is because the library is using the esp_flash_t type which is not contained in the Arduino-ESP32 core 1.0.6 that platformio.ini is using.

C:\Users\Max\.platformio\packages\framework-arduinoespressif32>grep -r "esp_flash_t" .

C:\Users\Max\.platformio\packages\framework-arduinoespressif32>

On the other hand, the latest Arduino-ESP32 v2.x core does have this definition. Supporting the 2.0 core is an open issue in PlatformIO.

As seen in e.g. this comment, one can still point PlatformIO to use the 2.0.0 core manually in a non-official way. When I use the platformio.ini

[env:esp32dev]
platform  = https://github.com/platformio/platform-espressif32.git#feature/arduino-idf-master
platform_packages =
   framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#2.0.0
board = esp32dev
framework = arduino
lib_ignore = SD
lib_deps =    
        https://github.com/adafruit/Adafruit-GFX-Library.git
        https://github.com/adafruit/SdFat.git
        https://github.com/adafruit/Adafruit_SPIFlash.git
        https://github.com/adafruit/Adafruit_ImageReader.git
        https://github.com/adafruit/Adafruit_HX8357_Library.git
        adafruit/Adafruit EPD @ ^4.4.2
        adafruit/Adafruit BusIO @ 1.9.3
        Wire

(notice the changed platform and addition of platform_packages), the compilation goes through.

Checking size .pio\build\esp32dev\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   4.0% (used 13032 bytes from 327680 bytes)
Flash: [==        ]  20.4% (used 267441 bytes from 1310720 bytes)
Building .pio\build\esp32dev\firmware.bin
esptool.py v3.1
Merged 2 ELF sections
============== [SUCCESS] Took 22.45 seconds ==============