TLDR: I set a flag in a callback and its value doesn\'t change in the main loop.
Unfortunately I have to make a simplified version of the code since the original is quite