Git Product home page Git Product logo

Comments (5)

rykovv avatar rykovv commented on June 10, 2024

Hi @Thermelgy-Repo

I am glad that it turned useful for you. Regarding your questions:

  1. I have tested the library with 256 elements of 256 bytes (64KB) and it worked well. It is mounted on SPIFFS which means it will reliably work as far as you keep the used (or intended to be used) space under 75% of assigned partition space. That is, if you want to have 8MB buffer, make sure you have 16MB flash and in the partition table you assigned 10MB to SPIFFS. If you want to use 100% of space having 8MB flash, then you will need to use EEPROM directly. In that case, the library will not be useful. It would be an interesting extension to add different mediums.
  2. Of course, you can modify next line in spiffs_circular_queue.cpp
    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.
  3. Yes, as far as you have extra 2MB of space (see 1). But anyway, I would definitely make a test before using it in my project, it shouldn't be difficult. Make next changes in spiffs_circular_queue.h:
    #define SPIFFS_CIRCULAR_QUEUE_MAX_SIZE (8192) #define SPIFFS_CIRCULAR_QUEUE_ITEM_SIZE (1024)
    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.

from spiffs_circular_queue.

Thermelgy-Repo avatar Thermelgy-Repo commented on June 10, 2024

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?

from spiffs_circular_queue.

Thermelgy-Repo avatar Thermelgy-Repo commented on June 10, 2024

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.

from spiffs_circular_queue.

rykovv avatar rykovv commented on June 10, 2024

@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.

from spiffs_circular_queue.

rykovv avatar rykovv commented on June 10, 2024

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!

from spiffs_circular_queue.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.