Closed endail closed 1 year ago
On second thought, setting the X register directly from C prior to starting the state machine might be a better option. That way the pull can be avoided altogether and even a default gain word in the machine.
It doesn't seem like the register can be set through a standard sdk function call. An ad hoc pull and mov through pio_sm_exec would also work.
https://github.com/endail/hx711-pico-c/blob/abf2bf6e9e89ae887d1102dcccdd6394adf65845/src/hx711_noblock.pio#L83
Currently the state machine begins with a predefined default gain of 128. This is fine if when the HX711 chip has powered up it too is configured for a gain of 128. But it is possible for a different gain to be saved to the chip for when it restarts.
This may require filling the TX FIFO with a gain value prior to starting the state machine, but also a nonblocking pull in the PIO program to set a default.