From b058b6aee0d8d059ed8038cf32ee06d755de8a1a Mon Sep 17 00:00:00 2001 From: Siegfried Siegert Date: Thu, 25 Jan 2024 14:26:19 +0100 Subject: [PATCH] Changer: skip polling, if amount due to change is 0 --- src/ATBAPP/ATBDeviceControllerPlugin.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/ATBAPP/ATBDeviceControllerPlugin.cpp b/src/ATBAPP/ATBDeviceControllerPlugin.cpp index bdabaeb..706b984 100644 --- a/src/ATBAPP/ATBDeviceControllerPlugin.cpp +++ b/src/ATBAPP/ATBDeviceControllerPlugin.cpp @@ -1105,10 +1105,24 @@ void ATBDeviceControllerPlugin::onCashChangerState() amountCoinsChangedInt = amountInt - this->cashStartAmountInt; } else { - amountCoinsChangedInt = 0; + amountCoinsChangedInt = 0; } QString amountCoinsChangedString = QString::number(amountCoinsChangedInt); + // if we do not need to give change: + if (amountCoinsChangedInt == 0) { + emit this->cashPaymentFinished(nsDeviceControllerInterface::RESULT_STATE::SUCCESS, + amountString, + amountCoinsString, // coins + amountNotesString, // notes + amountCoinsChangedString, // change + "", + ""); + changerStateRequestCounter = 0; + lastChangerResult = 0; + return; + } + // get changer state ------------------------------------------------ // Note: 'returnedAmount'-parameter is missleading here!