Filament Variation Detection
You would want a thickness gauge with the ability to communicate via serial. Once you managed to modify Marlin to talk to it, and you engineered a system of rollers for the filament to pass through, then you could automatically compensate for the thickness of the filament.



https://www.amazon.com/Neoteck-Digital-Thickness-Electronic-Micrometer/dp/B07Q33RSH6?th=1