ESPHome 2026.5.0-dev
Loading...
Searching...
No Matches
esphome::nextion::NextionCommandPacer Class Reference

#include <nextion.h>

Public Member Functions

 NextionCommandPacer (uint8_t initial_spacing=0)
 Creates command pacer with initial spacing.
 
void set_spacing (uint8_t spacing_ms)
 Set the minimum time between commands.
 
uint8_t get_spacing () const
 Get current command spacing.
 
bool can_send (uint32_t now) const
 Check if enough time has passed to send the next command.
 
void mark_sent (uint32_t now)
 Record the transmit timestamp for the most recently sent command.
 

Detailed Description

Definition at line 37 of file nextion.h.

Constructor & Destructor Documentation

◆ NextionCommandPacer()

esphome::nextion::NextionCommandPacer::NextionCommandPacer ( uint8_t initial_spacing = 0)
inlineexplicit

Creates command pacer with initial spacing.

Parameters
initial_spacingInitial time between commands in milliseconds

Definition at line 43 of file nextion.h.

Member Function Documentation

◆ can_send()

bool esphome::nextion::NextionCommandPacer::can_send ( uint32_t now) const
inline

Check if enough time has passed to send the next command.

Parameters
nowCurrent timestamp in milliseconds (use App.get_loop_component_start_time() for consistency with the rest of the queue timing).
Returns
true if the spacing interval has elapsed since the last command was sent.

Definition at line 63 of file nextion.h.

◆ get_spacing()

uint8_t esphome::nextion::NextionCommandPacer::get_spacing ( ) const
inline

Get current command spacing.

Returns
Current spacing in milliseconds

Definition at line 55 of file nextion.h.

◆ mark_sent()

void esphome::nextion::NextionCommandPacer::mark_sent ( uint32_t now)
inline

Record the transmit timestamp for the most recently sent command.

Parameters
nowCurrent timestamp in milliseconds, as returned by App.get_loop_component_start_time(). Must use the same clock source as can_send() to avoid unsigned underflow.

Definition at line 71 of file nextion.h.

◆ set_spacing()

void esphome::nextion::NextionCommandPacer::set_spacing ( uint8_t spacing_ms)
inline

Set the minimum time between commands.

Parameters
spacing_msSpacing in milliseconds

Definition at line 49 of file nextion.h.


The documentation for this class was generated from the following file: