We're using Marlin fimware on a BigTreeTech Octopus controller, we want G-code execution to pause when an input pin is low, and resume/continue when the pin is 1. The input pin is PG15 on the STM32 processor.

We've used:

M42 PG15 T0

to configure the pin as input, then:

M226 PG15 S0

to try to pause if PG15 is low, however G-code execution halts regardless of pin level. The Marlin documentation is not very clear on how to use M226.