I’ve downloaded chatter source code from github and I’m wondering how can I create my own Pics. I saw that Pics are saved in binary files (for example Pics/1.bin) what kind of graphic program can I use to create them and how can I upload the into chatter SPIFSS?
Ok. I’ve found solution. Image can be created online on this website: Online image converter - BMP, JPG or PNG to C array or binary | LVGL, all you need to do is to upload image and select output to Binary RGB565. Next step is to upload file to ESP32 SPIFFS by using Arduino plugin called ESP32FS (GitHub - me-no-dev/arduino-esp32fs-plugin: Arduino plugin for uploading files to ESP32 file system).
This works OK but the profile and friends are lost. However, the message counter and for example high scores in snake is preserved. So I ask - is there any way how to preserve the important things like profile and registered friends? I do not care if message history is lost.
Or another approach - what about to use some microSD card breakout board? Can it be connected somehow? I am not afraid to explore, but some pointers and initial guidance will be much appreciated.
Hey there!
What @K_Piwo said is correct. You can use the LVGL image converter to convert your images into the format loaded by the UI, and then upload it using a tool like ESP32FS.
The reason why the chat history, profile, and friends get deleted when you do that is because that data is stored on the filesystem of the device, which gets overwritten when you upload to it using a tool like ESP32FS. The same thing happens if you use CircuitBlocks to program your device, as that completely rewrites the firmware on the flash.
Settings and message counts are stored in a different part of the flash, so that data remains when you upload to the filesystem, although that part will also get erased if you use CircuitBlocks.
You could theoretically preserve your friends, profile, and messages if you download the contents of the filesystem to your computer and place it into the data folder so it gets uploaded back to the device. However, I haven’t been able to find a simple GUI solution like ESP32FS for downloading.
Let me know if I can answer any further questions.
Filip
It seems (to mee) that the most logical way to handle friends and profile is to store them on the same place as other vital settings (like message counter, which on the contrary is not that vital at all). It is relatively small amount of data, so I expect it could fit… It is important for me that this data is preserved during both the reprogramming (via Arduino IDE) and uploading filesystem (via ESP32FS).
I found some clues like Repo<Friend> Friends
, so I have an idea that this Repo
uses SPIFFS
implementation to store and get data. However I also found, that those other things are managed via Settings
, which is in the Chatter 2 library, so no good to modify. Do I need to code simmilar class to store settings at the same place like Settings
? I consider myself a newbie in this micro-controller world, however as professional programmer some understanding and tinkering is possible, however this seems like more advanced job, since C++ is not my " kind of language"…
Any ideas or tips will be appreciated!
The Settings data (device settings, message count, etc.) is stored using the non-volatile storage system, which has to be fixed-size in our abstraction. The device settings don’t change size, it’s always a few integers and bools so we can use the NVS abstraction to store them there. The friends, conversations, and messages on the other hand are dynamic, and with longer use of the Chatter can get up to a few KB and more in size.
As you mentioned, Repo<Friends>
stores the friends list on the SPIFFS which acts like a traditional filesystem. Repo
is an abstract class which stores arbitrary entries on the SPIFFS, acting like a sort of database. It’s used for friends, conversations, and messages. If you’d like to change how and where those entries are stored, the best approach would be to modify the Repo class. All the structures used with Repo
(Convo, Friend, Message) extend the Entity
struct, which has the uint64_t uid
property that you can use as a unique ID for entries.
Here’s the documentation for the ESP32’s NVS system: Non-volatile storage library - ESP32 - — ESP-IDF Programming Guide v4.4.7 documentation . You’ll find all the necessary information about using the NVS system there.
Let me know if I can give you any more information that will help you in this endeavor.
Filip