comboctl-main: Only receive frames if long RT button press was skipped
The code in adjustQuantityOnScreen() needs an current quantity. This is determined during the long button press. If no such long button press happens, get the quantity by explicitly receiving parsed frames. But don't read those parsed frames if a long button press happened; this is redundant and just slows down the function. Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
This commit is contained in:
parent
03a32f09cf
commit
8b2666ff74
1 changed files with 12 additions and 10 deletions
|
@ -706,6 +706,8 @@ suspend fun adjustQuantityOnScreen(
|
|||
return
|
||||
}
|
||||
|
||||
val currentQuantity: Int
|
||||
|
||||
if (longRTButtonPressPredicate(targetQuantity, initialQuantity)) {
|
||||
val needToIncrement = checkIfNeedsToIncrement(initialQuantity)
|
||||
logger(LogLevel.DEBUG) {
|
||||
|
@ -815,10 +817,9 @@ suspend fun adjustQuantityOnScreen(
|
|||
"Second phase: last seen quantity $lastQuantity is not the target quantity; " +
|
||||
"short-pressing RT button(s) to finetune it"
|
||||
}
|
||||
}
|
||||
|
||||
val currentQuantity: Int
|
||||
|
||||
currentQuantity = lastQuantity!!
|
||||
} else {
|
||||
while (true) {
|
||||
val parsedDisplayFrame = rtNavigationContext.getParsedDisplayFrame(filterDuplicates = true) ?: continue
|
||||
val parsedScreen = parsedDisplayFrame.parsedScreen
|
||||
|
@ -828,6 +829,7 @@ suspend fun adjustQuantityOnScreen(
|
|||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If the on-screen quantity is not the target quantity, we may
|
||||
// have overshot, or the in/decrement factor may have been increased
|
||||
|
|
Loading…
Reference in a new issue