tests/main.c freezes inside scale_zero
ali1234 opened this issue · 3 comments
ali1234 commented
Checking the source, the reason is here:
Line 131 in 898dc15
This while loop can never be exited because timeout is always 10 seconds on each loop. The absolute time at which the timeout ends is always 10 seconds from the point of calling the function: https://github.com/endail/hx711-pico-c/blob/main/src/hx711.c#L301 - ie inside the call.
So this while loop will keep reading until the realloc fails, at which point the pico seems to crash.
ali1234 commented
In fact if you watch the serial long enough it eventually does this, which confirms it:
*** PANIC ***
Out of memory
Note that calibration.c works okay, because it uses a sample count rather than a timeout.
endail commented
Thanks! Will definitely fix this.