Comment says 128 samples.  Code says 143 samples.  Did you mean 0x7F here?

Since you're resetting it on the next line, why not just test for ````theta_roundoff_trim_count++ >= 128````?