From 5007462c7032bb33ca269bb3204cc4e26ef02d6a Mon Sep 17 00:00:00 2001 From: mobil750 <51677542+mobil750@users.noreply.github.com> Date: Thu, 6 Apr 2023 12:25:52 +0200 Subject: [PATCH] correction for DPT 10.001 TimeOfDay implemented; #define DPT_TimeOfDay Dpt(10, 1, 1) (#237) extension of dptconvert.cpp to get "tmp.tm_wday = weekDay;" decoded in Struct tm --- src/knx/dpt.h | 2 +- src/knx/dptconvert.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/knx/dpt.h b/src/knx/dpt.h index f6dcef3..6a350eb 100644 --- a/src/knx/dpt.h +++ b/src/knx/dpt.h @@ -87,7 +87,7 @@ #define DPT_Rain_Amount Dpt(9, 26) #define DPT_Value_Temp_F Dpt(9, 27) #define DPT_Value_Wsp_kmh Dpt(9, 28) -#define DPT_TimeOfDay Dpt(10, 1) +#define DPT_TimeOfDay Dpt(10, 1, 1) #define DPT_Date Dpt(11, 1) #define DPT_Value_4_Ucount Dpt(12, 1) #define DPT_Value_4_Count Dpt(13, 1) diff --git a/src/knx/dptconvert.cpp b/src/knx/dptconvert.cpp index f687533..e316873 100644 --- a/src/knx/dptconvert.cpp +++ b/src/knx/dptconvert.cpp @@ -416,6 +416,7 @@ int busValueToTime(const uint8_t* payload, size_t payload_length, const Dpt& dat case 1: { unsigned char hours = unsigned8FromPayload(payload, 0) & 0x1F; + unsigned char weekDay = (unsigned8FromPayload(payload, 0) & 0xE0) >> 5; unsigned char minutes = unsigned8FromPayload(payload, 1) & 0x3F; unsigned char seconds = unsigned8FromPayload(payload, 2) & 0x3F; @@ -423,6 +424,7 @@ int busValueToTime(const uint8_t* payload, size_t payload_length, const Dpt& dat return false; struct tm tmp = {0}; tmp.tm_hour = hours; + tmp.tm_wday = weekDay; tmp.tm_min = minutes; tmp.tm_sec = seconds; value = tmp;