From f704e84ffd0571f08d4d87e5183ddb89de5a312c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=BCrz?= Date: Wed, 10 Aug 2022 10:22:07 +0200 Subject: [PATCH] Fix response values validation --- huawei/huaweifusionsolar.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/huawei/huaweifusionsolar.cpp b/huawei/huaweifusionsolar.cpp index 6f9beb5..094b17e 100644 --- a/huawei/huaweifusionsolar.cpp +++ b/huawei/huaweifusionsolar.cpp @@ -593,17 +593,17 @@ bool HuaweiFusionSolar::valuesAreVaild(const QVector &values, int readS return false; } - // According to the documentation: + // According to the documentation from 2016: // 0x7FFF: invalid value of the floating point type returned by one register // 0xFFFF: invalid value of a type other than the floating point type returned by one register // 0xFFFFFFFF: invalid value returned by two registers if (values.count() == 2) { - bool floatingPointValid = (values.at(0) != 0x7fff && values.at(1) != 0xffff); + bool floatingPointValid = (values != QVector() << 0x7fff << 0xffff); if (!floatingPointValid) qCDebug(dcHuaweiFusionSolar()) << "Invalid values. The received values match the invalid for floating pointer:" << values; - bool otherTypesValid = (values.at(0) != 0xffff && values.at(1) != 0xffff); + bool otherTypesValid = (values != QVector(2, 0xffff)); if (!otherTypesValid) qCDebug(dcHuaweiFusionSolar()) << "Invalid values. The received values match the invalid registers values:" << values;