Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: allow macro prompt to remain open even if the events were more t…
…han 100 events ago Previously we were only looking for a series of prompt action events within the last 100 events. However, if things are happening in the background while the prompt is still open, those events can keep racking up and eventually the prompt window will close (though klipperscreen still displays it). I've now refactored this code so that it will internally keep an array of the prompt events and we will process through all the events at first, but we will set a checkpoint at the most recent processed event so that we don't go back and re-process ones that were already done. Effectively this means on first load sure we iterated through potentially a lot of events, but then after that we're really only processing through at most a few events. In addition, the part of the code that would parse out the message, because it would replace all double quotes, it meant that I could not do this: ```gcode RESPOND TYPE=command MSG="action:prompt_begin \"Question of the day\"" RESPOND TYPE=command MSG="action:prompt_button Foo Bar|RESPOND MSG=\"FOO BAR\"" RESPOND TYPE=command MSG="action:prompt_show" ``` If I tried to click that button I would get the following error: ``` Malformed command 'RESPOND MSG=FOO BAR' ``` I've updated the message parsing to effectively just strip off matching open and closing single or double quotes from the message. For example, all of the following would result in a message of `Question of the day`: ``` RESPOND TYPE=command MSG="action:prompt_begin \"Question of the day\"" RESPOND TYPE=command MSG="action:prompt_begin 'Question of the day'" RESPOND TYPE=command MSG="action:prompt_begin Question of the day" ``` Signed-off-by: Branden Cash <203336+ammmze@users.noreply.github.com>
- Loading branch information