Sharing filament sensor model I made since I could not find anything on the internet suiting my needs.
Recommended print settings: