@T3P3Tony
I tried M99 and it ends current macro, but it does not stop firmware from selecting next tool.
Using Tx P0 does not work either, as when it is called from tool change macro it does change tool to x, but when macro from which it was called is completed, than it is overwritten anyway.
The only way of doing this is to set global variable in tool change macro and check it in daemon.g and in case of fail select previous tool. It works, but it's more hack than solution.
Currently I used blocking message in while loop when tool change fails. It asks user to manually change tools to match requested configuration. It makes sense when there's an error during tool change procedure (for example new tool was not properly lock on extruder carriage and it fell off), but it is a bit irritating when printer is not homed and tool change is triggered accidentally.
I think it would be the best if macro can return a value to inform firmware that tool change failed.