Skip to content

Commit 1ac48e5

Browse files
authored
Better handling of unsupported chips (#398)
1 parent 5936a22 commit 1ac48e5

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

CMakeLists.txt

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# get IDF version for comparison
2+
set(idf_version "${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}")
3+
14
# set conversion sources
25
set(COMPONENT_SRCS
36
conversions/yuv.c
@@ -16,6 +19,8 @@ set(COMPONENT_ADD_INCLUDEDIRS
1619
conversions/include
1720
)
1821

22+
set(COMPONENT_REQUIRES driver)
23+
1924
# set driver sources only for supported platforms
2025
if(IDF_TARGET STREQUAL "esp32" OR IDF_TARGET STREQUAL "esp32s2" OR IDF_TARGET STREQUAL "esp32s3")
2126
list(APPEND COMPONENT_SRCS
@@ -68,14 +73,11 @@ if(IDF_TARGET STREQUAL "esp32" OR IDF_TARGET STREQUAL "esp32s2" OR IDF_TARGET ST
6873
)
6974
endif()
7075

71-
set(COMPONENT_REQUIRES driver)
7276
set(COMPONENT_PRIV_REQUIRES freertos nvs_flash)
7377

74-
set(min_supported_idf_version "4.2")
75-
set(idf_version "${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}")
76-
if (idf_version VERSION_GREATER_EQUAL min_supported_idf_version)
78+
set(min_version_for_esp_timer "4.2")
79+
if (idf_version VERSION_GREATER_EQUAL min_version_for_esp_timer)
7780
list(APPEND COMPONENT_PRIV_REQUIRES esp_timer)
78-
message(WARNING "ESP-IDF version detected: '${idf_version}'.")
7981
endif()
8082

8183
endif()

conversions/esp_jpg_decode.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ static const char * jd_errors[] = {
6161
"Not supported JPEG standard"
6262
};
6363

64-
static uint32_t _jpg_write(JDEC *decoder, void *bitmap, JRECT *rect)
64+
static unsigned int _jpg_write(JDEC *decoder, void *bitmap, JRECT *rect)
6565
{
6666
uint16_t x = rect->left;
6767
uint16_t y = rect->top;
@@ -77,7 +77,7 @@ static uint32_t _jpg_write(JDEC *decoder, void *bitmap, JRECT *rect)
7777
return 0;
7878
}
7979

80-
static uint32_t _jpg_read(JDEC *decoder, uint8_t *buf, uint32_t len)
80+
static unsigned int _jpg_read(JDEC *decoder, uint8_t *buf, unsigned int len)
8181
{
8282
esp_jpg_decoder_t * jpeg = (esp_jpg_decoder_t *)decoder->device;
8383
if (jpeg->len && len > (jpeg->len - jpeg->index)) {

conversions/to_bmp.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ static bool _rgb565_write(void * arg, uint16_t x, uint16_t y, uint16_t w, uint16
160160
}
161161

162162
//input buffer
163-
static uint32_t _jpg_read(void * arg, size_t index, uint8_t *buf, size_t len)
163+
static unsigned int _jpg_read(void * arg, size_t index, uint8_t *buf, size_t len)
164164
{
165165
rgb_jpg_decoder * jpeg = (rgb_jpg_decoder *)arg;
166166
if(buf) {

0 commit comments

Comments
 (0)