Better handling of unsupported chips (#398)

This commit is contained in:
Me No Dev
2022-05-31 14:22:52 +03:00
committed by GitHub
parent 5936a22e95
commit 1ac48e5397
3 changed files with 10 additions and 8 deletions

View File

@ -1,3 +1,6 @@
# get IDF version for comparison
set(idf_version "${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}")
# set conversion sources # set conversion sources
set(COMPONENT_SRCS set(COMPONENT_SRCS
conversions/yuv.c conversions/yuv.c
@ -16,6 +19,8 @@ set(COMPONENT_ADD_INCLUDEDIRS
conversions/include conversions/include
) )
set(COMPONENT_REQUIRES driver)
# set driver sources only for supported platforms # set driver sources only for supported platforms
if(IDF_TARGET STREQUAL "esp32" OR IDF_TARGET STREQUAL "esp32s2" OR IDF_TARGET STREQUAL "esp32s3") if(IDF_TARGET STREQUAL "esp32" OR IDF_TARGET STREQUAL "esp32s2" OR IDF_TARGET STREQUAL "esp32s3")
list(APPEND COMPONENT_SRCS list(APPEND COMPONENT_SRCS
@ -68,14 +73,11 @@ if(IDF_TARGET STREQUAL "esp32" OR IDF_TARGET STREQUAL "esp32s2" OR IDF_TARGET ST
) )
endif() endif()
set(COMPONENT_REQUIRES driver)
set(COMPONENT_PRIV_REQUIRES freertos nvs_flash) set(COMPONENT_PRIV_REQUIRES freertos nvs_flash)
set(min_supported_idf_version "4.2") set(min_version_for_esp_timer "4.2")
set(idf_version "${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}") if (idf_version VERSION_GREATER_EQUAL min_version_for_esp_timer)
if (idf_version VERSION_GREATER_EQUAL min_supported_idf_version)
list(APPEND COMPONENT_PRIV_REQUIRES esp_timer) list(APPEND COMPONENT_PRIV_REQUIRES esp_timer)
message(WARNING "ESP-IDF version detected: '${idf_version}'.")
endif() endif()
endif() endif()

View File

@ -61,7 +61,7 @@ static const char * jd_errors[] = {
"Not supported JPEG standard" "Not supported JPEG standard"
}; };
static uint32_t _jpg_write(JDEC *decoder, void *bitmap, JRECT *rect) static unsigned int _jpg_write(JDEC *decoder, void *bitmap, JRECT *rect)
{ {
uint16_t x = rect->left; uint16_t x = rect->left;
uint16_t y = rect->top; uint16_t y = rect->top;
@ -77,7 +77,7 @@ static uint32_t _jpg_write(JDEC *decoder, void *bitmap, JRECT *rect)
return 0; return 0;
} }
static uint32_t _jpg_read(JDEC *decoder, uint8_t *buf, uint32_t len) static unsigned int _jpg_read(JDEC *decoder, uint8_t *buf, unsigned int len)
{ {
esp_jpg_decoder_t * jpeg = (esp_jpg_decoder_t *)decoder->device; esp_jpg_decoder_t * jpeg = (esp_jpg_decoder_t *)decoder->device;
if (jpeg->len && len > (jpeg->len - jpeg->index)) { if (jpeg->len && len > (jpeg->len - jpeg->index)) {

View File

@ -160,7 +160,7 @@ static bool _rgb565_write(void * arg, uint16_t x, uint16_t y, uint16_t w, uint16
} }
//input buffer //input buffer
static uint32_t _jpg_read(void * arg, size_t index, uint8_t *buf, size_t len) static unsigned int _jpg_read(void * arg, size_t index, uint8_t *buf, size_t len)
{ {
rgb_jpg_decoder * jpeg = (rgb_jpg_decoder *)arg; rgb_jpg_decoder * jpeg = (rgb_jpg_decoder *)arg;
if(buf) { if(buf) {