8#ifdef USE_BINARY_SENSOR
15#ifdef USE_LD2410S_VERSION
18#if defined(USE_NUMBER) && defined(USE_LD2410S_PARAMETERS)
21#if defined(USE_SELECT) && defined(USE_LD2410S_PARAMETERS)
28static constexpr size_t RX_BUFFER_SIZE = 96;
29static_assert(RX_BUFFER_SIZE <= 255,
"frame lengths are kept in a byte");
45static constexpr uint8_t RESPONSE_SPEEDS[] PROGMEM = {5, 10};
46static constexpr uint8_t RESPONSE_SPEED_COUNT =
sizeof(RESPONSE_SPEEDS);
49#ifdef USE_BINARY_SENSOR
50 SUB_BINARY_SENSOR(target)
53 SUB_SENSOR_WITH_DEDUP(distance, uint16_t)
55#ifdef USE_LD2410S_VERSION
56 SUB_TEXT_SENSOR(version)
58#if defined(USE_SELECT) && defined(USE_LD2410S_PARAMETERS)
59 SUB_SELECT(response_speed)
65 void dump_config()
override;
69#ifdef USE_LD2410S_PARAMETERS
73 this->
numbers_[
static_cast<uint8_t
>(parameter)] = number;
89#ifdef USE_LD2410S_PARAMETERS
92#ifdef USE_LD2410S_VERSION
106#ifdef USE_LD2410S_PARAMETERS
110#if defined(USE_NUMBER) && defined(USE_LD2410S_PARAMETERS)
118#ifdef USE_LD2410S_PARAMETERS
128#ifdef USE_LD2410S_PARAMETERS
virtual void setup()
Where the component's initialization should happen.
void status_set_warning()
virtual void loop()
This method will be called repeatedly.
Collects binary frames that give their own length, of up to N bytes, in one or more FrameFormats; the...
bool handle_version_(const uint8_t *values, uint16_t len)
void publish_parameters_()
void start_sequence_(const uint16_t *sequence, uint8_t length, uint32_t now)
uint8_t parameters_[PARAMETER_COUNT]
void restart_init_(uint32_t at)
uint16_t current_command_() const
void publish_target_(bool target, uint16_t distance)
bool handle_frame_(const uint8_t *frame, uint8_t len)
Returns false for bytes that are not a real frame.
bool handle_data_frame_(const uint8_t *payload, uint16_t len, bool standard)
Returns false for a data frame whose state byte is impossible, so it counts as dropped.
const uint16_t * sequence_
number::Number * numbers_[PARAMETER_COUNT]
LengthFrameReader< RX_BUFFER_SIZE, ld24xx::CmdFrameFormat, ld24xx::DataFrameFormat, ShortDataFrameFormat > reader_
void send_command_(uint16_t command)
void count_dropped_frame_()
bool handle_parameters_(const uint8_t *values, uint16_t len)
bool handle_command_ack_(const uint8_t *payload, uint16_t len)
void run_sequence_(uint32_t now)
Base-class for all numbers.
Base-class for all selects.
Parameter
The module's common parameters, in the order the parameter read answers them.
@ PARAMETER_STATUS_FREQUENCY
@ PARAMETER_DISTANCE_FREQUENCY
@ PARAMETER_RESPONSE_SPEED
A frame type that always has LEN bytes.