To start, here's a simulation of the linkage:
The diagrams below can get crowded and confusing, so the linkage is presented in two stages, starting with TrotBot's bar lengths without the retractable toe. Please note that the triangle's bottom right angle highlighted in pink is not 90 degrees, but is 109.475 degrees.
In case the 109.475 degree angle of the triangle above is confusing, below is the same linkage using a 90 degree angle instead, while shortening bar B7 from 3 to 2.83
Below are the bar and joint numbers used in the code:
Next, the retractable toe is added: