Skip to content

SignalPlot - Time-based State Control

Path: src/modbus/SignalPlot.h

Revision History: Initial documentation

SignalPlot is a component that handles time-based control points for various signal types. It extends the PlotBase class to provide a framework for executing specific actions at defined time intervals. This component is particularly useful for controlling signals through Modbus, directly manipulating GPIO pins, or executing commands at specific times during a profile execution.

  • ESP32 hardware platform
  • PlatformIO environment
  • Components: Bridge (for command execution)
  • Modbus TCP server for Modbus-based signal control
  • SignalPlotRegisterOffset: Enum for Modbus register offsets
  • SignalPlotCommand: Enum for control commands (START, STOP, PAUSE, RESUME)
  • E_SIGNAL_TYPE: Enum defining supported signal types
  • E_GpioWriteMode: Enum for GPIO write modes (DIGITAL, ANALOG_PWM)
  • E_SIGNAL_STATE: Enum for signal execution states
  • S_SignalControlPoint: Struct for defining control points
  • SignalPlot: Main class that handles time-based signal state control
  • Time-based execution of various signal types
  • Support for multiple control points (up to 20 per instance)
  • Control via Modbus TCP
  • Direct GPIO control (digital and analog/PWM)
  • Command execution through the Bridge component
  • Pause, resume, start, and stop control of signal execution
  • Configurable via JSON

SignalPlot

PlotBase

ModbusTCP

ModbusTypes

Bridge

CommandMessage

enable()

disable()

start()

stop()

pause()

resume()

start()

Disabled

Enabled

Running

ExecuteControlPoints

UpdateModbus

Stopped

Paused

  • Consider using a binary search when searching for control points if the number of points becomes significant
  • Optimize execution logic for control points with frequently accessed states
  • Validate Modbus access restrictions to prevent unauthorized control
  • Add validation for GPIO pins to ensure they don’t affect critical system functionality
  • Consider adding authorization for command execution to prevent security issues
  • Ensure command execution respects timing requirements in industrial applications
  • For critical applications, add error handling and recovery mechanisms
  • Document GPIO limitations for industrial environments
  • Pre-sort control points by time during loading to optimize runtime performance
  • Ensure GPIO pins are properly configured before using this component
  • Use meaningful names and descriptions for control points to improve maintainability
  • Consider implementing additional signal types for specific use cases
  • When using command strings, ensure proper escaping and validation to avoid parsing issues