1
0
mirror of https://github.com/esphome/esphome.git synced 2025-02-21 02:32:26 +01:00

Update esphome/components/ld2450/ld2450.h

Fixes target direction always being moving away

Co-authored-by: Trevor Schirmer <24777085+TrevorSchirmer@users.noreply.github.com>
This commit is contained in:
Hareesh M U 2024-11-27 15:01:49 +05:30 committed by GitHub
parent d78fdf1790
commit 18c9ebfed0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -215,6 +215,8 @@ class LD2450Component : public Component, public uart::UARTDevice {
}
int16_t decode_speed_(uint8_t low_byte, uint8_t high_byte) {
int16_t speed = (high_byte & 0x7F) << 8 | low_byte;
if ((high_byte & 0x80) == 0)
speed = -speed;
return speed * 10; // mm/s
}
std::string convert_signed_int_to_hex_(int value) {