openHASP icon indicating copy to clipboard operation
openHASP copied to clipboard

Add support for SD card e.g. Sunton 7"

Open Martinson50 opened this issue 1 year ago • 5 comments

I have a board with SD card so I hacked this repository locally to add the SDCard as a source of images. I dont feel to much comfortable to pull a request but to send the changed code in 3 main files: seems to work without issues when you add src object with Z:/image.png

/src/main.cpp: #if HASP_USE_SDCARD > 0 sdcardSetup(); #endif

/src/hasp_filesystem.cpp: bool sdcardSetup(void)

/src/hasp/hasp_attribute.cpp static hasp_attribute_type_t special_attribute_src(lv_obj_t* obj, const char* payload, char** text, bool update) .... } else if (payload == strstr_P(payload, PSTR("Z:"))) { char tempsrcf[64] = ""; strncpy(tempsrcf , payload + 2, sizeof(tempsrcf)); int readf = 0; File file; file = HASP_SD_FS.open(tempsrcf, "r"); .....

If anyone it's interested in this funcionality I can send the rest of the code or give more info.

Martinson50 avatar May 12 '24 12:05 Martinson50

By the way audio and i2c sensors added in custom code as proof of concept able to reproduce MP3 SDCard files in this sunton-8048s070c_16MB

Martinson50 avatar May 12 '24 12:05 Martinson50

This is very interesting indeed. Please share your code in a fork or PR. It is hard to follow when the code is incomplete. Ideally, all files should be able to use the SD card, like fonts, jsonl, etc...

fvanroie avatar May 12 '24 13:05 fvanroie

+1

darkman7hr avatar May 12 '24 13:05 darkman7hr

I found your fork at https://github.com/Martinson50/openHASP

Make sure not to touch code outside of the scope, or it can not be merged (like QR_CODE). In any case it is very interesting to see the progress.

fvanroie avatar May 22 '24 18:05 fvanroie

I think we need to lay the groundwork for broader support across multiple boards and future proof solution. Please also join this thread about SD card support #741 and file handling.

fvanroie avatar May 23 '24 15:05 fvanroie