Advanced configuration

The ReactiveESP32 library provides several configuration options that can be adjusted to optimize performance and resource usage based on your specific application requirements. These options can be set by defining the corresponding macros before including the ReactiveESP32 header files in your project.

Defines

RXESP32_DISPATCHER_TASK_SIZE_B 4096

Dispatcher task stack size in bytes.

If you are not using PlatformIO to set build flags, you can create a custom configuration header file named “rxesp32_custom_config.h” in the library’s “src” directory. This file will be automatically included here to override default configuration options.

In Arduino IDE, create the file at: c:\Users\your_username\Documents\Arduino\libraries\ReactiveESP32\src\rxesp32_custom_config.h

This defines the stack size allocated for the FreeRTOS task that processes reactive updates.

Since

v0.1.0

Note

If you experience stack overflows, consider increasing this value. This could happen if you have deep dependency chains or complex computations in your reactive nodes.

Warning

Mininum stack size is 2048 bytes.

RXESP32_DISPATCHER_TASK_PRIORITY 1

Dispatcher task priority.

This defines the FreeRTOS priority of the dispatcher task that processes reactive updates.

Since

v0.1.0

Note

Adjust this value based on your application’s priority scheme. A higher priority may improve responsiveness of reactive updates but could starve other FreeRTOS tasks.

Warning

Must be between 1 and configMAX_PRIORITIES - 1.

RXESP32_DISPATCHER_QUEUE_LENGTH 32

Length of the dispatcher task queue.

This defines the length of the queue used by the dispatcher task to hold pending reactive updates.

Since

v0.1.0

Note

Increase this value if you have a high frequency of reactive updates to avoid queue overflows.

Warning

Minimum length is 1.

RXESP32_DEFAULT_MAX_DEPENDENTS 8

Default maximum number of dependents for reactive nodes.

This defines the default maximum number of dependents (nodes that depend on a given node) that can be registered for reactive nodes like Signal and Computed.

Since

v0.1.0

Note

You can override this value per node by specifying a different max dependents value in the node template parameters.

Warning

Minimum value is 1.

RXESP32_DEFAULT_MAX_SOURCES 8

Default maximum number of sources for reactive nodes.

This defines the default maximum number of sources (nodes that a given node depends on) that can be registered for reactive nodes like Computed and Effect.

Since

v0.1.0

Note

You can override this value per node by specifying a different max sources value in the node template parameters.

Warning

Minimum value is 1.

RXESP32_PRIORITY_LEVELS 1

Number of priority levels for reactive updates.

This defines how many priority levels are available for scheduling reactive updates. A higher number of priority levels allows for more granular control over the order in which updates are processed.

Since

v0.1.0

Note

You can assign different priority levels to reactive nodes to influence their update order.

Warning

Must be between 1 and 10.

RXESP32_ENABLE_QUEUE_TO_SIGNAL 0

Enable integration with FreeRTOS queues to create Signals from queue readers.

When enabled, this feature allows you to create Signals that automatically update their values based on data received from FreeRTOS queues.

Since

v0.1.0

Note

This is useful for integrating reactive programming with existing FreeRTOS-based code that uses queues for inter-task communication.

RXESP32_QUEUE_TO_SIGNAL_MAX_QUEUE_READERS 8

Maximum number of FreeRTOS queue readers that can be attached to a Signal.

This defines the maximum number of FreeRTOS queue readers that can be associated with a single Signal when the queueToSignal feature is enabled.

Since

v0.1.0

Note

Each queue reader will read from its respective queue and update the Signal’s value accordingly.

Warning

Minimum value is 1.

RXESP32_QUEUE_TO_SIGNAL_QUEUE_VALUE_BUFFER_SIZE_B 128

Size of the buffer used to hold values read from FreeRTOS queues for Signals.

This defines the size of the internal buffer used to store values read from FreeRTOS queues before they are applied to the associated Signal.

Since

v0.1.0

Note

Ensure that this buffer size is sufficient to hold the data types being read from the queues.

Warning

Minimum size is 8 bytes.

RXESP32_ENABLE_DEPENDENCY_GRAPH 0

Enable dependency graph generation for visualization and debugging.

When enabled, the library will track and generate a dependency graph of all reactive nodes and their relationships and export it for visualization. This can be useful for debugging complex reactive systems.

Since

v0.1.0

Note

The generated dependency graph can be exported and visualized using Mermaid (https://mermaid.live).

RXESP32_DEPENDENCY_GRAPH_MAX_REGISTERED_NODES 64

Maximum number of nodes that can be registered in the dependency graph.

This defines the maximum number of reactive nodes that can be tracked and registered in the dependency graph when the dependency graph feature is enabled.

Since

v0.1.0

Note

Increase this value if your application has a large number of reactive nodes to ensure they are all captured in the graph.

Warning

Minimum value is 8.

RXESP32_DEPENDENCY_GRAPH_STREAM_BUFFER_SIZE_B 4096

Size of the stream buffer used to export the dependency graph data.

This defines the size of the internal stream buffer used to hold the serialized dependency graph data before it is exported for visualization.

Since

v0.1.0

Note

Ensure that this buffer size is sufficient to hold the entire graph data, especially for large graphs.

Warning

Minimum size is 64 bytes.

RXESP32_DEPENDENCY_GRAPH_NODE_ID_BUFFER_SIZE_B 8

Size of the buffer used to hold node IDs in the dependency graph.

This defines the size of the internal buffer used to store node IDs when generating the dependency graph. Each node ID will be stored with this example format: S123\n (node n° 123, type Signal, 5 bytes used).

Since

v0.1.0

Note

Ensure that this buffer size is sufficient to hold the node IDs used in your application.

Warning

Minimum size is 4 bytes to hold node IDs.

RXESP32_ENABLE_SIGNAL_HISTORY 0

Enable signal history tracking for debugging and analysis.

When enabled, Signals will maintain a history of their past values, allowing you to inspect previous states for debugging or analysis purposes.

Since

v0.1.0

Note

Be aware that enabling this feature will increase memory usage (sizeof(Type) * HistorySize), especially for Signals that change frequently.

RXESP32_ENABLE_NODE_METRICS 0

Enable node metrics tracking for performance monitoring.

When enabled, reactive nodes will collect and expose metrics such as update counts and processing times, which can be useful for performance monitoring and optimization.

Since

v0.1.0

Note

Enabling this feature may introduce some overhead due to metric collection.

RXESP32_LOG_LEVEL 0

Logging level for ReactiveESP32 library.

This defines the logging verbosity level for the ReactiveESP32 library. Higher levels produce more detailed logs.

Since

v0.1.0

  • 0: No logging

  • 1: Error logs only

  • 2: Warning logs

  • 3: Info logs

  • 4: Debug logs

  • 5: Verbose logs

Note

  • Internally uses ESP_LOGx macros from ESP-IDF, with the RxESP32 tag. You may need to set up ESP-IDF logging configuration to see the logs.

  • Adjust this value based on your debugging needs. Higher levels may impact performance due to increased logging overhead.

See Also