Git Product home page Git Product logo

queue's Introduction

queue

Persistent queue implementation for ESP32 stored in user specified partition in flash - when no space is available oldest elements are deleted until space is available

Maximum Queue element size is 255 bytes

file: queue.ino - test/play/exmaple
file: eeprom_queue.h - implementation

IMPORTANT: Before using please update :

#define EEPROM_Q_PARTIOTION_NAME "spiffs"
#define EEPROM_Q_PARTITION_SIZE (32 * 1024)

with the propriate values for you storage partition name and partions size in bytes

example partion table :

Name, Type, SubType, Offset, Size, Flags

nvs, data, nvs, 0x9000, 0x4000,
phy_init, data, phy, 0xD000, 0x1000,
otadata, data, ota, 0xE000, 0x2000,
ota_0, app, ota_0, 0x10000, 1984K,
ota_1, app, ota_1, 0x200000, 1984K,
eeprom, data, 0x99, 0x3F0000, 0x1000,
nvs_key, data, nvs_keys,0x3F1000, 0x4000
spiffs, data, spiffs, 0x3F5000, 32K,
#12K not used

functions implemented :

inline void init_q() - call before everything else
inline void erase_q() - erase the whole partiotion
inline uint32_t get_q_count() - current count of elements in the queue
inline void get_q_first(uint8_t buf[], uint8_t & size) - read withot remove
inline void q_first_remove() - remove
inline void add_q_last(uint8_t buf[], uint8_t size) - add element - if no space delete from beggining until space is available

usage :

init_q
...
add_q_last
...
add_q_last
...
get_q_first
q_first_remove
...
get_q_first
q_first_remove

dependancy: Log64 lib ( if not required remove all lines with LOG64_XXXX )

queue's People

Contributors

vtomanov avatar

Stargazers

Gary Fry avatar

Watchers

 avatar

queue's Issues

Please update documentation about limitations with API

Hi - I really like your implementation for a simple persistent queue implementation using ESP32 flash memory.

I've just gone through your code (manually) so I could be wrong of course, but my observations/questions are:

  • The maximum queue size is 32K (but can change if required)
  • What's the max message size?
  • What's the max # messages allowed in the queue? (appreciate this depends on the queue size, but let's assume there's a formula for this....
  • When adding a message to the queue, and the queue is full, the queue behaves like a ring buffer - that is, the oldest message is lost, in order to make room for the newest message.

Please can you add these answers to the readme file?

Thanks!

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.