A simple fix for the race condition with sysrtexec_state that breaks out all the state bits into separate bools.
A few notes:
– I renamed the cycle_stop global that was broken out previously to be consistent with the newly-added bits.
– In the existing code, in three places (the main protocolexecrtsystem() as well as the limit check loops in Limits.cpp and CoreXY.cpp) the ExecState is captured into a local copy which is then used in the if/else logic. To keep the functionality and structure the same, I made a sysgetrtexec_state() call in System.cpp that pulls all the global bools back into a bitfield for this purpose. This all should be functionally the same as before.
Note that sysgetrtexecstate() includes the cycle_stop bit as it used to in the olden days, and I changed the if/else to check it that way for consistency. (This may make line 275 in Protocol.cpp look like a mistake at first glance, but it should be correct.)
– Previously there was some discussion on whether sysgetrtexecstate() and the ExecState bitfield are necessary, but I feel it is a clean way to snapshot the current state in protocolexecrt_system() for the if/else logic to generate the next state.