@dc42
Alright it seems like i figured out what is causing the issue.
I created a new macro and started adding things one by one.
Everything went fine until I added this line:
G91 G1 H2 Z7 G90 ; Set to relative positioning, move Z up 5mm, change back to absolute positioning
after adding this the while loop kept on running. After removing it everything ran as expected again
EDIT:
just confirmed it by creating the following macro. This would just keep running the while loop infinite.
G91 G1 Z5 G90 ;Removed H2 to be sure this wasn't the cause
while iterations < 4
echo "iteration: " ^ iterations
Then I split the G91/G90 command from single line to multi line and it started working as expected. So it seems there is an issue with the single line implementation for relative/absolute.
Which I read here we should be able to do the way I did
https://forum.duet3d.com/topic/11662/treat-g90-g91-and-m82-m83-like-g53/3