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

Minimal ESP-NOW protocol test unit - no motor control. More...

#include "espnow_protocol.hpp"
#include "espnow_receiver.hpp"
#include "esp_log.h"
#include "esp_timer.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/queue.h"
#include "tmc51x0.hpp"
Include dependency graph for espnow_protocol_test_unit.cpp:

Functions

static void espnowCommandTask (void *arg)
 FreeRTOS task: handle incoming ESP-NOW protocol events (test-unit simulator).
 
static void statusUpdateTask (void *arg)
 FreeRTOS task: periodically send simulated STATUS_UPDATE messages.
 
void app_main ()
 

Variables

static const char * TAG = "EspNowTestUnit"
 
static Settings g_settings {}
 
static QueueHandle_t g_espnow_queue = nullptr
 
static TestState g_current_state = TestState::Idle
 
static uint32_t g_simulated_cycle = 0
 

Detailed Description

Minimal ESP-NOW protocol test unit - no motor control.

This is a simplified test unit that:

  • Receives ESP-NOW commands from remote controller
  • Responds with appropriate protocol messages
  • Does NOT initialize motor driver, bounds finder, or motion controller
  • Useful for testing ESP-NOW protocol communication without hardware dependencies

Protocol compatible with esp32_remote_controller (6-byte header).

Function Documentation

◆ app_main()

void app_main ( void )

ESP-IDF application entry point for the protocol test unit.

Initializes ESP-NOW receiver and starts background tasks that simulate the fatigue test unit protocol behavior without any motor driver dependencies.

Here is the call graph for this function:

◆ espnowCommandTask()

static void espnowCommandTask ( void * arg)
static

FreeRTOS task: handle incoming ESP-NOW protocol events (test-unit simulator).

This task consumes ProtoEvent messages from g_espnow_queue and responds with protocol ACKs and status updates. It does not initialize motor hardware.

Parameters
argUnused (FreeRTOS task signature).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ statusUpdateTask()

static void statusUpdateTask ( void * arg)
static

FreeRTOS task: periodically send simulated STATUS_UPDATE messages.

When the simulated state is RUNNING, this task increments cycle count on a simple timer and sends STATUS_UPDATE frames. When the configured target is reached, it sends COMPLETED and TEST_COMPLETE.

Parameters
argUnused (FreeRTOS task signature).
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ g_current_state

TestState g_current_state = TestState::Idle
static

◆ g_espnow_queue

QueueHandle_t g_espnow_queue = nullptr
static

◆ g_settings

Settings g_settings {}
static

◆ g_simulated_cycle

uint32_t g_simulated_cycle = 0
static

◆ TAG

const char* TAG = "EspNowTestUnit"
static