From f245c74520e884f42c8a4e129f61f94286d72339 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 5 Jul 2025 15:01:02 -0500 Subject: [PATCH] fix byte ordering --- esphome/components/ld2450/ld2450.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/esphome/components/ld2450/ld2450.cpp b/esphome/components/ld2450/ld2450.cpp index 6d74a2a607..4b87f1cea4 100644 --- a/esphome/components/ld2450/ld2450.cpp +++ b/esphome/components/ld2450/ld2450.cpp @@ -127,8 +127,8 @@ static inline uint16_t convert_seconds_to_ms(uint16_t value) { return value * 10 static inline void convert_int_values_to_hex(const int *values, uint8_t *bytes) { for (int i = 0; i < 4; i++) { uint16_t val = values[i] & 0xFFFF; - bytes[i * 2] = (val >> 8) & 0xFF; // Store high byte - bytes[i * 2 + 1] = val & 0xFF; // Store low byte + bytes[i * 2] = val & 0xFF; // Store low byte first (little-endian) + bytes[i * 2 + 1] = (val >> 8) & 0xFF; // Store high byte second } }