### Implementing Dynamic Log with Gyver Table (CPP) Source: https://github.com/gyverlibs/table/blob/main/README_EN.md This example illustrates using the `Table` class as a dynamic log or circular buffer. It shows how to initialize a table with zero rows, add new rows up to a specified maximum (5), and then use `shiftUp()` to remove the oldest row when the maximum is reached, always writing new data to the last row. ```CPP // initially 0 lines Table T (0, 2, Celltype :: int8); // can be reserved to your maximum // T.ESERVE (5); for (int i = 0; i <10; i ++) { if (t.rows () <5) t.addrow ();// Adding a line Else t.shiftup ();// rewinding (max. reached) t [-1] [0] = i;// recording in the last line } T.Dump (Serial); ``` -------------------------------- ### Cell Class Methods (CPP) Source: https://github.com/gyverlibs/table/blob/main/README_EN.md Represents a single cell in the table, providing methods to get its type, print its value, assign values of various types, convert to integer or float, and supporting comparison and assignment operators. ```CPP // Cell type Cell_t Type (); // Print in Print Size_t Printto (Print & P); // assign any type TEMPLATE T Operator = (T Val); // in int32 int32_t toint (); // in Float Float Tofloat (); ``` -------------------------------- ### Initializing & Manipulating Gyver Table (CPP) Source: https://github.com/gyverlibs/table/blob/main/README_EN.md This snippet demonstrates the basic usage of the `Table` class. It shows how to create a table with specific column data types, write values to individual cells and entire rows, access cell data with implicit and explicit type conversions, and perform standard arithmetic and comparison operations directly on cell objects. ```CPP // 4 lines, 3 columns Table Table (4, 3, Cell_t :: int8, Cell_t :: uint8, Cell_t :: Float); // entry in the first line Table [0] [0] = -123; Table [0] [1] = 123; Table [0] [2] = 123.456; // recording in the last line Table [-1] [0] = -123; // recording the entire line immediately (the function accepts any number of arguments) Table [1] .Write (-123, 123, -123.456); // The output of the table Table.Dump (Serial); // The conclusion of the cells Serial.println (Table [0] [0]);// Printed int8_t v = guble [0] [1];// Auto Convertation Table [0] [2] .tofloat ();// manual conversion (int32_t) Table [0] [2];// manual conversion // Changing cells // Any comparison operations and operators Table [0] [0] == 3; Table [0] [0]> 3; Table [0] [0] *= 3; Table [0] [0] ++; ``` -------------------------------- ### Integrating Gyver TableFile with LittleFS (CPP) Source: https://github.com/gyverlibs/table/blob/main/README_EN.md This snippet demonstrates how to use the `TableFile` class to persist table data to a file using the LittleFS filesystem. It shows initializing LittleFS, beginning the `TableFile` to load data from the file, writing a value to a cell, and calling the `tick()` method periodically in the main loop to handle background file operations. Dependencies include `` and ``. ```CPP #include #include Tablefile TB (& Littlefs, "Table.tbl"); VOID setup () { Littlefs.Begin (); tb.begin ();// read data from the file tb [0] [0] = 123; } VOID loop () { // call a ticker in a lup tb.tick (); } ``` -------------------------------- ### TableFile Class Methods (CPP) Source: https://github.com/gyverlibs/table/blob/main/README_EN.md Extends the Table class to provide automatic saving to a file when changes occur, requiring a file system and path, and including methods for initialization, updating, and background processing. ```CPP // specify the file system, the path to the file and the Timout in MS TableFile (fs :: fs* nfs = nullptr, constel* path = nullptr, uint32_t tout = 10000); // install the file system and file name VOID setfs (fs :: fs* nfs, const char* Path); // Install the Takeout of the Records, MS (silence 1000) VOID settimeout (uint32_t tout = 10000); // Read the data Bool Begin (); // update data in the file Bool update (); // ticker, call in LOOP.He will update the data himself when the timuta is changed and output, it will return True Bool Tick (); ``` -------------------------------- ### Table Class Methods (CPP) Source: https://github.com/gyverlibs/table/blob/main/README_EN.md Provides the core functionality for the dynamic table, including constructors, accessors, data manipulation, resizing, scrolling, and serialization/deserialization methods. ```CPP Table (); // lines, columns, types of these cells Table (Uint16_t Rows, Uint8_t Cols, ...); // Get the line of the table.Negative numbers - get from the end TBL :: row operator [] (int row); // Get the line of the table.Negative numbers - get from the end TBL :: row get (int row); // Get a cell TBL :: Cell get (int row, uint8_t color); // Bring the table to Print VOID DUMP (Print & P); // Bring like csv String Tocsv (Char Separator = ';', Uint8_t Dec = 2); // number of lines uint16_t rows (); // The number of columns uint8_t color (); // Clean cells (install 0) Void Clear (); // at least one of the cells was changed.Autos Bool Changed (); // Change the number of lines Bool Resize (Uint16_T RESS); // reserve the number of lines Bool Reserve (Uint16_T RESS); // Add a line from below Bool Addrow (); // Scroll the table up 1 line VOID Shiftup (); // Scroll the table down by 1 line VOID ShiftDown (); // completely free memory VOID Reset (); // export size of the table (for writeto) Size_t Writesize (); // export the table to size_t Write (uint8_t*, size_t) TEMPLATE Bool Writeto (T & Writer); // export the table in Stream (e.g. file) Bool Writeto (Stream & Stream); // export the table to the size of the size of writesize () Bool Writeto (Uint8_t* Buffer); // import a table from Stream (e.g. file) Bool Readfrom (Stream & Stream, Size_t Len); // import a table from the buffer Bool Readfrom (Consta Uint8_t* Buffer, Size_t Len); // Cell type Cell_t Type (Uint16_t Row, Uint8_t Col); ``` -------------------------------- ### TableFile Class Methods (C++) Source: https://github.com/gyverlibs/table/blob/main/README.md Extends the base Table class to add automatic saving functionality to a file system. Allows specifying the file system, path, and a timeout for automatic writes when the table changes. Includes methods to initialize, update, and tick the file saving process. ```C++ // указать файловую систему, путь к файлу и таймаут в мс TableFile(fs::FS* nfs = nullptr, const char* path = nullptr, uint32_t tout = 10000); // установить фа ``` -------------------------------- ### Table Class Methods (C++) Source: https://github.com/gyverlibs/table/blob/main/README.md Provides the core functionality for managing a dynamic binary table in memory. Includes methods for construction, creation, initialization, accessing and modifying cells/rows, resizing, adding/removing rows, scrolling, memory management, and data serialization/deserialization. ```C++ Table(); // строк, столбцов, типы данных ячеек Table(uint16_t rows, uint8_t cols, ...); // создать таблицу (строк, столбцов, типы данных ячеек) bool create(uint16_t rows, uint8_t cols, ...); // инициализировать количество и типы столбцов (не изменит таблицу если совпадает) bool init(uint8_t cols, ...); // получить строку таблицы. Отрицательные числа - получить с конца tbl::Row operator[](int row); // получить строку таблицы. Отрицательные числа - получить с конца tbl::Row get(int row); // получить ячейку tbl::Cell get(int row, uint8_t col); // вывести таблицу в print void dump(Print& p); // вывести как CSV String toCSV(char separator = ';', uint8_t dec = 2); // количество строк uint16_t rows(); // количество столбцов uint8_t cols(); // очистить ячейки (установить 0) void clear(); // хоть одна из ячеек была изменена. Автосброс bool changed(); // изменить количество строк bool resize(uint16_t rows); // зарезервировать количество строк bool reserve(uint16_t rows); // добавить пустую строку в конец bool add(); // добавить строку со значениями в конец bool append(...); // установить лимит кол-ва строк для add/append, будет прокручивать при превышении. 0 - отключить void setLimit(uint16_t limit); // сместить таблицу вверх и записать значения в конец void shift(...); // удалить строку. Отрицательные - с конца bool remove(int row); // удалить все строки void removeAll(); // дублировать последнюю строку и добавить в конец bool dupLast(); // прокрутить строки вверх на 1 строк void scrollUp(); // прокрутить строки вниз на 1 строк void scrollDown(); // полностью освободить память void reset(); // экспортный размер таблицы (для writeTo) size_t writeSize(); // экспортировать таблицу в size_t write(uint8_t*, size_t) template bool writeTo(T& writer); // экспортировать таблицу в write(uint8_t, size_t) bool writeTo(T& stream); // экспортировать таблицу в буфера размера writeSize() bool writeTo(uint8_t* buffer); // импортировать таблицу из Stream (напр. файл) bool readFrom(Stream& stream, size_t len); // импортировать таблицу из буфера bool readFrom(const uint8_t* buffer, size_t len); // тип ячейки cell_t type(uint16_t row, uint8_t col); ``` -------------------------------- ### row Class Methods (CPP) Source: https://github.com/gyverlibs/table/blob/main/README_EN.md Represents a single row within the table, providing methods for accessing individual cells by column index and writing multiple values to the row. ```CPP // Access to the cell Cell Operator [] (uint8_t color); // write in a line TEMPLATE VOID Write (Args ... Args); ``` -------------------------------- ### Data Types for Table Cells (C++) Source: https://github.com/gyverlibs/table/blob/main/README.md Defines the possible data types that can be stored within the cells of the Table. These enumerations are used when specifying the structure of the table during creation or initialization. ```C++ cell_t::None cell_t::Int8 cell_t::Uint8 cell_t::Int16 cell_t::Uint16 cell_t::Int32 cell_t::Uint32 cell_t::Int64 cell_t::Uint64 cell_t::Float ``` -------------------------------- ### Cell_t Enum Definition (CPP) Source: https://github.com/gyverlibs/table/blob/main/README_EN.md Defines the possible data types that can be stored in the table cells. ```CPP Cell_t :: None Cell_t :: int8 Cell_t :: uint8 Cell_t :: int16 Cell_t :: uint16 Cell_t :: int32 Cell_t :: uint32 Cell_t :: Float ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.