From d4c1dab354b31696a01a9df1080bb64d402e54b7 Mon Sep 17 00:00:00 2001 From: davebuk Date: Mon, 19 Dec 2022 10:43:59 +0000 Subject: [PATCH 1/3] Update light.cpp #2565 Remove decimal value from incoming MQTT brightness. --- code/espurna/light.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/code/espurna/light.cpp b/code/espurna/light.cpp index 8aa3f98a74..f89d07e227 100644 --- a/code/espurna/light.cpp +++ b/code/espurna/light.cpp @@ -1569,8 +1569,13 @@ String _lightGroupPayload() { // Basic value adjustments. Expression can be: // +offset, -offset or the new value - + long _lightAdjustValue(long value, espurna::StringView operation) { + const auto dot = std::find(operation.begin(), operation.end(), '.'); + if (dot != operation.end()) { + operation = espurna::StringView(operation.begin(), dot); + } + if (operation.length()) { switch (operation[0]) { case '+': From 66335c0470059805c60f13987700c3418b56a78c Mon Sep 17 00:00:00 2001 From: Max Prokhorov Date: Mon, 19 Dec 2022 20:02:08 +0300 Subject: [PATCH 2/3] Update code/espurna/light.cpp --- code/espurna/light.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/code/espurna/light.cpp b/code/espurna/light.cpp index f89d07e227..01ffd5cf16 100644 --- a/code/espurna/light.cpp +++ b/code/espurna/light.cpp @@ -1569,7 +1569,6 @@ String _lightGroupPayload() { // Basic value adjustments. Expression can be: // +offset, -offset or the new value - long _lightAdjustValue(long value, espurna::StringView operation) { const auto dot = std::find(operation.begin(), operation.end(), '.'); if (dot != operation.end()) { From 003f75e5601c0d98a186570bce9a2c119fcf4998 Mon Sep 17 00:00:00 2001 From: Max Prokhorov Date: Mon, 19 Dec 2022 20:02:51 +0300 Subject: [PATCH 3/3] Update code/espurna/light.cpp --- code/espurna/light.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/code/espurna/light.cpp b/code/espurna/light.cpp index 01ffd5cf16..515b107370 100644 --- a/code/espurna/light.cpp +++ b/code/espurna/light.cpp @@ -1569,6 +1569,7 @@ String _lightGroupPayload() { // Basic value adjustments. Expression can be: // +offset, -offset or the new value + long _lightAdjustValue(long value, espurna::StringView operation) { const auto dot = std::find(operation.begin(), operation.end(), '.'); if (dot != operation.end()) {