From 84859064a32f9a6e76e42c9a56649c5360deb614 Mon Sep 17 00:00:00 2001 From: Siegfried Siegert Date: Wed, 24 May 2023 10:48:27 +0200 Subject: [PATCH] Workaround: prevent signaling irregular coin inputs --- src/hwapi.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/hwapi.cpp b/src/hwapi.cpp index b41c27d..95f55c8 100644 --- a/src/hwapi.cpp +++ b/src/hwapi.cpp @@ -89,10 +89,20 @@ void hwapi::hwapi_slotPrintFinished_Err(void) { void hwapi::hwapi_slotGotCoin(void) { // new coin was inserted while transaction and new amount reported: - emit hwapi_gotNewCoin(); - uint32_t newSum=epi_CurrentPaymentGetAmount(); + // this slot is called sometimes irregularely and providing + // invalid sums! + // TODO: preveent irregular call. Meanwhile, we need this + // limit check: 75000Ft ~200€ + if (newSum > 75000) { + qCritical() << "Fixme: irregular gotNewCoin() signal"; + return; + } + + + emit hwapi_gotNewCoin(); + if (newSum>=hwapi_lastStartAmount) emit hwapi_payStopByMax();