From 33b1655d7606f1755436377483971c3fb1248b7b Mon Sep 17 00:00:00 2001 From: Bert Melis Date: Mon, 13 Jan 2025 11:15:24 +0100 Subject: [PATCH] includes + fixes --- src/Datapoint/ConversionHelpers.cpp | 4 ++-- src/Datapoint/ConversionHelpers.h | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Datapoint/ConversionHelpers.cpp b/src/Datapoint/ConversionHelpers.cpp index 45216db..bf70080 100644 --- a/src/Datapoint/ConversionHelpers.cpp +++ b/src/Datapoint/ConversionHelpers.cpp @@ -89,12 +89,12 @@ std::size_t decodeSchedule(const uint8_t* data, std::size_t len, char* output, s std::size_t pos = 0; for (std::size_t i = 0; i < 8; ++i) { unsigned int hour = data[i] >> 3; - unsigned int minutes = sdata[i] & 0x07) * 10; + unsigned int minutes = (data[i] & 0x07) * 10; if (hour > 23 || minutes > 59) { hour = 0; minutes 0; } - std::size_t result = snprintf(&output[pos], maxLen - res, "%u.02:%u.02", hour, minutes); + std::size_t result = snprintf(&output[pos], maxLen - result, "%u.02:%u.02", hour, minutes); if (result < 0) return 0; pos += result; if (i < 7) { diff --git a/src/Datapoint/ConversionHelpers.h b/src/Datapoint/ConversionHelpers.h index e410935..831f609 100644 --- a/src/Datapoint/ConversionHelpers.h +++ b/src/Datapoint/ConversionHelpers.h @@ -11,7 +11,8 @@ the LICENSE file. #include #include #include -#include +#include // strlen +#include // snprintf namespace VitoWiFi {