Workaround: prevent signaling irregular coin inputs

This commit is contained in:
Siegfried Siegert 2023-05-24 10:48:27 +02:00
parent ff4c52ddc9
commit 84859064a3
Signed by: SiegfriedSiegert
GPG Key ID: 68371E015E8F0B03

View File

@ -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();