Whew, today was quite a day of frustration and learning!
I started by doing some more research into adding a homing sequence before each tool change to prevent the arm from crashing into the 5-axis trunnion. Originally my plan of action was to add it directly into the post-processor in Fusion360 so that I wouldn't have to remember to add the gcode manually.
Just reading some of the tutorials, I found online for editing post-processors made me come to realize just how out of my league that was for my current understanding of it. I found the handbook by Autodesk on editing and making your post processors. However, the information was quite extensive, and there was virtually no way I could write in my custom code without spending quite a few hours understanding the terminology.
Instead, I decided to look up how to program in the homing sequence directly on the machine. Haas has a tutorial on adding a custom process for what I was looking for with the trunnion avoidance. There are macros you can program on the controller to execute any code you like in a sub-operation. It uses M codes with whatever code you choose, and if the number already has a preset assigned to it, your macro automatically overrides the default machine preset. For instance, an M06 code is a tool change; if you input a T1 M06, it will call up tool #1 and change it out with whatever is in the spindle. If I add a macro for M06, I can perform any action I choose, in this case, my unique homing sequence before changing the tools out. This sub-program is an IF-THEN process; IF the code reads an M06 in the G-code, THAN will perform the function outlined.
So my code ran to replace the M06 with a Home Z, A, B, X, & Y-axis in that order. Then you come into the problem of, what now? You replaced the M06 operation with your new sequence, and if you put an M06 line right after the axis moves, it will just repeat the whole program all over again forever. Thankfully Haas thought of this and created a secondary tool change code called M16, which does the same thing as the M06. And finally, you need to return the program to the operation it was going through; if not, it would stop when it finished the subprogram, and nothing would happen. That's where the M99 code comes in; this is a "now you're finished, you can continue along your journey like normal."
I kept getting errors when I tried running the program on its own and said the M16 was an unknown/undefined tool. I didn't realize that the M06 and M16 were purely a "swap tools out" program and needed a defined tool to change it out of. Thankfully when I ran a specific tool and then the tool change code it all worked out exactly like I wanted.
It took me quite a bit of time to figure out how to edit the macros and I ended up calling the Haas applications department to figure out how to do it properly.