HF-TMC51x0 Driver (TMC5130 & TMC5160) 0.1.0-dev
Hardware Agnostic C++ Driver for the TMC51x0 (TMC5130 & TMC5160)
Loading...
Searching...
No Matches
EspNowReceiver Namespace Reference

Functions

bool init (QueueHandle_t event_queue)
 Initialize ESP-NOW (WiFi STA + ESP-NOW) and start the receive task.
 
bool send_config_response (const Settings &s)
 Send CONFIG_RESPONSE containing the current settings.
 
bool send_config_ack (bool ok, uint8_t err_code=0)
 Send CONFIG_ACK for a CONFIG_SET request.
 
bool send_start_ack ()
 Send START_ACK (acknowledge START receipt).
 
bool send_pause_ack ()
 Send PAUSE_ACK (acknowledge PAUSE receipt).
 
bool send_resume_ack ()
 Send RESUME_ACK (acknowledge RESUME receipt).
 
bool send_stop_ack ()
 Send STOP_ACK (acknowledge STOP receipt).
 
bool send_status_update (uint32_t cycle, TestState state, uint8_t err_code=0, uint8_t bounds_valid=255)
 Send STATUS_UPDATE with cycle count and state.
 
bool send_error (uint8_t err_code, uint32_t at_cycle)
 Send ERROR message.
 
bool send_test_complete ()
 Send TEST_COMPLETE message.
 
bool send_bounds_result (uint8_t ok, uint8_t bounded, uint8_t cancelled, float min_deg_from_center, float max_deg_from_center, float global_min_deg, float global_max_deg)
 Send BOUNDS_RESULT message.
 
void enter_pairing_mode (uint32_t timeout_sec=PAIRING_MODE_TIMEOUT_SEC)
 Enter pairing mode for the specified duration.
 
void exit_pairing_mode ()
 Exit pairing mode immediately.
 
bool is_in_pairing_mode ()
 Check if device is currently in pairing mode.
 
SecuritySettingsget_security_settings ()
 Get access to the security settings for peer management.
 
bool add_approved_peer (const uint8_t mac[6], DeviceType type, const char *name)
 Manually add a peer as approved (bypasses pairing).
 
bool remove_approved_peer (const uint8_t mac[6])
 Remove a peer from the approved list.
 
size_t get_approved_peer_count ()
 Get the number of approved peers.
 

Function Documentation

◆ add_approved_peer()

bool EspNowReceiver::add_approved_peer ( const uint8_t mac[6],
DeviceType type,
const char * name )

Manually add a peer as approved (bypasses pairing).

Useful for adding pre-configured peers or debugging.

Parameters
macPeer's MAC address
typePeer's device type
nameHuman-readable name
Returns
true if added successfully
Here is the call graph for this function:

◆ enter_pairing_mode()

void EspNowReceiver::enter_pairing_mode ( uint32_t timeout_sec = PAIRING_MODE_TIMEOUT_SEC)

Enter pairing mode for the specified duration.

While in pairing mode, the test unit will respond to PairingRequest messages from remote controllers. After the timeout expires, pairing mode is automatically disabled.

Parameters
timeout_secDuration of pairing mode in seconds (default: 30)
Here is the caller graph for this function:

◆ exit_pairing_mode()

void EspNowReceiver::exit_pairing_mode ( )

Exit pairing mode immediately.

◆ get_approved_peer_count()

size_t EspNowReceiver::get_approved_peer_count ( )

Get the number of approved peers.

Returns
Number of approved peers (including pre-configured)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_security_settings()

SecuritySettings & EspNowReceiver::get_security_settings ( )

Get access to the security settings for peer management.

Use this with PeerStore functions to manage approved peers.

Returns
Reference to internal SecuritySettings

◆ init()

bool EspNowReceiver::init ( QueueHandle_t event_queue)

Initialize ESP-NOW (WiFi STA + ESP-NOW) and start the receive task.

  • Initializes NVS/WiFi/ESP-NOW.
  • Registers RX/TX callbacks.
  • Creates an internal queue for raw RX frames and starts an internal task that parses/validates packets and pushes ProtoEvent messages to event_queue.
Parameters
event_queueFreeRTOS queue that receives parsed ProtoEvent values.
Returns
true on successful initialization; false otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_in_pairing_mode()

bool EspNowReceiver::is_in_pairing_mode ( )

Check if device is currently in pairing mode.

Returns
true if in pairing mode
Here is the caller graph for this function:

◆ remove_approved_peer()

bool EspNowReceiver::remove_approved_peer ( const uint8_t mac[6])

Remove a peer from the approved list.

Parameters
macPeer's MAC address
Returns
true if removed
Here is the call graph for this function:

◆ send_bounds_result()

bool EspNowReceiver::send_bounds_result ( uint8_t ok,
uint8_t bounded,
uint8_t cancelled,
float min_deg_from_center,
float max_deg_from_center,
float global_min_deg,
float global_max_deg )

Send BOUNDS_RESULT message.

Parameters
ok1 if bounds finding completed (bounded or default unbounded window); 0 on failure.
bounded1 if mechanical bounds were detected.
cancelled1 if cancelled by user/STOP/PAUSE.
min_deg_from_centerLocal min bound relative to center/home (degrees).
max_deg_from_centerLocal max bound relative to center/home (degrees).
global_min_degGlobal min (degrees).
global_max_degGlobal max (degrees).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_config_ack()

bool EspNowReceiver::send_config_ack ( bool ok,
uint8_t err_code = 0 )

Send CONFIG_ACK for a CONFIG_SET request.

Parameters
oktrue if configuration was applied; false if rejected.
err_codeOptional error code (meaning is application-defined).
Returns
true if the packet was queued for transmission; false otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_config_response()

bool EspNowReceiver::send_config_response ( const Settings & s)

Send CONFIG_RESPONSE containing the current settings.

Parameters
sCurrent settings (test unit portion is serialized to wire).
Returns
true if the packet was queued for transmission; false otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_error()

bool EspNowReceiver::send_error ( uint8_t err_code,
uint32_t at_cycle )

Send ERROR message.

Parameters
err_codeApplication-defined error code.
at_cycleCycle count at which the error was observed.
Returns
true if the packet was queued for transmission; false otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_pause_ack()

bool EspNowReceiver::send_pause_ack ( )

Send PAUSE_ACK (acknowledge PAUSE receipt).

Returns
true if the packet was queued for transmission; false otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_resume_ack()

bool EspNowReceiver::send_resume_ack ( )

Send RESUME_ACK (acknowledge RESUME receipt).

Returns
true if the packet was queued for transmission; false otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_start_ack()

bool EspNowReceiver::send_start_ack ( )

Send START_ACK (acknowledge START receipt).

Returns
true if the packet was queued for transmission; false otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_status_update()

bool EspNowReceiver::send_status_update ( uint32_t cycle,
TestState state,
uint8_t err_code = 0,
uint8_t bounds_valid = 255 )

Send STATUS_UPDATE with cycle count and state.

Parameters
cycleCurrent cycle count.
stateCurrent protocol state.
err_codeOptional error code (used when state == ERROR).
Returns
true if the packet was queued for transmission; false otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_stop_ack()

bool EspNowReceiver::send_stop_ack ( )

Send STOP_ACK (acknowledge STOP receipt).

Returns
true if the packet was queued for transmission; false otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_test_complete()

bool EspNowReceiver::send_test_complete ( )

Send TEST_COMPLETE message.

Returns
true if the packet was queued for transmission; false otherwise.
Here is the call graph for this function:
Here is the caller graph for this function: