How abmt-community/esp32_nodes works
Project Components
• Configuration Files: Files with the “.acfg” extension (e.g., blinky.acfg, echo.acfg, http_cmd.acfg, etc.) configure which node setups or behaviors to load.
• Models: Under the “models” directory, the “.amdl” files define the node models. These files dictate the behavior or parameters for nodes like blink, echo, HTTP commands, MQTT, and others.
• Nodes: The “nodes” directory contains C++ implementation files (.cpp and .h) responsible for low-level hardware operations (GPIO, I2C, SPI, TCP/UDP communications, etc.). These nodes encapsulate the hardware interaction logic.
• Views & HTML: The “views” directory (with files like led.aview) and the “html” directory (holding files like index.html and cmd.html) provide interface elements or client-side components, notably for interacting with the HTTP-related demos.
Diagramming the Architecture
a. Main Components:
• ESP32 Hardware: Centerpiece of the design, running the configuration-based runtime.
• Runtime Environment: The ESP32 Runtime (rt_esp32) executing the node configurations.
• Configuration Layer:
• Configuration Files (.acfg) – define the enabled nodes and their parameters.
• Model Files (.amdl) – provide the definitions or “schemas” for nodes’ behaviors.
• View Files (.aview) – custom visualizations or UI components.
• Nodes Layer:
• Hardware Node Implementations – the C++ files implementing hardware interactions (e.g., GPIO, PWM, ADC, UART, TCP/UDP, etc.).
• Communication Interfaces:
• HTTP Interface: Managed via nodes like esp_http.cpp/h; linked with the html directory (cmd.html, index.html) for REST commands.
• Network Interfaces: TCP, UDP, and MQTT nodes facilitate external communications.
b. Relationships and Data Flow:
• The ESP32 Runtime parses the configuration (.acfg) files and loads the related model definitions (.amdl). This dynamic configuration directs which nodes to instantiate and how they should operate.
• Each node (for example, the “blinky” node for blinking an LED, or the “echo” node for processing UDP/TCP requests) handles specific hardware interactions, with their implementation detailed in the “nodes” folder.
• The HTTP nodes, in association with the html and view components, provide a user interface (web-based) for interacting with the system (e.g., the REST-command example using http_cmd/acfg).
c. Architectural Patterns:
• Modularity: Clearly delineation between configuration, business logic (nodes), and presentation (views/html).
• Layered Architecture:
• Top layer: User interfaces and network communication (HTTP, TCP/UDP).
• Middle layer: The runtime core and node instantiation based on configurations.
• Bottom layer: Low-level hardware controllers (GPIO, I2C, SPI, etc.) implemented in C++.
• Use of declarative configuration (via .acfg and .amdl files) allows for flexible customization of node behavior.