Convert /littlefs/ to L: in image source

This commit is contained in:
fvanroie 2021-10-01 17:47:16 +02:00
parent bbe2c373bf
commit 1000fbe963

View File

@ -1006,9 +1006,19 @@ static hasp_attribute_type_t special_attribute_src(lv_obj_t* obj, const char* pa
lv_mem_free(img_dsc);
}
if(payload != strstr_P(payload, PSTR("http://"))) {
if(payload != strstr_P(payload, PSTR("http://"))) { // not start with http
if(payload == strstr_P(payload, PSTR("/littlefs/"))) { // startsWith command/
char tempsrc[64] = "L:";
strncpy(tempsrc + 2, payload + 9, sizeof(tempsrc) - 2);
lv_img_set_src(obj, tempsrc);
} else if(payload == strstr_P(payload, PSTR("L:"))) { // startsWith command/
lv_img_set_src(obj, payload);
} else {
char tempsrc[64] = LV_SYMBOL_DUMMY;
strncpy(tempsrc + 3, payload, sizeof(tempsrc) - 3);
lv_img_set_src(obj, tempsrc);
}
} else {
#if defined(ARDUINO) && defined(ARDUINO_ARCH_ESP32)
HTTPClient http;
http.begin(payload);