Closed Thermelgy-Repo closed 2 years ago
Hi @Thermelgy-Repo
I am glad that it turned useful for you. Regarding your questions:
const char send_queue_filename[] = "/spiffs/send_queue.data"; ///< Path to store the queue data in SPIFFS
with any other file name. Just keep consistency with the rest of code.` You can further write a testbench writing a known value in each element throughout the whole queue, and then read it making comparisons. That will lead you out of the doubt.
Thank you @rykovv for your answers,
It will be great, if you clarify some more doubts :
I found the front and rear is initialized to 0 everytime.
I suspect that we can lost the track of next queue after a restart? Do we need to store front & rear in SPIFFS?
Also tried to compile the code using Arduino IDE, but missing the <sys/stat.h>. I thought it is the standard C library. Kindly help.
@Thermelgy-Repo,
Do we need to store front & rear in SPIFFS?
Absolutely. We have to store y retrieve them manually. In the current implementation, they are not written into the SPIFFS. You have to handle them separately. This peculiarity is given due to my project specifics. I used EEPROM for storing the config (queue pointers included) and the SPIFFS for the pending data. In a future version, I will make the pointers seamless to the user and improve the storage space usage.
Also tried to compile the code using Arduino IDE, but missing the <sys/stat.h>. I thought it is the standard C library. Kindly help.
The library was initially designed to work with the ESP32 MCU. Make sure Arduino IDE makes use of the xtensa toolchain for your project to be compiled. If you are not working with the ESP MCUs, then you will have to modify the library or check compatibility of your project with the current implementation. stat() function from <sys/stat.h> is used to check if the file exists. It is implemented in the ESP core (xtensa toolchain). You may be interested in this issue. See also this example.
I am working on the next version of the library, in which I will seamlessly add EEPROM as a storage medium and make queue nodes with variable size, so the resources are better exploited. Stay tuned!
Dear @rykovv, Thank you for your support. I have a couple of questions regarding this library :
For me my application is to use this concept of circular queue to store data when the network is down. My data is 1KB of size in each message, I am planning to keep the size of 8MB for buffer memory which will be sufficient to store data for an adequate days.