LD2410Async
Asynchronous Arduino ESP32 library for the LD2410 mmWave radar sensor
Loading...
Searching...
No Matches
tortureTest.ino File Reference
#include <Arduino.h>
#include <Ticker.h>
#include "LD2410Async.h"

Go to the source code of this file.

Macros

#define RADAR_RX_PIN   32
 
#define RADAR_TX_PIN   33
 
#define RADAR_BAUDRATE   256000
 
#define LED_PIN   2
 

Enumerations

enum  RequestCommand : uint8_t {
  REQ_GATE_PARAMS = 0 , REQ_FIRMWARE , REQ_BT_MAC , REQ_DIST_RES ,
  REQ_AUX , REQ_ALL_CONFIG , REQ_ALL_STATIC , REQ_COUNT
}
 

Functions

HardwareSerial RadarSerial (1)
 
void runRandomCommand ()
 
void commandCallback (LD2410Async *sender, LD2410Async::AsyncCommandResult result)
 
void recordResult (RequestCommand cmd, LD2410Async::AsyncCommandResult result)
 
void printStats ()
 
void scheduleRetry ()
 
bool sendCommand (RequestCommand cmd)
 
void disableConfigModeCallback (LD2410Async *, LD2410Async::AsyncCommandResult result)
 
void runRandomCommandAfterDelay ()
 
void setup ()
 
void loop ()
 

Variables

LD2410Async ld2410 (RadarSerial)
 
CommandStats stats [REQ_COUNT]
 
volatile bool commandInFlight = false
 
RequestCommand currentCmd = REQ_GATE_PARAMS
 
unsigned long cmdStartMs = 0
 
Ticker retryTicker
 
Ticker delayNextCommandTicker
 
unsigned long lastStatsPrintMs = 0
 
const unsigned long STATS_PRINT_PERIOD_MS = 300000
 

Macro Definition Documentation

◆ LED_PIN

#define LED_PIN   2

Definition at line 25 of file tortureTest.ino.

◆ RADAR_BAUDRATE

#define RADAR_BAUDRATE   256000

Definition at line 23 of file tortureTest.ino.

◆ RADAR_RX_PIN

#define RADAR_RX_PIN   32

Definition at line 19 of file tortureTest.ino.

◆ RADAR_TX_PIN

#define RADAR_TX_PIN   33

Definition at line 20 of file tortureTest.ino.

Enumeration Type Documentation

◆ RequestCommand

enum RequestCommand : uint8_t
Enumerator
REQ_GATE_PARAMS 
REQ_FIRMWARE 
REQ_BT_MAC 
REQ_DIST_RES 
REQ_AUX 
REQ_ALL_CONFIG 
REQ_ALL_STATIC 
REQ_COUNT 

Definition at line 49 of file tortureTest.ino.

Function Documentation

◆ commandCallback()

void commandCallback ( LD2410Async * sender,
LD2410Async::AsyncCommandResult result )

Definition at line 240 of file tortureTest.ino.

◆ disableConfigModeCallback()

void disableConfigModeCallback ( LD2410Async * ,
LD2410Async::AsyncCommandResult result )

Definition at line 193 of file tortureTest.ino.

◆ loop()

void loop ( )

Definition at line 283 of file tortureTest.ino.

◆ printStats()

void printStats ( )

Definition at line 110 of file tortureTest.ino.

◆ RadarSerial()

HardwareSerial RadarSerial ( 1 )

◆ recordResult()

void recordResult ( RequestCommand cmd,
LD2410Async::AsyncCommandResult result )

Definition at line 89 of file tortureTest.ino.

◆ runRandomCommand()

void runRandomCommand ( )

Definition at line 199 of file tortureTest.ino.

◆ runRandomCommandAfterDelay()

void runRandomCommandAfterDelay ( )

Definition at line 222 of file tortureTest.ino.

◆ scheduleRetry()

void scheduleRetry ( )

Definition at line 150 of file tortureTest.ino.

◆ sendCommand()

bool sendCommand ( RequestCommand cmd)

Definition at line 156 of file tortureTest.ino.

◆ setup()

void setup ( )

Definition at line 258 of file tortureTest.ino.

Variable Documentation

◆ cmdStartMs

unsigned long cmdStartMs = 0

Definition at line 72 of file tortureTest.ino.

◆ commandInFlight

volatile bool commandInFlight = false

Definition at line 70 of file tortureTest.ino.

◆ currentCmd

Definition at line 71 of file tortureTest.ino.

◆ delayNextCommandTicker

Ticker delayNextCommandTicker

Definition at line 78 of file tortureTest.ino.

◆ lastStatsPrintMs

unsigned long lastStatsPrintMs = 0

Definition at line 81 of file tortureTest.ino.

◆ ld2410

◆ retryTicker

Ticker retryTicker

Definition at line 75 of file tortureTest.ino.

◆ stats

CommandStats stats[REQ_COUNT]
Initial value:
= {
{ "requestGateParametersAsync", ULONG_MAX, 0, 0, 0, 0, 0, 0, 0 },
{ "requestFirmwareAsync", ULONG_MAX, 0, 0, 0, 0, 0, 0, 0 },
{ "requestBluetoothMacAddressAsync",ULONG_MAX, 0, 0, 0, 0, 0, 0, 0 },
{ "requestDistanceResolutionAsync", ULONG_MAX, 0, 0, 0, 0, 0, 0, 0 },
{ "requestAuxControlSettingsAsync", ULONG_MAX, 0, 0, 0, 0, 0, 0, 0 },
{ "requestAllConfigSettingsAsync", ULONG_MAX, 0, 0, 0, 0, 0, 0, 0 },
{ "requestAllStaticDataAsync", ULONG_MAX, 0, 0, 0, 0, 0, 0, 0 },
}

Definition at line 60 of file tortureTest.ino.

◆ STATS_PRINT_PERIOD_MS

const unsigned long STATS_PRINT_PERIOD_MS = 300000

Definition at line 82 of file tortureTest.ino.