mirror of
https://github.com/esphome/esphome.git
synced 2024-12-03 13:34:01 +01:00
set_detected_target_* helpers
This commit is contained in:
parent
45a6ca7451
commit
a2f02aba57
@ -101,6 +101,26 @@ void DfrobotSen0395Component::set_detected_(bool detected) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DfrobotSen0395Component::set_detected_target_distance_(int target, float value) {
|
||||||
|
#ifdef USE_SENSOR
|
||||||
|
if (is_valid_target_(target)) {
|
||||||
|
if (detected_targets_distance_sensors_[target - 1]) {
|
||||||
|
detected_targets_distance_sensors_[target - 1]->publish_state(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void DfrobotSen0395Component::set_detected_target_snr_(int target, float value) {
|
||||||
|
#ifdef USE_SENSOR
|
||||||
|
if (is_valid_target_(target)) {
|
||||||
|
if (detected_targets_snr_sensors_[target - 1]) {
|
||||||
|
detected_targets_snr_sensors_[target - 1]->publish_state(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
int8_t CircularCommandQueue::enqueue(std::unique_ptr<Command> cmd) {
|
int8_t CircularCommandQueue::enqueue(std::unique_ptr<Command> cmd) {
|
||||||
if (this->is_full()) {
|
if (this->is_full()) {
|
||||||
ESP_LOGE(TAG, "Command queue is full");
|
ESP_LOGE(TAG, "Command queue is full");
|
||||||
|
@ -139,6 +139,9 @@ class DfrobotSen0395Component : public uart::UARTDevice, public Component {
|
|||||||
|
|
||||||
void set_detected_(bool detected);
|
void set_detected_(bool detected);
|
||||||
|
|
||||||
|
void set_detected_target_distance_(int target, float value);
|
||||||
|
void set_detected_target_snr_(int target, float value);
|
||||||
|
|
||||||
bool is_valid_target_(int target) { return target >= 1 && target <= TARGET_COUNT; }
|
bool is_valid_target_(int target) { return target >= 1 && target <= TARGET_COUNT; }
|
||||||
|
|
||||||
friend class Command;
|
friend class Command;
|
||||||
|
Loading…
Reference in New Issue
Block a user