The wiring for the PAT9125 on RAMBo10a boards is not directly connected
to the SCL pin and requires the sw mode.
Detect this requirement by checking the definition for the SWI2C_SCL pin
in the board definition.
Remove SWI2C_SCL/SDA from the other boards to use the HW mode.
Rewrite the logic behind the "chunking"/error count behind the PAT9125.
Basic idea: check the _direction_ of movement returned by the optical
sensor and compare it to the direction of the stepper. To avoid doing
this continuosly (and because the optical sensor doesn't necessarily
have the accuracy to track small distances), do so in chunks.
Each time a chunk doesn't match the expected direction, increase the
error count.
Several improvements were done to the previous code:
- Increase the chunk window: this ensures that a filament with
poor response returns an usable direction, while also moving the
average return values from the sensor in the middle of the 12 bits
available for maximum effectiveness.
- Since the returned values are more reliable, reduce the error count
(1.25mm*4 = ~5mm before runout detection)
- Track _both_ positive and negative movement, although only trigger
errors during extrusion (necessary due to several assumptions made
in the mmu/unloading code)
- Do not reset the counters for each block: accumulate distances
correctly, allowing detection of any block lenght.
printf float library enabled - platform.txt must be modified!
+flash usage optimalization - printing to serial line
current flash usage: 253206bytes (MK3 + ML support)
platform.txt original line 20:
compiler.c.elf.flags=-w -Os -Wl,--gc-sections
platform.txt modified line 20 (enable printf float library)
compiler.c.elf.flags=-w -Os -Wl,-u,vfprintf -lprintf_flt -lm -Wl,--gc-sections