From 439a6b0542c9b1172c83deb475911326ca6d6908 Mon Sep 17 00:00:00 2001 From: Orne Brocaar Date: Mon, 17 Feb 2025 09:41:43 +0000 Subject: [PATCH] lrwn: Fix clocksync time_correction type. The correct type is i32 instead of u32, as the value can be negative. --- lrwn/src/applayer/clocksync/v1.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lrwn/src/applayer/clocksync/v1.rs b/lrwn/src/applayer/clocksync/v1.rs index dea8edf1..b0abfc09 100644 --- a/lrwn/src/applayer/clocksync/v1.rs +++ b/lrwn/src/applayer/clocksync/v1.rs @@ -180,7 +180,7 @@ pub struct AppTimeReqPayloadParam { #[derive(Debug, PartialEq)] pub struct AppTimeAnsPayload { - pub time_correction: u32, + pub time_correction: i32, pub param: AppTimeAnsPayloadParam, } @@ -194,7 +194,7 @@ impl PayloadCodec for AppTimeAnsPayload { time_correction: { let mut bytes = [0; 4]; bytes.copy_from_slice(&b[0..4]); - u32::from_le_bytes(bytes) + i32::from_le_bytes(bytes) }, param: AppTimeAnsPayloadParam { token_ans: b[4] & 0x0f,