LccNode creates object for OpenMRN.
More...
#include <LccNode.h>
LccNode creates object for OpenMRN.
- Note
- requires preprocessor defines to be configured, found in LccNodeConfig.h
Definition at line 100 of file LccNode.h.
◆ _check_for_brown_out_reset()
| void LccNode::_check_for_brown_out_reset |
( |
| ) |
|
|
inlineprivate |
_check_for_brown_out_reset check to see handling of ESP32 brownout should be done
- Note
- a brown out can occur when there is insufficient power (using Wi-Fi from USB based power), or unstable power (noise, temperature)
Definition at line 609 of file LccNode.h.
◆ _check_for_event_update_request()
| void LccNode::_check_for_event_update_request |
( |
int |
fd | ) |
|
|
inlineprivate |
_check_for_event_update_request checks to see if on the previous boot the administrator requested (via the CDI) to have the Node ID changed for all CDI events
- Note
- Node ID is kept updated in SPIFFS and if different than the current NodeID, request OpenMRN to update the events with the new Node ID for all events in memory.
Definition at line 344 of file LccNode.h.
◆ _check_for_factory_reset()
| void LccNode::_check_for_factory_reset |
( |
| ) |
|
|
inlineprivate |
_check_for_factory_reset checks if user requested factory reset via the CDI (get status from SPIFFS, if so, unlink the files)
Definition at line 358 of file LccNode.h.
◆ _check_for_firmware_update()
| void LccNode::_check_for_firmware_update |
( |
| ) |
|
|
inlineprivate |
Look for a request to jump into the ROM bootloader over CAN.
- Note
- Uses FIRMWARE_UPDATE_BOOTLOADER guard.
Definition at line 584 of file LccNode.h.
◆ _check_for_printing_packets()
| void LccNode::_check_for_printing_packets |
( |
| ) |
|
|
inlineprivate |
_check_for_printing_packets check to see LCC packets should be printed
- Note
- This is a developer feature, not exposed in the CDI and should not be enabled in deployed nodes as it will have performance impact.
Definition at line 599 of file LccNode.h.
◆ _init_SPIFFS()
| void LccNode::_init_SPIFFS |
( |
| ) |
|
|
inlineprivate |
_init_SPIFFS initializes the SPIFFS file system (esp32 Flash)
- Note
- SPFIFS is used as presistent storage of the CDI configuration, and other CDI information used for startup (Wi-Fi and NodeID information)
Definition at line 563 of file LccNode.h.
◆ _initComm()
| void LccNode::_initComm |
( |
| ) |
|
|
inlineprivate |
verifies commmunications options. If CAN wired requested, creates handle to CAN (TWAI) wired object ()
- Note
- Node ID is kept updated in SPIFFS and if different than the current NodeID, request OpenMRN to update the events with the new Node ID for all events in memory.
Definition at line 316 of file LccNode.h.
◆ _print_to_serial_info()
| void LccNode::_print_to_serial_info |
( |
| ) |
|
|
inlineprivate |
_print_to_serial_info sends to serial monitor information about esp32 and Node.
Definition at line 623 of file LccNode.h.
◆ _processSerialInput()
| void LccNode::_processSerialInput |
( |
| ) |
|
|
inlineprivate |
Process a single line of serial input to toggle testing mode.
Reads a trimmed line from the Node's serial monitor interface and, if the line equals "T" or "E" (case-insensitive), enables or disables the global testing mode respectively. When the state changes, a short banner message is printed to the serial console.
- "T" → testing ON (prints serialMonitorMri::NODE_TESTING_ON_INFO)
- "E" → testing OFF (prints serialMonitorMri::NODE_TESTING_OFF_INFO)
The call is non-blocking: if no complete line is available, it returns immediately without side effects.
- Note
- Producers can query the current state via LccNode::g_isTesting() to decide whether to emit per-edge diagnostic prints in addition to sending LCC Events.
Definition at line 696 of file LccNode.h.
◆ _start_CAN_Communications()
| void LccNode::_start_CAN_Communications |
( |
| ) |
|
|
inlineprivate |
_start_CAN_communications determines the correct CAN communications to start for the Node
- Note
- preprocessor defines (set in LccNodeConfig.h) are used to determine how the Node is to communicate
Definition at line 512 of file LccNode.h.
◆ _start_web_apps()
| void LccNode::_start_web_apps |
( |
| ) |
|
|
inlineprivate |
_start_wifi determines and initializes the correct Wi-Fi communications (Station mode, Access Point mode, or both) based on project features.
This method supports the following use cases:
- USE_ALEXA_VOICE: Requires Wi-Fi Station (STA) mode to connect to a router for Internet access (e.g., Alexa integration).
- USE_WEB_SERIAL: Requires AP mode to host the WebSerial interface for diagnostics.
- USE_OTA: Requires AP mode to serve a local web page for firmware update.
- USE_CAN_WIFI: Configuration is done at ApplyConfiguration callback when configuration can be accessed to determine whether Node is to be a Hub, Uplink, or None.
Wi-Fi mode is configured dynamically using WiFi.mode(WIFI_AP_STA) to allow simultaneous AP and STA operation. This function invokes _start_wifi_station() and/or _start_wifi_ap() as needed, based on flags and CDI configuration. SSID and password are retrieved from persistent storage or prompted via the serial monitor if missing.
- Note
- Preprocessor defines (set in LccNodeConfig.h) determine wifi requirements to be enabled at compile time.
Definition at line 398 of file LccNode.h.
◆ begin()
begin() starts the OpenMRN stack
- Note
- starts communications, SPIFFS, checks for firmware updates, event NodeID update, factory reset of CDI, ...
Definition at line 126 of file LccNode.h.
◆ getNodeID()
| openlcb::NodeID LccNode::getNodeID |
( |
| ) |
|
|
inline |
getNodeID() udpates the Node ID
- Returns
- returns NodeID currently being used for the Node and event IDs (uint64)
Definition at line 216 of file LccNode.h.
◆ getNowBridgeNodeId()
| openlcb::NodeID LccNode::getNowBridgeNodeId |
( |
| ) |
|
|
inline |
getNowBridgeNodeId() retrieves the Node ID
- Returns
- returns ESP_NOW NodeID currently being used for the Node for wireless CAN Network between nodes
Definition at line 231 of file LccNode.h.
◆ node()
| openlcb::Node * LccNode::node |
( |
| ) |
|
|
inline |
node() returns a pointer to the NODE object within memory
- Returns
- returns a pointer to the NODE object within memory
Definition at line 204 of file LccNode.h.
◆ setNodeID()
| void LccNode::setNodeID |
( |
openlcb::NodeID |
id | ) |
|
|
inline |
setNodeID() updates NodeID being used for the Node and event IDs (uint64)
Definition at line 223 of file LccNode.h.
◆ setNowBridgeNodeID()
| void LccNode::setNowBridgeNodeID |
( |
openlcb::NodeID |
id | ) |
|
|
inline |
◆ update()
update handles updating the OpenMRN stack
- Note
- should be invoked from sketch's loop() since it needs to run frequently to process LCC events, etc.
Definition at line 178 of file LccNode.h.
The documentation for this class was generated from the following file: