Could you use the value in S0 as a check. What value does it have with no button and what value with a button? There is also S7 CRC value that could be used in the same way.

You may need to reset S0 on each loop say to $0 then run owout owin and test the new value.

Just ideas nothing is tested