From db59864cfd5e2d9e41e8cacc1bd834fbf9ee58b7 Mon Sep 17 00:00:00 2001 From: Rolf Laich Date: Mon, 28 Nov 2022 11:21:49 +0100 Subject: [PATCH] Make all error messages shorter then 64 bytes In order to reduce memory requirements all error messages we require that all error messages are shorter than 64 bytes. --- src/SensirionErrors.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/SensirionErrors.cpp b/src/SensirionErrors.cpp index 9d7abaf..b0d7ffe 100644 --- a/src/SensirionErrors.cpp +++ b/src/SensirionErrors.cpp @@ -97,9 +97,7 @@ void errorToString(uint16_t error, char errorMessage[], strncpy(errorMessage, "Wrong CRC found", errorMessageSize); return; case LowLevelError::WrongNumberBytesError: - strncpy(errorMessage, - "The number of bytes to be read are " - "not a multiple of 3", + strncpy(errorMessage, "Number of bytes not a multiple of 3", errorMessageSize); return; case LowLevelError::NotEnoughDataError: @@ -107,11 +105,8 @@ void errorToString(uint16_t error, char errorMessage[], errorMessageSize); return; case LowLevelError::InternalBufferSizeError: - strncpy( - errorMessage, - "Can't execute this command on this board, internal " - "I2C buffer is too small", - errorMessageSize); + strncpy(errorMessage, "Internal I2C buffer too small", + errorMessageSize); return; } break;