BarbourSmith / FluidNC

The next generation of motion control firmware
Other
31 stars 7 forks source link

questions about run counter in Maslow_::take_measurement_avg_with_check #99

Open davidelang opened 2 months ago

davidelang commented 2 months ago

https://github.com/BarbourSmith/FluidNC/blob/24d76eb18778fc14287ebd88ece2d07c04959fbd/FluidNC/src/Maslow/Maslow.cpp#L821

I'm working my way through the code and think I'm seeing a couple logic errors here with how the variable run is handled

run starts at 0, and if < 2 the measurement is thrown away

so run 0,1 are thrown away, 2 is used (so only the first two measurements are thrown away, not the first three)

run = 2,3,4,5 are used when run = 6 (i.e. > 5) it is changed to 0, but this happens after the test for run < 2 is done which seems to mean that it's making one more pass through the logic than it should