fixes with USE_LV_FILESYSTEM = 0

This commit is contained in:
Gabor Kiss-Vamosi 2018-03-04 17:03:37 +01:00
parent 6e94c70fbb
commit 2123ee0218
3 changed files with 11 additions and 9 deletions

View File

@ -59,7 +59,7 @@
/*Input device settings*/
#define LV_INDEV_READ_PERIOD 50 /*Input device read period in milliseconds*/
#define LV_INDEV_POINT_MARKER 0 /*Mark the pressed points*/
#define LV_INDEV_POINT_MARKER 0 /*Mark the pressed points (required: USE_LV_REAL_DRAW = 1)*/
#define LV_INDEV_DRAG_LIMIT 10 /*Drag threshold in pixels */
#define LV_INDEV_DRAG_THROW 20 /*Drag throw slow-down in [%]. Greater value means faster slow-down */
#define LV_INDEV_LONG_PRESS_TIME 400 /*Long press time in milliseconds*/

View File

@ -395,6 +395,7 @@ void lv_draw_label(const lv_area_t * coords,const lv_area_t * mask, const lv_sty
void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask,
const lv_style_t * style, const void * src)
{
if(src == NULL) {
lv_draw_rect(coords, mask, &lv_style_plain);
lv_draw_label(coords, mask, &lv_style_plain, "No\ndata", LV_TXT_FLAG_NONE, NULL);
@ -403,6 +404,7 @@ void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask,
const uint8_t * u8_p = (uint8_t*) src;
if(u8_p[0] >= 'A' && u8_p[0] <= 'Z') { /*It will be a path of a file*/
#if USE_LV_FILESYSTEM
lv_fs_file_t file;
lv_fs_res_t res = lv_fs_open(&file, src, LV_FS_MODE_RD);
if(res == LV_FS_RES_OK) {
@ -467,7 +469,7 @@ void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask,
lv_draw_label(coords, mask, &lv_style_plain, "No data", LV_TXT_FLAG_NONE, NULL);
}
}
#endif
}
else {
const lv_img_t * img_var = src;

View File

@ -14,10 +14,6 @@
#error "lv_img: lv_label is required. Enable it in lv_conf.h (USE_LV_LABEL 1) "
#endif
#if USE_LV_FILESYSTEM == 0
#error "lv_img: lv_fs is required. Enable it in lv_conf.h (USE_LV_FILESYSTEM 1) "
#endif
#include "lv_img.h"
#include "../lv_themes/lv_theme.h"
#include "../lv_misc/lv_fs.h"
@ -118,6 +114,11 @@ void lv_img_set_src(lv_obj_t * img, const void * src_img)
lv_img_ext_t * ext = lv_obj_get_ext_attr(img);
#if USE_LV_FILESYSTEM == 0
if(src_type == LV_IMG_SRC_FILE) src_type = LV_IMG_SRC_UNKNOWN;
#endif
if(src_type == LV_IMG_SRC_UNKNOWN) {
if(ext->src_type == LV_IMG_SRC_SYMBOL || ext->src_type == LV_IMG_SRC_FILE) {
lv_mem_free(ext->src);
@ -127,7 +128,6 @@ void lv_img_set_src(lv_obj_t * img, const void * src_img)
return;
}
ext->src_type = src_type;
if(src_type == LV_IMG_SRC_VARIABLE) {
@ -138,7 +138,7 @@ void lv_img_set_src(lv_obj_t * img, const void * src_img)
ext->alpha_byte = ((lv_img_t*)src_img)->header.alpha_byte;
lv_obj_set_size(img, ext->w, ext->h);
}
#if USE_LV_FILESYSTEM
else if(src_type == LV_IMG_SRC_FILE) {
lv_fs_file_t file;
lv_fs_res_t res;
@ -173,7 +173,7 @@ void lv_img_set_src(lv_obj_t * img, const void * src_img)
}
}
#endif
else if(src_type == LV_IMG_SRC_SYMBOL) {
lv_style_t * style = lv_obj_get_style(img);
lv_point_t size;