firmware-base/docs/components/StatusLight.md
2025-06-03 16:21:36 +02:00

1.6 KiB

title description keywords
StatusLight Component Documentation for the StatusLight component used in ESP-32 industrial applications with Modbus-485 support. ESP-32, Platform.io, Modbus-485, StatusLight, C17, industrial

STATUSLIGHT

Path: ../src/components/StatusLight.h

Revision History: Initial documentation

The StatusLight component provides control over status LEDs with support for steady (ON/OFF) and blinking states. It integrates with Modbus for remote monitoring and control.

REQUIREMENTS

  • Pins:
  • A GPIO pin configured for output (e.g., PIN_LED_FEEDBACK_0).
  • Dependencies:
  • Arduino framework.
  • Modbus-485 support (ModbusTCP.h).
  • Logging (ArduinoLog.h).
  • Component base class (Component.h).

FEATURES

  • Supports ON, OFF, and BLINK states.
  • Modbus integration for remote state monitoring and control.
  • Configurable blink intervals.
  • Detailed logging for debugging.

TODOS

  • Add support for custom blink patterns.
  • Implement energy-saving modes.
  • Extend Modbus functionality for advanced configurations.

EXAMPLE

#ifdef PIN_LED_FEEDBACK_0
StatusLight statusLight_0 = new StatusLight(
this,                  // owner
PIN_LED_FEEDBACK_0,    // pin
ID_LED_FEEDBACK_0,     // key
LED_FEEDBACK_0_MB_ADDR // modbusAddress
);
if (statusLight_0) {
components.push_back(statusLight_0);
Log.infoln(F("StatusLight_0 initialized. Pin:%d, ID:%d, MB:%d"),
PIN_LED_FEEDBACK_0, ID_LED_FEEDBACK_0, LED_FEEDBACK_0_MB_ADDR);
} else {
Log.errorln(F("StatusLight_0 initialization failed."));
}
#endif