Skip to content

Commit

Permalink
Better handling of unsupported chips (#398)
Browse files Browse the repository at this point in the history
  • Loading branch information
me-no-dev authored May 31, 2022
1 parent 5936a22 commit 1ac48e5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
12 changes: 7 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# get IDF version for comparison
set(idf_version "${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}")

# set conversion sources
set(COMPONENT_SRCS
conversions/yuv.c
Expand All @@ -16,6 +19,8 @@ set(COMPONENT_ADD_INCLUDEDIRS
conversions/include
)

set(COMPONENT_REQUIRES driver)

# set driver sources only for supported platforms
if(IDF_TARGET STREQUAL "esp32" OR IDF_TARGET STREQUAL "esp32s2" OR IDF_TARGET STREQUAL "esp32s3")
list(APPEND COMPONENT_SRCS
Expand Down Expand Up @@ -68,14 +73,11 @@ if(IDF_TARGET STREQUAL "esp32" OR IDF_TARGET STREQUAL "esp32s2" OR IDF_TARGET ST
)
endif()

set(COMPONENT_REQUIRES driver)
set(COMPONENT_PRIV_REQUIRES freertos nvs_flash)

set(min_supported_idf_version "4.2")
set(idf_version "${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}")
if (idf_version VERSION_GREATER_EQUAL min_supported_idf_version)
set(min_version_for_esp_timer "4.2")
if (idf_version VERSION_GREATER_EQUAL min_version_for_esp_timer)
list(APPEND COMPONENT_PRIV_REQUIRES esp_timer)
message(WARNING "ESP-IDF version detected: '${idf_version}'.")
endif()

endif()
Expand Down
4 changes: 2 additions & 2 deletions conversions/esp_jpg_decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static const char * jd_errors[] = {
"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 y = rect->top;
Expand All @@ -77,7 +77,7 @@ static uint32_t _jpg_write(JDEC *decoder, void *bitmap, JRECT *rect)
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;
if (jpeg->len && len > (jpeg->len - jpeg->index)) {
Expand Down
2 changes: 1 addition & 1 deletion conversions/to_bmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ static bool _rgb565_write(void * arg, uint16_t x, uint16_t y, uint16_t w, uint16
}

//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;
if(buf) {
Expand Down

0 comments on commit 1ac48e5

Please sign in to comment.