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,17 +817,17 @@ 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
|
||||
|
||||
while (true) {
|
||||
val parsedDisplayFrame = rtNavigationContext.getParsedDisplayFrame(filterDuplicates = true) ?: continue
|
||||
val parsedScreen = parsedDisplayFrame.parsedScreen
|
||||
val quantity = getQuantity(parsedScreen)
|
||||
if (quantity != null) {
|
||||
currentQuantity = quantity
|
||||
break
|
||||
currentQuantity = lastQuantity!!
|
||||
} else {
|
||||
while (true) {
|
||||
val parsedDisplayFrame = rtNavigationContext.getParsedDisplayFrame(filterDuplicates = true) ?: continue
|
||||
val parsedScreen = parsedDisplayFrame.parsedScreen
|
||||
val quantity = getQuantity(parsedScreen)
|
||||
if (quantity != null) {
|
||||
currentQuantity = quantity
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue